comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java @ 540:80630520e25a

merged gnv-artifacts/0.4
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:49 +0200
parents 4939236c2dc9
children e0d7b8a0bc42
comparison
equal deleted inserted replaced
415:9f4a0b990d27 540:80630520e25a
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 TimeSeriesPointTimeSeriesTestCase extends GNVArtifactsTestCaseBase {
20
21
22 /**
23 * the logger, used to log exceptions and additonaly information
24 */
25 private static Logger log = Logger.getLogger(TimeSeriesPointTimeSeriesTestCase.class);
26
27 /**
28 * Constructor
29 */
30 public TimeSeriesPointTimeSeriesTestCase() {
31 }
32
33 /**
34 * Constructor
35 * @param name
36 */
37 public TimeSeriesPointTimeSeriesTestCase(String name) {
38 super(name);
39 }
40
41 /**
42 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact()
43 */
44 @Override
45 public void testArtifact() {
46 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact");
47 try {
48 String artefactName = "fis_marnet";
49 ArtifactFactory artifactFactory = this
50 .getArtifactFactory(artefactName);
51 assertNotNull(artifactFactory);
52 log.debug("TimeSeries-ArtifactFactory is available");
53 Artifact artifact = artifactFactory.createArtifact(
54 "" + System.currentTimeMillis(), bootstrap.getContext());
55 assertNotNull(artifact);
56 log.debug("TimeSeries-Artifact is available");
57
58 CallContext cc = createCallContext(artifactFactory);
59
60 // Erster Schritt
61
62 Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml");
63
64 int steps = 6;
65
66 for (int i = 1; i <= steps; i++){
67
68 this.doNextStep(
69 artifact,
70 cc,
71 "src/test/ressources/timeseries/" +
72 "timeseries_step_0"+i+"_feed.xml",
73 "src/test/ressources/timeseries/" +
74 "timeseries_step_0"+i+"_advance.xml",
75 describeDocument);
76 }
77
78 Document outputData = artifact.describe(describeDocument,cc);
79 FileOutputStream fos = null;
80 FileOutputStream fos2 = null;
81 FileOutputStream fos3 = null;
82 FileOutputStream fos4 = null;
83 try {
84 fos = new FileOutputStream("src/test/results/timeseries"
85 + System.currentTimeMillis()
86 + ".png");
87 fos2 = new FileOutputStream("src/test/results/timeseries"
88 + System.currentTimeMillis()
89 + ".xml");
90 fos3 = new FileOutputStream("src/test/results/timeseries"
91 + System.currentTimeMillis()
92 + ".csv");
93 fos4 = new FileOutputStream("src/test/results/timeseries"
94 + System.currentTimeMillis()
95 + ".odv");
96
97 artifact.out(this
98 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"),
99 fos, cc);
100 artifact.out(this
101 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_statistics.xml"),
102 fos2, cc);
103 artifact.out(this
104 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_csv.xml"),
105 fos3, cc);
106 artifact.out(this
107 .readDocument("src/test/ressources/timeseries/timeseries_step_06_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 } 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