comparison 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
comparison
equal deleted inserted replaced
9566:9826b465b751 9567:86e522bc7f36
2 2
3 import java.io.IOException; 3 import java.io.IOException;
4 4
5 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; 5 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
6 import org.dive4elements.river.client.shared.exceptions.ServerException; 6 import org.dive4elements.river.client.shared.exceptions.ServerException;
7
8 /**
9 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
10 */
11
12 // REMARK: ignored, because maven will auto-test all tests, but this one needs a running river-artifacts
13 // For running the JUunit test, the annotation @Ignore has to be disabled
14 import org.junit.Ignore; 7 import org.junit.Ignore;
15 import org.junit.Test; 8 import org.junit.Test;
16 9
17 import test.AbstractBerechnungsartenTester; 10 import test.AbstractBerechnungsartenTester;
11 import test.FilenameSupplier;
18 import test.ICalcMode; 12 import test.ICalcMode;
19 import test.IFilenameMapper;
20 import test.SimpleRecommendation; 13 import test.SimpleRecommendation;
21 import test.sinfo.SinfoFloodDurationRiversideChoice.RiversideChoiceKey; 14 import test.sinfo.SinfoFloodDurationRiversideChoice.RiversideChoiceKey;
22 15
23 @Ignore 16 @Ignore // ein- oder auskommentieren, je nach Bedarf!
24 public final class SinfoBerechnungsartenTester extends AbstractBerechnungsartenTester { 17 public final class SinfoBerechnungsartenTester extends AbstractBerechnungsartenTester {
25 // has to be public for jUnit-Test 18 // has to be public for jUnit-Test
26 public static enum CalcMode implements ICalcMode { 19 public static enum CalcMode implements ICalcMode {
27 sinfo_calc_flow_depth, sinfo_calc_flow_depth_development, sinfo_calc_flow_depth_minmax, sinfo_calc_collision, sinfo_calc_transport_bodies_heights, sinfo_calc_flood_duration; 20 sinfo_calc_flow_depth, sinfo_calc_flow_depth_development, sinfo_calc_flow_depth_minmax, sinfo_calc_collision, sinfo_calc_transport_bodies_heights, sinfo_calc_flood_duration;
28 21
29 }; 22 };
30 23
31 public static enum SinfoFilenameMapper implements IFilenameMapper { 24 FilenameSupplier FT_MINMAX_RHEIN_1_FILE = new FilenameSupplier("/sinfo/flowdepthminmax/sinfo_minmaxft_01.csv");
32 25 FilenameSupplier FT_MINMAX_ELBE_2_FILE = new FilenameSupplier("/sinfo/flowdepthminmax/sinfo_minmaxft_02.csv");
33 FT_MINMAX_RHEIN_1_FILE("/sinfo/flowdepthminmax/sinfo_minmaxft_01.csv"), // 26
34 FT_MINMAX_ELBE_2_FILE("/sinfo/flowdepthminmax/sinfo_minmaxft_02.csv"), // 27 FilenameSupplier FT_RHEIN_1_FILE = new FilenameSupplier("/sinfo/flowdepth/sinfo_ft_01.csv");
35 28 FilenameSupplier FT_RHEIN_2_FILE = new FilenameSupplier("/sinfo/flowdepth/sinfo_ft_02.csv");
36 FT_RHEIN_1_FILE("/sinfo/flowdepth/sinfo_ft_01.csv"), // 29
37 FT_RHEIN_2_FILE("/sinfo/flowdepth/sinfo_ft_02.csv"), // 30 FilenameSupplier FTE_ELBE_FILE = new FilenameSupplier("/sinfo/flowdepthdevelopment/sinfo_fte_01.csv");
38 31 FilenameSupplier FTE_RHEIN_FILE = new FilenameSupplier("/sinfo/flowdepthdevelopment/sinfo_fte_02.csv");
39 FTE_ELBE_FILE("/sinfo/flowdepthdevelopment/sinfo_fte_01.csv"), // 32
40 FTE_RHEIN_FILE("/sinfo/flowdepthdevelopment/sinfo_fte_02.csv"), 33 FilenameSupplier TKH_1_ELBE_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_01.csv");
41 34 FilenameSupplier TKH_2_RHEIN_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_02.csv");
42 TKH_1_ELBE_FILE("/sinfo/flowdepthtkh/sinfo_tkh_01.csv"), // 35 FilenameSupplier TKH_1_ELBE_CHART_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_chart_01.csv");
43 TKH_2_RHEIN_FILE("/sinfo/flowdepthtkh/sinfo_tkh_02.csv"), 36
44 37 // FilenameSupplier TKH_TKH_RHEIN_FILE = new FilenameSupplier("/sinfo/tkh/sinfo_tkh_export.csv");
45 TKH_TKH_RHEIN_FILE("/sinfo/tkh/sinfo_tkh_export.csv"), // 38
46 39 // FilenameSupplier COLLISION_RHEIN_HELLO_WORLD_FILE = new
47 COLLISION_RHEIN_HELLO_WORLD_FILE("/sinfo/collision/sinfo_collision_export.csv"), // 40 // FilenameSupplier("/sinfo/collision/sinfo_collision_export.csv");
48 COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE("/sinfo/collision/sinfo_collision_epoch_export.csv"), // 41 // FilenameSupplier COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE = new
49 42 // FilenameSupplier("/sinfo/collision/sinfo_collision_epoch_export.csv");
50 FLOOD_DURATION_HELLO_WORLD_FILE("/sinfo/floodduration/sinfo_floodduration_export.csv"); 43
51 private final String filename; 44 FilenameSupplier COLLISION_RHEIN_01 = new FilenameSupplier("/sinfo/collision/sinfo_grund_01.csv");
52 45 FilenameSupplier COLLISION_RHEIN_02 = new FilenameSupplier("/sinfo/collision/sinfo_grund_02.csv");
53 SinfoFilenameMapper(final String filename) { 46
54 this.filename = filename; 47 FilenameSupplier FLOOD_DURATION_CS_384_6 = new FilenameSupplier("/sinfo/floodduration/sinfo_uedi_01_chart_dauer_384km6.csv");
55 } 48 FilenameSupplier FLOOD_DURATION_CS_384_7 = new FilenameSupplier("/sinfo/floodduration/sinfo_uedi_01_chart_dauer_384km7.csv");
56 49 FilenameSupplier FLOOD_DURATION_CS_384_9 = new FilenameSupplier("/sinfo/floodduration/sinfo_uedi_01_chart_dauer_384km9.csv");
57 @Override 50
58 public String getFilename() { 51 // FilenameSupplier FLOOD_DURATION_HELLO_WORLD_FILE = new
59 return this.filename; 52 // FilenameSupplier("/sinfo/floodduration/sinfo_floodduration_export.csv");
60 }
61 }
62 53
63 /* FLOWDEPTH MIN MAX */ 54 /* FLOWDEPTH MIN MAX */
64 @Test 55 @Test
65 public void testFTMINMAX1() throws ServerException, IOException { 56 public void testFTMINMAX1() throws ServerException, IOException {
66 57
67 SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(SinfoFilenameMapper.FT_MINMAX_RHEIN_1_FILE, 430, 450, River.Rhein, 58 SinfoRunnerCreatorHelper
68 new SimpleRecommendation("bedheight", "bedheight-single-79-2004-MW-DGM-2004_Epoche_NHN", "longitudinal_section"), 59 .createSinfoFlowdepthMinMaxTest(430, 450, River.Rhein,
69 new SimpleRecommendation("staticwqkms", "additionals-wstv-0-269", "longitudinal_section", "Amtl.Festlegung_GlQ(2002)") 60 new SimpleRecommendation("bedheight", "bedheight-single-103-2004-DGM-2004_Epoche_NHN", "longitudinal_section"),
70 61 new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section", "Amtl.Festlegung_GlQ(2002)"))//
71 ).runTest(overrideFileExport() != null ? overrideFileExport() : true); 62 .addOutputTest(this.FT_MINMAX_RHEIN_1_FILE, "sinfo_flowdepthminmax_export", null)//
63 .runTest();
72 } 64 }
73 65
74 @Test 66 @Test
75 public void testFTMINMAX2() throws ConnectionException, ServerException, IOException { 67 public void testFTMINMAX2() throws ConnectionException, ServerException, IOException {
76 SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(SinfoFilenameMapper.FT_MINMAX_ELBE_2_FILE, 0, 90, River.Elbe, 68 SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(0, 90, River.Elbe,
77 // first 69 // first
70 // bedheight-single-58-2015-FP-2015_0-502
71
78 new SimpleRecommendation("bedheight", "bedheight-single-58-2015-MW-FP-2015_0-502", "longitudinal_section", "FP-2015_0-502"), 72 new SimpleRecommendation("bedheight", "bedheight-single-58-2015-MW-FP-2015_0-502", "longitudinal_section", "FP-2015_0-502"),
73 // fixations-wstv-0-156
79 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-156", "longitudinal_section", "02.09.2004"), 74 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-156", "longitudinal_section", "02.09.2004"),
80 75
81 // second 76 // second
82 new SimpleRecommendation("bedheight", "bedheight-single-58-2015-MW-FP-2015_0-502", "longitudinal_section", "FP-2015_0-502"), 77 new SimpleRecommendation("bedheight", "bedheight-single-58-2015-MW-FP-2015_0-502", "longitudinal_section", "FP-2015_0-502"),
83 new SimpleRecommendation("staticwqkms", "fixations-wstv-1-156", "longitudinal_section", "03.09.2004")) 78 new SimpleRecommendation("staticwqkms", "fixations-wstv-1-156", "longitudinal_section", "03.09.2004"))//
84 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 79 .addOutputTest(this.FT_MINMAX_ELBE_2_FILE, "sinfo_flowdepthminmax_export", null)//
80 .runTest();
85 } 81 }
86 82
87 /* FLOWDEPTH */ 83 /* FLOWDEPTH */
88 @Test 84 @Test
89 public void testRhein1FT() throws ConnectionException, ServerException, IOException { 85 public void testRhein1FT() throws ConnectionException, ServerException, IOException {
90 86
91 SinfoRunnerCreatorHelper.createSinfoFlowdepthTest(SinfoFilenameMapper.FT_RHEIN_1_FILE, 350, 380, River.Rhein, false, 87 SinfoRunnerCreatorHelper.createSinfoFlowdepthTest(350, 380, River.Rhein, false,
92 88 // [b34f91bd-17b3-435e-b609-8026980ed301;bedheight;0;DGM-2004_Epoche_NHN]#[e1bedb5e-edee-427d-b74e-7566652ebfda;staticwqkms;0;Amtl.Festlegung_GlQ(2002)]]]
93 new SimpleRecommendation("bedheight", "bedheight-soundings-79-2004-DGM-2004_Epoche_NHN", "longitudinal_section"), 89 // debug at org.dive4elements.river.client.shared.model.DefaultData.Recommendation line 142
94 new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section")) 90 new SimpleRecommendation("bedheight", " bedheight-single-103-2004-DGM-2004_Epoche_NHN", "longitudinal_section"),
95 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 91 new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section"))//
96 92
93 .addOutputTest(this.FT_RHEIN_1_FILE, "sinfo_flowdepth_export", null)//
94 .runTest();
97 } 95 }
98 96
99 @Test 97 @Test
100 public void testRhein2FT() throws ConnectionException, ServerException, IOException { 98 public void testRhein2FT() throws ConnectionException, ServerException, IOException {
101 SinfoRunnerCreatorHelper 99 SinfoRunnerCreatorHelper
102 .createSinfoFlowdepthTest(SinfoFilenameMapper.FT_RHEIN_2_FILE, 655, 675, River.Rhein, true, 100 .createSinfoFlowdepthTest(655, 675, River.Rhein, true,
103 new SimpleRecommendation("bedheight", "bedheight-soundings-92-2004-NIEDERRHEIN_QP-2004_Epoche_NHN", "longitudinal_section"), 101 new SimpleRecommendation("bedheight", "bedheight-soundings-92-2004-NIEDERRHEIN_QP-2004_Epoche_NHN", "longitudinal_section"),
104 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-323", "longitudinal_section")) 102 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-323", "longitudinal_section"))//
105 103
106 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 104 .addOutputTest(this.FT_RHEIN_2_FILE, "sinfo_flowdepth_export", null)//
105 .runTest();
107 } 106 }
108 107
109 /* FLOWDEPTH DEVELOPMENT */ 108 /* FLOWDEPTH DEVELOPMENT */
110 109
111 @Test 110 @Test
112 public void testElbeFTE() throws ConnectionException, ServerException, IOException { 111 public void testElbeFTE() throws ConnectionException, ServerException, IOException {
113 SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(SinfoFilenameMapper.FTE_ELBE_FILE, 210, 230, River.Elbe, 112 SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(210, 230, River.Elbe,
114 // current 113 // current
115 new SimpleRecommendation("bedheight", "bedheight-soundings-66-2008-FP-QP-2008", 114 new SimpleRecommendation("bedheight", "bedheight-soundings-66-2008-FP-QP-2008",
116 // "bedheight-single-66-2008-MW-FP-QP-2008", 115 // "bedheight-single-66-2008-MW-FP-QP-2008",
117 "longitudinal_section"), 116 "longitudinal_section"),
118 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-196", "longitudinal_section", "05.05.2008"), // sicher 117 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-196", "longitudinal_section", "05.05.2008"), // sicher
120 // historical 119 // historical
121 new SimpleRecommendation("bedheight", "bedheight-soundings-70-1995-QP-1995", 120 new SimpleRecommendation("bedheight", "bedheight-soundings-70-1995-QP-1995",
122 // "bedheight-single-70-1995-MW-QP-1995", 121 // "bedheight-single-70-1995-MW-QP-1995",
123 "longitudinal_section"), 122 "longitudinal_section"),
124 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-186", "longitudinal_section", "18.03.1997")// sicher 123 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-186", "longitudinal_section", "18.03.1997")// sicher
125 ).runTest(overrideFileExport() != null ? overrideFileExport() : true); 124 )//
125
126 .addOutputTest(this.FTE_ELBE_FILE, "sinfo_flowdepthdevelopment_export", null)//
127 .runTest();
126 } 128 }
127 129
128 @Test 130 @Test
129 public void testRheinFTE() throws ConnectionException, ServerException, IOException { 131 public void testRheinFTE() throws ConnectionException, ServerException, IOException {
130 SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(SinfoFilenameMapper.FTE_RHEIN_FILE, 655, 665, River.Rhein, 132 SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(655, 665, River.Rhein,
131 // current 133 // current
132 new SimpleRecommendation("bedheight", "bedheight-single-94-2008-MW-NIEDERRHEIN_QP-2008_Epoche_NHN", 134 new SimpleRecommendation("bedheight", "bedheight-single-94-2008-MW-NIEDERRHEIN_QP-2008_Epoche_NHN",
133 // "bedheight-single....", 135 // "bedheight-single....",
134 "longitudinal_section"), 136 "longitudinal_section"),
135 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-372", "longitudinal_section", "23.09.2009-1"), // sicher 137 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-372", "longitudinal_section", "23.09.2009-1"), // sicher
137 // historical 139 // historical
138 new SimpleRecommendation("bedheight", "bedheight-single-89-1991-MW-NIEDERRHEIN_QP-1991_Epoche_NHN", 140 new SimpleRecommendation("bedheight", "bedheight-single-89-1991-MW-NIEDERRHEIN_QP-1991_Epoche_NHN",
139 // "bedheight-soundings-89-1991-NIEDERRHEIN_QP-1991_Epoche_NHN", 141 // "bedheight-soundings-89-1991-NIEDERRHEIN_QP-1991_Epoche_NHN",
140 "longitudinal_section"), 142 "longitudinal_section"),
141 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-374", "longitudinal_section", "23.09.1991") // sicher 143 new SimpleRecommendation("staticwqkms", "fixations-wstv-0-374", "longitudinal_section", "23.09.1991") // sicher
142 ).runTest(overrideFileExport() != null ? overrideFileExport() : true); 144 )//
145
146 .addOutputTest(this.FTE_RHEIN_FILE, "sinfo_flowdepthdevelopment_export", null)//
147 .runTest();
143 } 148 }
144 149
145 /* TKH */ 150 /* TKH */
146 151
147 @Test 152 @Test
148 public void testElbeTKH_1() throws ConnectionException, ServerException, IOException { 153 public void testElbeTKH_1() throws ConnectionException, ServerException, IOException {
149 SinfoRunnerCreatorHelper.createSinfoTkhTest(SinfoFilenameMapper.TKH_1_ELBE_FILE, 150, 160, River.Elbe, new double[] { 1520.0 }) 154 SinfoRunnerCreatorHelper.createSinfoTkhTest(150, 160, River.Elbe, new double[] { 1520.0 })//
150 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 155 .addOutputTest(this.TKH_1_ELBE_FILE, "sinfo_tkh_export", null)//
156 .addOutputTest(this.TKH_1_ELBE_CHART_FILE, "sinfo_tkk", null)//
157
158 .runTest();
151 } 159 }
152 160
153 @Test 161 @Test
154 public void testRheinTKH_2() throws ConnectionException, ServerException, IOException { 162 public void testRheinTKH_2() throws ConnectionException, ServerException, IOException {
155 SinfoRunnerCreatorHelper.createSinfoTkhTest(SinfoFilenameMapper.TKH_2_RHEIN_FILE, 600, 610, River.Rhein, new double[] { 6125, 6526 }) 163 SinfoRunnerCreatorHelper.createSinfoTkhTest(600, 610, River.Rhein, new double[] { 6125, 6526 })//
156 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 164 .addOutputTest(this.TKH_2_RHEIN_FILE, "sinfo_tkh_export", null)//
157 } 165 .runTest();
158 166 }
159 @Test 167
160 public void testTKhTkh() throws ConnectionException, ServerException, IOException { 168 @Test
161 SinfoRunnerCreatorHelper.createSinfoTkhTest(SinfoFilenameMapper.TKH_TKH_RHEIN_FILE, 0, 182.4, River.Beispielfluss, new double[] { 1059.446 }) 169 public void testCollision_01() throws ConnectionException, ServerException, IOException {
162 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 170 SinfoRunnerCreatorHelper.createSinfoCollisionYearsTest(336.2, 866.3, River.Rhein, new int[] { 2003, 2006, 2007 })//
163 } 171
164 172 .addOutputTest(this.COLLISION_RHEIN_01, "sinfo_collision_export", null)//
165 @Test 173 .runTest();
166 public void testCollision() throws ConnectionException, ServerException, IOException { 174 }
167 SinfoRunnerCreatorHelper 175
168 .createSinfoCollisionYearsTest(SinfoFilenameMapper.COLLISION_RHEIN_HELLO_WORLD_FILE, 336.2, 866.3, River.Rhein, new int[] { 2006, 2008 }) 176 @Test
169 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 177 public void testCollision_02() throws ConnectionException, ServerException, IOException {
170 } 178 SinfoRunnerCreatorHelper.createSinfoCollisionEpochsTest(336.2, 866.3, River.Rhein, "2002,2007;2005,2009;")//
171 179
172 @Test 180 .addOutputTest(this.COLLISION_RHEIN_02, "sinfo_collision_export", null)//
173 public void testCollisionEpochs() throws ConnectionException, ServerException, IOException { 181 .runTest();
174 SinfoRunnerCreatorHelper 182 }
175 .createSinfoCollisionEpochsTest(SinfoFilenameMapper.COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE, 336.2, 866.3, River.Rhein, "2006,2008;") 183
176 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 184 @Test
177 } 185 public void testFloodDurationDurCurves() throws ConnectionException, ServerException, IOException {
178 186 SinfoRunnerCreatorHelper.createSinfoFloodDurationTest(336.2, 865.5, River.Rhein, null, false, RiversideChoiceKey.BOTH)//
179 @Test 187 .addOutputTest(this.FLOOD_DURATION_CS_384_6, "sinfo_floodduration_curve", "384.6")//
180 public void testFloodDuration() throws ConnectionException, ServerException, IOException { 188 .addOutputTest(this.FLOOD_DURATION_CS_384_7, "sinfo_floodduration_curve", "384.7")//
181 SinfoRunnerCreatorHelper 189 .addOutputTest(this.FLOOD_DURATION_CS_384_9, "sinfo_floodduration_curve", "384.9")//
182 .createSinfoFloodDurationTest(SinfoFilenameMapper.FLOOD_DURATION_HELLO_WORLD_FILE, 0, 182.4, River.Beispielfluss, new double[] { 2091.011 }, 190 // .addOutputTest(this.FLOOD_DURATION_HELLO_WORLD_FILE, "sinfo_floodduration_export", null)//
183 true, RiversideChoiceKey.BOTH) 191 .runTest();
184 192 }
185 .runTest(overrideFileExport() != null ? overrideFileExport() : true); 193
186 } 194 // // @Test
195 // public void testFloodDuration_HELLO_WORLD() throws ConnectionException, ServerException, IOException {
196 // SinfoRunnerCreatorHelper.createSinfoFloodDurationTest(336.2, 865.5, River.Rhein, new double[] { 2091.011 }, true,
197 // RiversideChoiceKey.BOTH)//
198 //
199 // .addOutputTest(this.FLOOD_DURATION_HELLO_WORLD_FILE, "sinfo_floodduration_export", null)//
200 // .runTest();
201 // }
187 202
188 } 203 }

http://dive4elements.wald.intevation.org