Mercurial > dive4elements > river
view gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java @ 9567:86e522bc7f36
jUnit-Tests completed
author | gernotbelger |
---|---|
date | Mon, 05 Nov 2018 13:21:57 +0100 |
parents | 173f188569c6 |
children | 531a60b7af95 |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package test.bundu; import java.io.IOException; import java.util.Calendar; import java.util.List; import java.util.TimeZone; import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; import org.dive4elements.river.client.shared.exceptions.ServerException; import org.dive4elements.river.client.shared.model.Data; import org.dive4elements.river.client.shared.model.DataItem; import org.dive4elements.river.client.shared.model.DefaultDataItem; import org.dive4elements.river.client.shared.model.IntDataItem; import org.dive4elements.river.client.shared.model.IntegerArrayData; import org.dive4elements.river.client.shared.model.StringOptionsData; import test.AbstractBerechnungsartenTester.River; import test.AbstractModuleRunner; /** * @author Domenico Nardi Tironi * */ class BunduBezugswstRunner extends AbstractModuleRunner { private final String fixationChoice; private final int bezugsjahr; private final int years_length; private final boolean fehlvolumina; private final String sounding; private final String calcChoice; private final double step; private final List<Segment> segments; private final String qSectorStart; private final String qSectorEnd; private final int[] events; private final String function; private final Double fehlVolFrom; private final Double fehlVolTo; private final boolean preprocessing; public BunduBezugswstRunner(final double from, final double to, final double step, final River river, final int bezugsjahr, final String fixationChoice, final String function, final String abflussklasseFrom, final String abflussklasseTo, final int[] events, final int years_length, final List<Segment> segments, final String calcChoice, final boolean preprocessing, final boolean fehlvolumina, final Double fehlVolFrom, final Double fehlVolTo, final String sounding) throws ConnectionException, ServerException { super(AbstractModuleRunner.Infotype.bundu, test.bundu.BunduBerechnungsartenTester.CalcMode.bundu_bezugswst, from, to, river); this.fixationChoice = fixationChoice; this.qSectorStart = abflussklasseFrom; this.qSectorEnd = abflussklasseTo; this.bezugsjahr = bezugsjahr; this.years_length = years_length; this.fehlvolumina = fehlvolumina; this.fehlVolFrom = fehlVolFrom; this.fehlVolTo = fehlVolTo; this.sounding = sounding; this.calcChoice = calcChoice; this.preprocessing = preprocessing; this.step = step; this.segments = segments; this.events = events; this.function = function; } @Override public void runTest() throws ServerException, IOException { /* Select River */ super.selectRiver(); /* Select ICalcMode */ super.selectCalcMode(); /* Select Range with step */ final Data[] temp = super.makeFromToData("ld_from", "ld_to", this.getFrom(), this.getTo()); final String stepStr = String.valueOf(this.step); final Data[] data = super.addItemToExistingData(temp, new StringOptionsData("ld_step", "ld_step", new DataItem[] { new DefaultDataItem(stepStr, stepStr, stepStr) })); super.feedAndGo(data, 0); /* bezugsjahr */ final String bezugsjahr = String.valueOf(this.bezugsjahr); final IntDataItem[] eventArray = new IntDataItem[this.events.length]; for (int i = 0; i < this.events.length; i++) { eventArray[i] = new IntDataItem("id", "id", this.events[i]); } final IntegerArrayData iadTemp = new IntegerArrayData("events_temp", "events_temp", eventArray); super.feedAndGo(new Data[] { super.getSimpleTextInput("singleyear", bezugsjahr), iadTemp }, 0); /* fixierungsauswahl - auto oder manuell */ // AUTO: 0, 3 final Data q1 = super.getSimpleTextInput("q1", this.qSectorStart); final Data q2 = super.getSimpleTextInput("q2", this.qSectorEnd); final Data fixChoice = super.getSimpleTextInput("fix_choice", this.fixationChoice); // start, end (missing) // final DateTimeFormat df = DateTimeFormat.getFormat("dd.MM.yyyy"); final Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getDefault());// TODO: TimeZoneHandling cal.set(Calendar.YEAR, (this.bezugsjahr - 5)); cal.set(Calendar.DAY_OF_YEAR, 1); final Data startData = super.getSimpleTextInput("start", String.valueOf(cal.getTime().getTime())); cal.set(Calendar.YEAR, (this.bezugsjahr - 5)); cal.set(Calendar.DAY_OF_YEAR, 365); final Data endData = super.getSimpleTextInput("end", String.valueOf(cal.getTime().getTime())); final IntegerArrayData iad = new IntegerArrayData("events", "events", eventArray); super.feedAndGo(new Data[] { q1, q2, iad, fixChoice, startData, endData }, 0); if (this.fixationChoice.equals("state.bundu.wst.fix.manual")) { super.feedAndGo(new Data[] { q1, q2 }, 0); // ein State extra im workflow } /* Länge der Abflusszeitreihe */ super.feedAndGoSimpleTextInput("year_input_q_series", String.valueOf(this.years_length)); /* (W)Q-Input / UD Input */ final Data[] wqData = Segment.getDataforFeed("wq_values", this.segments); final Data[] wqAndMode = super.addItemToExistingData(wqData, new StringOptionsData("bundu.wst.mode", "bundu.wst.mode", new DataItem[] { new DefaultDataItem("Q", "Q", "Q") })); super.feedAndGo(wqAndMode, // 0);// reachable state index /* calc_choice */ final Data preprocessingData = super.getSimpleTextInput("preprocessing", String.valueOf(this.preprocessing)); final Data functionData = super.getSimpleTextInput("function", this.function); final Data calcChoice = super.getSimpleTextInput("calc_choice", this.calcChoice); super.feedAndGo(new Data[] { calcChoice, preprocessingData, functionData }, 0); if (this.calcChoice.equals("state.bundu.wst.calc.manual")) { super.feedAndGo(new Data[] { functionData }, 0); // extra states im workflow super.feedAndGo(new Data[] { preprocessingData }, 0); } /* missing_volume */ final Data missingVolume = super.getSimpleTextInput("missing_volume", String.valueOf(this.fehlvolumina)); super.feedAndGo(new Data[] { missingVolume }, 0); if (this.fehlvolumina) { super.makeKmRange(this.fehlVolFrom, this.fehlVolTo, "ld_from_part", "ld_to_part"); super.feedAndGoSimpleTextInput("soundings", this.sounding); } describeCollection(); super.runTests(); } }