Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 102:994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
gnv-artifacts/trunk@150 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 09:55:40 +0000 |
parents | 504570de21fd |
children | 4042844339ee |
comparison
equal
deleted
inserted
replaced
101:e01c163ea5b0 | 102:994a39b084d6 |
---|---|
20 import org.w3c.dom.Document; | 20 import org.w3c.dom.Document; |
21 import org.xml.sax.SAXException; | 21 import org.xml.sax.SAXException; |
22 | 22 |
23 import de.intevation.artifactdatabase.Config; | 23 import de.intevation.artifactdatabase.Config; |
24 import de.intevation.artifactdatabase.FactoryBootstrap; | 24 import de.intevation.artifactdatabase.FactoryBootstrap; |
25 import de.intevation.artifactdatabase.ArtifactDatabaseImpl.CallContextImpl; | |
25 import de.intevation.artifacts.Artifact; | 26 import de.intevation.artifacts.Artifact; |
26 import de.intevation.artifacts.ArtifactFactory; | 27 import de.intevation.artifacts.ArtifactFactory; |
28 import de.intevation.artifacts.CallContext; | |
27 import de.intevation.gnv.artifacts.context.GNVArtifactContext; | 29 import de.intevation.gnv.artifacts.context.GNVArtifactContext; |
28 import de.intevation.gnv.utils.ArtifactXMLUtilities; | 30 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
29 | 31 |
30 /** | 32 /** |
31 * @author Tim Englich <tim.englich@intevation.de> | 33 * @author Tim Englich <tim.englich@intevation.de> |
75 log.debug("TimeSeries-ArtifactFactory is available"); | 77 log.debug("TimeSeries-ArtifactFactory is available"); |
76 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); | 78 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
77 assertNotNull(artifact); | 79 assertNotNull(artifact); |
78 log.debug("TimeSeries-Artifact is available"); | 80 log.debug("TimeSeries-Artifact is available"); |
79 | 81 |
82 | |
83 CallContext cc = new TestCallContext(bootstrap.getContext()); | |
84 | |
80 // Erster Schritt | 85 // Erster Schritt |
81 Document outputData = artifact.describe(null); | 86 Document outputData = artifact.describe(null); |
82 this.writeDocument2Log(outputData); | 87 this.writeDocument2Log(outputData); |
83 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), null); | 88 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc); |
84 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), null); | 89 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc); |
85 this.writeDocument2Log(outputData); | 90 this.writeDocument2Log(outputData); |
86 | 91 |
87 // Zweiter Schritt | 92 // Zweiter Schritt |
88 outputData = artifact.describe(null); | 93 outputData = artifact.describe(null); |
89 this.writeDocument2Log(outputData); | 94 this.writeDocument2Log(outputData); |
90 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), null); | 95 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc); |
91 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), null); | 96 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc); |
92 this.writeDocument2Log(outputData); | 97 this.writeDocument2Log(outputData); |
93 | 98 |
94 // Dritter Schritt | 99 // Dritter Schritt |
95 outputData = artifact.describe(null); | 100 outputData = artifact.describe(null); |
96 this.writeDocument2Log(outputData); | 101 this.writeDocument2Log(outputData); |
97 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), null); | 102 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc); |
98 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), null); | 103 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc); |
99 this.writeDocument2Log(outputData); | 104 this.writeDocument2Log(outputData); |
100 | 105 |
101 | 106 |
102 // Vierter Schritt | 107 // Vierter Schritt |
103 outputData = artifact.describe(null); | 108 outputData = artifact.describe(null); |
104 this.writeDocument2Log(outputData); | 109 this.writeDocument2Log(outputData); |
105 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), null); | 110 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), cc); |
106 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"), null); | 111 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc); |
107 this.writeDocument2Log(outputData); | 112 this.writeDocument2Log(outputData); |
108 | 113 |
109 // Fünfter Schritt | 114 // Fünfter Schritt |
110 outputData = artifact.describe(null); | 115 outputData = artifact.describe(null); |
111 FileOutputStream fos = null; | 116 FileOutputStream fos = null; |
112 try{ | 117 try{ |
113 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); | 118 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); |
114 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), null); | 119 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc); |
115 artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, null); | 120 artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, cc); |
116 } catch (Exception e){ | 121 } catch (Exception e){ |
117 log.error(e,e); | 122 log.error(e,e); |
118 fail(); | 123 fail(); |
119 }finally{ | 124 }finally{ |
120 try { | 125 try { |