9422
|
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.uinfo; |
|
11 |
|
12 import java.io.IOException; |
|
13 |
|
14 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; |
|
15 import org.dive4elements.river.client.shared.exceptions.ServerException; |
|
16 import org.dive4elements.river.client.shared.model.Data; |
|
17 import org.dive4elements.river.client.shared.model.DataItem; |
|
18 import org.dive4elements.river.client.shared.model.DefaultDataItem; |
|
19 import org.dive4elements.river.client.shared.model.StringOptionsData; |
|
20 |
|
21 import test.AbstractBerechnungsartenTester.River; |
|
22 import test.AbstractModuleRunner; |
|
23 import test.uinfo.UInfoBerechnungsartenTester.CalcMode; |
|
24 |
|
25 /** |
|
26 * @author Domenico Nardi Tironi |
|
27 * |
|
28 */ |
9424
|
29 class UinfoSalixRunner extends AbstractModuleRunner { |
9422
|
30 private final String scenarioChoice; |
|
31 private boolean isUseScenario; |
|
32 |
9567
|
33 public UinfoSalixRunner(final double from, final double to, final River river, final String scenarioChoice) throws ConnectionException, ServerException { |
|
34 super(AbstractModuleRunner.Infotype.uinfo, CalcMode.uinfo_salix_line, from, to, river); |
9422
|
35 this.scenarioChoice = scenarioChoice; |
|
36 this.isUseScenario = (scenarioChoice != null) ? (this.isUseScenario = true) : (this.isUseScenario = false); |
|
37 } |
|
38 |
|
39 @Override |
9567
|
40 public void runTest() throws ServerException, IOException { |
9422
|
41 /* Select River */ |
|
42 super.selectRiver(); |
|
43 |
|
44 /* Select ICalcMode */ |
|
45 super.selectCalcMode(); |
|
46 |
|
47 super.feed(new Data[] { |
|
48 new StringOptionsData("ld_mode", "ld_mode", new DataItem[] { new DefaultDataItem("distance_only", "distance_only", "distance_only") }) }); // ggf |
|
49 |
|
50 /* Select Range */ |
|
51 super.selectRange(); |
|
52 |
9424
|
53 /* use scenario */ |
|
54 final String key = "use_scenario"; |
|
55 final String value = String.valueOf(this.isUseScenario); |
|
56 |
9441
|
57 super.feedAndGoSimpleTextInput(key, value); |
9422
|
58 |
|
59 if (this.isUseScenario) { |
|
60 // TODO: make regional, supraregional, historical |
9424
|
61 makeScenario(); |
9422
|
62 } |
|
63 |
|
64 describeCollection(); |
|
65 |
9567
|
66 super.runTests(); |
9422
|
67 } |
9424
|
68 |
|
69 protected void makeScenario() throws ConnectionException, ServerException { |
|
70 // Override in subs |
|
71 } |
|
72 |
|
73 protected final String getScenarioChoice() { |
|
74 |
|
75 return this.scenarioChoice; |
|
76 } |
9422
|
77 } |