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