comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java @ 657:af3f56758f59

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

http://dive4elements.wald.intevation.org