Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.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 MeshVerticalCrossSectionTestCase extends GNVArtifactsTestCaseBase { | |
18 | |
19 private static Logger log = Logger.getLogger(MeshVerticalCrossSectionTestCase.class); | |
20 | |
21 /** | |
22 * Constructor | |
23 */ | |
24 public MeshVerticalCrossSectionTestCase() { | |
25 } | |
26 | |
27 /** | |
28 * Constructor | |
29 * @param name | |
30 */ | |
31 public MeshVerticalCrossSectionTestCase(String name) { | |
32 super(name); | |
33 } | |
34 | |
35 /** | |
36 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() | |
37 */ | |
38 @Override | |
39 public void testArtifact() { | |
40 try { | |
41 log.debug("GNVArtifactsTestCase." + | |
42 "testHVerticalCrossSectionMeshArtifact"); | |
43 String artefactName = "fis_modeldata"; | |
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/verticalcrosssection_mesh/verticalcrosssection_describe.xml"); | |
53 | |
54 int steps = 7; | |
55 | |
56 for (int i = 1; i <= steps; i++){ | |
57 | |
58 this.doNextStep( | |
59 artifact, | |
60 cc, | |
61 "src/test/ressources/verticalcrosssection_mesh/" + | |
62 "verticalcrosssection_step_0"+i+"_feed.xml", | |
63 "src/test/ressources/verticalcrosssection_mesh/" + | |
64 "verticalcrosssection_step_0"+i+"_advance.xml", | |
65 describeDocument); | |
66 } | |
67 | |
68 Document outputData = artifact.describe(describeDocument,cc); | |
69 FileOutputStream fos = null; | |
70 FileOutputStream fos2 = null; | |
71 FileOutputStream fos3 = null; | |
72 try { | |
73 fos = new FileOutputStream( | |
74 "src/test/results/verticalcrosssection_mesh" | |
75 + System.currentTimeMillis() + ".png"); | |
76 | |
77 fos2 = new FileOutputStream( | |
78 "src/test/results/verticalcrosssection_mesh" | |
79 + System.currentTimeMillis() + ".csv"); | |
80 fos3 = new FileOutputStream( | |
81 "src/test/results/verticalcrosssection_mesh" | |
82 + System.currentTimeMillis() + ".odv"); | |
83 artifact.out(this.readDocument("src/test/ressources/" + | |
84 "verticalcrosssection_mesh/" + | |
85 "verticalcrosssection_step_0"+steps+"_out_chart.xml"), | |
86 fos, cc); | |
87 artifact.out(this.readDocument("src/test/ressources/" + | |
88 "verticalcrosssection_mesh/" + | |
89 "verticalcrosssection_step_0"+steps+"_out_csv.xml"), | |
90 fos2,cc); | |
91 // TODO: FIXME: ODV-Export nach Reparatur wieder Testbar machen. | |
92 // artifact.out(this.readDocument("src/test/ressources/" + | |
93 // "verticalcrosssection_mesh/" + | |
94 // "verticalcrosssection_step_0"+steps+"_out_odv.xml"), | |
95 // fos3,cc); | |
96 | |
97 } catch (Exception e) { | |
98 log.error(e, e); | |
99 fail(); | |
100 } finally { | |
101 try { | |
102 fos.flush(); | |
103 fos.close(); | |
104 fos2.flush(); | |
105 fos2.close(); | |
106 fos3.flush(); | |
107 fos3.close(); | |
108 } catch (Exception e) { | |
109 log.error(e, e); | |
110 } | |
111 } | |
112 } catch (Exception e) { | |
113 log.error(e, e); | |
114 fail(); | |
115 } | |
116 } | |
117 | |
118 } |