Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 114:d8d38a4dd965
Added TestCase for HorizontalProfiles of InstataneousPoints and the required Configuration
gnv-artifacts/trunk@164 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Wed, 30 Sep 2009 13:48:02 +0000 |
parents | 065ec0a29394 |
children | 820238357bab |
comparison
equal
deleted
inserted
replaced
113:a16f5267803e | 114:d8d38a4dd965 |
---|---|
424 log.error(e,e); | 424 log.error(e,e); |
425 fail(); | 425 fail(); |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 public void testHorizontalProfileInstantaneousPointArtifact(){ | |
430 try { | |
431 log.debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact"); | |
432 String artefactName = "fis_instantaneouspoint"; | |
433 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); | |
434 assertNotNull(artifactFactory); | |
435 log.debug("VerticalProfile-ArtifactFactory is available"); | |
436 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); | |
437 assertNotNull(artifact); | |
438 log.debug("VerticalProfile-Artifact is available"); | |
439 | |
440 | |
441 CallContext cc = new TestCallContext(bootstrap.getContext()); | |
442 | |
443 // Erster Schritt | |
444 this.doNextStep(artifact, cc, | |
445 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_feed.xml", | |
446 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_advance.xml"); | |
447 | |
448 // Zweiter Schritt | |
449 this.doNextStep(artifact, cc, | |
450 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_feed.xml", | |
451 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_advance.xml"); | |
452 // Dritter Schritt | |
453 this.doNextStep(artifact, cc, | |
454 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_feed.xml", | |
455 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_advance.xml"); | |
456 // Vierter Schritt | |
457 this.doNextStep(artifact, cc, | |
458 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_feed.xml", | |
459 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_advance.xml"); | |
460 // Fünfter Schritt | |
461 this.doNextStep(artifact, cc, | |
462 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_feed.xml", | |
463 "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_advance.xml"); | |
464 | |
465 | |
466 Document outputData = artifact.describe(null); | |
467 FileOutputStream fos = null; | |
468 FileOutputStream fos2 = null; | |
469 FileOutputStream fos3 = null; | |
470 try{ | |
471 fos = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".png"); | |
472 fos2 = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml"); | |
473 fos3 = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv"); | |
474 artifact.feed(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_feed.xml"), cc); | |
475 //artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_statistics.xml"),fos2, cc); | |
476 artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_chart.xml"),fos, cc); | |
477 // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_csv.xml"),fos3, cc); | |
478 } catch (Exception e){ | |
479 log.error(e,e); | |
480 fail(); | |
481 }finally{ | |
482 try { | |
483 fos.flush(); | |
484 fos.close(); | |
485 fos2.flush(); | |
486 fos2.close(); | |
487 fos3.flush(); | |
488 fos3.close(); | |
489 } catch (Exception e) { | |
490 log.error(e,e); | |
491 } | |
492 } | |
493 } catch (Exception e) { | |
494 log.error(e,e); | |
495 fail(); | |
496 } | |
497 } | |
498 | |
429 protected void createFile(byte[] content, String fileName){ | 499 protected void createFile(byte[] content, String fileName){ |
430 try { | 500 try { |
431 FileOutputStream fos = new FileOutputStream(new File(fileName)); | 501 FileOutputStream fos = new FileOutputStream(new File(fileName)); |
432 ByteArrayInputStream bis = new ByteArrayInputStream(content); | 502 ByteArrayInputStream bis = new ByteArrayInputStream(content); |
433 byte[] buf = new byte[4096]; | 503 byte[] buf = new byte[4096]; |