Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 241:8500529d82af
Added ODV-Export to VerticalProfiles
gnv-artifacts/trunk@309 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 09 Nov 2009 15:24:41 +0000 |
parents | 76897b73db4e |
children | 5925739d25ac |
comparison
equal
deleted
inserted
replaced
240:76897b73db4e | 241:8500529d82af |
---|---|
296 log.debug("VerticalProfile-Artifact is available"); | 296 log.debug("VerticalProfile-Artifact is available"); |
297 | 297 |
298 CallContext cc = createCallContext(); | 298 CallContext cc = createCallContext(); |
299 | 299 |
300 Document describeDocument = this.readDocument("src/test/ressources/verticalprofile/verticalprofile_describe.xml"); | 300 Document describeDocument = this.readDocument("src/test/ressources/verticalprofile/verticalprofile_describe.xml"); |
301 // Erster Schritt | 301 int steps = 5; |
302 this | 302 |
303 .doNextStep( | 303 for (int i = 1; i <= steps; i++){ |
304 artifact, | 304 this.doNextStep( |
305 cc, | 305 artifact, |
306 "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml", | 306 cc, |
307 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml", describeDocument); | 307 "src/test/ressources/verticalprofile/" + |
308 | 308 "verticalprofile_step_0"+i+"_feed.xml", |
309 // Zweiter Schritt | 309 "src/test/ressources/verticalprofile/" + |
310 this | 310 "verticalprofile_step_0"+i+"_advance.xml", |
311 .doNextStep( | 311 describeDocument); |
312 artifact, | 312 } |
313 cc, | |
314 "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml", | |
315 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml", describeDocument); | |
316 | |
317 // Dritter Schritt | |
318 this | |
319 .doNextStep( | |
320 artifact, | |
321 cc, | |
322 "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml", | |
323 "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml", describeDocument); | |
324 | |
325 // Vierter Schritt | |
326 this | |
327 .doNextStep( | |
328 artifact, | |
329 cc, | |
330 "src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml", | |
331 "src/test/ressources/verticalprofile/verticalprofile_step_04_advance.xml", describeDocument); | |
332 | |
333 // Fünfter Schritt | |
334 this | |
335 .doNextStep( | |
336 artifact, | |
337 cc, | |
338 "src/test/ressources/verticalprofile/verticalprofile_step_05_feed.xml", | |
339 "src/test/ressources/verticalprofile/verticalprofile_step_05_advance.xml", describeDocument); | |
340 | |
341 | 313 |
342 // Vierter Schritt | 314 // Vierter Schritt |
343 Document outputData = artifact.describe(describeDocument,cc); | 315 Document outputData = artifact.describe(describeDocument,cc); |
344 FileOutputStream fos = null; | 316 FileOutputStream fos = null; |
345 FileOutputStream fos2 = null; | 317 FileOutputStream fos2 = null; |
346 FileOutputStream fos3 = null; | 318 FileOutputStream fos3 = null; |
319 FileOutputStream fos4 = null; | |
347 try { | 320 try { |
348 fos = new FileOutputStream("src/test/results/verticalprofile" | 321 fos = new FileOutputStream("src/test/results/verticalprofile" |
349 + System.currentTimeMillis() | 322 + System.currentTimeMillis() |
350 + ".png"); | 323 + ".png"); |
351 fos2 = new FileOutputStream("src/test/results/verticalprofile" | 324 fos2 = new FileOutputStream("src/test/results/verticalprofile" |
352 + System.currentTimeMillis() | 325 + System.currentTimeMillis() |
353 + ".xml"); | 326 + ".xml"); |
354 fos3 = new FileOutputStream("src/test/results/verticalprofile" | 327 fos3 = new FileOutputStream("src/test/results/verticalprofile" |
355 + System.currentTimeMillis() | 328 + System.currentTimeMillis() |
356 + ".csv"); | 329 + ".csv"); |
357 artifact | 330 fos4 = new FileOutputStream("src/test/results/verticalprofile" |
358 .feed( | 331 + System.currentTimeMillis() |
359 this | 332 + ".odv"); |
360 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_06_feed.xml"), | 333 artifact.feed(this.readDocument("src/test/ressources/" + |
361 cc); | 334 "verticalprofile/" + |
362 artifact | 335 "verticalprofile_step_06_feed.xml"), |
363 .out( | 336 cc); |
364 this | 337 artifact.out(this.readDocument("src/test/ressources/" + |
365 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_06_out_statistics.xml"), | 338 "verticalprofile/" + |
366 fos2, cc); | 339 "verticalprofile_step_06_out_statistics.xml"), |
367 artifact | 340 fos2, cc); |
368 .out( | 341 artifact.out(this.readDocument("src/test/ressources/" + |
369 this | 342 "verticalprofile/" + |
370 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_06_out_chart.xml"), | 343 "verticalprofile_step_06_out_chart.xml"), |
371 fos, cc); | 344 fos, cc); |
372 artifact | 345 artifact.out(this.readDocument("src/test/ressources/" + |
373 .out( | 346 "verticalprofile/" + |
374 this | 347 "verticalprofile_step_06_out_csv.xml"), |
375 .readDocument("src/test/ressources/verticalprofile/verticalprofile_step_06_out_csv.xml"), | 348 fos3, cc); |
376 fos3, cc); | 349 artifact.out(this.readDocument("src/test/ressources/" + |
350 "verticalprofile/" + | |
351 "verticalprofile_step_06_out_odv.xml"), | |
352 fos4, cc); | |
377 } catch (Exception e) { | 353 } catch (Exception e) { |
378 log.error(e, e); | 354 log.error(e, e); |
379 fail(); | 355 fail(); |
380 } finally { | 356 } finally { |
381 try { | 357 try { |
383 fos.close(); | 359 fos.close(); |
384 fos2.flush(); | 360 fos2.flush(); |
385 fos2.close(); | 361 fos2.close(); |
386 fos3.flush(); | 362 fos3.flush(); |
387 fos3.close(); | 363 fos3.close(); |
364 fos4.flush(); | |
365 fos4.close(); | |
388 } catch (Exception e) { | 366 } catch (Exception e) { |
389 log.error(e, e); | 367 log.error(e, e); |
390 } | 368 } |
391 } | 369 } |
392 } catch (Exception e) { | 370 } catch (Exception e) { |
407 "" + System.currentTimeMillis(), bootstrap.getContext()); | 385 "" + System.currentTimeMillis(), bootstrap.getContext()); |
408 assertNotNull(artifact); | 386 assertNotNull(artifact); |
409 log.debug("VerticalProfile-Artifact is available"); | 387 log.debug("VerticalProfile-Artifact is available"); |
410 | 388 |
411 CallContext cc = createCallContext(); | 389 CallContext cc = createCallContext(); |
412 Document describeDocument = this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_describe.xml"); | 390 Document describeDocument = this.readDocument("src/test/ressources/" + |
413 // Erster Schritt | 391 "verticalprofile_mesh/" + |
414 this | 392 "verticalprofile_describe.xml"); |
415 .doNextStep( | 393 |
416 artifact, | 394 int steps = 9; |
417 cc, | 395 |
418 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml", | 396 for (int i = 1; i <= steps; i++){ |
419 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml", describeDocument); | 397 this.doNextStep( |
420 | 398 artifact, |
421 // Zweiter Schritt | 399 cc, |
422 this | 400 "src/test/ressources/verticalprofile_mesh/" + |
423 .doNextStep( | 401 "verticalprofile_step_0"+i+"_feed.xml", |
424 artifact, | 402 "src/test/ressources/verticalprofile_mesh/" + |
425 cc, | 403 "verticalprofile_step_0"+i+"_advance.xml", |
426 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml", | 404 describeDocument); |
427 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml", describeDocument); | 405 } |
428 | |
429 // Dritter Schritt | |
430 this | |
431 .doNextStep( | |
432 artifact, | |
433 cc, | |
434 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml", | |
435 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml", describeDocument); | |
436 | |
437 // Vierter Schritt | |
438 this | |
439 .doNextStep( | |
440 artifact, | |
441 cc, | |
442 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml", | |
443 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml", describeDocument); | |
444 | |
445 // Fünfter Schritt | |
446 this | |
447 .doNextStep( | |
448 artifact, | |
449 cc, | |
450 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml", | |
451 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml", describeDocument); | |
452 | |
453 // Sechster Schritt | |
454 this | |
455 .doNextStep( | |
456 artifact, | |
457 cc, | |
458 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml", | |
459 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_advance.xml", describeDocument); | |
460 | |
461 // Siebter Schritt | |
462 this | |
463 .doNextStep( | |
464 artifact, | |
465 cc, | |
466 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_07_feed.xml", | |
467 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_07_advance.xml", describeDocument); | |
468 | |
469 // Achter Schritt | |
470 this | |
471 .doNextStep( | |
472 artifact, | |
473 cc, | |
474 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_08_feed.xml", | |
475 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_08_advance.xml", describeDocument); | |
476 | |
477 | |
478 // Neunter Schritt | |
479 this | |
480 .doNextStep( | |
481 artifact, | |
482 cc, | |
483 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_09_feed.xml", | |
484 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_09_advance.xml", describeDocument); | |
485 | |
486 | |
487 // 10. Schritt | 406 // 10. Schritt |
488 Document outputData = artifact.describe(describeDocument,cc); | 407 Document outputData = artifact.describe(describeDocument,cc); |
489 FileOutputStream fos = null; | 408 FileOutputStream fos = null; |
490 FileOutputStream fos2 = null; | 409 FileOutputStream fos2 = null; |
491 FileOutputStream fos3 = null; | 410 FileOutputStream fos3 = null; |
411 FileOutputStream fos4 = null; | |
492 try { | 412 try { |
493 fos = new FileOutputStream( | 413 fos = new FileOutputStream( |
494 "src/test/results/verticalprofile_mesh" | 414 "src/test/results/verticalprofile_mesh" |
495 + System.currentTimeMillis() + ".png"); | 415 + System.currentTimeMillis() + ".png"); |
496 fos2 = new FileOutputStream( | 416 fos2 = new FileOutputStream( |
497 "src/test/results/verticalprofile_mesh" | 417 "src/test/results/verticalprofile_mesh" |
498 + System.currentTimeMillis() + ".xml"); | 418 + System.currentTimeMillis() + ".xml"); |
499 fos3 = new FileOutputStream( | 419 fos3 = new FileOutputStream( |
500 "src/test/results/verticalprofile_mesh" | 420 "src/test/results/verticalprofile_mesh" |
501 + System.currentTimeMillis() + ".csv"); | 421 + System.currentTimeMillis() + ".csv"); |
502 artifact | 422 fos4 = new FileOutputStream( |
503 .feed( | 423 "src/test/results/verticalprofile_mesh" |
504 this | 424 + System.currentTimeMillis() + ".odv"); |
505 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_feed.xml"), | 425 artifact.feed(this.readDocument("src/test/ressources/" + |
426 "verticalprofile_mesh/" + | |
427 "verticalprofile_step_10_feed.xml"), | |
506 cc); | 428 cc); |
507 artifact | 429 artifact.out(this.readDocument("src/test/ressources/" + |
508 .out( | 430 "verticalprofile_mesh/" + |
509 this | 431 "verticalprofile_step_10_out_statistics.xml"), |
510 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_out_statistics.xml"), | 432 fos2, cc); |
511 fos2, cc); | 433 artifact.out(this.readDocument("src/test/ressources/" + |
512 artifact | 434 "verticalprofile_mesh/" + |
513 .out( | 435 "verticalprofile_step_10_out_chart.xml"), |
514 this | 436 fos, cc); |
515 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_out_chart.xml"), | 437 artifact.out(this.readDocument("src/test/ressources/" + |
516 fos, cc); | 438 "verticalprofile_mesh/" + |
517 artifact | 439 "verticalprofile_step_10_out_csv.xml"), |
518 .out( | 440 fos3, cc); |
519 this | 441 artifact.out(this.readDocument("src/test/ressources/" + |
520 .readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_out_csv.xml"), | 442 "verticalprofile_mesh/" + |
521 fos3, cc); | 443 "verticalprofile_step_10_out_odv.xml"), |
444 fos4, cc); | |
522 } catch (Exception e) { | 445 } catch (Exception e) { |
523 log.error(e, e); | 446 log.error(e, e); |
524 fail(); | 447 fail(); |
525 } finally { | 448 } finally { |
526 try { | 449 try { |
528 fos.close(); | 451 fos.close(); |
529 fos2.flush(); | 452 fos2.flush(); |
530 fos2.close(); | 453 fos2.close(); |
531 fos3.flush(); | 454 fos3.flush(); |
532 fos3.close(); | 455 fos3.close(); |
456 fos4.flush(); | |
457 fos4.close(); | |
533 } catch (Exception e) { | 458 } catch (Exception e) { |
534 log.error(e, e); | 459 log.error(e, e); |
535 } | 460 } |
536 } | 461 } |
537 } catch (Exception e) { | 462 } catch (Exception e) { |