comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 171:7fb9441dd8af

Format Code to max 80 Chars per Row and Cleanup gnv-artifacts/trunk@208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 09 Oct 2009 07:54:48 +0000
parents 4841808819d9
children 08b8b79b30ff
comparison
equal deleted inserted replaced
170:7be22e76c270 171:7fb9441dd8af
32 import de.intevation.gnv.artifacts.context.GNVArtifactContext; 32 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
33 import de.intevation.gnv.utils.ArtifactXMLUtilities; 33 import de.intevation.gnv.utils.ArtifactXMLUtilities;
34 34
35 /** 35 /**
36 * @author Tim Englich <tim.englich@intevation.de> 36 * @author Tim Englich <tim.englich@intevation.de>
37 * 37 *
38 */ 38 */
39 public class GNVArtifactsTestCase extends TestCase { 39 public class GNVArtifactsTestCase extends TestCase {
40 40
41 /** 41 /**
42 * the logger, used to log exceptions and additonaly information 42 * the logger, used to log exceptions and additonaly information
43 */ 43 */
44 private static Logger log = null; 44 private static Logger log = null;
45 45
46 static { 46 static {
47 BasicConfigurator.configure(); 47 BasicConfigurator.configure();
48 log = Logger.getLogger(GNVArtifactContext.class); 48 log = Logger.getLogger(GNVArtifactContext.class);
49 } 49 }
50 50
51 private String configurationDir = "src/test/ressources/"; 51 private String configurationDir = "src/test/ressources/";
52 52
53 private FactoryBootstrap bootstrap = null; 53 private FactoryBootstrap bootstrap = null;
54
54 /** 55 /**
55 * Constructor 56 * Constructor
57 *
56 * @param name 58 * @param name
57 */ 59 */
58 public GNVArtifactsTestCase(String name) { 60 public GNVArtifactsTestCase(String name) {
59 super(name); 61 super(name);
60 } 62 }
63 * @see junit.framework.TestCase#setUp() 65 * @see junit.framework.TestCase#setUp()
64 */ 66 */
65 protected void setUp() throws Exception { 67 protected void setUp() throws Exception {
66 log.debug("GNVArtifactsTestCase.setUp"); 68 log.debug("GNVArtifactsTestCase.setUp");
67 super.setUp(); 69 super.setUp();
68 log.info(Config.CONFIG_DIR + " ==> "+configurationDir); 70 log.info(Config.CONFIG_DIR + " ==> " + configurationDir);
69 System.setProperty(Config.CONFIG_DIR, configurationDir); 71 System.setProperty(Config.CONFIG_DIR, configurationDir);
70 log.info("Bootstrap wird initialisiert."); 72 log.info("Bootstrap wird initialisiert.");
71 bootstrap = new FactoryBootstrap(); 73 bootstrap = new FactoryBootstrap();
72 bootstrap.boot(); 74 bootstrap.boot();
73 } 75 }
74 76
75 public void testTimeSeriesArtifact(){ 77 public void testTimeSeriesArtifact() {
76 try { 78 try {
77 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); 79 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact");
78 String artefactName = "fis_marnet"; 80 String artefactName = "fis_marnet";
79 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 81 ArtifactFactory artifactFactory = this
82 .getArtifactFactory(artefactName);
80 assertNotNull(artifactFactory); 83 assertNotNull(artifactFactory);
81 log.debug("TimeSeries-ArtifactFactory is available"); 84 log.debug("TimeSeries-ArtifactFactory is available");
82 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 85 Artifact artifact = artifactFactory.createArtifact(
86 "" + System.currentTimeMillis(), bootstrap.getContext());
83 assertNotNull(artifact); 87 assertNotNull(artifact);
84 log.debug("TimeSeries-Artifact is available"); 88 log.debug("TimeSeries-Artifact is available");
85 89
86 CallContext cc = createCallContext(); 90 CallContext cc = createCallContext();
87 91
88 // Erster Schritt 92 // Erster Schritt
89 93
90 this.doNextStep(artifact, cc, 94 this
91 "src/test/ressources/timeseries/timeseries_step_01_feed.xml", 95 .doNextStep(
92 "src/test/ressources/timeseries/timeseries_step_01_advance.xml"); 96 artifact,
93 97 cc,
98 "src/test/ressources/timeseries/timeseries_step_01_feed.xml",
99 "src/test/ressources/timeseries/timeseries_step_01_advance.xml");
100
94 // Zweiter Schritt 101 // Zweiter Schritt
95 this.doNextStep(artifact, cc, 102 this
96 "src/test/ressources/timeseries/timeseries_step_02_feed.xml", 103 .doNextStep(
97 "src/test/ressources/timeseries/timeseries_step_02_advance.xml"); 104 artifact,
98 105 cc,
106 "src/test/ressources/timeseries/timeseries_step_02_feed.xml",
107 "src/test/ressources/timeseries/timeseries_step_02_advance.xml");
108
99 // Dritter Schritt 109 // Dritter Schritt
100 this.doNextStep(artifact, cc, 110 this
101 "src/test/ressources/timeseries/timeseries_step_03_feed.xml", 111 .doNextStep(
102 "src/test/ressources/timeseries/timeseries_step_03_advance.xml"); 112 artifact,
103 113 cc,
114 "src/test/ressources/timeseries/timeseries_step_03_feed.xml",
115 "src/test/ressources/timeseries/timeseries_step_03_advance.xml");
116
104 // Vierter Schritt 117 // Vierter Schritt
105 this.doNextStep(artifact, cc, 118 this
106 "src/test/ressources/timeseries/timeseries_step_04_feed.xml", 119 .doNextStep(
107 "src/test/ressources/timeseries/timeseries_step_04_advance.xml"); 120 artifact,
108 121 cc,
122 "src/test/ressources/timeseries/timeseries_step_04_feed.xml",
123 "src/test/ressources/timeseries/timeseries_step_04_advance.xml");
124
109 Document outputData; 125 Document outputData;
110 // Fünfter Schritt 126 // Fünfter Schritt
111 outputData = artifact.describe(cc); 127 outputData = artifact.describe(cc);
112 FileOutputStream fos = null; 128 FileOutputStream fos = null;
113 try{ 129 try {
114 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); 130 fos = new FileOutputStream(
115 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc); 131 "src/test/results/timeseriesdiagramm"
116 artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, cc); 132 + System.currentTimeMillis() + ".png");
117 } catch (Exception e){ 133 artifact
118 log.error(e,e); 134 .feed(
135 this
136 .readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"),
137 cc);
138 artifact
139 .out(
140 this
141 .readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),
142 fos, cc);
143 } catch (Exception e) {
144 log.error(e, e);
119 fail(); 145 fail();
120 }finally{ 146 } finally {
121 try { 147 try {
122 fos.flush(); 148 fos.flush();
123 fos.close(); 149 fos.close();
124 } catch (Exception e) { 150 } catch (Exception e) {
125 log.error(e,e); 151 log.error(e, e);
126 } 152 }
127 } 153 }
128 } catch (Exception e) { 154 } catch (Exception e) {
129 log.error(e,e); 155 log.error(e, e);
130 fail(); 156 fail();
131 } 157 }
132 } 158 }
133 159
134 /** 160 /**
135 * @return 161 * @return
136 */ 162 */
137 private CallContext createCallContext() { 163 private CallContext createCallContext() {
138 CallMeta callMeta = new DefaultCallMeta(new PreferredLocale[]{new DefaultPreferredLocale("de_DE", 1.0f)}); 164 CallMeta callMeta = new DefaultCallMeta(
139 CallContext cc = new TestCallContext(bootstrap.getContext(),callMeta); 165 new PreferredLocale[] { new DefaultPreferredLocale("de_DE",
166 1.0f) });
167 CallContext cc = new TestCallContext(bootstrap.getContext(), callMeta);
140 return cc; 168 return cc;
141 } 169 }
142 170
143 /** 171 /**
144 * @param artifact 172 * @param artifact
145 * @param cc 173 * @param cc
146 * @throws Exception 174 * @throws Exception
147 */ 175 */
148 private void doNextStep(Artifact artifact, CallContext cc, String feedDocument, String advanceDocument) throws Exception { 176 private void doNextStep(Artifact artifact, CallContext cc,
177 String feedDocument, String advanceDocument)
178 throws Exception {
149 Document outputData = artifact.describe(cc); 179 Document outputData = artifact.describe(cc);
150 this.writeDocument2Log(outputData); 180 this.writeDocument2Log(outputData);
151 outputData = artifact.feed(this.readDocument(feedDocument), cc); 181 outputData = artifact.feed(this.readDocument(feedDocument), cc);
152 this.check4ExceptionReport(outputData); 182 this.check4ExceptionReport(outputData);
153 outputData = artifact.advance(this.readDocument(advanceDocument), cc); 183 outputData = artifact.advance(this.readDocument(advanceDocument), cc);
154 this.writeDocument2Log(outputData); 184 this.writeDocument2Log(outputData);
155 this.check4ExceptionReport(outputData); 185 this.check4ExceptionReport(outputData);
156 186
157 187 }
158 } 188
159 189 public void testTimeSeriesMeshArtifact() {
160 public void testTimeSeriesMeshArtifact(){
161 try { 190 try {
162 log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact"); 191 log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact");
163 String artefactName = "fis_modeldata"; 192 String artefactName = "fis_modeldata";
164 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 193 ArtifactFactory artifactFactory = this
194 .getArtifactFactory(artefactName);
165 assertNotNull(artifactFactory); 195 assertNotNull(artifactFactory);
166 log.debug("TimeSeriesMesh-ArtifactFactory is available"); 196 log.debug("TimeSeriesMesh-ArtifactFactory is available");
167 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 197 Artifact artifact = artifactFactory.createArtifact(
198 "" + System.currentTimeMillis(), bootstrap.getContext());
168 assertNotNull(artifact); 199 assertNotNull(artifact);
169 log.debug("TimeSeriesMesh-Artifact is available"); 200 log.debug("TimeSeriesMesh-Artifact is available");
170 201
171
172 CallContext cc = createCallContext(); 202 CallContext cc = createCallContext();
173 203
174 // Erster Schritt 204 // Erster Schritt
175 this.doNextStep(artifact, cc, 205 this
176 "src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml", 206 .doNextStep(
177 "src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml"); 207 artifact,
178 208 cc,
209 "src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml",
210 "src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml");
211
179 // Zweiter Schritt 212 // Zweiter Schritt
180 this.doNextStep(artifact, cc, 213 this
181 "src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml", 214 .doNextStep(
182 "src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml"); 215 artifact,
183 216 cc,
217 "src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml",
218 "src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml");
219
184 // Dritter Schritt 220 // Dritter Schritt
185 this.doNextStep(artifact, cc, 221 this
186 "src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml", 222 .doNextStep(
187 "src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml"); 223 artifact,
188 224 cc,
189 225 "src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml",
226 "src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml");
227
190 // Vierter Schritt 228 // Vierter Schritt
191 this.doNextStep(artifact, cc, 229 this
192 "src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml", 230 .doNextStep(
193 "src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml"); 231 artifact,
194 232 cc,
233 "src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml",
234 "src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml");
235
195 // Fünfter Schritt 236 // Fünfter Schritt
196 this.doNextStep(artifact, cc, 237 this
197 "src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml", 238 .doNextStep(
198 "src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml"); 239 artifact,
199 240 cc,
241 "src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml",
242 "src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml");
243
200 // Sechster Schritt 244 // Sechster Schritt
201 this.doNextStep(artifact, cc, 245 this
202 "src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml", 246 .doNextStep(
203 "src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml"); 247 artifact,
204 248 cc,
249 "src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml",
250 "src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml");
251
205 // Siebter Schritt 252 // Siebter Schritt
206 Document outputData = artifact.describe(cc); 253 Document outputData = artifact.describe(cc);
207 FileOutputStream fos = null; 254 FileOutputStream fos = null;
208 FileOutputStream fos2 = null; 255 FileOutputStream fos2 = null;
209 FileOutputStream fos3 = null; 256 FileOutputStream fos3 = null;
210 try{ 257 try {
211 fos = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".png"); 258 fos = new FileOutputStream("src/test/results/timeseries_mesh"
212 fos2 = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".xml"); 259 + System.currentTimeMillis()
213 fos3 = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".csv"); 260 + ".png");
214 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_feed.xml"), cc); 261 fos2 = new FileOutputStream("src/test/results/timeseries_mesh"
215 artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_statistics.xml"),fos2, cc); 262 + System.currentTimeMillis()
216 artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_chart.xml"),fos, cc); 263 + ".xml");
217 artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_csv.xml"),fos3, cc); 264 fos3 = new FileOutputStream("src/test/results/timeseries_mesh"
218 } catch (Exception e){ 265 + System.currentTimeMillis()
219 log.error(e,e); 266 + ".csv");
267 artifact
268 .feed(
269 this
270 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_feed.xml"),
271 cc);
272 artifact
273 .out(
274 this
275 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_statistics.xml"),
276 fos2, cc);
277 artifact
278 .out(
279 this
280 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_chart.xml"),
281 fos, cc);
282 artifact
283 .out(
284 this
285 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_csv.xml"),
286 fos3, cc);
287 } catch (Exception e) {
288 log.error(e, e);
220 fail(); 289 fail();
221 }finally{ 290 } finally {
222 try { 291 try {
223 fos.flush(); 292 fos.flush();
224 fos.close(); 293 fos.close();
225 fos2.flush(); 294 fos2.flush();
226 fos2.close(); 295 fos2.close();
227 fos3.flush(); 296 fos3.flush();
228 fos3.close(); 297 fos3.close();
229 } catch (Exception e) { 298 } catch (Exception e) {
230 log.error(e,e); 299 log.error(e, e);
231 } 300 }
232 } 301 }
233 } catch (Exception e) { 302 } catch (Exception e) {
234 log.error(e,e); 303 log.error(e, e);
235 fail(); 304 fail();
236 } 305 }
237 } 306 }
238 307
239 public void testVerticalProfileArtifact(){ 308 public void testVerticalProfileArtifact() {
240 try { 309 try {
241 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); 310 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
242 String artefactName = "fis_marnet"; 311 String artefactName = "fis_marnet";
243 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 312 ArtifactFactory artifactFactory = this
313 .getArtifactFactory(artefactName);
244 assertNotNull(artifactFactory); 314 assertNotNull(artifactFactory);
245 log.debug("VerticalProfile-ArtifactFactory is available"); 315 log.debug("VerticalProfile-ArtifactFactory is available");
246 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 316 Artifact artifact = artifactFactory.createArtifact(
317 "" + System.currentTimeMillis(), bootstrap.getContext());
247 assertNotNull(artifact); 318 assertNotNull(artifact);
248 log.debug("VerticalProfile-Artifact is available"); 319 log.debug("VerticalProfile-Artifact is available");
249 320
250
251 CallContext cc = createCallContext(); 321 CallContext cc = createCallContext();
252 322
253 // Erster Schritt 323 // Erster Schritt
254 this.doNextStep(artifact, cc, 324 this
255 "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml", 325 .doNextStep(
256 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); 326 artifact,
257 327 cc,
258 328 "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml",
329 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml");
330
259 // Zweiter Schritt 331 // Zweiter Schritt
260 this.doNextStep(artifact, cc, 332 this
261 "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml", 333 .doNextStep(
262 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); 334 artifact,
263 335 cc,
264 336 "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml",
337 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml");
338
265 // Dritter Schritt 339 // Dritter Schritt
266 this.doNextStep(artifact, cc, 340 this
267 "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml", 341 .doNextStep(
268 "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"); 342 artifact,
269 343 cc,
270 344 "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml",
345 "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml");
346
271 // Vierter Schritt 347 // Vierter Schritt
272 Document outputData = artifact.describe(cc); 348 Document outputData = artifact.describe(cc);
273 FileOutputStream fos = null; 349 FileOutputStream fos = null;
274 FileOutputStream fos2 = null; 350 FileOutputStream fos2 = null;
275 FileOutputStream fos3 = null; 351 FileOutputStream fos3 = null;
276 try{ 352 try {
277 fos = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".png"); 353 fos = new FileOutputStream("src/test/results/verticalprofile"
278 fos2 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".xml"); 354 + System.currentTimeMillis()
279 fos3 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".csv"); 355 + ".png");
280 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"), cc); 356 fos2 = new FileOutputStream("src/test/results/verticalprofile"
281 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),fos2, cc); 357 + System.currentTimeMillis()
282 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),fos, cc); 358 + ".xml");
283 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.xml"),fos3, cc); 359 fos3 = new FileOutputStream("src/test/results/verticalprofile"
284 } catch (Exception e){ 360 + System.currentTimeMillis()
285 log.error(e,e); 361 + ".csv");
362 artifact
363 .feed(
364 this
365 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"),
366 cc);
367 artifact
368 .out(
369 this
370 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),
371 fos2, cc);
372 artifact
373 .out(
374 this
375 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),
376 fos, cc);
377 artifact
378 .out(
379 this
380 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.xml"),
381 fos3, cc);
382 } catch (Exception e) {
383 log.error(e, e);
286 fail(); 384 fail();
287 }finally{ 385 } finally {
288 try { 386 try {
289 fos.flush(); 387 fos.flush();
290 fos.close(); 388 fos.close();
291 fos2.flush(); 389 fos2.flush();
292 fos2.close(); 390 fos2.close();
293 fos3.flush(); 391 fos3.flush();
294 fos3.close(); 392 fos3.close();
295 } catch (Exception e) { 393 } catch (Exception e) {
296 log.error(e,e); 394 log.error(e, e);
297 } 395 }
298 } 396 }
299 } catch (Exception e) { 397 } catch (Exception e) {
300 log.error(e,e); 398 log.error(e, e);
301 fail(); 399 fail();
302 } 400 }
303 } 401 }
304 402
305 public void testVerticalProfileMeshArtifact(){ 403 public void testVerticalProfileMeshArtifact() {
306 try { 404 try {
307 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); 405 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
308 String artefactName = "fis_modeldata"; 406 String artefactName = "fis_modeldata";
309 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 407 ArtifactFactory artifactFactory = this
408 .getArtifactFactory(artefactName);
310 assertNotNull(artifactFactory); 409 assertNotNull(artifactFactory);
311 log.debug("VerticalProfile-ArtifactFactory is available"); 410 log.debug("VerticalProfile-ArtifactFactory is available");
312 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 411 Artifact artifact = artifactFactory.createArtifact(
412 "" + System.currentTimeMillis(), bootstrap.getContext());
313 assertNotNull(artifact); 413 assertNotNull(artifact);
314 log.debug("VerticalProfile-Artifact is available"); 414 log.debug("VerticalProfile-Artifact is available");
315 415
316
317 CallContext cc = createCallContext(); 416 CallContext cc = createCallContext();
318 417
319 // Erster Schritt 418 // Erster Schritt
320 this.doNextStep(artifact, cc, 419 this
321 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml", 420 .doNextStep(
322 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"); 421 artifact,
323 422 cc,
423 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml",
424 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml");
425
324 // Zweiter Schritt 426 // Zweiter Schritt
325 this.doNextStep(artifact, cc, 427 this
326 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml", 428 .doNextStep(
327 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"); 429 artifact,
328 430 cc,
431 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml",
432 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml");
433
329 // Dritter Schritt 434 // Dritter Schritt
330 this.doNextStep(artifact, cc, 435 this
331 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml", 436 .doNextStep(
332 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"); 437 artifact,
333 438 cc,
439 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml",
440 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml");
441
334 // Vierter Schritt 442 // Vierter Schritt
335 this.doNextStep(artifact, cc, 443 this
336 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml", 444 .doNextStep(
337 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"); 445 artifact,
338 446 cc,
447 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml",
448 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml");
449
339 // Fünfter Schritt 450 // Fünfter Schritt
340 this.doNextStep(artifact, cc, 451 this
341 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml", 452 .doNextStep(
342 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"); 453 artifact,
343 454 cc,
455 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml",
456 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml");
457
344 // Sechster Schritt 458 // Sechster Schritt
345 Document outputData = artifact.describe(cc); 459 Document outputData = artifact.describe(cc);
346 FileOutputStream fos = null; 460 FileOutputStream fos = null;
347 FileOutputStream fos2 = null; 461 FileOutputStream fos2 = null;
348 FileOutputStream fos3 = null; 462 FileOutputStream fos3 = null;
349 try{ 463 try {
350 fos = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".png"); 464 fos = new FileOutputStream(
351 fos2 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".xml"); 465 "src/test/results/verticalprofile_mesh"
352 fos3 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".csv"); 466 + System.currentTimeMillis() + ".png");
353 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml"), cc); 467 fos2 = new FileOutputStream(
354 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_statistics.xml"),fos2, cc); 468 "src/test/results/verticalprofile_mesh"
355 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_chart.xml"),fos, cc); 469 + System.currentTimeMillis() + ".xml");
356 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_csv.xml"),fos3, cc); 470 fos3 = new FileOutputStream(
357 } catch (Exception e){ 471 "src/test/results/verticalprofile_mesh"
358 log.error(e,e); 472 + System.currentTimeMillis() + ".csv");
473 artifact
474 .feed(
475 this
476 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml"),
477 cc);
478 artifact
479 .out(
480 this
481 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_statistics.xml"),
482 fos2, cc);
483 artifact
484 .out(
485 this
486 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_chart.xml"),
487 fos, cc);
488 artifact
489 .out(
490 this
491 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_csv.xml"),
492 fos3, cc);
493 } catch (Exception e) {
494 log.error(e, e);
359 fail(); 495 fail();
360 }finally{ 496 } finally {
361 try { 497 try {
362 fos.flush(); 498 fos.flush();
363 fos.close(); 499 fos.close();
364 fos2.flush(); 500 fos2.flush();
365 fos2.close(); 501 fos2.close();
366 fos3.flush(); 502 fos3.flush();
367 fos3.close(); 503 fos3.close();
368 } catch (Exception e) { 504 } catch (Exception e) {
369 log.error(e,e); 505 log.error(e, e);
370 } 506 }
371 } 507 }
372 } catch (Exception e) { 508 } catch (Exception e) {
373 log.error(e,e); 509 log.error(e, e);
374 fail(); 510 fail();
375 } 511 }
376 } 512 }
377 513
378 514 public void testVerticalProfileInstantaneousPointArtifact() {
379
380 public void testVerticalProfileInstantaneousPointArtifact(){
381 try { 515 try {
382 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); 516 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
383 String artefactName = "fis_bsh_ctd"; 517 String artefactName = "fis_bsh_ctd";
384 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 518 ArtifactFactory artifactFactory = this
519 .getArtifactFactory(artefactName);
385 assertNotNull(artifactFactory); 520 assertNotNull(artifactFactory);
386 log.debug("VerticalProfile-ArtifactFactory is available"); 521 log.debug("VerticalProfile-ArtifactFactory is available");
387 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 522 Artifact artifact = artifactFactory.createArtifact(
523 "" + System.currentTimeMillis(), bootstrap.getContext());
388 assertNotNull(artifact); 524 assertNotNull(artifact);
389 log.debug("VerticalProfile-Artifact is available"); 525 log.debug("VerticalProfile-Artifact is available");
390 526
391
392 CallContext cc = createCallContext(); 527 CallContext cc = createCallContext();
393 528
394 // Erster Schritt 529 // Erster Schritt
395 this.doNextStep(artifact, cc, 530 this
396 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml", 531 .doNextStep(
397 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"); 532 artifact,
398 533 cc,
534 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml",
535 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml");
536
399 // Zweiter Schritt 537 // Zweiter Schritt
400 this.doNextStep(artifact, cc, 538 this
401 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml", 539 .doNextStep(
402 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"); 540 artifact,
403 541 cc,
542 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml",
543 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml");
544
404 // Dritter Schritt 545 // Dritter Schritt
405 this.doNextStep(artifact, cc, 546 this
406 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml", 547 .doNextStep(
407 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"); 548 artifact,
408 549 cc,
550 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml",
551 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml");
552
409 // Vierter Schritt 553 // Vierter Schritt
410 Document outputData = artifact.describe(cc); 554 Document outputData = artifact.describe(cc);
411 FileOutputStream fos = null; 555 FileOutputStream fos = null;
412 FileOutputStream fos2 = null; 556 FileOutputStream fos2 = null;
413 FileOutputStream fos3 = null; 557 FileOutputStream fos3 = null;
414 try{ 558 try {
415 fos = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".png"); 559 fos = new FileOutputStream(
416 fos2 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml"); 560 "src/test/results/verticalprofile_instantaneouspoint"
417 fos3 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv"); 561 + System.currentTimeMillis() + ".png");
418 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"), cc); 562 fos2 = new FileOutputStream(
419 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),fos2, cc); 563 "src/test/results/verticalprofile_instantaneouspoint"
420 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),fos, cc); 564 + System.currentTimeMillis() + ".xml");
421 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.xml"),fos3, cc); 565 fos3 = new FileOutputStream(
422 } catch (Exception e){ 566 "src/test/results/verticalprofile_instantaneouspoint"
423 log.error(e,e); 567 + System.currentTimeMillis() + ".csv");
568 artifact
569 .feed(
570 this
571 .readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"),
572 cc);
573 artifact
574 .out(
575 this
576 .readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),
577 fos2, cc);
578 artifact
579 .out(
580 this
581 .readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),
582 fos, cc);
583 artifact
584 .out(
585 this
586 .readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.xml"),
587 fos3, cc);
588 } catch (Exception e) {
589 log.error(e, e);
424 fail(); 590 fail();
425 }finally{ 591 } finally {
426 try { 592 try {
427 fos.flush(); 593 fos.flush();
428 fos.close(); 594 fos.close();
429 fos2.flush(); 595 fos2.flush();
430 fos2.close(); 596 fos2.close();
431 fos3.flush(); 597 fos3.flush();
432 fos3.close(); 598 fos3.close();
433 } catch (Exception e) { 599 } catch (Exception e) {
434 log.error(e,e); 600 log.error(e, e);
435 } 601 }
436 } 602 }
437 } catch (Exception e) { 603 } catch (Exception e) {
438 log.error(e,e); 604 log.error(e, e);
439 fail(); 605 fail();
440 } 606 }
441 } 607 }
442 608
443 public void testHorizontalProfileInstantaneousPointArtifact(){ 609 public void testHorizontalProfileInstantaneousPointArtifact() {
444 try { 610 try {
445 log.debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact"); 611 log
446 String artefactName = "fis_delphin"; 612 .debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact");
447 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 613 String artefactName = "fis_delphin";
614 ArtifactFactory artifactFactory = this
615 .getArtifactFactory(artefactName);
448 assertNotNull(artifactFactory); 616 assertNotNull(artifactFactory);
449 log.debug("VerticalProfile-ArtifactFactory is available"); 617 log.debug("VerticalProfile-ArtifactFactory is available");
450 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 618 Artifact artifact = artifactFactory.createArtifact(
619 "" + System.currentTimeMillis(), bootstrap.getContext());
451 assertNotNull(artifact); 620 assertNotNull(artifact);
452 log.debug("VerticalProfile-Artifact is available"); 621 log.debug("VerticalProfile-Artifact is available");
453 622
454
455 CallContext cc = createCallContext(); 623 CallContext cc = createCallContext();
456 624
457 // Erster Schritt 625 // Erster Schritt
458 this.doNextStep(artifact, cc, 626 this
459 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_feed.xml", 627 .doNextStep(
460 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_advance.xml"); 628 artifact,
461 629 cc,
462 630 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_feed.xml",
631 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_advance.xml");
632
463 // Erster Schritt 633 // Erster Schritt
464 this.doNextStep(artifact, cc, 634 this
465 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_feed.xml", 635 .doNextStep(
466 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_advance.xml"); 636 artifact,
467 637 cc,
638 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_feed.xml",
639 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_advance.xml");
640
468 // Zweiter Schritt 641 // Zweiter Schritt
469 this.doNextStep(artifact, cc, 642 this
470 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_feed.xml", 643 .doNextStep(
471 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_advance.xml"); 644 artifact,
645 cc,
646 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_feed.xml",
647 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_advance.xml");
472 // Dritter Schritt 648 // Dritter Schritt
473 this.doNextStep(artifact, cc, 649 this
474 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_feed.xml", 650 .doNextStep(
475 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_advance.xml"); 651 artifact,
652 cc,
653 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_feed.xml",
654 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_advance.xml");
476 // Vierter Schritt 655 // Vierter Schritt
477 this.doNextStep(artifact, cc, 656 this
478 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_feed.xml", 657 .doNextStep(
479 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_advance.xml"); 658 artifact,
480 // Fünfter Schritt 659 cc,
481 this.doNextStep(artifact, cc, 660 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_feed.xml",
482 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_feed.xml", 661 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_advance.xml");
483 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_advance.xml"); 662 // Fünfter Schritt
484 663 this
485 664 .doNextStep(
665 artifact,
666 cc,
667 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_feed.xml",
668 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_advance.xml");
669
486 Document outputData = artifact.describe(cc); 670 Document outputData = artifact.describe(cc);
487 FileOutputStream fos = null; 671 FileOutputStream fos = null;
488 FileOutputStream fos2 = null; 672 FileOutputStream fos2 = null;
489 FileOutputStream fos3 = null; 673 FileOutputStream fos3 = null;
490 try{ 674 try {
491 fos = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".png"); 675 fos = new FileOutputStream(
492 fos2 = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml"); 676 "src/test/results/horizontalprofile_instantaneouspoint"
493 fos3 = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv"); 677 + System.currentTimeMillis() + ".png");
494 artifact.feed(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_feed.xml"), cc); 678 fos2 = new FileOutputStream(
495 //artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_statistics.xml"),fos2, cc); 679 "src/test/results/horizontalprofile_instantaneouspoint"
496 artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_chart.xml"),fos, cc); 680 + System.currentTimeMillis() + ".xml");
497 // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_csv.xml"),fos3, cc); 681 fos3 = new FileOutputStream(
498 } catch (Exception e){ 682 "src/test/results/horizontalprofile_instantaneouspoint"
499 log.error(e,e); 683 + System.currentTimeMillis() + ".csv");
684 artifact
685 .feed(
686 this
687 .readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_feed.xml"),
688 cc);
689 // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_statistics.xml"),fos2,
690 // cc);
691 artifact
692 .out(
693 this
694 .readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_chart.xml"),
695 fos, cc);
696 // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_csv.xml"),fos3,
697 // cc);
698 } catch (Exception e) {
699 log.error(e, e);
500 fail(); 700 fail();
501 }finally{ 701 } finally {
502 try { 702 try {
503 fos.flush(); 703 fos.flush();
504 fos.close(); 704 fos.close();
505 fos2.flush(); 705 fos2.flush();
506 fos2.close(); 706 fos2.close();
507 fos3.flush(); 707 fos3.flush();
508 fos3.close(); 708 fos3.close();
509 } catch (Exception e) { 709 } catch (Exception e) {
510 log.error(e,e); 710 log.error(e, e);
511 } 711 }
512 } 712 }
513 } catch (Exception e) { 713 } catch (Exception e) {
514 log.error(e,e); 714 log.error(e, e);
515 fail(); 715 fail();
516 } 716 }
517 } 717 }
518 718
519 public void testHorizontalProfileMeshPointArtifact(){ 719 public void testHorizontalProfileMeshPointArtifact() {
520 try { 720 try {
521 log.debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact"); 721 log
522 String artefactName = "fis_modeldata"; 722 .debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact");
523 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 723 String artefactName = "fis_modeldata";
724 ArtifactFactory artifactFactory = this
725 .getArtifactFactory(artefactName);
524 assertNotNull(artifactFactory); 726 assertNotNull(artifactFactory);
525 log.debug("VerticalProfile-ArtifactFactory is available"); 727 log.debug("VerticalProfile-ArtifactFactory is available");
526 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 728 Artifact artifact = artifactFactory.createArtifact(
729 "" + System.currentTimeMillis(), bootstrap.getContext());
527 assertNotNull(artifact); 730 assertNotNull(artifact);
528 log.debug("VerticalProfile-Artifact is available"); 731 log.debug("VerticalProfile-Artifact is available");
529 732
530
531 CallContext cc = createCallContext(); 733 CallContext cc = createCallContext();
532 734
533
534
535 // Erster Schritt 735 // Erster Schritt
536 this.doNextStep(artifact, cc, 736 this
537 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_feed.xml", 737 .doNextStep(
538 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_advance.xml"); 738 artifact,
539 739 cc,
740 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_feed.xml",
741 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_advance.xml");
742
540 // Zweiter Schritt 743 // Zweiter Schritt
541 this.doNextStep(artifact, cc, 744 this
542 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_feed.xml", 745 .doNextStep(
543 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_advance.xml"); 746 artifact,
747 cc,
748 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_feed.xml",
749 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_advance.xml");
544 // Dritter Schritt 750 // Dritter Schritt
545 this.doNextStep(artifact, cc, 751 this
546 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_feed.xml", 752 .doNextStep(
547 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_advance.xml"); 753 artifact,
754 cc,
755 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_feed.xml",
756 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_advance.xml");
548 // Vierter Schritt 757 // Vierter Schritt
549 this.doNextStep(artifact, cc, 758 this
550 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_feed.xml", 759 .doNextStep(
551 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_advance.xml"); 760 artifact,
552 // Fünfter Schritt 761 cc,
553 this.doNextStep(artifact, cc, 762 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_feed.xml",
554 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_feed.xml", 763 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_advance.xml");
555 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_advance.xml"); 764 // Fünfter Schritt
556 765 this
766 .doNextStep(
767 artifact,
768 cc,
769 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_feed.xml",
770 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_advance.xml");
771
557 // Sechster Schritt 772 // Sechster Schritt
558 this.doNextStep(artifact, cc, 773 this
559 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_feed.xml", 774 .doNextStep(
560 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_advance.xml"); 775 artifact,
561 776 cc,
777 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_feed.xml",
778 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_advance.xml");
779
562 // Siebter Schritt 780 // Siebter Schritt
563 this.doNextStep(artifact, cc, 781 this
564 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_feed.xml", 782 .doNextStep(
565 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_advance.xml"); 783 artifact,
566 784 cc,
785 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_feed.xml",
786 "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_advance.xml");
787
567 Document outputData = artifact.describe(cc); 788 Document outputData = artifact.describe(cc);
568 FileOutputStream fos = null; 789 FileOutputStream fos = null;
569 FileOutputStream fos2 = null; 790 FileOutputStream fos2 = null;
570 FileOutputStream fos3 = null; 791 FileOutputStream fos3 = null;
571 try{ 792 try {
572 fos = new FileOutputStream("src/test/results/horizontalProfile_mesh"+System.currentTimeMillis()+".png"); 793 fos = new FileOutputStream(
573 fos2 = new FileOutputStream("src/test/results/horizontalProfile_mesh"+System.currentTimeMillis()+".xml"); 794 "src/test/results/horizontalProfile_mesh"
574 fos3 = new FileOutputStream("src/test/results/horizontalProfile_mesh"+System.currentTimeMillis()+".csv"); 795 + System.currentTimeMillis() + ".png");
575 artifact.feed(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_feed.xml"), cc); 796 fos2 = new FileOutputStream(
576 artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_statistics.xml"),fos2, cc); 797 "src/test/results/horizontalProfile_mesh"
577 artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_chart.xml"),fos, cc); 798 + System.currentTimeMillis() + ".xml");
578 // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_csv.xml"),fos3, cc); 799 fos3 = new FileOutputStream(
579 } catch (Exception e){ 800 "src/test/results/horizontalProfile_mesh"
580 log.error(e,e); 801 + System.currentTimeMillis() + ".csv");
802 artifact
803 .feed(
804 this
805 .readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_feed.xml"),
806 cc);
807 artifact
808 .out(
809 this
810 .readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_statistics.xml"),
811 fos2, cc);
812 artifact
813 .out(
814 this
815 .readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_chart.xml"),
816 fos, cc);
817 // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_csv.xml"),fos3,
818 // cc);
819 } catch (Exception e) {
820 log.error(e, e);
581 fail(); 821 fail();
582 }finally{ 822 } finally {
583 try { 823 try {
584 fos.flush(); 824 fos.flush();
585 fos.close(); 825 fos.close();
586 fos2.flush(); 826 fos2.flush();
587 fos2.close(); 827 fos2.close();
588 fos3.flush(); 828 fos3.flush();
589 fos3.close(); 829 fos3.close();
590 } catch (Exception e) { 830 } catch (Exception e) {
591 log.error(e,e); 831 log.error(e, e);
592 } 832 }
593 } 833 }
594 } catch (Exception e) { 834 } catch (Exception e) {
595 log.error(e,e); 835 log.error(e, e);
596 fail(); 836 fail();
597 } 837 }
598 } 838 }
599 839
600 protected void createFile(byte[] content, String fileName){ 840 protected void createFile(byte[] content, String fileName) {
601 try { 841 try {
602 FileOutputStream fos = new FileOutputStream(new File(fileName)); 842 FileOutputStream fos = new FileOutputStream(new File(fileName));
603 ByteArrayInputStream bis = new ByteArrayInputStream(content); 843 ByteArrayInputStream bis = new ByteArrayInputStream(content);
604 byte[] buf = new byte[4096]; 844 byte[] buf = new byte[4096];
605 while (bis.read(buf) > 0){ 845 while (bis.read(buf) > 0) {
606 fos.write(buf); 846 fos.write(buf);
607 } 847 }
608 fos.flush(); 848 fos.flush();
609 fos.close(); 849 fos.close();
610 } catch (FileNotFoundException e) { 850 } catch (FileNotFoundException e) {
611 log.error(e,e); 851 log.error(e, e);
612 } catch (IOException e) { 852 } catch (IOException e) {
613 log.error(e,e); 853 log.error(e, e);
614 } 854 }
615 } 855 }
616
617 856
618 /** 857 /**
619 * @param artefactName 858 * @param artefactName
620 */ 859 */
621 private ArtifactFactory getArtifactFactory(String artefactName){ 860 private ArtifactFactory getArtifactFactory(String artefactName) {
622 log.debug("GNVArtifactsTestCase.getArtifactFactory"); 861 log.debug("GNVArtifactsTestCase.getArtifactFactory");
623 ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories(); 862 ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories();
624 for (int i = 0; i < artifactFactories.length; i++){ 863 for (int i = 0; i < artifactFactories.length; i++) {
625 if (artifactFactories[i].getName().equals(artefactName)){ 864 if (artifactFactories[i].getName().equals(artefactName)) {
626 log.debug("ArtifactFactory wurde gefunden."); 865 log.debug("ArtifactFactory wurde gefunden.");
627 return artifactFactories[i]; 866 return artifactFactories[i];
628 } 867 }
629 } 868 }
630 return null; 869 return null;
631 } 870 }
632 871
633 protected void writeDocument2Log(Document document){ 872 protected void writeDocument2Log(Document document) {
634 log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); 873 log.debug(new ArtifactXMLUtilities().writeDocument2String(document));
635 } 874 }
636 875
637 876 protected Document readDocument(String fileName) {
638 protected Document readDocument(String fileName){
639 Document returnValue = null; 877 Document returnValue = null;
640 try { 878 try {
641 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); 879 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
880 .newInstance();
642 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); 881 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
643 returnValue = docBuilder.parse (new File(fileName)); 882 returnValue = docBuilder.parse(new File(fileName));
644 } catch (ParserConfigurationException e) { 883 } catch (ParserConfigurationException e) {
645 log.error(e,e); 884 log.error(e, e);
646 } catch (SAXException e) { 885 } catch (SAXException e) {
647 log.error(e,e); 886 log.error(e, e);
648 } catch (IOException e) { 887 } catch (IOException e) {
649 log.error(e,e); 888 log.error(e, e);
650 } 889 }
651 return returnValue; 890 return returnValue;
652 } 891 }
653 892
654 893 private void check4ExceptionReport(Document document) throws Exception {
655 private void check4ExceptionReport(Document document) throws Exception{
656 document = new ArtifactXMLUtilities().reInitDocument(document); 894 document = new ArtifactXMLUtilities().reInitDocument(document);
657 String message = Config.getStringXPath(document,"/exceptionreport/exception"); 895 String message = Config.getStringXPath(document,
658 if (message != null){ 896 "/exceptionreport/exception");
897 if (message != null) {
659 throw new Exception(message); 898 throw new Exception(message);
660 } 899 }
661 } 900 }
662 } 901 }

http://dive4elements.wald.intevation.org