Mercurial > dive4elements > river
comparison gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java @ 9439:ce0a48b93f4b
bundu jUnit test first attempt
author | gernotbelger |
---|---|
date | Mon, 20 Aug 2018 16:57:25 +0200 |
parents | |
children | 173f188569c6 |
comparison
equal
deleted
inserted
replaced
9438:d2f5375ede26 | 9439:ce0a48b93f4b |
---|---|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package test.bundu; | |
11 | |
12 import java.io.IOException; | |
13 import java.util.List; | |
14 | |
15 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; | |
16 import org.dive4elements.river.client.shared.exceptions.ServerException; | |
17 import org.dive4elements.river.client.shared.model.Data; | |
18 import org.dive4elements.river.client.shared.model.DataItem; | |
19 import org.dive4elements.river.client.shared.model.DefaultDataItem; | |
20 import org.dive4elements.river.client.shared.model.IntDataItem; | |
21 import org.dive4elements.river.client.shared.model.IntegerArrayData; | |
22 import org.dive4elements.river.client.shared.model.StringOptionsData; | |
23 | |
24 import test.AbstractBerechnungsartenTester.River; | |
25 import test.AbstractModuleRunner; | |
26 import test.IFilenameMapper; | |
27 | |
28 /** | |
29 * @author Domenico Nardi Tironi | |
30 * | |
31 */ | |
32 class BunduBezugswstRunner extends AbstractModuleRunner { | |
33 | |
34 private final String fixationChoice; | |
35 private final int bezugsjahr; | |
36 private final int years_length; | |
37 | |
38 private final boolean fehlvolumina; | |
39 private final String sounding; | |
40 | |
41 private final String calcChoice; | |
42 private final double step; | |
43 private final List<Segment> segments; | |
44 private final int qSectorStart; | |
45 private final int qSectorEnd; | |
46 private final int[] events; | |
47 | |
48 public BunduBezugswstRunner(final IFilenameMapper file, final double from, final double to, final double step, final River river, final int bezugsjahr, | |
49 final String fixationChoice, final int gaugeRangeQsectorStart_q1, final int gaugeRangeQsectorEnd_q2, final int[] events, final int years_length, | |
50 final List<Segment> segments, final String calcChoice, final boolean fehlvolumina, final String sounding) | |
51 throws ConnectionException, ServerException { | |
52 super(AbstractModuleRunner.Infotype.bundu, test.bundu.BunduBerechnungsartenTester.CalcMode.bundu_bezugswst, file, from, to, river); | |
53 this.fixationChoice = fixationChoice; | |
54 this.qSectorStart = gaugeRangeQsectorStart_q1; | |
55 this.qSectorEnd = gaugeRangeQsectorEnd_q2; | |
56 this.bezugsjahr = bezugsjahr; | |
57 this.years_length = years_length; | |
58 this.fehlvolumina = fehlvolumina; | |
59 this.sounding = sounding; | |
60 this.calcChoice = calcChoice; | |
61 this.step = step; | |
62 this.segments = segments; | |
63 this.events = events; | |
64 } | |
65 | |
66 @Override | |
67 public void runTest(final boolean exportToFile) throws ServerException, IOException { | |
68 /* Select River */ | |
69 super.selectRiver(); | |
70 | |
71 /* Select ICalcMode */ | |
72 super.selectCalcMode(); | |
73 | |
74 /* Select Range with step */ | |
75 final Data[] temp = super.makeFromToData("ld_from", "ld_to"); | |
76 final String stepStr = String.valueOf(this.step); | |
77 final Data[] data = super.addItemToExistingData(temp, | |
78 new StringOptionsData("ld_step", "ld_step", new DataItem[] { new DefaultDataItem(stepStr, stepStr, stepStr) })); | |
79 | |
80 super.feedAndGo(data, 0); | |
81 | |
82 /* bezugsjahr */ | |
83 final String bezugsjahr = String.valueOf(this.bezugsjahr); | |
84 super.feedAndGoSimpleTextInput("singleyear", bezugsjahr); | |
85 | |
86 /* fixierungsauswahl - auto oder manuell */ | |
87 // AUTO: 0, 3 | |
88 final Data q1 = super.getSimpleTextInput("q1", String.valueOf(this.qSectorStart)); | |
89 final Data q2 = super.getSimpleTextInput("q2", String.valueOf(this.qSectorEnd)); | |
90 final Data fixChoice = super.getSimpleTextInput("fix_choice", this.fixationChoice); | |
91 | |
92 final IntDataItem[] arr = new IntDataItem[this.events.length]; | |
93 for (int i = 0; i < this.events.length; i++) { | |
94 arr[i] = new IntDataItem("id", "id", this.events[i]); | |
95 } | |
96 final IntegerArrayData iad = new IntegerArrayData("events", "events", arr); | |
97 | |
98 super.feedAndGo(new Data[] { q1, q2, iad, fixChoice }, 0); | |
99 | |
100 // TODO: Automatische ereignisauswahl + Wahl der Abflussklassen im Hintergrund | |
101 | |
102 /* Länge der Abflusszeitreihe */ | |
103 super.feedAndGoSimpleTextInput("year_input_q_series", String.valueOf(this.years_length)); | |
104 | |
105 /* (W)Q-Input / UD Input */ | |
106 | |
107 final Data[] wqData = Segment.getDataforFeed("wq_values", this.segments); | |
108 final Data[] wqAndMode = super.addItemToExistingData(wqData, | |
109 new StringOptionsData("bundu.wst.mode", "bundu.wst.mode", new DataItem[] { new DefaultDataItem("Q", "Q", "Q") })); | |
110 | |
111 super.feedAndGo(wqAndMode, // | |
112 0);// reachable state index | |
113 | |
114 /* calc_choice */ | |
115 final Data preprocessingData = super.getSimpleTextInput("preprocessing", "false"); | |
116 final Data functionData = super.getSimpleTextInput("function", "log"); | |
117 final Data calcChoice = super.getSimpleTextInput("calc_choice", this.calcChoice); | |
118 super.feedAndGoData(new Data[] { preprocessingData, functionData, calcChoice }); | |
119 | |
120 // TODO: automaitische Wahl der Berechnungsgrundlagen + Ausreißer (preprocessing) | |
121 | |
122 /* missing_volume */ | |
123 super.feedAndGoSimpleTextInput("missing_volume", String.valueOf(this.fehlvolumina)); | |
124 | |
125 // TODO: Strecke der FehlVolumina machen | |
126 | |
127 /* Wahl der Peilungen */ | |
128 | |
129 super.feedAndGoSimpleTextInput("soundings", this.sounding); | |
130 | |
131 describeCollection(); | |
132 | |
133 super.export(exportToFile); | |
134 } | |
135 | |
136 } |