Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.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 TimeSeriesPointTimeSeriesTestCase extends GNVArtifactsTestCaseBase { | |
18 | |
19 | |
20 /** | |
21 * the logger, used to log exceptions and additonaly information | |
22 */ | |
23 private static Logger log = Logger.getLogger(TimeSeriesPointTimeSeriesTestCase.class); | |
24 | |
25 /** | |
26 * Constructor | |
27 */ | |
28 public TimeSeriesPointTimeSeriesTestCase() { | |
29 } | |
30 | |
31 /** | |
32 * Constructor | |
33 * @param name | |
34 */ | |
35 public TimeSeriesPointTimeSeriesTestCase(String name) { | |
36 super(name); | |
37 } | |
38 | |
39 /** | |
40 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() | |
41 */ | |
42 @Override | |
43 public void testArtifact() { | |
44 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); | |
45 try { | |
46 String artefactName = "fis_marnet"; | |
47 ArtifactFactory artifactFactory = this | |
48 .getArtifactFactory(artefactName); | |
49 assertNotNull(artifactFactory); | |
50 log.debug("TimeSeries-ArtifactFactory is available"); | |
51 | |
52 Artifact artifact = createArtifact(artifactFactory); | |
53 | |
54 CallContext cc = createCallContext(artifactFactory); | |
55 | |
56 // Erster Schritt | |
57 | |
58 Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml"); | |
59 | |
60 int steps = 6; | |
61 | |
62 for (int i = 1; i <= steps; i++){ | |
63 | |
64 this.doNextStep( | |
65 artifact, | |
66 cc, | |
67 "src/test/ressources/timeseries/" + | |
68 "timeseries_step_0"+i+"_feed.xml", | |
69 "src/test/ressources/timeseries/" + | |
70 "timeseries_step_0"+i+"_advance.xml", | |
71 describeDocument); | |
72 } | |
73 | |
74 Document outputData = artifact.describe(describeDocument,cc); | |
75 FileOutputStream fos = null; | |
76 FileOutputStream fos2 = null; | |
77 FileOutputStream fos3 = null; | |
78 FileOutputStream fos4 = null; | |
79 try { | |
80 fos = new FileOutputStream("src/test/results/timeseries" | |
81 + System.currentTimeMillis() | |
82 + ".png"); | |
83 fos2 = new FileOutputStream("src/test/results/timeseries" | |
84 + System.currentTimeMillis() | |
85 + ".xml"); | |
86 fos3 = new FileOutputStream("src/test/results/timeseries" | |
87 + System.currentTimeMillis() | |
88 + ".csv"); | |
89 fos4 = new FileOutputStream("src/test/results/timeseries" | |
90 + System.currentTimeMillis() | |
91 + ".odv"); | |
92 | |
93 artifact.out(this | |
94 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"), | |
95 fos, cc); | |
96 artifact.out(this | |
97 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_statistics.xml"), | |
98 fos2, cc); | |
99 artifact.out(this | |
100 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_csv.xml"), | |
101 fos3, cc); | |
102 artifact.out(this | |
103 .readDocument("src/test/ressources/timeseries/timeseries_step_06_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 } catch (Exception e) { | |
113 log.error(e, e); | |
114 } | |
115 } | |
116 } catch (Exception e) { | |
117 log.error(e, e); | |
118 fail(); | |
119 } | |
120 } | |
121 | |
122 } |