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