Mercurial > dive4elements > river
diff 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 diff
--- a/gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java Mon Nov 05 10:19:12 2018 +0100 +++ b/gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java Mon Nov 05 13:21:57 2018 +0100 @@ -10,7 +10,9 @@ 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; @@ -23,7 +25,6 @@ import test.AbstractBerechnungsartenTester.River; import test.AbstractModuleRunner; -import test.IFilenameMapper; /** * @author Domenico Nardi Tironi @@ -45,28 +46,35 @@ 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 IFilenameMapper file, 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 fehlvolumina, final String sounding) - throws ConnectionException, ServerException { - super(AbstractModuleRunner.Infotype.bundu, test.bundu.BunduBerechnungsartenTester.CalcMode.bundu_bezugswst, file, from, to, river); + 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(final boolean exportToFile) throws ServerException, IOException { + public void runTest() throws ServerException, IOException { /* Select River */ super.selectRiver(); @@ -74,7 +82,7 @@ super.selectCalcMode(); /* Select Range with step */ - final Data[] temp = super.makeFromToData("ld_from", "ld_to"); + 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) })); @@ -83,23 +91,39 @@ /* bezugsjahr */ final String bezugsjahr = String.valueOf(this.bezugsjahr); - super.feedAndGoSimpleTextInput("singleyear", 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 IntDataItem[] arr = new IntDataItem[this.events.length]; - for (int i = 0; i < this.events.length; i++) { - arr[i] = new IntDataItem("id", "id", this.events[i]); + 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 } - final IntegerArrayData iad = new IntegerArrayData("events", "events", arr); - - super.feedAndGo(new Data[] { q1, q2, iad, fixChoice }, 0); - - // TODO: Automatische ereignisauswahl + Wahl der Abflussklassen im Hintergrund /* Länge der Abflusszeitreihe */ super.feedAndGoSimpleTextInput("year_input_q_series", String.valueOf(this.years_length)); @@ -114,25 +138,26 @@ 0);// reachable state index /* calc_choice */ - final Data preprocessingData = super.getSimpleTextInput("preprocessing", "false"); + 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.feedAndGoData(new Data[] { preprocessingData, functionData, calcChoice }); + super.feedAndGo(new Data[] { calcChoice, preprocessingData, functionData }, 0); - // TODO: automaitische Wahl der Berechnungsgrundlagen + Ausreißer (preprocessing) + 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 */ - super.feedAndGoSimpleTextInput("missing_volume", String.valueOf(this.fehlvolumina)); - - // TODO: Strecke der FehlVolumina machen + final Data missingVolume = super.getSimpleTextInput("missing_volume", String.valueOf(this.fehlvolumina)); + super.feedAndGo(new Data[] { missingVolume }, 0); - /* Wahl der Peilungen */ - - super.feedAndGoSimpleTextInput("soundings", this.sounding); - + if (this.fehlvolumina) { + super.makeKmRange(this.fehlVolFrom, this.fehlVolTo, "ld_from_part", "ld_to_part"); + super.feedAndGoSimpleTextInput("soundings", this.sounding); + } describeCollection(); - - super.export(exportToFile); + super.runTests(); } }