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