diff gwt-client/src/test/java/test/sinfo/SinfoBerechnungsartenTester.java @ 9567:86e522bc7f36

jUnit-Tests completed
author gernotbelger
date Mon, 05 Nov 2018 13:21:57 +0100
parents da19f1f58d72
children 531a60b7af95
line wrap: on
line diff
--- a/gwt-client/src/test/java/test/sinfo/SinfoBerechnungsartenTester.java	Mon Nov 05 10:19:12 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoBerechnungsartenTester.java	Mon Nov 05 13:21:57 2018 +0100
@@ -4,23 +4,16 @@
 
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
 import org.dive4elements.river.client.shared.exceptions.ServerException;
-
-/**
- * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
- */
-
-// REMARK: ignored, because maven will auto-test all tests, but this one needs a running river-artifacts
-// For running the JUunit test, the annotation @Ignore has to be disabled
 import org.junit.Ignore;
 import org.junit.Test;
 
 import test.AbstractBerechnungsartenTester;
+import test.FilenameSupplier;
 import test.ICalcMode;
-import test.IFilenameMapper;
 import test.SimpleRecommendation;
 import test.sinfo.SinfoFloodDurationRiversideChoice.RiversideChoiceKey;
 
-@Ignore
+@Ignore // ein- oder auskommentieren, je nach Bedarf!
 public final class SinfoBerechnungsartenTester extends AbstractBerechnungsartenTester {
     // has to be public for jUnit-Test
     public static enum CalcMode implements ICalcMode {
@@ -28,89 +21,95 @@
 
     };
 
-    public static enum SinfoFilenameMapper implements IFilenameMapper {
-
-        FT_MINMAX_RHEIN_1_FILE("/sinfo/flowdepthminmax/sinfo_minmaxft_01.csv"), //
-        FT_MINMAX_ELBE_2_FILE("/sinfo/flowdepthminmax/sinfo_minmaxft_02.csv"), //
-
-        FT_RHEIN_1_FILE("/sinfo/flowdepth/sinfo_ft_01.csv"), //
-        FT_RHEIN_2_FILE("/sinfo/flowdepth/sinfo_ft_02.csv"), //
-
-        FTE_ELBE_FILE("/sinfo/flowdepthdevelopment/sinfo_fte_01.csv"), //
-        FTE_RHEIN_FILE("/sinfo/flowdepthdevelopment/sinfo_fte_02.csv"),
-
-        TKH_1_ELBE_FILE("/sinfo/flowdepthtkh/sinfo_tkh_01.csv"), //
-        TKH_2_RHEIN_FILE("/sinfo/flowdepthtkh/sinfo_tkh_02.csv"),
+    FilenameSupplier FT_MINMAX_RHEIN_1_FILE = new FilenameSupplier("/sinfo/flowdepthminmax/sinfo_minmaxft_01.csv");
+    FilenameSupplier FT_MINMAX_ELBE_2_FILE = new FilenameSupplier("/sinfo/flowdepthminmax/sinfo_minmaxft_02.csv");
 
-        TKH_TKH_RHEIN_FILE("/sinfo/tkh/sinfo_tkh_export.csv"), //
-
-        COLLISION_RHEIN_HELLO_WORLD_FILE("/sinfo/collision/sinfo_collision_export.csv"), //
-        COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE("/sinfo/collision/sinfo_collision_epoch_export.csv"), //
-
-        FLOOD_DURATION_HELLO_WORLD_FILE("/sinfo/floodduration/sinfo_floodduration_export.csv");
-        private final String filename;
+    FilenameSupplier FT_RHEIN_1_FILE = new FilenameSupplier("/sinfo/flowdepth/sinfo_ft_01.csv");
+    FilenameSupplier FT_RHEIN_2_FILE = new FilenameSupplier("/sinfo/flowdepth/sinfo_ft_02.csv");
 
-        SinfoFilenameMapper(final String filename) {
-            this.filename = filename;
-        }
+    FilenameSupplier FTE_ELBE_FILE = new FilenameSupplier("/sinfo/flowdepthdevelopment/sinfo_fte_01.csv");
+    FilenameSupplier FTE_RHEIN_FILE = new FilenameSupplier("/sinfo/flowdepthdevelopment/sinfo_fte_02.csv");
 
-        @Override
-        public String getFilename() {
-            return this.filename;
-        }
-    }
+    FilenameSupplier TKH_1_ELBE_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_01.csv");
+    FilenameSupplier TKH_2_RHEIN_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_02.csv");
+    FilenameSupplier TKH_1_ELBE_CHART_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_chart_01.csv");
+
+    // FilenameSupplier TKH_TKH_RHEIN_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_export.csv");
+
+    // FilenameSupplier COLLISION_RHEIN_HELLO_WORLD_FILE = new
+    // FilenameSupplier("/sinfo/collision/sinfo_collision_export.csv");
+    // FilenameSupplier COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE = new
+    // FilenameSupplier("/sinfo/collision/sinfo_collision_epoch_export.csv");
+
+    FilenameSupplier COLLISION_RHEIN_01 = new FilenameSupplier("/sinfo/collision/sinfo_grund_01.csv");
+    FilenameSupplier COLLISION_RHEIN_02 = new FilenameSupplier("/sinfo/collision/sinfo_grund_02.csv");
+
+    FilenameSupplier FLOOD_DURATION_CS_384_6 = new FilenameSupplier("/sinfo/floodduration/sinfo_uedi_01_chart_dauer_384km6.csv");
+    FilenameSupplier FLOOD_DURATION_CS_384_7 = new FilenameSupplier("/sinfo/floodduration/sinfo_uedi_01_chart_dauer_384km7.csv");
+    FilenameSupplier FLOOD_DURATION_CS_384_9 = new FilenameSupplier("/sinfo/floodduration/sinfo_uedi_01_chart_dauer_384km9.csv");
+
+    // FilenameSupplier FLOOD_DURATION_HELLO_WORLD_FILE = new
+    // FilenameSupplier("/sinfo/floodduration/sinfo_floodduration_export.csv");
 
     /* FLOWDEPTH MIN MAX */
     @Test
     public void testFTMINMAX1() throws ServerException, IOException {
 
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(SinfoFilenameMapper.FT_MINMAX_RHEIN_1_FILE, 430, 450, River.Rhein,
-                new SimpleRecommendation("bedheight", "bedheight-single-79-2004-MW-DGM-2004_Epoche_NHN", "longitudinal_section"),
-                new SimpleRecommendation("staticwqkms", "additionals-wstv-0-269", "longitudinal_section", "Amtl.Festlegung_GlQ(2002)")
-
-        ).runTest(overrideFileExport() != null ? overrideFileExport() : true);
+        SinfoRunnerCreatorHelper
+                .createSinfoFlowdepthMinMaxTest(430, 450, River.Rhein,
+                        new SimpleRecommendation("bedheight", "bedheight-single-103-2004-DGM-2004_Epoche_NHN", "longitudinal_section"),
+                        new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section", "Amtl.Festlegung_GlQ(2002)"))//
+                .addOutputTest(this.FT_MINMAX_RHEIN_1_FILE, "sinfo_flowdepthminmax_export", null)//
+                .runTest();
     }
 
     @Test
     public void testFTMINMAX2() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(SinfoFilenameMapper.FT_MINMAX_ELBE_2_FILE, 0, 90, River.Elbe,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(0, 90, River.Elbe,
                 // first
+                // bedheight-single-58-2015-FP-2015_0-502
+
                 new SimpleRecommendation("bedheight", "bedheight-single-58-2015-MW-FP-2015_0-502", "longitudinal_section", "FP-2015_0-502"),
+                // fixations-wstv-0-156
                 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-156", "longitudinal_section", "02.09.2004"),
 
                 // second
                 new SimpleRecommendation("bedheight", "bedheight-single-58-2015-MW-FP-2015_0-502", "longitudinal_section", "FP-2015_0-502"),
-                new SimpleRecommendation("staticwqkms", "fixations-wstv-1-156", "longitudinal_section", "03.09.2004"))
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+                new SimpleRecommendation("staticwqkms", "fixations-wstv-1-156", "longitudinal_section", "03.09.2004"))//
+                .addOutputTest(this.FT_MINMAX_ELBE_2_FILE, "sinfo_flowdepthminmax_export", null)//
+                .runTest();
     }
 
     /* FLOWDEPTH */
     @Test
     public void testRhein1FT() throws ConnectionException, ServerException, IOException {
 
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthTest(SinfoFilenameMapper.FT_RHEIN_1_FILE, 350, 380, River.Rhein, false,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthTest(350, 380, River.Rhein, false,
+                // [b34f91bd-17b3-435e-b609-8026980ed301;bedheight;0;DGM-2004_Epoche_NHN]#[e1bedb5e-edee-427d-b74e-7566652ebfda;staticwqkms;0;Amtl.Festlegung_GlQ(2002)]]]
+                // debug at org.dive4elements.river.client.shared.model.DefaultData.Recommendation line 142
+                new SimpleRecommendation("bedheight", " bedheight-single-103-2004-DGM-2004_Epoche_NHN", "longitudinal_section"),
+                new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section"))//
 
-                new SimpleRecommendation("bedheight", "bedheight-soundings-79-2004-DGM-2004_Epoche_NHN", "longitudinal_section"),
-                new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section"))
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
-
+                .addOutputTest(this.FT_RHEIN_1_FILE, "sinfo_flowdepth_export", null)//
+                .runTest();
     }
 
     @Test
     public void testRhein2FT() throws ConnectionException, ServerException, IOException {
         SinfoRunnerCreatorHelper
-                .createSinfoFlowdepthTest(SinfoFilenameMapper.FT_RHEIN_2_FILE, 655, 675, River.Rhein, true,
+                .createSinfoFlowdepthTest(655, 675, River.Rhein, true,
                         new SimpleRecommendation("bedheight", "bedheight-soundings-92-2004-NIEDERRHEIN_QP-2004_Epoche_NHN", "longitudinal_section"),
-                        new SimpleRecommendation("staticwqkms", "fixations-wstv-0-323", "longitudinal_section"))
+                        new SimpleRecommendation("staticwqkms", "fixations-wstv-0-323", "longitudinal_section"))//
 
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+                .addOutputTest(this.FT_RHEIN_2_FILE, "sinfo_flowdepth_export", null)//
+                .runTest();
     }
 
     /* FLOWDEPTH DEVELOPMENT */
 
     @Test
     public void testElbeFTE() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(SinfoFilenameMapper.FTE_ELBE_FILE, 210, 230, River.Elbe,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(210, 230, River.Elbe,
                 // current
                 new SimpleRecommendation("bedheight", "bedheight-soundings-66-2008-FP-QP-2008",
                         // "bedheight-single-66-2008-MW-FP-QP-2008",
@@ -122,12 +121,15 @@
                         // "bedheight-single-70-1995-MW-QP-1995",
                         "longitudinal_section"),
                 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-186", "longitudinal_section", "18.03.1997")// sicher
-        ).runTest(overrideFileExport() != null ? overrideFileExport() : true);
+        )//
+
+                .addOutputTest(this.FTE_ELBE_FILE, "sinfo_flowdepthdevelopment_export", null)//
+                .runTest();
     }
 
     @Test
     public void testRheinFTE() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(SinfoFilenameMapper.FTE_RHEIN_FILE, 655, 665, River.Rhein,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(655, 665, River.Rhein,
                 // current
                 new SimpleRecommendation("bedheight", "bedheight-single-94-2008-MW-NIEDERRHEIN_QP-2008_Epoche_NHN",
                         // "bedheight-single....",
@@ -139,50 +141,63 @@
                         // "bedheight-soundings-89-1991-NIEDERRHEIN_QP-1991_Epoche_NHN",
                         "longitudinal_section"),
                 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-374", "longitudinal_section", "23.09.1991") // sicher
-        ).runTest(overrideFileExport() != null ? overrideFileExport() : true);
+        )//
+
+                .addOutputTest(this.FTE_RHEIN_FILE, "sinfo_flowdepthdevelopment_export", null)//
+                .runTest();
     }
 
     /* TKH */
 
     @Test
     public void testElbeTKH_1() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoTkhTest(SinfoFilenameMapper.TKH_1_ELBE_FILE, 150, 160, River.Elbe, new double[] { 1520.0 })
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+        SinfoRunnerCreatorHelper.createSinfoTkhTest(150, 160, River.Elbe, new double[] { 1520.0 })//
+                .addOutputTest(this.TKH_1_ELBE_FILE, "sinfo_tkh_export", null)//
+                .addOutputTest(this.TKH_1_ELBE_CHART_FILE, "sinfo_tkk", null)//
+
+                .runTest();
     }
 
     @Test
     public void testRheinTKH_2() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoTkhTest(SinfoFilenameMapper.TKH_2_RHEIN_FILE, 600, 610, River.Rhein, new double[] { 6125, 6526 })
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
-    }
-
-    @Test
-    public void testTKhTkh() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoTkhTest(SinfoFilenameMapper.TKH_TKH_RHEIN_FILE, 0, 182.4, River.Beispielfluss, new double[] { 1059.446 })
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+        SinfoRunnerCreatorHelper.createSinfoTkhTest(600, 610, River.Rhein, new double[] { 6125, 6526 })//
+                .addOutputTest(this.TKH_2_RHEIN_FILE, "sinfo_tkh_export", null)//
+                .runTest();
     }
 
     @Test
