comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java @ 1119:7c4f81f74c47

merged gnv-artifacts
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:00 +0200
parents f953c9a559d8
children
comparison
equal deleted inserted replaced
1027:fca4b5eb8d2f 1119:7c4f81f74c47
1 /*
2 * Copyright (c) 2010 by Intevation GmbH
3 *
4 * This program is free software under the LGPL (>=v2.1)
5 * Read the file LGPL.txt coming with the software for details
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
7 */
8
9 package de.intevation.gnv.artifacts;
10
11 import de.intevation.artifacts.Artifact;
12 import de.intevation.artifacts.ArtifactFactory;
13 import de.intevation.artifacts.CallContext;
14
15 import java.io.FileOutputStream;
16
17 import org.apache.log4j.Logger;
18
19 import org.w3c.dom.Document;
20
21 /**
22 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
23 *
24 */
25 public class MeshVerticalProfileTestCase extends GNVArtifactsTestCaseBase {
26
27 private static Logger log = Logger.getLogger(MeshVerticalProfileTestCase.class);
28
29 /**
30 * Constructor
31 */
32 public MeshVerticalProfileTestCase() {
33 }
34
35 /**
36 * Constructor
37 * @param name
38 */
39 public MeshVerticalProfileTestCase(String name) {
40 super(name);
41 }
42
43 /**
44 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact()
45 */
46 @Override
47 public void testArtifact() {
48 try {
49 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
50 String artefactName = "fis_modeldata";
51 ArtifactFactory artifactFactory = this
52 .getArtifactFactory(artefactName);
53 assertNotNull(artifactFactory);
54 log.debug("VerticalProfile-ArtifactFactory is available");
55
56 Artifact artifact = createArtifact(artifactFactory);
57
58 CallContext cc = createCallContext(artifactFactory);
59 Document describeDocument = this.readDocument("src/test/ressources/" +
60 "verticalprofile_mesh/" +
61 "verticalprofile_describe.xml");
62
63 int steps = 11;
64
65 for (int i = 1; i <= steps; i++){
66 String number = ""+i;
67 if (i < 10){
68 number = "0"+number;
69 }
70 this.doNextStep(
71 artifact,
72 cc,
73 "src/test/ressources/verticalprofile_mesh/" +
74 "verticalprofile_step_"+number+"_feed.xml",
75 "src/test/ressources/verticalprofile_mesh/" +
76 "verticalprofile_step_"+number+"_advance.xml",
77 describeDocument);
78 }
79 // 10. Schritt
80 Document outputData = artifact.describe(describeDocument,cc);
81 FileOutputStream fos = null;
82 FileOutputStream fos2 = null;
83 FileOutputStream fos3 = null;
84 FileOutputStream fos4 = null;
85 try {
86 fos = new FileOutputStream(
87 "src/test/results/verticalprofile_mesh"
88 + System.currentTimeMillis() + ".png");
89 fos2 = new FileOutputStream(
90 "src/test/results/verticalprofile_mesh"
91 + System.currentTimeMillis() + ".xml");
92 fos3 = new FileOutputStream(
93 "src/test/results/verticalprofile_mesh"
94 + System.currentTimeMillis() + ".csv");
95 fos4 = new FileOutputStream(
96 "src/test/results/verticalprofile_mesh"
97 + System.currentTimeMillis() + ".odv");
98 artifact.out(this.readDocument("src/test/ressources/" +
99 "verticalprofile_mesh/" +
100 "verticalprofile_step_"+steps+"_out_statistics.xml"),
101 fos2, cc);
102 artifact.out(this.readDocument("src/test/ressources/" +
103 "verticalprofile_mesh/" +
104 "verticalprofile_step_"+steps+"_out_chart.xml"),
105 fos, cc);
106 artifact.out(this.readDocument("src/test/ressources/" +
107 "verticalprofile_mesh/" +
108 "verticalprofile_step_"+steps+"_out_csv.xml"),
109 fos3, cc);
110 artifact.out(this.readDocument("src/test/ressources/" +
111 "verticalprofile_mesh/" +
112 "verticalprofile_step_"+steps+"_out_odv.xml"),
113 fos4, cc);
114 } catch (Exception e) {
115 log.error(e, e);
116 fail();
117 } finally {
118 try {
119 fos.flush();
120 fos.close();
121 fos2.flush();
122 fos2.close();
123 fos3.flush();
124 fos3.close();
125 fos4.flush();
126 fos4.close();
127 } catch (Exception e) {
128 log.error(e, e);
129 }
130 }
131 } catch (Exception e) {
132 log.error(e, e);
133 fail();
134 }
135 }
136
137 }

http://dive4elements.wald.intevation.org