diff gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 73:504570de21fd

Refactoring Work depending on Infrastructurchanges in the Artifact-Module gnv-artifacts/trunk@79 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 14 Sep 2009 10:32:38 +0000
parents 1fece4da4f2f
children 994a39b084d6
line wrap: on
line diff
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java	Thu Sep 10 13:14:03 2009 +0000
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java	Mon Sep 14 10:32:38 2009 +0000
@@ -78,39 +78,52 @@
         log.debug("TimeSeries-Artifact is available");
         
         // Erster Schritt
-        Document outputData = artifact.describe(bootstrap.getContext());
+        Document outputData = artifact.describe(null);
         this.writeDocument2Log(outputData);
-        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), bootstrap.getContext());
-        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), bootstrap.getContext());
+        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), null);
+        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), null);
         this.writeDocument2Log(outputData);
         
         // Zweiter Schritt
-        outputData = artifact.describe(bootstrap.getContext());
+        outputData = artifact.describe(null);
         this.writeDocument2Log(outputData);
-        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), bootstrap.getContext());
-        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), bootstrap.getContext());
+        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), null);
+        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), null);
         this.writeDocument2Log(outputData);
         
         // Dritter Schritt
-        outputData = artifact.describe(bootstrap.getContext());
+        outputData = artifact.describe(null);
         this.writeDocument2Log(outputData);
-        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), bootstrap.getContext());
-        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), bootstrap.getContext());
+        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), null);
+        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), null);
         this.writeDocument2Log(outputData);
         
         
         // Vierter Schritt
-        outputData = artifact.describe(bootstrap.getContext());
+        outputData = artifact.describe(null);
         this.writeDocument2Log(outputData);
-        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), bootstrap.getContext());
-        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"), bootstrap.getContext());
+        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), null);
+        outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"), null);
         this.writeDocument2Log(outputData);
         
         // Fünfter Schritt
-        outputData = artifact.describe(bootstrap.getContext());
-        artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), bootstrap.getContext());
-        byte[] result = artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"), bootstrap.getContext());
-        this.createFile(result, "src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png");
+        outputData = artifact.describe(null);
+        FileOutputStream fos = null;
+        try{
+            fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png");
+            artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), null);
+            artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, null);
+        } catch (Exception e){
+            log.error(e,e);
+            fail();
+        }finally{
+            try {
+                fos.flush();
+                fos.close();
+            } catch (Exception e) {
+                log.error(e,e);
+            }
+        }
     }
     
     protected void createFile(byte[] content, String fileName){

http://dive4elements.wald.intevation.org