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