[PATCH 2 of 2] little improvements
Wald Commits
scm-commit at wald.intevation.org
Mon Aug 20 18:20:22 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1534782015 -7200
# Node ID 173f188569c6403eb41f5e7810d5c112ee182866
# Parent e75afd693f781f60cdab72984ae823a5fed73422
little improvements
diff -r e75afd693f78 -r 173f188569c6 gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java
--- a/gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java Mon Aug 20 17:30:13 2018 +0200
+++ b/gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java Mon Aug 20 18:20:15 2018 +0200
@@ -5,13 +5,14 @@
import java.util.List;
import org.dive4elements.river.client.shared.exceptions.ServerException;
+import org.junit.Ignore;
import org.junit.Test;
import test.AbstractBerechnungsartenTester;
import test.ICalcMode;
import test.IFilenameMapper;
-//@Ignore
+ at Ignore
public class BunduBerechnungsartenTester extends AbstractBerechnungsartenTester {
public static enum CalcMode implements ICalcMode {
@@ -34,30 +35,64 @@
}
}
- // FixChoice
- // "state.bundu.wst.fix.auto"
- // state.bundu.wst.fix.manual;
-
- // CalcChoice:
- // state.bundu.wst.calc.manual
- // state.bundu.wst.calc.auto
-
- // SOUNDINGS: SIehe ParameterMatrixPanel.getData
+ // public static final LinkedHashMap<String, String> getMapValues(final FLYSConstants MSG) {
+ // final LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
+ // mapValues.put("0", MSG.gauge_mnq());
+ // mapValues.put("1", MSG.gauge_mq());
+ // mapValues.put("2", MSG.gauge_mhq());
+ // mapValues.put("3", MSG.gauge_hq5());
+ // return mapValues;
+ // }
@Test
public void testBezugswstAuto() throws ServerException, IOException {
+ /* WQ-Input */
final List<Segment> segments = new ArrayList<Segment>();
+ // gauge, fromKm, toKm, Q-Input
segments.add(new Segment("Köln", 670., 703.3, 1090.));
segments.add(new Segment("Düsseldorf", 703.3, 710., 1060.));
- final int abflussklasseFrom = 0;
- final int abflussklasseTo = 3; // TODO: Make map here
+ /* Abflussklassen */
+ // MSG won't work here!
+ // final LinkedHashMap<String, String> map = FixGaugeSelectPanel.getMapValues(MSG);
+ // final String mnq = MSG.gauge_mnq();
+ // final String hq5 = MSG.gauge_hq5();
+ final String abflussklasseFrom = "0"; // map.get(mnq);
+ final String abflussklasseTo = "3";// map.get(hq5);
+
+ /* Function */
+ // from FixFunctionSelect:
+ // funcDesc.put("log", "W(Q) = m*ln(Q + b)");
+ // funcDesc.put("linear", "W(Q) = m * Q + b");
+ // funcDesc.put("log-linear", "W(Q) = a*ln(m*Q+b)");
+ // funcDesc.put("exp", "W(Q) = m * a^Q + b");
+ // funcDesc.put("quad", "W(Q) = n*Q^2+m*Q+b");
+ // funcDesc.put("pow", "W(Q) = a * Q^c + d");
+ // funcDesc.put("sq-pow", "S(Q) = a * Q^b");
+
+ final String function = "log";
+
+ /* calc-choice (has to be set due to state-transition-conditions) */
+ // state.bundu.wst.calc.manual
+ // state.bundu.wst.calc.auto
+ final String calcChoice = "state.bundu.wst.calc.auto";
+
+ /* fixation-choice (has to be set due to state-transition-conditions) */
+ // "state.bundu.wst.fix.auto"
+ // state.bundu.wst.fix.manual;
+ final String fixChoice = "state.bundu.wst.fix.auto";
+
+ /* Soundings */
+ // --> Debug at ParameterMatrixPanel.getData
+ final String sounding = "single-95"; // Todo: make multiple if needed
+
+ /* events - have to be set also when auto is selected */
+ // --> get ids by debugging FixCalculation line 73 (constructor)
final int[] events = new int[] { 1465, 1466, 1452, 1453, 1472, 1473, 1478, 1479, 1604, 1605, 1317, 1318, 1353, 1354, 1596, 1597, 1323, 1324, 1345, 1346,
- 1330, 1331, 1458, 1459 }; // get ids by debugging FixCalculation line 73 (constructor)
+ 1330, 1331, 1458, 1459 };
- new BunduBezugswstRunner(FilenameMapper.BEZUGSWST_FILE, 670., 710., 100, River.Rhein, 2015, "state.bundu.wst.fix.auto", abflussklasseFrom,
- abflussklasseTo, events, 10, segments, "state.bundu.wst.calc.auto", false, "single-95")
- .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+ new BunduBezugswstRunner(FilenameMapper.BEZUGSWST_FILE, 670., 710., 100, River.Rhein, 2015, fixChoice, function, abflussklasseFrom, abflussklasseTo,
+ events, 10, segments, calcChoice, false, sounding).runTest(overrideFileExport() != null ? overrideFileExport() : true);
}
}
\ No newline at end of file
diff -r e75afd693f78 -r 173f188569c6 gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java
--- a/gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java Mon Aug 20 17:30:13 2018 +0200
+++ b/gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java Mon Aug 20 18:20:15 2018 +0200
@@ -41,18 +41,19 @@
private final String calcChoice;
private final double step;
private final List<Segment> segments;
- private final int qSectorStart;
- private final int qSectorEnd;
+ private final String qSectorStart;
+ private final String qSectorEnd;
private final int[] events;
+ private final String function;
public BunduBezugswstRunner(final IFilenameMapper file, final double from, final double to, final double step, final River river, final int bezugsjahr,
- final String fixationChoice, final int gaugeRangeQsectorStart_q1, final int gaugeRangeQsectorEnd_q2, final int[] events, final int years_length,
- final List<Segment> segments, final String calcChoice, final boolean fehlvolumina, final String sounding)
+ final String fixationChoice, final String function, final String abflussklasseFrom, final String abflussklasseTo, final int[] events,
+ final int years_length, final List<Segment> segments, final String calcChoice, final boolean fehlvolumina, final String sounding)
throws ConnectionException, ServerException {
super(AbstractModuleRunner.Infotype.bundu, test.bundu.BunduBerechnungsartenTester.CalcMode.bundu_bezugswst, file, from, to, river);
this.fixationChoice = fixationChoice;
- this.qSectorStart = gaugeRangeQsectorStart_q1;
- this.qSectorEnd = gaugeRangeQsectorEnd_q2;
+ this.qSectorStart = abflussklasseFrom;
+ this.qSectorEnd = abflussklasseTo;
this.bezugsjahr = bezugsjahr;
this.years_length = years_length;
this.fehlvolumina = fehlvolumina;
@@ -61,6 +62,7 @@
this.step = step;
this.segments = segments;
this.events = events;
+ this.function = function;
}
@Override
@@ -85,8 +87,8 @@
/* fixierungsauswahl - auto oder manuell */
// AUTO: 0, 3
- final Data q1 = super.getSimpleTextInput("q1", String.valueOf(this.qSectorStart));
- final Data q2 = super.getSimpleTextInput("q2", String.valueOf(this.qSectorEnd));
+ final Data q1 = super.getSimpleTextInput("q1", this.qSectorStart);
+ final Data q2 = super.getSimpleTextInput("q2", this.qSectorEnd);
final Data fixChoice = super.getSimpleTextInput("fix_choice", this.fixationChoice);
final IntDataItem[] arr = new IntDataItem[this.events.length];
@@ -113,7 +115,7 @@
/* calc_choice */
final Data preprocessingData = super.getSimpleTextInput("preprocessing", "false");
- final Data functionData = super.getSimpleTextInput("function", "log");
+ final Data functionData = super.getSimpleTextInput("function", this.function);
final Data calcChoice = super.getSimpleTextInput("calc_choice", this.calcChoice);
super.feedAndGoData(new Data[] { preprocessingData, functionData, calcChoice });
diff -r e75afd693f78 -r 173f188569c6 gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java
--- a/gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java Mon Aug 20 17:30:13 2018 +0200
+++ b/gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java Mon Aug 20 18:20:15 2018 +0200
@@ -6,13 +6,14 @@
import org.dive4elements.river.client.shared.exceptions.ServerException;
import org.dive4elements.river.client.shared.model.SalixZone;
+import org.junit.Ignore;
import org.junit.Test;
import test.AbstractBerechnungsartenTester;
import test.ICalcMode;
import test.IFilenameMapper;
-//@Ignore
+ at Ignore
public class UInfoBerechnungsartenTester extends AbstractBerechnungsartenTester {
public static enum CalcMode implements ICalcMode {
More information about the Dive4Elements-commits
mailing list