Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.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 InstantaneousPointHorizontalProfileTestCase extends | |
26 GNVArtifactsTestCaseBase { | |
27 | |
28 private static Logger log = Logger.getLogger(InstantaneousPointHorizontalProfileTestCase.class); | |
29 | |
30 /** | |
31 * Constructor | |
32 */ | |
33 public InstantaneousPointHorizontalProfileTestCase() { | |
34 } | |
35 | |
36 /** | |
37 * Constructor | |
38 * @param name | |
39 */ | |
40 public InstantaneousPointHorizontalProfileTestCase(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." + | |
51 "testHorizontalProfileInstantaneousPointArtifact"); | |
52 String artefactName = "fis_delphin"; | |
53 ArtifactFactory artifactFactory = this | |
54 .getArtifactFactory(artefactName); | |
55 assertNotNull(artifactFactory); | |
56 log.debug("VerticalProfile-ArtifactFactory is available"); | |
57 | |
58 Artifact artifact = createArtifact(artifactFactory); | |
59 | |
60 CallContext cc = createCallContext(artifactFactory); | |
61 Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_describe.xml"); | |
62 | |
63 int steps = 9; | |
64 | |
65 for (int i = 0; i < steps; i++){ | |
66 | |
67 this.doNextStep( | |
68 artifact, | |
69 cc, | |
70 "src/test/ressources/horizontalProfile_instantaneouspoint/" + | |
71 "horizontalprofile_step_0"+i+"_feed.xml", | |
72 "src/test/ressources/horizontalProfile_instantaneouspoint/" + | |
73 "horizontalprofile_step_0"+i+"_advance.xml", | |
74 describeDocument); | |
75 } | |
76 | |
77 Document outputData = artifact.describe(describeDocument, cc); | |
78 FileOutputStream fos = null; | |
79 FileOutputStream fos2 = null; | |
80 FileOutputStream fos3 = null; | |
81 FileOutputStream fos4 = null; | |
82 try { | |
83 fos = new FileOutputStream( | |
84 "src/test/results/horizontalprofile_instantaneouspoint" | |
85 + System.currentTimeMillis() + ".png"); | |
86 fos2 = new FileOutputStream( | |
87 "src/test/results/horizontalprofile_instantaneouspoint" | |
88 + System.currentTimeMillis() + ".xml"); | |
89 fos3 = new FileOutputStream( | |
90 "src/test/results/horizontalprofile_instantaneouspoint" | |
91 + System.currentTimeMillis() + ".csv"); | |
92 fos4 = new FileOutputStream( | |
93 "src/test/results/horizontalprofile_instantaneouspoint" | |
94 + System.currentTimeMillis() + ".odv"); | |
95 artifact.out(this.readDocument("src/test/ressources/" + | |
96 "horizontalProfile_instantaneouspoint/" + | |
97 "horizontalprofile_step_08_out_statistics.xml"), | |
98 fos2,cc); | |
99 artifact.out(this.readDocument("src/test/ressources/" + | |
100 "horizontalProfile_instantaneouspoint/" + | |
101 "horizontalprofile_step_08_out_chart.xml"), | |
102 fos,cc); | |
103 artifact.out(this.readDocument("src/test/ressources/" + | |
104 "horizontalProfile_instantaneouspoint/" + | |
105 "horizontalprofile_step_08_out_csv.xml"), | |
106 fos3,cc); | |
107 artifact.out(this.readDocument("src/test/ressources/" + | |
108 "horizontalProfile_instantaneouspoint/" + | |
109 "horizontalprofile_step_08_out_odv.xml"), | |
110 fos4,cc); | |
111 } catch (Exception e) { | |
112 log.error(e, e); | |
113 fail(); | |
114 } finally { | |
115 try { | |
116 fos.flush(); | |
117 fos.close(); | |
118 fos2.flush(); | |
119 fos2.close(); | |
120 fos3.flush(); | |
121 fos3.close(); | |
122 } catch (Exception e) { | |
123 log.error(e, e); | |
124 } | |
125 } | |
126 } catch (Exception e) { | |
127 log.error(e, e); | |
128 fail(); | |
129 } | |
130 } | |
131 | |
132 } |