diff gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 219:f8cb64d5fe4f

Added the Testcase for Horizontal Cross-Sections gnv-artifacts/trunk@279 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 30 Oct 2009 11:42:58 +0000
parents c0a798299efc
children 3e82b4f1c455
line wrap: on
line diff
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java	Fri Oct 30 11:26:03 2009 +0000
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java	Fri Oct 30 11:42:58 2009 +0000
@@ -870,6 +870,102 @@
         }
     }
     
+    public void testHorizontalCrossSectionMeshArtifact() {
+        try {
+            log.debug("GNVArtifactsTestCase.testHorizontalCrossSectionMeshArtifact");
+            String artefactName = "fis_modeldata";
+            ArtifactFactory artifactFactory = this
+                    .getArtifactFactory(artefactName);
+            assertNotNull(artifactFactory);
+            log.debug("HorizontalCrossSectionMesh-ArtifactFactory is available");
+            Artifact artifact = artifactFactory.createArtifact(
+                    "" + System.currentTimeMillis(), bootstrap.getContext());
+            assertNotNull(artifact);
+            log.debug("HorizontalCrossSectionMesh-Artifact is available");
+
+            CallContext cc = createCallContext();
+
+            // Erster Schritt
+            this
+                    .doNextStep(
+                            artifact,
+                            cc,
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_01_feed.xml",
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_01_advance.xml");
+
+            // Zweiter Schritt
+            this
+                    .doNextStep(
+                            artifact,
+                            cc,
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_02_feed.xml",
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_02_advance.xml");
+            // Dritter Schritt
+            this
+                    .doNextStep(
+                            artifact,
+                            cc,
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_03_feed.xml",
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_03_advance.xml");
+            // Vierter Schritt
+            this
+                    .doNextStep(
+                            artifact,
+                            cc,
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_04_feed.xml",
+                            "src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_04_advance.xml");
+            
+            Document outputData = artifact.describe(cc);
+            FileOutputStream fos = null;
+            FileOutputStream fos2 = null;
+            FileOutputStream fos3 = null;
+            try {
+                fos = new FileOutputStream(
+                        "src/test/results/horizontalcrosssection_mesh"
+                                + System.currentTimeMillis() + ".png");
+                fos2 = new FileOutputStream(
+                        "src/test/results/horizontalcrosssection_mesh"
+                                + System.currentTimeMillis() + ".xml");
+                fos3 = new FileOutputStream(
+                        "src/test/results/horizontalcrosssection_mesh"
+                                + System.currentTimeMillis() + ".csv");
+                artifact
+                        .feed(this.readDocument("src/test/ressources/horizontal" +
+                                                "crosssection_mesh/horizontalcrosssection_step_05_feed.xml"),
+                              cc);
+                artifact
+                        .out(this.readDocument("src/test/ressources/horizontal" +
+                                               "crosssection_mesh/horizontalcrosssection_step_05_out_statistics.xml"),
+                              fos2, cc);
+                artifact
+                        .out(this.readDocument("src/test/ressources/horizontal" +
+                                               "crosssection_mesh/horizontalcrosssection_step_05_out_chart.xml"),
+                              fos, cc);
+                artifact.out(this.readDocument("src/test/ressources/horizontal" +
+                                               "crosssection_mesh/horizontalcrosssection_step_05_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();
+        }
+    }
+    
     public void testVerticalCrossSectionMeshArtifact() {
         try {
             log.debug("GNVArtifactsTestCase.testHVerticalCrossSectionMeshArtifact");

http://dive4elements.wald.intevation.org