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

http://dive4elements.wald.intevation.org