9439
|
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; |
9442
|
44 private final String qSectorStart; |
|
45 private final String qSectorEnd; |
9439
|
46 private final int[] events; |
9442
|
47 private final String function; |
9439
|
48 |
|
49 public BunduBezugswstRunner(final IFilenameMapper file, final double from, final double to, final double step, final River river, final int bezugsjahr, |
9442
|
50 final String fixationChoice, final String function, final String abflussklasseFrom, final String abflussklasseTo, final int[] events, |
|
51 final int years_length, final List<Segment> segments, final String calcChoice, final boolean fehlvolumina, final String sounding) |
9439
|
52 throws ConnectionException, ServerException { |
|
53 super(AbstractModuleRunner.Infotype.bundu, test.bundu.BunduBerechnungsartenTester.CalcMode.bundu_bezugswst, file, from, to, river); |
|
54 this.fixationChoice = fixationChoice; |
9442
|
55 this.qSectorStart = abflussklasseFrom; |
|
56 this.qSectorEnd = abflussklasseTo; |
9439
|
57 this.bezugsjahr = bezugsjahr; |
|
58 this.years_length = years_length; |
|
59 this.fehlvolumina = fehlvolumina; |
|
60 this.sounding = sounding; |
|
61 this.calcChoice = calcChoice; |
|
62 this.step = step; |
|
63 this.segments = segments; |
|
64 this.events = events; |
9442
|
65 this.function = function; |
9439
|
66 } |
|
67 |
|
68 @Override |
|
69 public void runTest(final boolean exportToFile) throws ServerException, IOException { |
|
70 /* Select River */ |
|
71 super.selectRiver(); |
|
72 |
|
73 /* Select ICalcMode */ |
|
74 super.selectCalcMode(); |
|
75 |
|
76 /* Select Range with step */ |
|
77 final Data[] temp = super.makeFromToData("ld_from", "ld_to"); |
|
78 final String stepStr = String.valueOf(this.step); |
|
79 final Data[] data = super.addItemToExistingData(temp, |
|
80 new StringOptionsData("ld_step", "ld_step", new DataItem[] { new DefaultDataItem(stepStr, stepStr, stepStr) })); |
|
81 |
|
82 super.feedAndGo(data, 0); |
|
83 |
|
84 /* bezugsjahr */ |
|
85 final String bezugsjahr = String.valueOf(this.bezugsjahr); |
|
86 super.feedAndGoSimpleTextInput("singleyear", bezugsjahr); |
|
87 |
|
88 /* fixierungsauswahl - auto oder manuell */ |
|
89 // AUTO: 0, 3 |
9442
|
90 final Data q1 = super.getSimpleTextInput("q1", this.qSectorStart); |
|
91 final Data q2 = super.getSimpleTextInput("q2", this.qSectorEnd); |
9439
|
92 final Data fixChoice = super.getSimpleTextInput("fix_choice", this.fixationChoice); |
|
93 |
|
94 final IntDataItem[] arr = new IntDataItem[this.events.length]; |
|
95 for (int i = 0; i < this.events.length; i++) { |
|
96 arr[i] = new IntDataItem("id", "id", this.events[i]); |
|
97 } |
|
98 final IntegerArrayData iad = new IntegerArrayData("events", "events", arr); |
|
99 |
|
100 super.feedAndGo(new Data[] { q1, q2, iad, fixChoice }, 0); |
|
101 |
|
102 // TODO: Automatische ereignisauswahl + Wahl der Abflussklassen im Hintergrund |
|
103 |
|
104 /* Länge der Abflusszeitreihe */ |
|
105 super.feedAndGoSimpleTextInput("year_input_q_series", String.valueOf(this.years_length)); |
|
106 |
|
107 /* (W)Q-Input / UD Input */ |
|
108 |
|
109 final Data[] wqData = Segment.getDataforFeed("wq_values", this.segments); |
|
110 final Data[] wqAndMode = super.addItemToExistingData(wqData, |
|
111 new StringOptionsData("bundu.wst.mode", "bundu.wst.mode", new DataItem[] { new DefaultDataItem("Q", "Q", "Q") })); |
|
112 |
|
113 super.feedAndGo(wqAndMode, // |
|
114 0);// reachable state index |
|
115 |
|
116 /* calc_choice */ |
|
117 final Data preprocessingData = super.getSimpleTextInput("preprocessing", "false"); |
9442
|
118 final Data functionData = super.getSimpleTextInput("function", this.function); |
9439
|
119 final Data calcChoice = super.getSimpleTextInput("calc_choice", this.calcChoice); |
|
120 super.feedAndGoData(new Data[] { preprocessingData, functionData, calcChoice }); |
|
121 |
|
122 // TODO: automaitische Wahl der Berechnungsgrundlagen + Ausreißer (preprocessing) |
|
123 |
|
124 /* missing_volume */ |
|
125 super.feedAndGoSimpleTextInput("missing_volume", String.valueOf(this.fehlvolumina)); |
|
126 |
|
127 // TODO: Strecke der FehlVolumina machen |
|
128 |
|
129 /* Wahl der Peilungen */ |
|
130 |
|
131 super.feedAndGoSimpleTextInput("soundings", this.sounding); |
|
132 |
|
133 describeCollection(); |
|
134 |
|
135 super.export(exportToFile); |
|
136 } |
|
137 |
|
138 } |