Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.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 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 | |
54 Artifact artifact = createArtifact(artifactFactory); | |
55 | |
56 CallContext cc = createCallContext(artifactFactory); | |
57 | |
58 // Erster Schritt | |
59 | |
60 Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml"); | |
61 | |
62 int steps = 6; | |
63 | |
64 for (int i = 1; i <= steps; i++){ | |
65 | |
66 this.doNextStep( | |
67 artifact, | |
68 cc, | |
69 "src/test/ressources/timeseries/" + | |
70 "timeseries_step_0"+i+"_feed.xml", | |
71 "src/test/ressources/timeseries/" + | |
72 "timeseries_step_0"+i+"_advance.xml", | |
73 describeDocument); | |
74 } | |
75 | |
76 Document outputData = artifact.describe(describeDocument,cc); | |
77 FileOutputStream fos = null; | |
78 FileOutputStream fos2 = null; | |
79 FileOutputStream fos3 = null; | |
80 FileOutputStream fos4 = null; | |
81 try { | |
82 fos = new FileOutputStream("src/test/results/timeseries" | |
83 + System.currentTimeMillis() | |
84 + ".png"); | |
85 fos2 = new FileOutputStream("src/test/results/timeseries" | |
86 + System.currentTimeMillis() | |
87 + ".xml"); | |
88 fos3 = new FileOutputStream("src/test/results/timeseries" | |
89 + System.currentTimeMillis() | |
90 + ".csv"); | |
91 fos4 = new FileOutputStream("src/test/results/timeseries" | |
92 + System.currentTimeMillis() | |
93 + ".odv"); | |
94 | |
95 artifact.out(this | |
96 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"), | |
97 fos, cc); | |
98 artifact.out(this | |
99 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_statistics.xml"), | |
100 fos2, cc); | |
101 artifact.out(this | |
102 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_csv.xml"), | |
103 fos3, cc); | |
104 artifact.out(this | |
105 .readDocument("src/test/ressources/timeseries/timeseries_step_06_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 } catch (Exception e) { | |
115 log.error(e, e); | |
116 } | |
117 } | |
118 } catch (Exception e) { | |
119 log.error(e, e); | |
120 fail(); | |
121 } | |
122 } | |
123 | |
124 } |