-    public void testCollision() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper
-                .createSinfoCollisionYearsTest(SinfoFilenameMapper.COLLISION_RHEIN_HELLO_WORLD_FILE, 336.2, 866.3, River.Rhein, new int[] { 2006, 2008 })
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+    public void testCollision_01() throws ConnectionException, ServerException, IOException {
+        SinfoRunnerCreatorHelper.createSinfoCollisionYearsTest(336.2, 866.3, River.Rhein, new int[] { 2003, 2006, 2007 })//
+
+                .addOutputTest(this.COLLISION_RHEIN_01, "sinfo_collision_export", null)//
+                .runTest();
     }
 
     @Test
-    public void testCollisionEpochs() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper
-                .createSinfoCollisionEpochsTest(SinfoFilenameMapper.COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE, 336.2, 866.3, River.Rhein, "2006,2008;")
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+    public void testCollision_02() throws ConnectionException, ServerException, IOException {
+        SinfoRunnerCreatorHelper.createSinfoCollisionEpochsTest(336.2, 866.3, River.Rhein, "2002,2007;2005,2009;")//
+
+                .addOutputTest(this.COLLISION_RHEIN_02, "sinfo_collision_export", null)//
+                .runTest();
     }
 
     @Test
-    public void testFloodDuration() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper
-                .createSinfoFloodDurationTest(SinfoFilenameMapper.FLOOD_DURATION_HELLO_WORLD_FILE, 0, 182.4, River.Beispielfluss, new double[] { 2091.011 },
-                        true, RiversideChoiceKey.BOTH)
-
-                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
+    public void testFloodDurationDurCurves() throws ConnectionException, ServerException, IOException {
+        SinfoRunnerCreatorHelper.createSinfoFloodDurationTest(336.2, 865.5, River.Rhein, null, false, RiversideChoiceKey.BOTH)//
+                .addOutputTest(this.FLOOD_DURATION_CS_384_6, "sinfo_floodduration_curve", "384.6")//
+                .addOutputTest(this.FLOOD_DURATION_CS_384_7, "sinfo_floodduration_curve", "384.7")//
+                .addOutputTest(this.FLOOD_DURATION_CS_384_9, "sinfo_floodduration_curve", "384.9")//
+                // .addOutputTest(this.FLOOD_DURATION_HELLO_WORLD_FILE, "sinfo_floodduration_export", null)//
+                .runTest();
     }
 
+    // // @Test
+    // public void testFloodDuration_HELLO_WORLD() throws ConnectionException, ServerException, IOException {
+    // SinfoRunnerCreatorHelper.createSinfoFloodDurationTest(336.2, 865.5, River.Rhein, new double[] { 2091.011 }, true,
+    // RiversideChoiceKey.BOTH)//
+    //
+    // .addOutputTest(this.FLOOD_DURATION_HELLO_WORLD_FILE, "sinfo_floodduration_export", null)//
+    // .runTest();
+    // }
+
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org