diff 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
line wrap: on
line diff
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java	Wed Sep 30 13:42:51 2009 +0000
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java	Wed Sep 30 13:48:02 2009 +0000
@@ -426,6 +426,76 @@
         }
     }
     
+    public void testHorizontalProfileInstantaneousPointArtifact(){
+        try {
+            log.debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact");
+            String artefactName = "fis_instantaneouspoint"; 
+            ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
+            assertNotNull(artifactFactory);
+            log.debug("VerticalProfile-ArtifactFactory is available");
+            Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
+            assertNotNull(artifact);
+            log.debug("VerticalProfile-Artifact is available");
+            
+            
+            CallContext cc = new TestCallContext(bootstrap.getContext());
+            
+            // Erster Schritt
+            this.doNextStep(artifact, cc,
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_feed.xml",
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_advance.xml");
+            
+            // Zweiter Schritt
+            this.doNextStep(artifact, cc,
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_feed.xml",
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_advance.xml");
+            // Dritter Schritt
+            this.doNextStep(artifact, cc,
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_feed.xml",
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_advance.xml");
+            // Vierter Schritt
+            this.doNextStep(artifact, cc,
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_feed.xml",
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_advance.xml");
+           // Fünfter Schritt
+            this.doNextStep(artifact, cc,
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_feed.xml",
+                    "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_advance.xml");
+            
+            
+            Document outputData = artifact.describe(null);
+            FileOutputStream fos = null;
+            FileOutputStream fos2 = null;
+            FileOutputStream fos3 = null;
+            try{
+                fos = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".png");
+                fos2 = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml");
+                fos3 = new FileOutputStream("src/test/results/horizontalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv");
+                artifact.feed(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_feed.xml"), cc);
+                //artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_statistics.xml"),fos2, cc);
+                artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_chart.xml"),fos, cc);
+//                artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_csv.xml"),fos3, cc);
+            } catch (Exception e){
+                log.error(e,e);
+                fail();
+            }finally{
+                try {
+                    fos.flush();
+                    fos.close();
+                    fos2.flush();
+                    fos2.close();
+                    fos3.flush();
+                    fos3.close();
+                } catch (Exception e) {
+                    log.error(e,e);
+                }
+            }
+        } catch (Exception e) {
+            log.error(e,e);
+            fail();
+        }
+    }
+    
     protected void createFile(byte[] content, String fileName){
         try {
             FileOutputStream fos = new FileOutputStream(new File(fileName));

http://dive4elements.wald.intevation.org