Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 111:065ec0a29394
Integrate the type Point into the ArtifactMethod.
Integrate Responstest for feed-Requests into the JUnitTest
gnv-artifacts/trunk@160 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 15:30:03 +0000 |
parents | 678aad19a08d |
children | d8d38a4dd965 |
rev | line source |
---|---|
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.artifacts; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
6 import java.io.ByteArrayInputStream; |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
7 import java.io.File; |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
8 import java.io.FileNotFoundException; |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
9 import java.io.FileOutputStream; |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
10 import java.io.IOException; |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
11 |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
12 import javax.xml.parsers.DocumentBuilder; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 import javax.xml.parsers.DocumentBuilderFactory; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 import javax.xml.parsers.ParserConfigurationException; |
72
1fece4da4f2f
TestCase moved from TimeSeriesArtifact to FISArtifact. Used FIS: Marnet
Tim Englich <tim.englich@intevation.de>
parents:
69
diff
changeset
|
15 |
1fece4da4f2f
TestCase moved from TimeSeriesArtifact to FISArtifact. Used FIS: Marnet
Tim Englich <tim.englich@intevation.de>
parents:
69
diff
changeset
|
16 import junit.framework.TestCase; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 import org.apache.log4j.BasicConfigurator; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 import org.apache.log4j.Logger; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 import org.w3c.dom.Document; |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
21 import org.xml.sax.SAXException; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifactdatabase.Config; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifactdatabase.FactoryBootstrap; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.artifacts.Artifact; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.artifacts.ArtifactFactory; |
102
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
27 import de.intevation.artifacts.CallContext; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.gnv.artifacts.context.GNVArtifactContext; |
72
1fece4da4f2f
TestCase moved from TimeSeriesArtifact to FISArtifact. Used FIS: Marnet
Tim Englich <tim.englich@intevation.de>
parents:
69
diff
changeset
|
29 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 * @author Tim Englich <tim.englich@intevation.de> |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 * |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 public class GNVArtifactsTestCase extends TestCase { |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 * the logger, used to log exceptions and additonaly information |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 private static Logger log = null; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 static { |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 BasicConfigurator.configure(); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 log = Logger.getLogger(GNVArtifactContext.class); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
47 private String configurationDir = "src/test/ressources/"; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 private FactoryBootstrap bootstrap = null; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 * Constructor |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 * @param name |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 public GNVArtifactsTestCase(String name) { |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 super(name); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 * @see junit.framework.TestCase#setUp() |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 protected void setUp() throws Exception { |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 log.debug("GNVArtifactsTestCase.setUp"); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 super.setUp(); |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
64 log.info(Config.CONFIG_DIR + " ==> "+configurationDir); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
65 System.setProperty(Config.CONFIG_DIR, configurationDir); |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 log.info("Bootstrap wird initialisiert."); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 bootstrap = new FactoryBootstrap(); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 bootstrap.boot(); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 public void testTimeSeriesArtifact(){ |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
72 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
73 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
74 String artefactName = "fis_marnet"; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
75 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
76 assertNotNull(artifactFactory); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
77 log.debug("TimeSeries-ArtifactFactory is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
78 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
79 assertNotNull(artifact); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
80 log.debug("TimeSeries-Artifact is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
81 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
82 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
83 CallContext cc = new TestCallContext(bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
84 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
85 // Erster Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
86 |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
87 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
88 "src/test/ressources/timeseries/timeseries_step_01_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
89 "src/test/ressources/timeseries/timeseries_step_01_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
90 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
91 // Zweiter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
92 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
93 "src/test/ressources/timeseries/timeseries_step_02_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
94 "src/test/ressources/timeseries/timeseries_step_02_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
95 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
96 // Dritter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
97 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
98 "src/test/ressources/timeseries/timeseries_step_03_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
99 "src/test/ressources/timeseries/timeseries_step_03_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
100 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
101 // Vierter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
102 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
103 "src/test/ressources/timeseries/timeseries_step_04_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
104 "src/test/ressources/timeseries/timeseries_step_04_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
105 |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
106 Document outputData; |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
107 // F�nfter Schritt |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
108 outputData = artifact.describe(null); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
109 FileOutputStream fos = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
110 try{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
111 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
112 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
113 artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
114 } catch (Exception e){ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
115 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
116 fail(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
117 }finally{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
118 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
119 fos.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
120 fos.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
121 } catch (Exception e) { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
122 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
123 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
124 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
125 } catch (Exception e) { |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
126 log.error(e,e); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
127 fail(); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
128 } |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 } |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
130 |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
131 /** |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
132 * @param artifact |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
133 * @param cc |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
134 * @throws Exception |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
135 */ |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
136 private void doNextStep(Artifact artifact, CallContext cc, String feedDocument, String advanceDocument) throws Exception { |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
137 Document outputData = artifact.describe(null); |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
138 this.writeDocument2Log(outputData); |
111
065ec0a29394
Integrate the type Point into the ArtifactMethod.
Tim Englich <tim.englich@intevation.de>
parents:
109
diff
changeset
|
139 outputData = artifact.feed(this.readDocument(feedDocument), cc); |
065ec0a29394
Integrate the type Point into the ArtifactMethod.
Tim Englich <tim.englich@intevation.de>
parents:
109
diff
changeset
|
140 this.check4ExceptionReport(outputData); |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
141 outputData = artifact.advance(this.readDocument(advanceDocument), cc); |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
142 this.writeDocument2Log(outputData); |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
143 this.check4ExceptionReport(outputData); |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
144 } |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
145 |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
146 public void testTimeSeriesMeshArtifact(){ |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
147 try { |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
148 log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact"); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
149 String artefactName = "fis_modeldata"; |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
150 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
151 assertNotNull(artifactFactory); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
152 log.debug("TimeSeriesMesh-ArtifactFactory is available"); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
153 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
154 assertNotNull(artifact); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
155 log.debug("TimeSeriesMesh-Artifact is available"); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
156 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
157 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
158 CallContext cc = new TestCallContext(bootstrap.getContext()); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
159 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
160 // Erster Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
161 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
162 "src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
163 "src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml"); |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
164 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
165 // Zweiter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
166 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
167 "src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
168 "src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml"); |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
169 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
170 // Dritter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
171 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
172 "src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
173 "src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml"); |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
174 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
175 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
176 // Vierter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
177 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
178 "src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
179 "src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml"); |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
180 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
181 // F�nfter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
182 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
183 "src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
184 "src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml"); |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
185 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
186 // Sechster Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
187 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
188 "src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
189 "src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml"); |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
190 |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
191 // Siebter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
192 Document outputData = artifact.describe(null); |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
193 FileOutputStream fos = null; |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
194 FileOutputStream fos2 = null; |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
195 FileOutputStream fos3 = null; |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
196 try{ |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
197 fos = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".png"); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
198 fos2 = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".xml"); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
199 fos3 = new FileOutputStream("src/test/results/timeseries_mesh"+System.currentTimeMillis()+".csv"); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
200 artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_feed.xml"), cc); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
201 artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_statistics.xml"),fos2, cc); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
202 artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_chart.xml"),fos, cc); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
203 artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_csv.xml"),fos3, cc); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
204 } catch (Exception e){ |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
205 log.error(e,e); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
206 fail(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
207 }finally{ |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
208 try { |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
209 fos.flush(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
210 fos.close(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
211 fos2.flush(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
212 fos2.close(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
213 fos3.flush(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
214 fos3.close(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
215 } catch (Exception e) { |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
216 log.error(e,e); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
217 } |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
218 } |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
219 } catch (Exception e) { |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
220 log.error(e,e); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
221 fail(); |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
222 } |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
223 } |
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
224 |
103
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
225 public void testVerticalProfileArtifact(){ |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
226 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
227 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
228 String artefactName = "fis_marnet"; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
229 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
230 assertNotNull(artifactFactory); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
231 log.debug("VerticalProfile-ArtifactFactory is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
232 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
233 assertNotNull(artifact); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
234 log.debug("VerticalProfile-Artifact is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
235 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
236 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
237 CallContext cc = new TestCallContext(bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
238 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
239 // Erster Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
240 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
241 "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
242 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
243 |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
244 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
245 // Zweiter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
246 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
247 "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
248 "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
249 |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
250 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
251 // Dritter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
252 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
253 "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
254 "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"); |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
255 |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
256 |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
257 // Vierter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
258 Document outputData = artifact.describe(null); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
259 FileOutputStream fos = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
260 FileOutputStream fos2 = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
261 FileOutputStream fos3 = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
262 try{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
263 fos = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".png"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
264 fos2 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".xml"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
265 fos3 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".csv"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
266 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"), cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
267 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),fos2, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
268 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),fos, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
269 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.xml"),fos3, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
270 } catch (Exception e){ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
271 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
272 fail(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
273 }finally{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
274 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
275 fos.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
276 fos.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
277 fos2.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
278 fos2.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
279 fos3.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
280 fos3.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
281 } catch (Exception e) { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
282 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
283 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
284 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
285 } catch (Exception e) { |
103
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
286 log.error(e,e); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
287 fail(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
288 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
289 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
290 |
105
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
291 public void testVerticalProfileMeshArtifact(){ |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
292 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
293 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
294 String artefactName = "fis_modeldata"; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
295 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
296 assertNotNull(artifactFactory); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
297 log.debug("VerticalProfile-ArtifactFactory is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
298 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
299 assertNotNull(artifact); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
300 log.debug("VerticalProfile-Artifact is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
301 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
302 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
303 CallContext cc = new TestCallContext(bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
304 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
305 // Erster Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
306 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
307 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
308 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
309 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
310 // Zweiter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
311 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
312 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
313 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
314 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
315 // Dritter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
316 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
317 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
318 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
319 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
320 // Vierter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
321 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
322 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
323 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
324 |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
325 // F�nfter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
326 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
327 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
328 "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
329 |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
330 // Sechster Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
331 Document outputData = artifact.describe(null); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
332 FileOutputStream fos = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
333 FileOutputStream fos2 = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
334 FileOutputStream fos3 = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
335 try{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
336 fos = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".png"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
337 fos2 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".xml"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
338 fos3 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".csv"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
339 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml"), cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
340 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_statistics.xml"),fos2, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
341 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_chart.xml"),fos, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
342 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_csv.xml"),fos3, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
343 } catch (Exception e){ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
344 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
345 fail(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
346 }finally{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
347 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
348 fos.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
349 fos.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
350 fos2.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
351 fos2.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
352 fos3.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
353 fos3.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
354 } catch (Exception e) { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
355 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
356 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
357 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
358 } catch (Exception e) { |
105
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
359 log.error(e,e); |
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
360 fail(); |
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
361 } |
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
362 } |
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
363 |
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
364 |
11b2d43da90d
TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents:
103
diff
changeset
|
365 |
103
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
366 public void testVerticalProfileInstantaneousPointArtifact(){ |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
367 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
368 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
369 String artefactName = "fis_instantaneouspoint"; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
370 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
371 assertNotNull(artifactFactory); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
372 log.debug("VerticalProfile-ArtifactFactory is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
373 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
374 assertNotNull(artifact); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
375 log.debug("VerticalProfile-Artifact is available"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
376 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
377 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
378 CallContext cc = new TestCallContext(bootstrap.getContext()); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
379 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
380 // Erster Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
381 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
382 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
383 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
384 |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
385 // Zweiter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
386 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
387 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
388 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
389 |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
390 // Dritter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
391 this.doNextStep(artifact, cc, |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
392 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml", |
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
393 "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
394 |
107
4ebf9ad2e7eb
Added TestCase for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
106
diff
changeset
|
395 // Vierter Schritt |
109
678aad19a08d
Some Coderedundances refactored.
Tim Englich <tim.englich@intevation.de>
parents:
107
diff
changeset
|
396 Document outputData = artifact.describe(null); |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
397 FileOutputStream fos = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
398 FileOutputStream fos2 = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
399 FileOutputStream fos3 = null; |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
400 try{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
401 fos = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".png"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
402 fos2 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
403 fos3 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
404 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"), cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
405 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),fos2, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
406 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),fos, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
407 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.xml"),fos3, cc); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
408 } catch (Exception e){ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
409 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
410 fail(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
411 }finally{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
412 try { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
413 fos.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
414 fos.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
415 fos2.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
416 fos2.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
417 fos3.flush(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
418 fos3.close(); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
419 } catch (Exception e) { |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
420 log.error(e,e); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
421 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
422 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
423 } catch (Exception e) { |
103
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
424 log.error(e,e); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
425 fail(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
426 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
427 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
428 |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
429 protected void createFile(byte[] content, String fileName){ |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
430 try { |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
431 FileOutputStream fos = new FileOutputStream(new File(fileName)); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
432 ByteArrayInputStream bis = new ByteArrayInputStream(content); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
433 byte[] buf = new byte[4096]; |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
434 while (bis.read(buf) > 0){ |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
435 fos.write(buf); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
436 } |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
437 fos.flush(); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
438 fos.close(); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
439 } catch (FileNotFoundException e) { |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
440 log.error(e,e); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
441 } catch (IOException e) { |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
442 log.error(e,e); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
443 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
444 } |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
445 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
446 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
447 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
448 * @param artefactName |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
449 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
450 private ArtifactFactory getArtifactFactory(String artefactName){ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
451 log.debug("GNVArtifactsTestCase.getArtifactFactory"); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
452 ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories(); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
453 for (int i = 0; i < artifactFactories.length; i++){ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
454 if (artifactFactories[i].getName().equals(artefactName)){ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
455 log.debug("ArtifactFactory wurde gefunden."); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
456 return artifactFactories[i]; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
457 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
458 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
459 return null; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
460 } |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
461 |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
462 protected void writeDocument2Log(Document document){ |
72
1fece4da4f2f
TestCase moved from TimeSeriesArtifact to FISArtifact. Used FIS: Marnet
Tim Englich <tim.englich@intevation.de>
parents:
69
diff
changeset
|
463 log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
464 } |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
465 |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
466 |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
467 protected Document readDocument(String fileName){ |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
468 Document returnValue = null; |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
469 try { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
470 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
471 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
472 returnValue = docBuilder.parse (new File(fileName)); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
473 } catch (ParserConfigurationException e) { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
474 log.error(e,e); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
475 } catch (SAXException e) { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
476 log.error(e,e); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
477 } catch (IOException e) { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
478 log.error(e,e); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
479 } |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
480 return returnValue; |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
481 } |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
482 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
483 |
106
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
484 private void check4ExceptionReport(Document document) throws Exception{ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
485 document = new ArtifactXMLUtilities().reInitDocument(document); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
486 String message = Config.getStringXPath(document,"/exceptionreport/exception"); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
487 if (message != null){ |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
488 throw new Exception(message); |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
489 } |
10d9a440f52e
ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents:
105
diff
changeset
|
490 } |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
491 } |