comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.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 MeshVerticalCrossSectionTestCase extends GNVArtifactsTestCaseBase {
26
27 private static Logger log = Logger.getLogger(MeshVerticalCrossSectionTestCase.class);
28
29 /**
30 * Constructor
31 */
32 public MeshVerticalCrossSectionTestCase() {
33 }
34
35 /**
36 * Constructor
37 * @param name
38 */
39 public MeshVerticalCrossSectionTestCase(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." +
50 "testHVerticalCrossSectionMeshArtifact");
51 String artefactName = "fis_modeldata";
52 ArtifactFactory artifactFactory = this
53 .getArtifactFactory(artefactName);
54 assertNotNull(artifactFactory);
55 log.debug("VerticalProfile-ArtifactFactory is available");
56
57 Artifact artifact = createArtifact(artifactFactory);
58
59 CallContext cc = createCallContext(artifactFactory);
60 Document describeDocument = this.readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_describe.xml");
61
62 int steps = 7;
63
64 for (int i = 1; i <= steps; i++){
65
66 this.doNextStep(
67 artifact,
68 cc,
69 "src/test/ressources/verticalcrosssection_mesh/" +
70 "verticalcrosssection_step_0"+i+"_feed.xml",
71 "src/test/ressources/verticalcrosssection_mesh/" +
72 "verticalcrosssection_step_0"+i+"_advance.xml",
73 describeDocument);
74 }
75
76 Document outputData = artifact.describe(describeDocument,cc);
77 FileOutputStream fos = null;
78 FileOutputStream fos2 = null;
79 FileOutputStream fos3 = null;
80 try {
81 fos = new FileOutputStream(
82 "src/test/results/verticalcrosssection_mesh"
83 + System.currentTimeMillis() + ".png");
84
85 fos2 = new FileOutputStream(
86 "src/test/results/verticalcrosssection_mesh"
87 + System.currentTimeMillis() + ".csv");
88 fos3 = new FileOutputStream(
89 "src/test/results/verticalcrosssection_mesh"
90 + System.currentTimeMillis() + ".odv");
91 artifact.out(this.readDocument("src/test/ressources/" +
92 "verticalcrosssection_mesh/" +
93 "verticalcrosssection_step_0"+steps+"_out_chart.xml"),
94 fos, cc);
95 artifact.out(this.readDocument("src/test/ressources/" +
96 "verticalcrosssection_mesh/" +
97 "verticalcrosssection_step_0"+steps+"_out_csv.xml"),
98 fos2,cc);
99 // TODO: FIXME: ODV-Export nach Reparatur wieder Testbar machen.
100 // artifact.out(this.readDocument("src/test/ressources/" +
101 // "verticalcrosssection_mesh/" +
102 // "verticalcrosssection_step_0"+steps+"_out_odv.xml"),
103 // fos3,cc);
104
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 } catch (Exception e) {
117 log.error(e, e);
118 }
119 }
120 } catch (Exception e) {
121 log.error(e, e);
122 fail();
123 }
124 }
125
126 }

http://dive4elements.wald.intevation.org