Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.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 MeshVerticalProfileTestCase extends GNVArtifactsTestCaseBase { | |
20 | |
21 private static Logger log = Logger.getLogger(MeshVerticalProfileTestCase.class); | |
22 | |
23 /** | |
24 * Constructor | |
25 */ | |
26 public MeshVerticalProfileTestCase() { | |
27 } | |
28 | |
29 /** | |
30 * Constructor | |
31 * @param name | |
32 */ | |
33 public MeshVerticalProfileTestCase(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.testVerticalProfileArtifact"); | |
44 String artefactName = "fis_modeldata"; | |
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/" + | |
54 "verticalprofile_mesh/" + | |
55 "verticalprofile_describe.xml"); | |
56 | |
57 int steps = 11; | |
58 | |
59 for (int i = 1; i <= steps; i++){ | |
60 String number = ""+i; | |
61 if (i < 10){ | |
62 number = "0"+number; | |
63 } | |
64 this.doNextStep( | |
65 artifact, | |
66 cc, | |
67 "src/test/ressources/verticalprofile_mesh/" + | |
68 "verticalprofile_step_"+number+"_feed.xml", | |
69 "src/test/ressources/verticalprofile_mesh/" + | |
70 "verticalprofile_step_"+number+"_advance.xml", | |
71 describeDocument); | |
72 } | |
73 // 10. Schritt | |
74 Document outputData = artifact.describe(describeDocument,cc); | |
75 FileOutputStream fos = null; | |
76 FileOutputStream fos2 = null; | |
77 FileOutputStream fos3 = null; | |
78 FileOutputStream fos4 = null; | |
79 try { | |
80 fos = new FileOutputStream( | |
81 "src/test/results/verticalprofile_mesh" | |
82 + System.currentTimeMillis() + ".png"); | |
83 fos2 = new FileOutputStream( | |
84 "src/test/results/verticalprofile_mesh" | |
85 + System.currentTimeMillis() + ".xml"); | |
86 fos3 = new FileOutputStream( | |
87 "src/test/results/verticalprofile_mesh" | |
88 + System.currentTimeMillis() + ".csv"); | |
89 fos4 = new FileOutputStream( | |
90 "src/test/results/verticalprofile_mesh" | |
91 + System.currentTimeMillis() + ".odv"); | |
92 artifact.out(this.readDocument("src/test/ressources/" + | |
93 "verticalprofile_mesh/" + | |
94 "verticalprofile_step_"+steps+"_out_statistics.xml"), | |
95 fos2, cc); | |
96 artifact.out(this.readDocument("src/test/ressources/" + | |
97 "verticalprofile_mesh/" + | |
98 "verticalprofile_step_"+steps+"_out_chart.xml"), | |
99 fos, cc); | |
100 artifact.out(this.readDocument("src/test/ressources/" + | |
101 "verticalprofile_mesh/" + | |
102 "verticalprofile_step_"+steps+"_out_csv.xml"), | |
103 fos3, cc); | |
104 artifact.out(this.readDocument("src/test/ressources/" + | |
105 "verticalprofile_mesh/" + | |
106 "verticalprofile_step_"+steps+"_out_odv.xml"), | |
107 fos4, cc); | |
108 } catch (Exception e) { | |
109 log.error(e, e); | |
110 fail(); | |
111 } finally { | |
112 try { | |
113 fos.flush(); | |
114 fos.close(); | |
115 fos2.flush(); | |
116 fos2.close(); | |
117 fos3.flush(); | |
118 fos3.close(); | |
119 fos4.flush(); | |
120 fos4.close(); | |
121 } catch (Exception e) { | |
122 log.error(e, e); | |
123 } | |
124 } | |
125 } catch (Exception e) { | |
126 log.error(e, e); | |
127 fail(); | |
128 } | |
129 } | |
130 | |
131 } |