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