comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java @ 345:c16c622ba2f3

Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven. gnv-artifacts/trunk@412 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 11 Dec 2009 10:02:10 +0000
parents
children 4939236c2dc9
comparison
equal deleted inserted replaced
344:44adf8918155 345:c16c622ba2f3
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 Artifact artifact = artifactFactory.createArtifact(
50 "" + System.currentTimeMillis(), bootstrap.getContext());
51 assertNotNull(artifact);
52 log.debug("TimeSeriesMesh-Artifact is available");
53
54 CallContext cc = createCallContext();
55
56 Document describeDocument = this.readDocument("src/test/ressources/timeseries_mesh/timeseries_describe.xml");
57
58 int steps = 8;
59
60 for (int i = 1; i <= steps; i++){
61 this.doNextStep(
62 artifact,
63 cc,
64 "src/test/ressources/timeseries_mesh/" +
65 "timeseries_step_0"+i+"_feed.xml",
66 "src/test/ressources/timeseries_mesh/" +
67 "timeseries_step_0"+i+"_advance.xml",
68 describeDocument);
69 }
70 // Achter Schritt
71 Document outputData = artifact.describe(describeDocument,cc);
72 FileOutputStream fos = null;
73 FileOutputStream fos2 = null;
74 FileOutputStream fos3 = null;
75 FileOutputStream fos4 = null;
76 try {
77 fos = new FileOutputStream("src/test/results/timeseries_mesh"
78 + System.currentTimeMillis()
79 + ".png");
80 fos2 = new FileOutputStream("src/test/results/timeseries_mesh"
81 + System.currentTimeMillis()
82 + ".xml");
83 fos3 = new FileOutputStream("src/test/results/timeseries_mesh"
84 + System.currentTimeMillis()
85 + ".csv");
86 fos4 = new FileOutputStream("src/test/results/timeseries_mesh"
87 + System.currentTimeMillis()
88 + ".odv");
89 artifact
90 .out(
91 this
92 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_statistics.xml"),
93 fos2, cc);
94 artifact
95 .out(
96 this
97 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_chart.xml"),
98 fos, cc);
99 artifact
100 .out(
101 this
102 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_csv.xml"),
103 fos3, cc);
104 artifact
105 .out(
106 this
107 .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_odv.xml"),
108 fos4, cc);
109 } catch (Exception e) {
110 log.error(e, e);
111 fail();
112 } finally {
113 try {
114 fos.flush();
115 fos.close();
116 fos2.flush();
117 fos2.close();
118 fos3.flush();
119 fos3.close();
120 } catch (Exception e) {
121 log.error(e, e);
122 }
123 }
124 } catch (Exception e) {
125 log.error(e, e);
126 fail();
127 }
128 }
129
130 }

http://dive4elements.wald.intevation.org