annotate gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 106:10d9a440f52e

ExceptionTest for Responsdocuments added. UnitTests will now fail if the Artifact delivers an ExceptionReport using the advance Request. gnv-artifacts/trunk@155 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 29 Sep 2009 12:56:27 +0000
parents 11b2d43da90d
children 4ebf9ad2e7eb
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
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
86 Document outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
87 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
88 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
89 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
90 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
91 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
92
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
93 // Zweiter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
94 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
95 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
96 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
97 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
98 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
99
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
100 // Dritter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
101 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
102 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
103 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
104 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
105 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
106 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
107
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
108
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
109 // Vierter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
110 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
111 this.writeDocument2Log(outputData);
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_04_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
113 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
114 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
115 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
116
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
117 // F�nfter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
118 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
119 FileOutputStream fos = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
120 try{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
121 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
122 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
123 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
124 } catch (Exception e){
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
125 log.error(e,e);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
126 fail();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
127 }finally{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
128 try {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
129 fos.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
130 fos.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
131 } catch (Exception e) {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
132 log.error(e,e);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
133 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
134 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
135 } catch (Exception e) {
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 72
diff changeset
136 log.error(e,e);
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 72
diff changeset
137 fail();
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 72
diff changeset
138 }
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140
103
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
141 public void testVerticalProfileArtifact(){
106
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
142 try {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
143 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
144 String artefactName = "fis_marnet";
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
145 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
146 assertNotNull(artifactFactory);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
147 log.debug("VerticalProfile-ArtifactFactory is available");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
148 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
149 assertNotNull(artifact);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
150 log.debug("VerticalProfile-Artifact is available");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
151
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
152
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
153 CallContext cc = new TestCallContext(bootstrap.getContext());
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
154
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
155 // Erster Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
156 Document outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
157 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
158 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
159 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
160 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
161 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
162
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
163 // Zweiter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
164 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
165 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
166 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
167 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
168 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
169 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
170
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
171 // Dritter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
172 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
173 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
174 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
175 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
176 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
177 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
178
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
179 // Vierter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
180 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
181 FileOutputStream fos = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
182 FileOutputStream fos2 = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
183 FileOutputStream fos3 = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
184 try{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
185 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
186 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
187 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
188 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
189 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
190 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
191 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
192 } catch (Exception e){
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
193 log.error(e,e);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
194 fail();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
195 }finally{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
196 try {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
197 fos.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
198 fos.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
199 fos2.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
200 fos2.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
201 fos3.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
202 fos3.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
203 } catch (Exception e) {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
204 log.error(e,e);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
205 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
206 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
207 } catch (Exception e) {
103
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
208 log.error(e,e);
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
209 fail();
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 }
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
212
105
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
213 public void testVerticalProfileMeshArtifact(){
106
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
214 try {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
215 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
216 String artefactName = "fis_modeldata";
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
217 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
218 assertNotNull(artifactFactory);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
219 log.debug("VerticalProfile-ArtifactFactory is available");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
220 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
221 assertNotNull(artifact);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
222 log.debug("VerticalProfile-Artifact is available");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
223
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
224
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
225 CallContext cc = new TestCallContext(bootstrap.getContext());
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
226
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
227 // Erster Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
228 Document outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
229 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
230 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
231 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
232 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
233 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
234
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
235 // Zweiter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
236 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
237 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
238 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
239 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
240 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
241 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
242
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
243 // Dritter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
244 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
245 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
246 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
247 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
248 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
249 this.check4ExceptionReport(outputData);
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 // Vierter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
252 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
253 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
254 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
255 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
256 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
257 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
258
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
259 // F�nfter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
260 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
261 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
262 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
263 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
264 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
265 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
266
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
267 // Sechster Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
268 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
269 FileOutputStream fos = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
270 FileOutputStream fos2 = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
271 FileOutputStream fos3 = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
272 try{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
273 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
274 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
275 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
276 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
277 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
278 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
279 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
280 } catch (Exception e){
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
281 log.error(e,e);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
282 fail();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
283 }finally{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
284 try {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
285 fos.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
286 fos.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
287 fos2.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
288 fos2.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
289 fos3.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
290 fos3.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
291 } catch (Exception e) {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
292 log.error(e,e);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
293 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
294 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
295 } catch (Exception e) {
105
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
296 log.error(e,e);
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
297 fail();
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
298 }
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
299 }
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
300
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
301
11b2d43da90d TestCaseRequests for VerticalProfile FIS Mesh
Tim Englich <tim.englich@intevation.de>
parents: 103
diff changeset
302
103
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
303 public void testVerticalProfileInstantaneousPointArtifact(){
106
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
304 try {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
305 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
306 String artefactName = "fis_instantaneouspoint";
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
307 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
308 assertNotNull(artifactFactory);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
309 log.debug("VerticalProfile-ArtifactFactory is available");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
310 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
311 assertNotNull(artifact);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
312 log.debug("VerticalProfile-Artifact is available");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
313
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 CallContext cc = new TestCallContext(bootstrap.getContext());
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
316
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
317 // Erster Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
318 Document outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
319 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
320 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
321 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
322 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
323 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
324
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
325 // Zweiter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
326 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
327 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
328 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
329 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
330 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
331 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
332
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
333 // Dritter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
334 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
335 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
336 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
337 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"), cc);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
338 this.writeDocument2Log(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
339 this.check4ExceptionReport(outputData);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
340
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
341 // Vierter Schritt
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
342 outputData = artifact.describe(null);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
343 FileOutputStream fos = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
344 FileOutputStream fos2 = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
345 FileOutputStream fos3 = null;
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
346 try{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
347 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
348 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
349 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
350 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
351 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
352 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
353 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
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 fail();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
357 }finally{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
358 try {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
359 fos.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
360 fos.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
361 fos2.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
362 fos2.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
363 fos3.flush();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
364 fos3.close();
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
365 } catch (Exception e) {
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
366 log.error(e,e);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
367 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
368 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
369 } catch (Exception e) {
103
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
370 log.error(e,e);
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
371 fail();
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
372 }
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
373 }
4042844339ee Testcases for VerticalProfile and VerticalProfile Instantaneouspoint added
Tim Englich <tim.englich@intevation.de>
parents: 102
diff changeset
374
69
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
375 protected void createFile(byte[] content, String fileName){
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
376 try {
69
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
377 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
378 ByteArrayInputStream bis = new ByteArrayInputStream(content);
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
379 byte[] buf = new byte[4096];
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
380 while (bis.read(buf) > 0){
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
381 fos.write(buf);
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
382 }
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
383 fos.flush();
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
384 fos.close();
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
385 } catch (FileNotFoundException e) {
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
386 log.error(e,e);
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
387 } catch (IOException e) {
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
388 log.error(e,e);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
389 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
390 }
69
f24c825144bc TestCase Refactored to the new Folder-Based Configuration.
Tim Englich <tim.englich@intevation.de>
parents: 62
diff changeset
391
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
392
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
393 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
394 * @param artefactName
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
395 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
396 private ArtifactFactory getArtifactFactory(String artefactName){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
397 log.debug("GNVArtifactsTestCase.getArtifactFactory");
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
398 ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories();
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
399 for (int i = 0; i < artifactFactories.length; i++){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
400 if (artifactFactories[i].getName().equals(artefactName)){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
401 log.debug("ArtifactFactory wurde gefunden.");
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
402 return artifactFactories[i];
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
403 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
404 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
405 return null;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
406 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
407
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
408 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
409 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
410 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
411
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
412
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
413 protected Document readDocument(String fileName){
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
414 Document returnValue = null;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
415 try {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
416 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
417 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
418 returnValue = docBuilder.parse (new File(fileName));
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
419 } catch (ParserConfigurationException e) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
420 log.error(e,e);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
421 } catch (SAXException e) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
422 log.error(e,e);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
423 } catch (IOException e) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
424 log.error(e,e);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
425 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
426 return returnValue;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
427 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
428
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
429
106
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
430 private void check4ExceptionReport(Document document) throws Exception{
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
431 document = new ArtifactXMLUtilities().reInitDocument(document);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
432 String message = Config.getStringXPath(document,"/exceptionreport/exception");
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
433 if (message != null){
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
434 throw new Exception(message);
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
435 }
10d9a440f52e ExceptionTest for Responsdocuments added.
Tim Englich <tim.englich@intevation.de>
parents: 105
diff changeset
436 }
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
437 }

http://dive4elements.wald.intevation.org