comparison gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java @ 9567:86e522bc7f36

jUnit-Tests completed
author gernotbelger
date Mon, 05 Nov 2018 13:21:57 +0100
parents 173f188569c6
children 531a60b7af95
comparison
equal deleted inserted replaced
9566:9826b465b751 9567:86e522bc7f36
7 import org.dive4elements.river.client.shared.exceptions.ServerException; 7 import org.dive4elements.river.client.shared.exceptions.ServerException;
8 import org.junit.Ignore; 8 import org.junit.Ignore;
9 import org.junit.Test; 9 import org.junit.Test;
10 10
11 import test.AbstractBerechnungsartenTester; 11 import test.AbstractBerechnungsartenTester;
12 import test.FilenameSupplier;
12 import test.ICalcMode; 13 import test.ICalcMode;
13 import test.IFilenameMapper;
14 14
15 @Ignore 15 @Ignore
16 public class BunduBerechnungsartenTester extends AbstractBerechnungsartenTester { 16 public class BunduBerechnungsartenTester extends AbstractBerechnungsartenTester {
17
18 private static final String BUNDU_WST_DEFAULT_EXPORT_MODE = "bundu_wst_export";
19 private static final String BUNDU_WSPL_LONGITUDINAL_SECTION_MODE = "bundu_wspl_longitudinal_section";
20
21 private static final String BUNDU_BEZUGSWST_AUTO_FIX_CHOICE = "state.bundu.wst.fix.auto";
17 22
18 public static enum CalcMode implements ICalcMode { 23 public static enum CalcMode implements ICalcMode {
19 bundu_bezugswst, // 24 bundu_bezugswst, //
20 // der Vollständigkeit halber 25 // der Vollständigkeit halber
21 bundu_analysis, bundu_vollmer 26 bundu_analysis, bundu_vollmer
22 }; 27 };
23 28
24 public static enum FilenameMapper implements IFilenameMapper { 29 final FilenameSupplier BEZUGSWST_FILE = new FilenameSupplier("/bundu/bezugswst/bezugswst.csv");
25 BEZUGSWST_FILE("/bundu/bezugswst/bezugswst.csv"); // 30 final FilenameSupplier BEZUGSWST_02_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_02.csv");
26 private final String filename; 31 final FilenameSupplier BEZUGSWST_02_CHART_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_02_chart.csv");
27 32 final FilenameSupplier BEZUGSWST_03_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_03.csv"); //
28 FilenameMapper(final String filename) {
29 this.filename = filename;
30 }
31
32 @Override
33 public String getFilename() {
34 return this.filename;
35 }
36 }
37 33
38 // public static final LinkedHashMap<String, String> getMapValues(final FLYSConstants MSG) { 34 // public static final LinkedHashMap<String, String> getMapValues(final FLYSConstants MSG) {
39 // final LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>(); 35 // final LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
40 // mapValues.put("0", MSG.gauge_mnq()); 36 // mapValues.put("0", MSG.gauge_mnq());
41 // mapValues.put("1", MSG.gauge_mq()); 37 // mapValues.put("1", MSG.gauge_mq());
42 // mapValues.put("2", MSG.gauge_mhq()); 38 // mapValues.put("2", MSG.gauge_mhq());
43 // mapValues.put("3", MSG.gauge_hq5()); 39 // mapValues.put("3", MSG.gauge_hq5());
44 // return mapValues; 40 // return mapValues;
45 // } 41 // }
46 42
47 @Test 43 // @Test
48 public void testBezugswstAuto() throws ServerException, IOException { 44 public void testBezugswst_HELLO_WORLD() throws ServerException, IOException {
45
49 /* WQ-Input */ 46 /* WQ-Input */
47 // FIXME: normally provided by state, but we do not have access to server-side at this point.
50 final List<Segment> segments = new ArrayList<Segment>(); 48 final List<Segment> segments = new ArrayList<Segment>();
51 // gauge, fromKm, toKm, Q-Input 49 // gauge, fromKm, toKm, Q-Input
52 segments.add(new Segment("Köln", 670., 703.3, 1090.)); 50 segments.add(new Segment("Köln", 670., 703.3, 1060.));
53 segments.add(new Segment("Düsseldorf", 703.3, 710., 1060.)); 51 segments.add(new Segment("Düsseldorf", 703.4, 710., 1090.));
54 52
55 /* Abflussklassen */ 53 /* Abflussklassen */
56 // MSG won't work here! 54 // MSG won't work here!
57 // final LinkedHashMap<String, String> map = FixGaugeSelectPanel.getMapValues(MSG); 55 // final LinkedHashMap<String, String> map = FixGaugeSelectPanel.getMapValues(MSG);
58 // final String mnq = MSG.gauge_mnq(); 56 // final String mnq = MSG.gauge_mnq();
83 // state.bundu.wst.fix.manual; 81 // state.bundu.wst.fix.manual;
84 final String fixChoice = "state.bundu.wst.fix.auto"; 82 final String fixChoice = "state.bundu.wst.fix.auto";
85 83
86 /* Soundings */ 84 /* Soundings */
87 // --> Debug at ParameterMatrixPanel.getData 85 // --> Debug at ParameterMatrixPanel.getData
88 final String sounding = "single-95"; // Todo: make multiple if needed 86 final String sounding = "single-95"; // TESTs
89
90 /* events - have to be set also when auto is selected */ 87 /* events - have to be set also when auto is selected */
91 // --> get ids by debugging FixCalculation line 73 (constructor) 88 // --> get ids by debugging FixCalculation line 73 (constructor)
92 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, 89 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,
93 1330, 1331, 1458, 1459 }; 90 1330, 1331, 1458, 1459 };
94 91
95 new BunduBezugswstRunner(FilenameMapper.BEZUGSWST_FILE, 670., 710., 100, River.Rhein, 2015, fixChoice, function, abflussklasseFrom, abflussklasseTo, 92 final boolean preprocessing = false;
96 events, 10, segments, calcChoice, false, sounding).runTest(overrideFileExport() != null ? overrideFileExport() : true); 93 final boolean missingVolume = false;
94
95 new BunduBezugswstRunner(670.0, 710., 100., River.Rhein, 2014, fixChoice, function, abflussklasseFrom, abflussklasseTo, events, 40, segments,
96 calcChoice, preprocessing, missingVolume, null, null, sounding)//
97 .addOutputTest(this.BEZUGSWST_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null)//
98 .runTest();
99 }
100
101 @Test
102 public void testBezugswst02() throws ServerException, IOException {
103
104 final List<Segment> segments = new ArrayList<Segment>();
105 // gauge, fromKm, toKm, Q-Input
106 segments.add(new Segment("Maxau", 336.2, 384.8, 1257.));
107 segments.add(new Segment("Speyer", 384.9, 428.1, 1278.));
108 segments.add(new Segment("Worms", 428.2, 496.6, 1418.));
109 segments.add(new Segment("Mainz", 496.7, 529.1, 1605.));
110 segments.add(new Segment("Kaub", 529.2, 585.7, 1659.));
111 segments.add(new Segment("Koblenz", 585.8, 592.3, 1715.));
112 segments.add(new Segment("Andernach", 592.4, 621, 2030.));
113
114 final String fixChoice = "state.bundu.wst.fix.auto";
115
116 final String calcChoice = "state.bundu.wst.calc.manual";
117
118 final String abflussklasseFrom = "0"; // map.get(mnq);
119 final String abflussklasseTo = "3";// map.get(hq5);
120
121 final int[] events = new int[] { 1524, 1523, 1522, 1521, 1520, 1519, 1518, 1393, 1392, 1391, 1390, 1389, 1388, 1387, 1311, 1302, 1301, 1300, 1299, 1298,
122 1297, 1296, 1397, 1396, 1395, 1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1566, 1565, 1564, 1563, 1540, 1539, 1538, 1537, 1536, 1535, 1534,
123 1533, 1494, 1493, 1492, 1491, 1562, 1561, 1560, 1559, 1558, 1557, 1556, 1555, 1407, 1406, 1405, 1404, 1440, 1441, 1442, 1443, 1567, 1568, 1569,
124 1570, 1500, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1498, 1362, 1398, 1399, 1400, 1444, 1445, 1446, 1401, 1402, 1403, 1363, 1447, 1448,
125 1449, 1364, 1501, 1365, 1367, 1368, 1369, 1366, 1370, 1371, 1495, 1496, 1497, 1295, 1408, 1409, 1410, 1490, 1360, 1422, 1428, 1411, 1412, 1413,
126 1437, 1438, 1439, 1450, 1361, 1424, 1431, 1423, 1432, 1433, 1503, 1504, 1505, 1506, 1507, 1499, 1429, 1430, 1571, 1572, 1573, 1434, 1435, 1427,
127 1436, 1307, 1303, 1304, 1305, 1308, 1508, 1509, 1510, 1511, 1512, 1309, 1574, 1575, 1576, 1577, 1578, 1579, 1310, 1314, 1315, 1372, 1373, 1374,
128 1375, 1376, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588
129
130 };
131
132 // --> Debug at ParameterMatrixPanel.getData
133 final String sounding = "single-83"; // 2006
134
135 final boolean preprocessing = true;
136 final boolean missingVolume = true;
137
138 new BunduBezugswstRunner(336.2, 621., 100, River.Rhein, 2010, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 10, segments,
139 calcChoice, preprocessing, missingVolume, 400., 401., sounding)//
140 .addOutputTest(this.BEZUGSWST_02_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) //
141 .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no currentKM
142 .runTest();
143 }
144
145 @Test
146 public void testBezugswst03() throws ServerException, IOException {
147 /* WQ-Input */
148 final List<Segment> segments = new ArrayList<Segment>();
149
150 segments.add(new Segment("Worms", 428.2, 496.6, 487.));
151 segments.add(new Segment("Mainz", 496.7, 529.2, 583.));
152
153 final String fixChoice = BunduBerechnungsartenTester.BUNDU_BEZUGSWST_AUTO_FIX_CHOICE;
154 final String calcChoice = "state.bundu.wst.calc.manual";
155
156 final String abflussklasseFrom = "0"; // map.get(mnq);
157 final String abflussklasseTo = "3";// map.get(hq5);
158
159 // FIXME auto auswahl?
160 // --> get ids by debugging FixCalculation line 73 (constructor)
161 final int[] events = new int[] { 1440, 1569, 1570, 1543, 1544, 1545, 1399, 1400, 1444, 1402, 1403, 1368, 1369, 1496, 1497, 1409, 1410, 1428, 1412, 1413,
162 1437, 1424, 1431, 1504, 1505, 1429, 1572, 1573, 1434, 1427, 1304, 1305, 1509, 1510, 1575, 1576, 1578, 1579, 1315, 1373, 1374, 1581, 1582, 1584,
163 1585, 1587, 1588, 1590, 1591, 1514, 1515, 1415, 1416 };
164
165 // --> Debug at ParameterMatrixPanel.getData
166 final String sounding = "single-103"; //
167
168 final boolean preprocessing = true;
169 final boolean missingVolume = true;
170
171 new BunduBezugswstRunner(430., 500., 100, River.Rhein, 2014, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 40, segments,
172 calcChoice, preprocessing, missingVolume, 430., 480., sounding)//
173 .addOutputTest(this.BEZUGSWST_03_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) //
174 // .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no
175 // currentKM
176 .runTest();
97 } 177 }
98 } 178 }

http://dive4elements.wald.intevation.org