9031
|
1 package test; |
|
2 |
|
3 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
|
4 * Software engineering by |
|
5 * Björnsen Beratende Ingenieure GmbH |
|
6 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
|
7 * |
|
8 * This file is Free Software under the GNU AGPL (>=v3) |
|
9 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
10 * documentation coming with Dive4Elements River for details. |
|
11 */ |
|
12 |
|
13 import java.io.IOException; |
|
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.OutputMode; |
|
21 import org.dive4elements.river.client.shared.model.StringOptionsData; |
|
22 |
|
23 /** |
|
24 * @author Domenico Nardi Tironi |
|
25 * |
|
26 */ |
|
27 public class SinfoTest extends SuperTest { |
|
28 |
|
29 private final String calcMode; |
|
30 |
|
31 public SinfoTest(final String username, final String password, final String infotype, final String calcmode) throws ConnectionException, ServerException { |
|
32 super(username, password, infotype); |
|
33 this.calcMode = calcmode; |
|
34 } |
|
35 |
|
36 @Override |
|
37 public void runTest(final boolean exportToFile) throws ServerException, IOException { |
|
38 // TODO Auto-generated method stub |
|
39 /* Select River */ |
|
40 final Data data = new StringOptionsData("river", "river", new DataItem[] { new DefaultDataItem("Beispielfluss", "Beispielfluss", "Beispielfluss") }); |
|
41 feedAndGo(new Data[] { data }, 0); |
|
42 |
|
43 /* Select CalcMode */ |
|
44 // final DataList calcModes = getArtifact().getArtifactDescription().getCurrentData(); // AUSWAHL-Möglichkeiten |
|
45 // final DataItem minMaxFlowdepth = calcModes.get(0).getItems()[2]; // CalcMode |
|
46 final Data dataCalcMode = new StringOptionsData("calculation_mode", "calculation_mode", |
|
47 new DataItem[] { new DefaultDataItem(this.calcMode, this.calcMode, this.calcMode) }); |
|
48 feedAndGo(new Data[] { dataCalcMode }, 0); |
|
49 |
|
50 /* Select Range */ |
|
51 |
|
52 // entweder eine bestimmte Range |
|
53 final Data dataFrom = new StringOptionsData("ld_from", "ld_from", new DataItem[] { new DefaultDataItem("10", "10", "10") }); |
|
54 final Data dataTo = new StringOptionsData("ld_to", "ld_to", new DataItem[] { new DefaultDataItem("100", "100", "100") }); |
|
55 final Data[] rangeFromToDetermined = new Data[] { dataFrom, dataTo }; |
|
56 |
|
57 // oder die maxRange |
|
58 // final DataList list = getArtifact().getArtifactDescription().getCurrentData(); |
|
59 // final Data[] rangeMax = new Data[] { list.get(0), list.get(1) }; |
|
60 |
|
61 feedAndGo(rangeFromToDetermined, 0); |
|
62 |
|
63 /* Select Fixpunkte */ |
|
64 feedAndGo(super.getPairData(), 0); |
|
65 |
|
66 // Describe collection |
|
67 describeCollection(); // wichtig, damit die Facets erzeugt werden |
|
68 |
|
69 // /* Export calculation */ |
|
70 final OutputMode[] modes = getArtifact().getArtifactDescription().getOutputModes(); |
|
71 if (modes != null) { |
|
72 final OutputMode mode = modes[1]; // output.sinfo_flowdepthminmax_export |
|
73 doGet(mode.getName(), exportToFile); |
|
74 } |
|
75 } |
|
76 |
|
77 } |