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