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

http://dive4elements.wald.intevation.org