Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 104:5e086156e3d1
Bugfix: Remove leading- and trailingwhitespaces from Date- and Integervalues
gnv-artifacts/trunk@153 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 12:03:39 +0000 |
parents | 4042844339ee |
children | 11b2d43da90d |
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(){ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); |
72
1fece4da4f2f
TestCase moved from TimeSeriesArtifact to FISArtifact. Used FIS: Marnet
Tim Englich <tim.englich@intevation.de>
parents:
69
diff
changeset
|
73 String artefactName = "fis_marnet"; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 assertNotNull(artifactFactory); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 log.debug("TimeSeries-ArtifactFactory is available"); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 assertNotNull(artifact); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 log.debug("TimeSeries-Artifact is available"); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 |
102
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
81 |
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
82 CallContext cc = new TestCallContext(bootstrap.getContext()); |
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
83 |
60
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
84 // Erster Schritt |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
85 Document outputData = artifact.describe(null); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
86 this.writeDocument2Log(outputData); |
102
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
87 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc); |
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
88 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc); |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
89 this.writeDocument2Log(outputData); |
60
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
90 |
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
91 // Zweiter Schritt |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
92 outputData = artifact.describe(null); |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
93 this.writeDocument2Log(outputData); |
102
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
94 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc); |
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
95 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc); |
60
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
96 this.writeDocument2Log(outputData); |
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
97 |
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
98 // Dritter Schritt |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
99 outputData = artifact.describe(null); |
60
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
100 this.writeDocument2Log(outputData); |
102
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
101 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc); |
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
102 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc); |
60
eed1baaeb481
TestCase implemented until Choosing the TimeInetval of an TimeSeries
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
103 this.writeDocument2Log(outputData); |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 |
62 | 106 // Vierter Schritt |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
107 outputData = artifact.describe(null); |
62 | 108 this.writeDocument2Log(outputData); |
102
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
109 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), cc); |
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
110 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc); |
62 | 111 this.writeDocument2Log(outputData); |
112 | |
113 // F�nfter Schritt | |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
114 outputData = artifact.describe(null); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
115 FileOutputStream fos = null; |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
116 try{ |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
117 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); |
102
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
118 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc); |
994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
119 artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, cc); |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
120 } catch (Exception e){ |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
121 log.error(e,e); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
122 fail(); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
123 }finally{ |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
124 try { |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
125 fos.flush(); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
126 fos.close(); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
127 } catch (Exception e) { |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
128 log.error(e,e); |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
129 } |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
72
diff
changeset
|
130 } |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 |
103
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
133 public void testVerticalProfileArtifact(){ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
134 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
135 String artefactName = "fis_marnet"; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
136 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
137 assertNotNull(artifactFactory); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
138 log.debug("VerticalProfile-ArtifactFactory is available"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
139 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
140 assertNotNull(artifact); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
141 log.debug("VerticalProfile-Artifact is available"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
142 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
143 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
144 CallContext cc = new TestCallContext(bootstrap.getContext()); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
145 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
146 // Erster Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
147 Document outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
148 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
149 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
150 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_advance.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
151 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
152 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
153 // Zweiter Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
154 outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
155 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
156 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
157 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
158 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
159 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
160 // Dritter Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
161 outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
162 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
163 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
164 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
165 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
166 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
167 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
168 // Vierter Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
169 outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
170 FileOutputStream fos = null; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
171 FileOutputStream fos2 = null; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
172 FileOutputStream fos3 = null; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
173 try{ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
174 fos = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".png"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
175 fos2 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".xml"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
176 fos3 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".csv"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
177 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
178 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),fos2, cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
179 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),fos, cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
180 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.xml"),fos3, cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
181 } catch (Exception e){ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
182 log.error(e,e); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
183 fail(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
184 }finally{ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
185 try { |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
186 fos.flush(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
187 fos.close(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
188 fos2.flush(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
189 fos2.close(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
190 fos3.flush(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
191 fos3.close(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
192 } catch (Exception e) { |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
193 log.error(e,e); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
194 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
195 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
196 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
197 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
198 public void testVerticalProfileInstantaneousPointArtifact(){ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
199 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
200 String artefactName = "fis_instantaneouspoint"; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
201 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
202 assertNotNull(artifactFactory); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
203 log.debug("VerticalProfile-ArtifactFactory is available"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
204 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
205 assertNotNull(artifact); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
206 log.debug("VerticalProfile-Artifact is available"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
207 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
208 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
209 CallContext cc = new TestCallContext(bootstrap.getContext()); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
210 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
211 // Erster Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
212 Document outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
213 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
214 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
215 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
216 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
217 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
218 // Zweiter Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
219 outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
220 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
221 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
222 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
223 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
224 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
225 // Dritter Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
226 outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
227 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
228 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
229 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
230 this.writeDocument2Log(outputData); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
231 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
232 |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
233 // Vierter Schritt |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
234 outputData = artifact.describe(null); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
235 FileOutputStream fos = null; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
236 FileOutputStream fos2 = null; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
237 FileOutputStream fos3 = null; |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
238 try{ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
239 fos = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".png"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
240 fos2 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
241 fos3 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv"); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
242 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"), cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
243 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),fos2, cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
244 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),fos, cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
245 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.xml"),fos3, cc); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
246 } catch (Exception e){ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
247 log.error(e,e); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
248 fail(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
249 }finally{ |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
250 try { |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
251 fos.flush(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
252 fos.close(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
253 fos2.flush(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
254 fos2.close(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
255 fos3.flush(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
256 fos3.close(); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
257 } catch (Exception e) { |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
258 log.error(e,e); |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
259 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
260 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
261 } |
4042844339ee
Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents:
102
diff
changeset
|
262 |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
263 protected void createFile(byte[] content, String fileName){ |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
264 try { |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
265 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
|
266 ByteArrayInputStream bis = new ByteArrayInputStream(content); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
267 byte[] buf = new byte[4096]; |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
268 while (bis.read(buf) > 0){ |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
269 fos.write(buf); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
270 } |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
271 fos.flush(); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
272 fos.close(); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
273 } catch (FileNotFoundException e) { |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
274 log.error(e,e); |
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
275 } catch (IOException e) { |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
276 log.error(e,e); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
277 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
278 } |
69
f24c825144bc
TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents:
62
diff
changeset
|
279 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
280 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
281 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
282 * @param artefactName |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
283 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
284 private ArtifactFactory getArtifactFactory(String artefactName){ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
285 log.debug("GNVArtifactsTestCase.getArtifactFactory"); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
286 ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories(); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
287 for (int i = 0; i < artifactFactories.length; i++){ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
288 if (artifactFactories[i].getName().equals(artefactName)){ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
289 log.debug("ArtifactFactory wurde gefunden."); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
290 return artifactFactories[i]; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
291 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
292 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
293 return null; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
294 } |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
295 |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
296 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
|
297 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
|
298 } |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
299 |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
300 |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
301 protected Document readDocument(String fileName){ |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
302 Document returnValue = null; |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
303 try { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
304 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
305 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
306 returnValue = docBuilder.parse (new File(fileName)); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
307 } catch (ParserConfigurationException e) { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
308 log.error(e,e); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
309 } catch (SAXException e) { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
310 log.error(e,e); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
311 } catch (IOException e) { |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
312 log.error(e,e); |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
313 } |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
314 return returnValue; |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
315 } |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
316 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
317 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
318 } |