Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java Mon Nov 05 10:19:12 2018 +0100 +++ b/gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java Mon Nov 05 13:21:57 2018 +0100 @@ -9,31 +9,27 @@ import org.junit.Test; import test.AbstractBerechnungsartenTester; +import test.FilenameSupplier; import test.ICalcMode; -import test.IFilenameMapper; @Ignore public class BunduBerechnungsartenTester extends AbstractBerechnungsartenTester { + private static final String BUNDU_WST_DEFAULT_EXPORT_MODE = "bundu_wst_export"; + private static final String BUNDU_WSPL_LONGITUDINAL_SECTION_MODE = "bundu_wspl_longitudinal_section"; + + private static final String BUNDU_BEZUGSWST_AUTO_FIX_CHOICE = "state.bundu.wst.fix.auto"; + public static enum CalcMode implements ICalcMode { bundu_bezugswst, // // der Vollständigkeit halber bundu_analysis, bundu_vollmer }; - public static enum FilenameMapper implements IFilenameMapper { - BEZUGSWST_FILE("/bundu/bezugswst/bezugswst.csv"); // - private final String filename; - - FilenameMapper(final String filename) { - this.filename = filename; - } - - @Override - public String getFilename() { - return this.filename; - } - } + final FilenameSupplier BEZUGSWST_FILE = new FilenameSupplier("/bundu/bezugswst/bezugswst.csv"); + final FilenameSupplier BEZUGSWST_02_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_02.csv"); + final FilenameSupplier BEZUGSWST_02_CHART_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_02_chart.csv"); + final FilenameSupplier BEZUGSWST_03_FILE = new FilenameSupplier("/bundu/bezugswst/bundu_bzws_03.csv"); // // public static final LinkedHashMap<String, String> getMapValues(final FLYSConstants MSG) { // final LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>(); @@ -44,13 +40,15 @@ // return mapValues; // } - @Test - public void testBezugswstAuto() throws ServerException, IOException { + // @Test + public void testBezugswst_HELLO_WORLD() throws ServerException, IOException { + /* WQ-Input */ + // FIXME: normally provided by state, but we do not have access to server-side at this point. 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.)); + segments.add(new Segment("Köln", 670., 703.3, 1060.)); + segments.add(new Segment("Düsseldorf", 703.4, 710., 1090.)); /* Abflussklassen */ // MSG won't work here! @@ -85,14 +83,96 @@ /* Soundings */ // --> Debug at ParameterMatrixPanel.getData - final String sounding = "single-95"; // Todo: make multiple if needed - + final String sounding = "single-95"; // TESTs /* 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 }; - 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); + final boolean preprocessing = false; + final boolean missingVolume = false; + + new BunduBezugswstRunner(670.0, 710., 100., River.Rhein, 2014, fixChoice, function, abflussklasseFrom, abflussklasseTo, events, 40, segments, + calcChoice, preprocessing, missingVolume, null, null, sounding)// + .addOutputTest(this.BEZUGSWST_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null)// + .runTest(); + } + + @Test + public void testBezugswst02() throws ServerException, IOException { + + final List<Segment> segments = new ArrayList<Segment>(); + // gauge, fromKm, toKm, Q-Input + segments.add(new Segment("Maxau", 336.2, 384.8, 1257.)); + segments.add(new Segment("Speyer", 384.9, 428.1, 1278.)); + segments.add(new Segment("Worms", 428.2, 496.6, 1418.)); + segments.add(new Segment("Mainz", 496.7, 529.1, 1605.)); + segments.add(new Segment("Kaub", 529.2, 585.7, 1659.)); + segments.add(new Segment("Koblenz", 585.8, 592.3, 1715.)); + segments.add(new Segment("Andernach", 592.4, 621, 2030.)); + + final String fixChoice = "state.bundu.wst.fix.auto"; + + final String calcChoice = "state.bundu.wst.calc.manual"; + + final String abflussklasseFrom = "0"; // map.get(mnq); + final String abflussklasseTo = "3";// map.get(hq5); + + 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, + 1297, 1296, 1397, 1396, 1395, 1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1566, 1565, 1564, 1563, 1540, 1539, 1538, 1537, 1536, 1535, 1534, + 1533, 1494, 1493, 1492, 1491, 1562, 1561, 1560, 1559, 1558, 1557, 1556, 1555, 1407, 1406, 1405, 1404, 1440, 1441, 1442, 1443, 1567, 1568, 1569, + 1570, 1500, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1498, 1362, 1398, 1399, 1400, 1444, 1445, 1446, 1401, 1402, 1403, 1363, 1447, 1448, + 1449, 1364, 1501, 1365, 1367, 1368, 1369, 1366, 1370, 1371, 1495, 1496, 1497, 1295, 1408, 1409, 1410, 1490, 1360, 1422, 1428, 1411, 1412, 1413, + 1437, 1438, 1439, 1450, 1361, 1424, 1431, 1423, 1432, 1433, 1503, 1504, 1505, 1506, 1507, 1499, 1429, 1430, 1571, 1572, 1573, 1434, 1435, 1427, + 1436, 1307, 1303, 1304, 1305, 1308, 1508, 1509, 1510, 1511, 1512, 1309, 1574, 1575, 1576, 1577, 1578, 1579, 1310, 1314, 1315, 1372, 1373, 1374, + 1375, 1376, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588 + + }; + + // --> Debug at ParameterMatrixPanel.getData + final String sounding = "single-83"; // 2006 + + final boolean preprocessing = true; + final boolean missingVolume = true; + + new BunduBezugswstRunner(336.2, 621., 100, River.Rhein, 2010, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 10, segments, + calcChoice, preprocessing, missingVolume, 400., 401., sounding)// + .addOutputTest(this.BEZUGSWST_02_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) // + .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no currentKM + .runTest(); + } + + @Test + public void testBezugswst03() throws ServerException, IOException { + /* WQ-Input */ + final List<Segment> segments = new ArrayList<Segment>(); + + segments.add(new Segment("Worms", 428.2, 496.6, 487.)); + segments.add(new Segment("Mainz", 496.7, 529.2, 583.)); + + final String fixChoice = BunduBerechnungsartenTester.BUNDU_BEZUGSWST_AUTO_FIX_CHOICE; + final String calcChoice = "state.bundu.wst.calc.manual"; + + final String abflussklasseFrom = "0"; // map.get(mnq); + final String abflussklasseTo = "3";// map.get(hq5); + + // FIXME auto auswahl? + // --> get ids by debugging FixCalculation line 73 (constructor) + 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, + 1437, 1424, 1431, 1504, 1505, 1429, 1572, 1573, 1434, 1427, 1304, 1305, 1509, 1510, 1575, 1576, 1578, 1579, 1315, 1373, 1374, 1581, 1582, 1584, + 1585, 1587, 1588, 1590, 1591, 1514, 1515, 1415, 1416 }; + + // --> Debug at ParameterMatrixPanel.getData + final String sounding = "single-103"; // + + final boolean preprocessing = true; + final boolean missingVolume = true; + + new BunduBezugswstRunner(430., 500., 100, River.Rhein, 2014, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 40, segments, + calcChoice, preprocessing, missingVolume, 430., 480., sounding)// + .addOutputTest(this.BEZUGSWST_03_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) // + // .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no + // currentKM + .runTest(); } } \ No newline at end of file