Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.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 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 | |
51 Artifact artifact = createArtifact(artifactFactory); | |
52 | |
53 CallContext cc = createCallContext(artifactFactory); | |
54 Document describeDocument = this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_describe.xml"); | |
55 | |
56 int steps = 5; | |
57 | |
58 for (int i = 1; i <= steps; i++){ | |
59 this.doNextStep( | |
60 artifact, | |
61 cc, | |
62 "src/test/ressources/verticalprofile_instantaneouspoint/" + | |
63 "verticalprofile_step_0"+i+"_feed.xml", | |
64 "src/test/ressources/verticalprofile_instantaneouspoint/" + | |
65 "verticalprofile_step_0"+i+"_advance.xml", | |
66 describeDocument); | |
67 } | |
68 | |
69 // Vierter Schritt | |
70 Document outputData = artifact.describe(describeDocument,cc); | |
71 FileOutputStream fos = null; | |
72 FileOutputStream fos2 = null; | |
73 FileOutputStream fos3 = null; | |
74 FileOutputStream fos4 = null; | |
75 try { | |
76 fos = new FileOutputStream( | |
77 "src/test/results/verticalprofile_instantaneouspoint" | |
78 + System.currentTimeMillis() + ".png"); | |
79 fos2 = new FileOutputStream( | |
80 "src/test/results/verticalprofile_instantaneouspoint" | |
81 + System.currentTimeMillis() + ".xml"); | |
82 fos3 = new FileOutputStream( | |
83 "src/test/results/verticalprofile_instantaneouspoint" | |
84 + System.currentTimeMillis() + ".csv"); | |
85 fos4 = new FileOutputStream( | |
86 "src/test/results/verticalprofile_instantaneouspoint" | |
87 + System.currentTimeMillis() + ".odv"); | |
88 artifact.out(this.readDocument("src/test/ressources/" + | |
89 "verticalprofile_instantaneouspoint/" + | |
90 "verticalprofile_step_05_out_statistics.xml"), | |
91 fos2, cc); | |
92 artifact.out(this.readDocument("src/test/ressources/" + | |
93 "verticalprofile_instantaneouspoint/" + | |
94 "verticalprofile_step_05_out_chart.xml"), | |
95 fos, cc); | |
96 artifact.out(this.readDocument("src/test/ressources/" + | |
97 "verticalprofile_instantaneouspoint/" + | |
98 "verticalprofile_step_05_out_csv.xml"), | |
99 fos3, cc); | |
100 artifact.out(this.readDocument("src/test/ressources/" + | |
101 "verticalprofile_instantaneouspoint/" + | |
102 "verticalprofile_step_05_out_odv.xml"), | |
103 fos4, cc); | |
104 } catch (Exception e) { | |
105 log.error(e, e); | |
106 fail(); | |
107 } finally { | |
108 try { | |
109 fos.flush(); | |
110 fos.close(); | |
111 fos2.flush(); | |
112 fos2.close(); | |
113 fos3.flush(); | |
114 fos3.close(); | |
115 } catch (Exception e) { | |
116 log.error(e, e); | |
117 } | |
118 } | |
119 } catch (Exception e) { | |
120 log.error(e, e); | |
121 fail(); | |
122 } | |
123 } | |
124 | |
125 } |