Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 109:678aad19a08d
Some Coderedundances refactored.
gnv-artifacts/trunk@158 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 14:59:43 +0000 |
parents | 4ebf9ad2e7eb |
children | 065ec0a29394 |
comparison
equal
deleted
inserted
replaced
108:2aae4a78e555 | 109:678aad19a08d |
---|---|
81 | 81 |
82 | 82 |
83 CallContext cc = new TestCallContext(bootstrap.getContext()); | 83 CallContext cc = new TestCallContext(bootstrap.getContext()); |
84 | 84 |
85 // Erster Schritt | 85 // Erster Schritt |
86 Document outputData = artifact.describe(null); | 86 |
87 this.writeDocument2Log(outputData); | 87 this.doNextStep(artifact, cc, |
88 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc); | 88 "src/test/ressources/timeseries/timeseries_step_01_feed.xml", |
89 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc); | 89 "src/test/ressources/timeseries/timeseries_step_01_advance.xml"); |
90 this.writeDocument2Log(outputData); | |
91 this.check4ExceptionReport(outputData); | |
92 | 90 |
93 // Zweiter Schritt | 91 // Zweiter Schritt |
94 outputData = artifact.describe(null); | 92 this.doNextStep(artifact, cc, |
95 this.writeDocument2Log(outputData); | 93 "src/test/ressources/timeseries/timeseries_step_02_feed.xml", |
96 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc); | 94 "src/test/ressources/timeseries/timeseries_step_02_advance.xml"); |
97 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc); | |
98 this.writeDocument2Log(outputData); | |
99 | 95 |
100 // Dritter Schritt | 96 // Dritter Schritt |
101 outputData = artifact.describe(null); | 97 this.doNextStep(artifact, cc, |
102 this.writeDocument2Log(outputData); | 98 "src/test/ressources/timeseries/timeseries_step_03_feed.xml", |
103 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc); | 99 "src/test/ressources/timeseries/timeseries_step_03_advance.xml"); |
104 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc); | |
105 this.writeDocument2Log(outputData); | |
106 this.check4ExceptionReport(outputData); | |
107 | |
108 | 100 |
109 // Vierter Schritt | 101 // Vierter Schritt |
110 outputData = artifact.describe(null); | 102 this.doNextStep(artifact, cc, |
111 this.writeDocument2Log(outputData); | 103 "src/test/ressources/timeseries/timeseries_step_04_feed.xml", |
112 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), cc); | 104 "src/test/ressources/timeseries/timeseries_step_04_advance.xml"); |
113 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc); | 105 |
114 this.writeDocument2Log(outputData); | 106 Document outputData; |
115 this.check4ExceptionReport(outputData); | |
116 | |
117 // Fünfter Schritt | 107 // Fünfter Schritt |
118 outputData = artifact.describe(null); | 108 outputData = artifact.describe(null); |
119 FileOutputStream fos = null; | 109 FileOutputStream fos = null; |
120 try{ | 110 try{ |
121 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); | 111 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); |
135 } catch (Exception e) { | 125 } catch (Exception e) { |
136 log.error(e,e); | 126 log.error(e,e); |
137 fail(); | 127 fail(); |
138 } | 128 } |
139 } | 129 } |
130 | |
131 /** | |
132 * @param artifact | |
133 * @param cc | |
134 * @throws Exception | |
135 */ | |
136 private void doNextStep(Artifact artifact, CallContext cc, String feedDocument, String advanceDocument) throws Exception { | |
137 Document outputData = artifact.describe(null); | |
138 this.writeDocument2Log(outputData); | |
139 artifact.feed(this.readDocument(feedDocument), cc); | |
140 outputData = artifact.advance(this.readDocument(advanceDocument), cc); | |
141 this.writeDocument2Log(outputData); | |
142 this.check4ExceptionReport(outputData); | |
143 } | |
140 | 144 |
141 public void testTimeSeriesMeshArtifact(){ | 145 public void testTimeSeriesMeshArtifact(){ |
142 try { | 146 try { |
143 log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact"); | 147 log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact"); |
144 String artefactName = "fis_modeldata"; | 148 String artefactName = "fis_modeldata"; |
151 | 155 |
152 | 156 |
153 CallContext cc = new TestCallContext(bootstrap.getContext()); | 157 CallContext cc = new TestCallContext(bootstrap.getContext()); |
154 | 158 |
155 // Erster Schritt | 159 // Erster Schritt |
160 this.doNextStep(artifact, cc, | |
161 "src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml", | |
162 "src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml"); | |
163 | |
164 // Zweiter Schritt | |
165 this.doNextStep(artifact, cc, | |
166 "src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml", | |
167 "src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml"); | |
168 | |
169 // Dritter Schritt | |
170 this.doNextStep(artifact, cc, | |
171 "src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml", | |
172 "src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml"); | |
173 | |
174 | |
175 // Vierter Schritt | |
176 this.doNextStep(artifact, cc, | |
177 "src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml", | |
178 "src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml"); | |
179 | |
180 // Fünfter Schritt | |
181 this.doNextStep(artifact, cc, | |
182 "src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml", | |
183 "src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml"); | |
184 | |
185 // Sechster Schritt | |
186 this.doNextStep(artifact, cc, | |
187 "src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml", | |
188 "src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml"); | |
189 | |
190 // Siebter Schritt | |
156 Document outputData = artifact.describe(null); | 191 Document outputData = artifact.describe(null); |
157 this.writeDocument2Log(outputData); | |
158 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml"), cc); | |
159 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml"), cc); | |
160 this.writeDocument2Log(outputData); | |
161 this.check4ExceptionReport(outputData); | |
162 | |
163 // Zweiter Schritt | |
164 outputData = artifact.describe(null); | |
165 this.writeDocument2Log(outputData); | |
166 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml"), cc); | |
167 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml"), cc); | |
168 this.writeDocument2Log(outputData); | |
169 | |
170 // Dritter Schritt | |
171 outputData = artifact.describe(null); | |
172 this.writeDocument2Log(outputData); | |
173 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml"), cc); | |
174 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml"), cc); | |
175 this.writeDocument2Log(outputData); | |
176 this.check4ExceptionReport(outputData); | |
177 | |
178 | |
179 // Vierter Schritt | |
180 outputData = artifact.describe(null); | |
181 this.writeDocument2Log(outputData); | |
182 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml"), cc); | |
183 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml"),cc); | |
184 this.writeDocument2Log(outputData); | |
185 this.check4ExceptionReport(outputData); | |
186 | |
187 // Fünfter Schritt | |
188 outputData = artifact.describe(null); | |
189 this.writeDocument2Log(outputData); | |
190 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml"), cc); | |
191 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml"),cc); | |
192 this.writeDocument2Log(outputData); | |
193 this.check4ExceptionReport(outputData); | |
194 | |
195 // Sechster Schritt | |
196 outputData = artifact.describe(null); | |
197 this.writeDocument2Log(outputData); | |
198 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml"), cc); | |
199 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml"),cc); | |
200 this.writeDocument2Log(outputData); | |
201 this.check4ExceptionReport(outputData); | |
202 | |
203 // Siebter Schritt | |
204 outputData = artifact.describe(null); | |
205 FileOutputStream fos = null; | 192 FileOutputStream fos = null; |
206 FileOutputStream fos2 = null; | 193 FileOutputStream fos2 = null; |
207 FileOutputStream fos3 = null; | 194 FileOutputStream fos3 = null; |
208 try{ | 195 try{ |
209 fos = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".png"); | 196 fos = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".png"); |
247 | 234 |
248 | 235 |
249 CallContext cc = new TestCallContext(bootstrap.getContext()); | 236 CallContext cc = new TestCallContext(bootstrap.getContext()); |
250 | 237 |
251 // Erster Schritt | 238 // Erster Schritt |
239 this.doNextStep(artifact, cc, | |
240 "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml", | |
241 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); | |
242 | |
243 | |
244 // Zweiter Schritt | |
245 this.doNextStep(artifact, cc, | |
246 "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml", | |
247 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); | |
248 | |
249 | |
250 // Dritter Schritt | |
251 this.doNextStep(artifact, cc, | |
252 "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml", | |
253 "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"); | |
254 | |
255 | |
256 // Vierter Schritt | |
252 Document outputData = artifact.describe(null); | 257 Document outputData = artifact.describe(null); |
253 this.writeDocument2Log(outputData); | |
254 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml"), cc); | |
255 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_advance.xml"), cc); | |
256 this.writeDocument2Log(outputData); | |
257 this.check4ExceptionReport(outputData); | |
258 | |
259 // Zweiter Schritt | |
260 outputData = artifact.describe(null); | |
261 this.writeDocument2Log(outputData); | |
262 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml"), cc); | |
263 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"), cc); | |
264 this.writeDocument2Log(outputData); | |
265 this.check4ExceptionReport(outputData); | |
266 | |
267 // Dritter Schritt | |
268 outputData = artifact.describe(null); | |
269 this.writeDocument2Log(outputData); | |
270 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml"), cc); | |
271 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"), cc); | |
272 this.writeDocument2Log(outputData); | |
273 this.check4ExceptionReport(outputData); | |
274 | |
275 // Vierter Schritt | |
276 outputData = artifact.describe(null); | |
277 FileOutputStream fos = null; | 258 FileOutputStream fos = null; |
278 FileOutputStream fos2 = null; | 259 FileOutputStream fos2 = null; |
279 FileOutputStream fos3 = null; | 260 FileOutputStream fos3 = null; |
280 try{ | 261 try{ |
281 fos = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".png"); | 262 fos = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".png"); |
319 | 300 |
320 | 301 |
321 CallContext cc = new TestCallContext(bootstrap.getContext()); | 302 CallContext cc = new TestCallContext(bootstrap.getContext()); |
322 | 303 |
323 // Erster Schritt | 304 // Erster Schritt |
305 this.doNextStep(artifact, cc, | |
306 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml", | |
307 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"); | |
308 | |
309 // Zweiter Schritt | |
310 this.doNextStep(artifact, cc, | |
311 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml", | |
312 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"); | |
313 | |
314 // Dritter Schritt | |
315 this.doNextStep(artifact, cc, | |
316 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml", | |
317 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"); | |
318 | |
319 // Vierter Schritt | |
320 this.doNextStep(artifact, cc, | |
321 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml", | |
322 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"); | |
323 | |
324 // Fünfter Schritt | |
325 this.doNextStep(artifact, cc, | |
326 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml", | |
327 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"); | |
328 | |
329 // Sechster Schritt | |
324 Document outputData = artifact.describe(null); | 330 Document outputData = artifact.describe(null); |
325 this.writeDocument2Log(outputData); | |
326 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml"), cc); | |
327 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"), cc); | |
328 this.writeDocument2Log(outputData); | |
329 this.check4ExceptionReport(outputData); | |
330 | |
331 // Zweiter Schritt | |
332 outputData = artifact.describe(null); | |
333 this.writeDocument2Log(outputData); | |
334 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml"), cc); | |
335 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"), cc); | |
336 this.writeDocument2Log(outputData); | |
337 this.check4ExceptionReport(outputData); | |
338 | |
339 // Dritter Schritt | |
340 outputData = artifact.describe(null); | |
341 this.writeDocument2Log(outputData); | |
342 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml"), cc); | |
343 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"), cc); | |
344 this.writeDocument2Log(outputData); | |
345 this.check4ExceptionReport(outputData); | |
346 | |
347 // Vierter Schritt | |
348 outputData = artifact.describe(null); | |
349 this.writeDocument2Log(outputData); | |
350 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml"), cc); | |
351 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"), cc); | |
352 this.writeDocument2Log(outputData); | |
353 this.check4ExceptionReport(outputData); | |
354 | |
355 // Fünfter Schritt | |
356 outputData = artifact.describe(null); | |
357 this.writeDocument2Log(outputData); | |
358 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml"), cc); | |
359 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"), cc); | |
360 this.writeDocument2Log(outputData); | |
361 this.check4ExceptionReport(outputData); | |
362 | |
363 // Sechster Schritt | |
364 outputData = artifact.describe(null); | |
365 FileOutputStream fos = null; | 331 FileOutputStream fos = null; |
366 FileOutputStream fos2 = null; | 332 FileOutputStream fos2 = null; |
367 FileOutputStream fos3 = null; | 333 FileOutputStream fos3 = null; |
368 try{ | 334 try{ |
369 fos = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".png"); | 335 fos = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".png"); |
409 | 375 |
410 | 376 |
411 CallContext cc = new TestCallContext(bootstrap.getContext()); | 377 CallContext cc = new TestCallContext(bootstrap.getContext()); |
412 | 378 |
413 // Erster Schritt | 379 // Erster Schritt |
380 this.doNextStep(artifact, cc, | |
381 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml", | |
382 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"); | |
383 | |
384 // Zweiter Schritt | |
385 this.doNextStep(artifact, cc, | |
386 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml", | |
387 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"); | |
388 | |
389 // Dritter Schritt | |
390 this.doNextStep(artifact, cc, | |
391 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml", | |
392 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"); | |
393 | |
394 // Vierter Schritt | |
414 Document outputData = artifact.describe(null); | 395 Document outputData = artifact.describe(null); |
415 this.writeDocument2Log(outputData); | |
416 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml"), cc); | |
417 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"), cc); | |
418 this.writeDocument2Log(outputData); | |
419 this.check4ExceptionReport(outputData); | |
420 | |
421 // Zweiter Schritt | |
422 outputData = artifact.describe(null); | |
423 this.writeDocument2Log(outputData); | |
424 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml"), cc); | |
425 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"), cc); | |
426 this.writeDocument2Log(outputData); | |
427 this.check4ExceptionReport(outputData); | |
428 | |
429 // Dritter Schritt | |
430 outputData = artifact.describe(null); | |
431 this.writeDocument2Log(outputData); | |
432 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml"), cc); | |
433 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"), cc); | |
434 this.writeDocument2Log(outputData); | |
435 this.check4ExceptionReport(outputData); | |
436 | |
437 // Vierter Schritt | |
438 outputData = artifact.describe(null); | |
439 FileOutputStream fos = null; | 396 FileOutputStream fos = null; |
440 FileOutputStream fos2 = null; | 397 FileOutputStream fos2 = null; |
441 FileOutputStream fos3 = null; | 398 FileOutputStream fos3 = null; |
442 try{ | 399 try{ |
443 fos = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".png"); | 400 fos = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".png"); |