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