Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java @ 376:d8f3ef441bf2
merged gnv-artifacts/0.3
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:13:47 +0200 |
parents | c16c622ba2f3 |
children | 4939236c2dc9 |
comparison
equal
deleted
inserted
replaced
293:6b0ef2324d02 | 376:d8f3ef441bf2 |
---|---|
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 InstantaneousPointVerticalProfileTestCase extends | |
20 GNVArtifactsTestCaseBase { | |
21 | |
22 private static Logger log = Logger.getLogger(InstantaneousPointVerticalProfileTestCase.class); | |
23 | |
24 /** | |
25 * Constructor | |
26 */ | |
27 public InstantaneousPointVerticalProfileTestCase() { | |
28 } | |
29 | |
30 /** | |
31 * Constructor | |
32 * @param name | |
33 */ | |
34 public InstantaneousPointVerticalProfileTestCase(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_bsh_ctd"; | |
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(); | |
56 Document describeDocument = this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_describe.xml"); | |
57 | |
58 int steps = 5; | |
59 | |
60 for (int i = 1; i <= steps; i++){ | |
61 this.doNextStep( | |
62 artifact, | |
63 cc, | |
64 "src/test/ressources/verticalprofile_instantaneouspoint/" + | |
65 "verticalprofile_step_0"+i+"_feed.xml", | |
66 "src/test/ressources/verticalprofile_instantaneouspoint/" + | |
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( | |
79 "src/test/results/verticalprofile_instantaneouspoint" | |
80 + System.currentTimeMillis() + ".png"); | |
81 fos2 = new FileOutputStream( | |
82 "src/test/results/verticalprofile_instantaneouspoint" | |
83 + System.currentTimeMillis() + ".xml"); | |
84 fos3 = new FileOutputStream( | |
85 "src/test/results/verticalprofile_instantaneouspoint" | |
86 + System.currentTimeMillis() + ".csv"); | |
87 fos4 = new FileOutputStream( | |
88 "src/test/results/verticalprofile_instantaneouspoint" | |
89 + System.currentTimeMillis() + ".odv"); | |
90 artifact.out(this.readDocument("src/test/ressources/" + | |
91 "verticalprofile_instantaneouspoint/" + | |
92 "verticalprofile_step_05_out_statistics.xml"), | |
93 fos2, cc); | |
94 artifact.out(this.readDocument("src/test/ressources/" + | |
95 "verticalprofile_instantaneouspoint/" + | |
96 "verticalprofile_step_05_out_chart.xml"), | |
97 fos, cc); | |
98 artifact.out(this.readDocument("src/test/ressources/" + | |
99 "verticalprofile_instantaneouspoint/" + | |
100 "verticalprofile_step_05_out_csv.xml"), | |
101 fos3, cc); | |
102 artifact.out(this.readDocument("src/test/ressources/" + | |
103 "verticalprofile_instantaneouspoint/" + | |
104 "verticalprofile_step_05_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 } 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 } |