comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java @ 875:5e9efdda6894

merged gnv-artifacts/1.0
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:56 +0200
parents c4156275c1e1
children f953c9a559d8
comparison
equal deleted inserted replaced
722:bb3ffe7d719e 875:5e9efdda6894
1 package de.intevation.gnv.artifacts;
2
3 import de.intevation.artifacts.Artifact;
4 import de.intevation.artifacts.ArtifactFactory;
5 import de.intevation.artifacts.CallContext;
6
7 import java.io.FileOutputStream;
8
9 import org.apache.log4j.Logger;
10
11 import org.w3c.dom.Document;
12
13 /**
14 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
15 *
16 */
17 public class MeshTimeSeriesTestCase extends GNVArtifactsTestCaseBase {
18
19 private static Logger log = Logger.getLogger(MeshTimeSeriesTestCase.class);
20
21 /**
22 * Constructor
23 */
24 public MeshTimeSeriesTestCase() {
25 }
26
27 /**
28 * Constructor
29 * @param name
30 */
31 public MeshTimeSeriesTestCase(String name) {
32 super(name);
33 }
34
35 /**
36 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact()
37 */
38 @Override
39 public void testArtifact() {
40 try {
41 log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact");
42 String artefactName = "fis_modeldata";
43 ArtifactFactory artifactFactory = this
44 .getArtifactFactory(artefactName);
45 assertNotNull(artifactFactory);
46 log.debug("TimeSeriesMesh-ArtifactFactory is available");
47
48 Artifact artifact = createArtifact(artifactFactory);
49
50 CallContext cc = createCallContext(artifactFactory);
51
52 Document describeDocument = this.readDocument("src/test/ressources/timeseries_mesh/timeseries_describe.xml");
53
54 int steps = 8;
55
56 for (int i = 1; i <= steps; i++){
57 this.doNextStep(
58 artifact,
59 cc,
60 "src/test/ressources/timeseries_mesh/" +
61 "timeseries_step_0"+i+"_feed.xml",
62 "src/test/ressources/timeseries_mesh/" +
63 "timeseries_step_0"+i+"_advance.xml",
64 describeDocument);
65 }
66 // Achter Schritt
67 Document outputData = artifact.describe(describeDocument,cc);
68 FileOutputStream fos = null;
69 FileOutputStream fos2 = null;
70 FileOutputStream fos3 = null;
71 FileOutputStream fos4 = null;
72 try {
73 fos = new FileOutputStream("src/test/results/timeseries_mesh"
74 + System.currentTimeMillis()
75 + ".png");
76 fos2 = new FileOutputStream("src/test/results/timeseries_mesh"
77 + System.currentTimeMillis()
78 + ".xml");
79 fos3 = new FileOutputStream("src/test/results/timeseries_mesh"
80 + System.currentTimeMillis()
81 + ".csv");
82 fos4 = new FileOutputStream("src/test/results/timeseries_mesh"
83 + System.currentTimeMillis()
84 + ".odv");
85 artifact
86 .out(
87 this
88 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_statistics.xml"),
89 fos2, cc);
90 artifact
91 .out(
92 this
93 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_chart.xml"),
94 fos, cc);
95 artifact
96 .out(
97 this
98 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_csv.xml"),
99 fos3, cc);
100 artifact
101 .out(
102 this
103 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_odv.xml"),
104 fos4, cc);
105 } catch (Exception e) {
106 log.error(e, e);
107 fail();
108 } finally {
109 try {
110 fos.flush();
111 fos.close();
112 fos2.flush();
113 fos2.close();
114 fos3.flush();
115 fos3.close();
116 } catch (Exception e) {
117 log.error(e, e);
118 }
119 }
120 } catch (Exception e) {
121 log.error(e, e);
122 fail();
123 }
124 }
125
126 }

http://dive4elements.wald.intevation.org