Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java @ 345:c16c622ba2f3
Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
gnv-artifacts/trunk@412 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 11 Dec 2009 10:02:10 +0000 |
parents | |
children | 4939236c2dc9 |
comparison
equal
deleted
inserted
replaced
344:44adf8918155 | 345:c16c622ba2f3 |
---|---|
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 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/horizontalProfile_mesh/horizontalprofile_describe.xml"); | |
57 | |
58 int steps = 10; | |
59 | |
60 for (int i = 1; i <= steps; i++){ | |
61 String number = ""+i; | |
62 if (i < 10){ | |
63 number = "0"+number; | |
64 } | |
65 this.doNextStep( | |
66 artifact, | |
67 cc, | |
68 "src/test/ressources/horizontalProfile_mesh/" + | |
69 "horizontalprofile_step_"+number+"_feed.xml", | |
70 "src/test/ressources/horizontalProfile_mesh/" + | |
71 "horizontalprofile_step_"+number+"_advance.xml", | |
72 describeDocument); | |
73 } | |
74 | |
75 Document outputData = artifact.describe(describeDocument,cc); | |
76 FileOutputStream fos = null; | |
77 FileOutputStream fos2 = null; | |
78 FileOutputStream fos3 = null; | |
79 FileOutputStream fos4 = null; | |
80 try { | |
81 fos = new FileOutputStream( | |
82 "src/test/results/horizontalProfile_mesh" | |
83 + System.currentTimeMillis() + ".png"); | |
84 fos2 = new FileOutputStream( | |
85 "src/test/results/horizontalProfile_mesh" | |
86 + System.currentTimeMillis() + ".xml"); | |
87 fos3 = new FileOutputStream( | |
88 "src/test/results/horizontalProfile_mesh" | |
89 + System.currentTimeMillis() + ".csv"); | |
90 fos4 = new FileOutputStream( | |
91 "src/test/results/horizontalProfile_mesh" | |
92 + System.currentTimeMillis() + ".odv"); | |
93 artifact.out(this.readDocument("src/test/ressources/" + | |
94 "horizontalProfile_mesh/" + | |
95 "horizontalprofile_step_10_out_statistics.xml"), | |
96 fos2, cc); | |
97 artifact.out(this.readDocument("src/test/ressources/" + | |
98 "horizontalProfile_mesh/" + | |
99 "horizontalprofile_step_10_out_chart.xml"), | |
100 fos, cc); | |
101 artifact.out(this.readDocument("src/test/ressources/" + | |
102 "horizontalProfile_mesh/" + | |
103 "horizontalprofile_step_10_out_csv.xml"), | |
104 fos3, cc); | |
105 artifact.out(this.readDocument("src/test/ressources/" + | |
106 "horizontalProfile_mesh/" + | |
107 "horizontalprofile_step_10_out_odv.xml"), | |
108 fos4, cc); | |
109 } catch (Exception e) { | |
110 log.error(e, e); | |
111 fail(); | |
112 } finally { | |
113 try { | |
114 fos.flush(); | |
115 fos.close(); | |
116 fos2.flush(); | |
117 fos2.close(); | |
118 fos3.flush(); | |
119 fos3.close(); | |
120 fos4.flush(); | |
121 fos4.close(); | |
122 } catch (Exception e) { | |
123 log.error(e, e); | |
124 } | |
125 } | |
126 } catch (Exception e) { | |
127 log.error(e, e); | |
128 fail(); | |
129 } | |
130 } | |
131 | |
132 } |