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