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

http://dive4elements.wald.intevation.org