comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java @ 657:af3f56758f59

merged gnv-artifacts/0.5
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:53 +0200
parents e0d7b8a0bc42
children 9a828e5a2390
comparison
equal deleted inserted replaced
590:5f5f273c8566 657:af3f56758f59
1 /**
2 *
3 */
4 package de.intevation.gnv.artifacts;
5
6 import java.io.FileOutputStream;
7
8 import org.apache.log4j.Logger;
9 import org.w3c.dom.Document;
10
11 import de.intevation.artifacts.Artifact;
12 import de.intevation.artifacts.ArtifactFactory;
13 import de.intevation.artifacts.CallContext;
14
15 /**
16 * @author Tim Englich <tim.englich@intevation.de>
17 *
18 */
19 public class MeshHorizontalCrossSectionTestCase extends
20 GNVArtifactsTestCaseBase {
21
22 private static Logger log = Logger.getLogger(MeshHorizontalCrossSectionTestCase.class);
23
24 /**
25 * Constructor
26 */
27 public MeshHorizontalCrossSectionTestCase() {
28 }
29
30 /**
31 * Constructor
32 * @param name
33 */
34 public MeshHorizontalCrossSectionTestCase(String name) {
35 super(name);
36 }
37
38 /**
39 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact()
40 */
41 @Override
42 public void testArtifact() {
43 try {
44 log.debug("GNVArtifactsTestCase.testHorizontalCrossSectionMeshArtifact");
45 String artefactName = "fis_modeldata";
46 ArtifactFactory artifactFactory = this
47 .getArtifactFactory(artefactName);
48 assertNotNull(artifactFactory);
49 log.debug("HorizontalCrossSectionMesh-ArtifactFactory is available");
50
51 Artifact artifact = createArtifact(artifactFactory);
52
53 CallContext cc = createCallContext(artifactFactory);
54 Document describeDocument = this.readDocument("src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_describe.xml");
55 int steps = 8;
56
57 for (int i = 1; i <= steps; i++){
58 this.doNextStep(
59 artifact,
60 cc,
61 "src/test/ressources/horizontalcrosssection_mesh/" +
62 "horizontalcrosssection_step_0"+i+"_feed.xml",
63 "src/test/ressources/horizontalcrosssection_mesh/" +
64 "horizontalcrosssection_step_0"+i+"_advance.xml",
65 describeDocument);
66 }
67
68 Document outputData = artifact.describe(describeDocument,cc);
69 FileOutputStream fos = null;
70 FileOutputStream fos2 = null;
71 try {
72 fos = new FileOutputStream(
73 "src/test/results/horizontalcrosssection_mesh"
74 + System.currentTimeMillis() + ".zip");
75 fos2 = new FileOutputStream(
76 "src/test/results/horizontalcrosssection_mesh"
77 + System.currentTimeMillis() + ".txt");
78 artifact.out(this.readDocument("src/test/ressources/" +
79 "horizontalcrosssection_mesh/" +
80 "horizontalcrosssection_step_0"+steps+"_out_zip.xml"),
81 fos, cc);
82 artifact.out(this.readDocument("src/test/ressources/" +
83 "horizontalcrosssection_mesh/" +
84 "horizontalcrosssection_step_0"+steps+"_out_wms.xml"),
85 fos2,cc);
86 } catch (Exception e) {
87 log.error(e, e);
88 fail();
89 } finally {
90 try {
91 fos.flush();
92 fos.close();
93 fos2.flush();
94 fos2.close();
95 } catch (Exception e) {
96 log.error(e, e);
97 }
98 }
99 } catch (Exception e) {
100 log.error(e, e);
101 fail();
102 }
103 }
104
105 }

http://dive4elements.wald.intevation.org