Mercurial > dive4elements > river
comparison gwt-client/src/test/java/test/sinfo/SinfoCollisionRunner.java @ 9422:e567fac95e3d
uinfo salix no scenario jUnit test
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 11:43:42 +0200 |
parents | |
children | 86e522bc7f36 |
comparison
equal
deleted
inserted
replaced
9420:2c8ba17b807e | 9422:e567fac95e3d |
---|---|
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.sinfo; | |
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.IFilenameMapper; | |
24 import test.sinfo.SinfoBerechnungsartenTester.CalcMode; | |
25 | |
26 /** | |
27 * @author Domenico Nardi Tironi | |
28 * | |
29 */ | |
30 final class SinfoCollisionRunner extends AbstractModuleRunner { | |
31 | |
32 private final int[] years; | |
33 private final String epochs; | |
34 private boolean isYears; // cannot be final because of the ternary expression | |
35 | |
36 public SinfoCollisionRunner(final IFilenameMapper file, final double from, final double to, final River river, final int[] years, final String epochs) | |
37 throws ConnectionException, ServerException { | |
38 super(AbstractModuleRunner.Infotype.sinfo, CalcMode.sinfo_calc_collision, file, from, to, river); | |
39 this.years = years; | |
40 this.epochs = epochs; | |
41 this.isYears = (years != null) ? (this.isYears = true) : (this.isYears = false); | |
42 } | |
43 | |
44 @Override | |
45 public void runTest(final boolean exportToFile) throws ServerException, IOException { | |
46 /* Select River */ | |
47 super.selectRiver(); | |
48 | |
49 /* Select ICalcMode */ | |
50 super.selectCalcMode(); | |
51 | |
52 super.feed(new Data[] { | |
53 new StringOptionsData("ld_mode", "ld_mode", new DataItem[] { new DefaultDataItem("distance_only", "distance_only", "distance_only") }) }); // ggf | |
54 | |
55 /* Select Range */ | |
56 super.selectRange(); | |
57 | |
58 /* Year or Epoch? eigentlich vermutlich überflüssig */ | |
59 final String yeSelectStr = this.isYears ? "state.sinfo.year" : "state.sinfo.epoch"; | |
60 final Data yearEpochSelect = new StringOptionsData("ye_select", "ye_select", | |
61 new DataItem[] { new DefaultDataItem(yeSelectStr, yeSelectStr, yeSelectStr) }); | |
62 feedAndGo(new Data[] { yearEpochSelect }, 0); | |
63 | |
64 if (this.years != null) { | |
65 final StringBuilder sb = new StringBuilder(); | |
66 for (final int value : this.years) { | |
67 sb.append(String.valueOf(value)); | |
68 sb.append(" "); | |
69 } | |
70 final Data yearsData = new StringOptionsData("years", "years", new DataItem[] { new DefaultDataItem("years", "years", sb.toString()) }); | |
71 feedAndGo(new Data[] { yearsData }, 0); | |
72 } else if (this.epochs != null) { | |
73 final Data data = new StringOptionsData("epochs", "epochs", new DataItem[] { new DefaultDataItem("epochs", "epochs", this.epochs) }); | |
74 feedAndGo(new Data[] { data }, 0); | |
75 } | |
76 describeCollection(); | |
77 | |
78 super.export(exportToFile); | |
79 } | |
80 } |