comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.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 InstantaneousPointHorizontalProfileTestCase extends
20 GNVArtifactsTestCaseBase {
21
22 private static Logger log = Logger.getLogger(InstantaneousPointHorizontalProfileTestCase.class);
23
24 /**
25 * Constructor
26 */
27 public InstantaneousPointHorizontalProfileTestCase() {
28 }
29
30 /**
31 * Constructor
32 * @param name
33 */
34 public InstantaneousPointHorizontalProfileTestCase(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." +
45 "testHorizontalProfileInstantaneousPointArtifact");
46 String artefactName = "fis_delphin";
47 ArtifactFactory artifactFactory = this
48 .getArtifactFactory(artefactName);
49 assertNotNull(artifactFactory);
50 log.debug("VerticalProfile-ArtifactFactory is available");
51
52 Artifact artifact = createArtifact(artifactFactory);
53
54 CallContext cc = createCallContext(artifactFactory);
55 Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_describe.xml");
56
57 int steps = 9;
58
59 for (int i = 0; i < steps; i++){
60
61 this.doNextStep(
62 artifact,
63 cc,
64 "src/test/ressources/horizontalProfile_instantaneouspoint/" +
65 "horizontalprofile_step_0"+i+"_feed.xml",
66 "src/test/ressources/horizontalProfile_instantaneouspoint/" +
67 "horizontalprofile_step_0"+i+"_advance.xml",
68 describeDocument);
69 }
70
71 Document outputData = artifact.describe(describeDocument, cc);
72 FileOutputStream fos = null;
73 FileOutputStream fos2 = null;
74 FileOutputStream fos3 = null;
75 FileOutputStream fos4 = null;
76 try {
77 fos = new FileOutputStream(
78 "src/test/results/horizontalprofile_instantaneouspoint"
79 + System.currentTimeMillis() + ".png");
80 fos2 = new FileOutputStream(
81 "src/test/results/horizontalprofile_instantaneouspoint"
82 + System.currentTimeMillis() + ".xml");
83 fos3 = new FileOutputStream(
84 "src/test/results/horizontalprofile_instantaneouspoint"
85 + System.currentTimeMillis() + ".csv");
86 fos4 = new FileOutputStream(
87 "src/test/results/horizontalprofile_instantaneouspoint"
88 + System.currentTimeMillis() + ".odv");
89 artifact.out(this.readDocument("src/test/ressources/" +
90 "horizontalProfile_instantaneouspoint/" +
91 "horizontalprofile_step_08_out_statistics.xml"),
92 fos2,cc);
93 artifact.out(this.readDocument("src/test/ressources/" +
94 "horizontalProfile_instantaneouspoint/" +
95 "horizontalprofile_step_08_out_chart.xml"),
96 fos,cc);
97 artifact.out(this.readDocument("src/test/ressources/" +
98 "horizontalProfile_instantaneouspoint/" +
99 "horizontalprofile_step_08_out_csv.xml"),
100 fos3,cc);
101 artifact.out(this.readDocument("src/test/ressources/" +
102 "horizontalProfile_instantaneouspoint/" +
103 "horizontalprofile_step_08_out_odv.xml"),
104 fos4,cc);
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