Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.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 TimeSeriesPointVerticalProfileTestCase extends | |
20 GNVArtifactsTestCaseBase { | |
21 | |
22 private static Logger log = Logger.getLogger(TimeSeriesPointVerticalProfileTestCase.class); | |
23 | |
24 /** | |
25 * Constructor | |
26 */ | |
27 public TimeSeriesPointVerticalProfileTestCase() { | |
28 } | |
29 | |
30 /** | |
31 * Constructor | |
32 * @param name | |
33 */ | |
34 public TimeSeriesPointVerticalProfileTestCase(String name) { | |
35 super(name); | |
36 } | |
37 | |
38 /** | |
39 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() | |
40 */ | |
41 @Override | |
42 public void testArtifact() { | |
43 try { | |
44 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); | |
45 String artefactName = "fis_marnet"; | |
46 ArtifactFactory artifactFactory = this | |
47 .getArtifactFactory(artefactName); | |
48 assertNotNull(artifactFactory); | |
49 log.debug("VerticalProfile-ArtifactFactory is available"); | |
50 Artifact artifact = artifactFactory.createArtifact( | |
51 "" + System.currentTimeMillis(), bootstrap.getContext()); | |
52 assertNotNull(artifact); | |
53 log.debug("VerticalProfile-Artifact is available"); | |
54 | |
55 CallContext cc = createCallContext(artifactFactory); | |
56 | |
57 Document describeDocument = this.readDocument("src/test/ressources/verticalprofile/verticalprofile_describe.xml"); | |
58 int steps = 7; | |
59 | |
60 for (int i = 1; i <= steps; i++){ | |
61 this.doNextStep( | |
62 artifact, | |
63 cc, | |
64 "src/test/ressources/verticalprofile/" + | |
65 "verticalprofile_step_0"+i+"_feed.xml", | |
66 "src/test/ressources/verticalprofile/" + | |
67 "verticalprofile_step_0"+i+"_advance.xml", | |
68 describeDocument); | |
69 } | |
70 | |
71 // Vierter Schritt | |
72 Document outputData = artifact.describe(describeDocument,cc); | |
73 FileOutputStream fos = null; | |
74 FileOutputStream fos2 = null; | |
75 FileOutputStream fos3 = null; | |
76 FileOutputStream fos4 = null; | |
77 try { | |
78 fos = new FileOutputStream("src/test/results/verticalprofile" | |
79 + System.currentTimeMillis() | |
80 + ".png"); | |
81 fos2 = new FileOutputStream("src/test/results/verticalprofile" | |
82 + System.currentTimeMillis() | |
83 + ".xml"); | |
84 fos3 = new FileOutputStream("src/test/results/verticalprofile" | |
85 + System.currentTimeMillis() | |
86 + ".csv"); | |
87 fos4 = new FileOutputStream("src/test/results/verticalprofile" | |
88 + System.currentTimeMillis() | |
89 + ".odv"); | |
90 artifact.out(this.readDocument("src/test/ressources/" + | |
91 "verticalprofile/" + | |
92 "verticalprofile_step_07_out_statistics.xml"), | |
93 fos2, cc); | |
94 artifact.out(this.readDocument("src/test/ressources/" + | |
95 "verticalprofile/" + | |
96 "verticalprofile_step_07_out_chart.xml"), | |
97 fos, cc); | |
98 artifact.out(this.readDocument("src/test/ressources/" + | |
99 "verticalprofile/" + | |
100 "verticalprofile_step_07_out_csv.xml"), | |
101 fos3, cc); | |
102 artifact.out(this.readDocument("src/test/ressources/" + | |
103 "verticalprofile/" + | |
104 "verticalprofile_step_07_out_odv.xml"), | |
105 fos4, cc); | |
106 } catch (Exception e) { | |
107 log.error(e, e); | |
108 fail(); | |
109 } finally { | |
110 try { | |
111 fos.flush(); | |
112 fos.close(); | |
113 fos2.flush(); | |
114 fos2.close(); | |
115 fos3.flush(); | |
116 fos3.close(); | |
117 fos4.flush(); | |
118 fos4.close(); | |
119 } catch (Exception e) { | |
120 log.error(e, e); | |
121 } | |
122 } | |
123 } catch (Exception e) { | |
124 log.error(e, e); | |
125 fail(); | |
126 } | |
127 } | |
128 | |
129 } |