comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 106:10d9a440f52e

ExceptionTest for Responsdocuments added. UnitTests will now fail if the Artifact delivers an ExceptionReport using the advance Request. gnv-artifacts/trunk@155 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 29 Sep 2009 12:56:27 +0000
parents 11b2d43da90d
children 4ebf9ad2e7eb
comparison
equal deleted inserted replaced
105:11b2d43da90d 106:10d9a440f52e
67 bootstrap = new FactoryBootstrap(); 67 bootstrap = new FactoryBootstrap();
68 bootstrap.boot(); 68 bootstrap.boot();
69 } 69 }
70 70
71 public void testTimeSeriesArtifact(){ 71 public void testTimeSeriesArtifact(){
72 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); 72 try {
73 String artefactName = "fis_marnet"; 73 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact");
74 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 74 String artefactName = "fis_marnet";
75 assertNotNull(artifactFactory); 75 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
76 log.debug("TimeSeries-ArtifactFactory is available"); 76 assertNotNull(artifactFactory);
77 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 77 log.debug("TimeSeries-ArtifactFactory is available");
78 assertNotNull(artifact); 78 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
79 log.debug("TimeSeries-Artifact is available"); 79 assertNotNull(artifact);
80 80 log.debug("TimeSeries-Artifact is available");
81 81
82 CallContext cc = new TestCallContext(bootstrap.getContext()); 82
83 83 CallContext cc = new TestCallContext(bootstrap.getContext());
84 // Erster Schritt 84
85 Document outputData = artifact.describe(null); 85 // Erster Schritt
86 this.writeDocument2Log(outputData); 86 Document outputData = artifact.describe(null);
87 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc); 87 this.writeDocument2Log(outputData);
88 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc); 88 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc);
89 this.writeDocument2Log(outputData); 89 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc);
90 90 this.writeDocument2Log(outputData);
91 // Zweiter Schritt 91 this.check4ExceptionReport(outputData);
92 outputData = artifact.describe(null); 92
93 this.writeDocument2Log(outputData); 93 // Zweiter Schritt
94 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc); 94 outputData = artifact.describe(null);
95 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc); 95 this.writeDocument2Log(outputData);
96 this.writeDocument2Log(outputData); 96 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc);
97 97 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc);
98 // Dritter Schritt 98 this.writeDocument2Log(outputData);
99 outputData = artifact.describe(null); 99
100 this.writeDocument2Log(outputData); 100 // Dritter Schritt
101 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc); 101 outputData = artifact.describe(null);
102 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc); 102 this.writeDocument2Log(outputData);
103 this.writeDocument2Log(outputData); 103 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc);
104 104 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc);
105 105 this.writeDocument2Log(outputData);
106 // Vierter Schritt 106 this.check4ExceptionReport(outputData);
107 outputData = artifact.describe(null); 107
108 this.writeDocument2Log(outputData); 108
109 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), cc); 109 // Vierter Schritt
110 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc); 110 outputData = artifact.describe(null);
111 this.writeDocument2Log(outputData); 111 this.writeDocument2Log(outputData);
112 112 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), cc);
113 // Fünfter Schritt 113 outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc);
114 outputData = artifact.describe(null); 114 this.writeDocument2Log(outputData);
115 FileOutputStream fos = null; 115 this.check4ExceptionReport(outputData);
116 try{ 116
117 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); 117 // Fünfter Schritt
118 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc); 118 outputData = artifact.describe(null);
119 artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, cc); 119 FileOutputStream fos = null;
120 } catch (Exception e){ 120 try{
121 fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png");
122 artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc);
123 artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, cc);
124 } catch (Exception e){
125 log.error(e,e);
126 fail();
127 }finally{
128 try {
129 fos.flush();
130 fos.close();
131 } catch (Exception e) {
132 log.error(e,e);
133 }
134 }
135 } catch (Exception e) {
121 log.error(e,e); 136 log.error(e,e);
122 fail(); 137 fail();
123 }finally{ 138 }
124 try { 139 }
125 fos.flush(); 140
126 fos.close(); 141 public void testVerticalProfileArtifact(){
127 } catch (Exception e) { 142 try {
143 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
144 String artefactName = "fis_marnet";
145 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
146 assertNotNull(artifactFactory);
147 log.debug("VerticalProfile-ArtifactFactory is available");
148 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
149 assertNotNull(artifact);
150 log.debug("VerticalProfile-Artifact is available");
151
152
153 CallContext cc = new TestCallContext(bootstrap.getContext());
154
155 // Erster Schritt
156 Document outputData = artifact.describe(null);
157 this.writeDocument2Log(outputData);
158 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml"), cc);
159 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_advance.xml"), cc);
160 this.writeDocument2Log(outputData);
161 this.check4ExceptionReport(outputData);
162
163 // Zweiter Schritt
164 outputData = artifact.describe(null);
165 this.writeDocument2Log(outputData);
166 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml"), cc);
167 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"), cc);
168 this.writeDocument2Log(outputData);
169 this.check4ExceptionReport(outputData);
170
171 // Dritter Schritt
172 outputData = artifact.describe(null);
173 this.writeDocument2Log(outputData);
174 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml"), cc);
175 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"), cc);
176 this.writeDocument2Log(outputData);
177 this.check4ExceptionReport(outputData);
178
179 // Vierter Schritt
180 outputData = artifact.describe(null);
181 FileOutputStream fos = null;
182 FileOutputStream fos2 = null;
183 FileOutputStream fos3 = null;
184 try{
185 fos = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".png");
186 fos2 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".xml");
187 fos3 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".csv");
188 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"), cc);
189 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),fos2, cc);
190 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),fos, cc);
191 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.xml"),fos3, cc);
192 } catch (Exception e){
128 log.error(e,e); 193 log.error(e,e);
129 } 194 fail();
130 } 195 }finally{
131 } 196 try {
132 197 fos.flush();
133 public void testVerticalProfileArtifact(){ 198 fos.close();
134 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); 199 fos2.flush();
135 String artefactName = "fis_marnet"; 200 fos2.close();
136 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 201 fos3.flush();
137 assertNotNull(artifactFactory); 202 fos3.close();
138 log.debug("VerticalProfile-ArtifactFactory is available"); 203 } catch (Exception e) {
139 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 204 log.error(e,e);
140 assertNotNull(artifact); 205 }
141 log.debug("VerticalProfile-Artifact is available"); 206 }
142 207 } catch (Exception e) {
143
144 CallContext cc = new TestCallContext(bootstrap.getContext());
145
146 // Erster Schritt
147 Document outputData = artifact.describe(null);
148 this.writeDocument2Log(outputData);
149 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml"), cc);
150 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_advance.xml"), cc);
151 this.writeDocument2Log(outputData);
152
153 // Zweiter Schritt
154 outputData = artifact.describe(null);
155 this.writeDocument2Log(outputData);
156 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml"), cc);
157 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"), cc);
158 this.writeDocument2Log(outputData);
159
160 // Dritter Schritt
161 outputData = artifact.describe(null);
162 this.writeDocument2Log(outputData);
163 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml"), cc);
164 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"), cc);
165 this.writeDocument2Log(outputData);
166
167
168 // Vierter Schritt
169 outputData = artifact.describe(null);
170 FileOutputStream fos = null;
171 FileOutputStream fos2 = null;
172 FileOutputStream fos3 = null;
173 try{
174 fos = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".png");
175 fos2 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".xml");
176 fos3 = new FileOutputStream("src/test/results/verticalprofile"+System.currentTimeMillis()+".csv");
177 artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"), cc);
178 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),fos2, cc);
179 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),fos, cc);
180 artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.xml"),fos3, cc);
181 } catch (Exception e){
182 log.error(e,e); 208 log.error(e,e);
183 fail(); 209 fail();
184 }finally{ 210 }
185 try { 211 }
186 fos.flush(); 212
187 fos.close(); 213 public void testVerticalProfileMeshArtifact(){
188 fos2.flush(); 214 try {
189 fos2.close(); 215 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
190 fos3.flush(); 216 String artefactName = "fis_modeldata";
191 fos3.close(); 217 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
192 } catch (Exception e) { 218 assertNotNull(artifactFactory);
219 log.debug("VerticalProfile-ArtifactFactory is available");
220 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
221 assertNotNull(artifact);
222 log.debug("VerticalProfile-Artifact is available");
223
224
225 CallContext cc = new TestCallContext(bootstrap.getContext());
226
227 // Erster Schritt
228 Document outputData = artifact.describe(null);
229 this.writeDocument2Log(outputData);
230 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml"), cc);
231 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"), cc);
232 this.writeDocument2Log(outputData);
233 this.check4ExceptionReport(outputData);
234
235 // Zweiter Schritt
236 outputData = artifact.describe(null);
237 this.writeDocument2Log(outputData);
238 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml"), cc);
239 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"), cc);
240 this.writeDocument2Log(outputData);
241 this.check4ExceptionReport(outputData);
242
243 // Dritter Schritt
244 outputData = artifact.describe(null);
245 this.writeDocument2Log(outputData);
246 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml"), cc);
247 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"), cc);
248 this.writeDocument2Log(outputData);
249 this.check4ExceptionReport(outputData);
250
251 // Vierter Schritt
252 outputData = artifact.describe(null);
253 this.writeDocument2Log(outputData);
254 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml"), cc);
255 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"), cc);
256 this.writeDocument2Log(outputData);
257 this.check4ExceptionReport(outputData);
258
259 // Fünfter Schritt
260 outputData = artifact.describe(null);
261 this.writeDocument2Log(outputData);
262 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml"), cc);
263 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"), cc);
264 this.writeDocument2Log(outputData);
265 this.check4ExceptionReport(outputData);
266
267 // Sechster Schritt
268 outputData = artifact.describe(null);
269 FileOutputStream fos = null;
270 FileOutputStream fos2 = null;
271 FileOutputStream fos3 = null;
272 try{
273 fos = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".png");
274 fos2 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".xml");
275 fos3 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".csv");
276 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml"), cc);
277 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_statistics.xml"),fos2, cc);
278 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_chart.xml"),fos, cc);
279 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_csv.xml"),fos3, cc);
280 } catch (Exception e){
193 log.error(e,e); 281 log.error(e,e);
194 } 282 fail();
195 } 283 }finally{
196 } 284 try {
197 285 fos.flush();
198 public void testVerticalProfileMeshArtifact(){ 286 fos.close();
199 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); 287 fos2.flush();
200 String artefactName = "fis_modeldata"; 288 fos2.close();
201 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 289 fos3.flush();
202 assertNotNull(artifactFactory); 290 fos3.close();
203 log.debug("VerticalProfile-ArtifactFactory is available"); 291 } catch (Exception e) {
204 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 292 log.error(e,e);
205 assertNotNull(artifact); 293 }
206 log.debug("VerticalProfile-Artifact is available"); 294 }
207 295 } catch (Exception e) {
208
209 CallContext cc = new TestCallContext(bootstrap.getContext());
210
211 // Erster Schritt
212 Document outputData = artifact.describe(null);
213 this.writeDocument2Log(outputData);
214 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml"), cc);
215 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"), cc);
216 this.writeDocument2Log(outputData);
217
218 // Zweiter Schritt
219 outputData = artifact.describe(null);
220 this.writeDocument2Log(outputData);
221 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml"), cc);
222 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"), cc);
223 this.writeDocument2Log(outputData);
224
225 // Dritter Schritt
226 outputData = artifact.describe(null);
227 this.writeDocument2Log(outputData);
228 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml"), cc);
229 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"), cc);
230 this.writeDocument2Log(outputData);
231
232
233 // Vierter Schritt
234 outputData = artifact.describe(null);
235 this.writeDocument2Log(outputData);
236 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml"), cc);
237 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"), cc);
238 this.writeDocument2Log(outputData);
239
240 // Fünfter Schritt
241 outputData = artifact.describe(null);
242 this.writeDocument2Log(outputData);
243 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml"), cc);
244 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"), cc);
245 this.writeDocument2Log(outputData);
246
247 // Vierter Schritt
248 outputData = artifact.describe(null);
249 FileOutputStream fos = null;
250 FileOutputStream fos2 = null;
251 FileOutputStream fos3 = null;
252 try{
253 fos = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".png");
254 fos2 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".xml");
255 fos3 = new FileOutputStream("src/test/results/verticalprofile_mesh"+System.currentTimeMillis()+".csv");
256 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml"), cc);
257 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_statistics.xml"),fos2, cc);
258 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_chart.xml"),fos, cc);
259 artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_csv.xml"),fos3, cc);
260 } catch (Exception e){
261 log.error(e,e); 296 log.error(e,e);
262 fail(); 297 fail();
263 }finally{ 298 }
264 try { 299 }
265 fos.flush(); 300
266 fos.close(); 301
267 fos2.flush(); 302
268 fos2.close(); 303 public void testVerticalProfileInstantaneousPointArtifact(){
269 fos3.flush(); 304 try {
270 fos3.close(); 305 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact");
271 } catch (Exception e) { 306 String artefactName = "fis_instantaneouspoint";
307 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName);
308 assertNotNull(artifactFactory);
309 log.debug("VerticalProfile-ArtifactFactory is available");
310 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext());
311 assertNotNull(artifact);
312 log.debug("VerticalProfile-Artifact is available");
313
314
315 CallContext cc = new TestCallContext(bootstrap.getContext());
316
317 // Erster Schritt
318 Document outputData = artifact.describe(null);
319 this.writeDocument2Log(outputData);
320 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml"), cc);
321 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"), cc);
322 this.writeDocument2Log(outputData);
323 this.check4ExceptionReport(outputData);
324
325 // Zweiter Schritt
326 outputData = artifact.describe(null);
327 this.writeDocument2Log(outputData);
328 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml"), cc);
329 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"), cc);
330 this.writeDocument2Log(outputData);
331 this.check4ExceptionReport(outputData);
332
333 // Dritter Schritt
334 outputData = artifact.describe(null);
335 this.writeDocument2Log(outputData);
336 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml"), cc);
337 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"), cc);
338 this.writeDocument2Log(outputData);
339 this.check4ExceptionReport(outputData);
340
341 // Vierter Schritt
342 outputData = artifact.describe(null);
343 FileOutputStream fos = null;
344 FileOutputStream fos2 = null;
345 FileOutputStream fos3 = null;
346 try{
347 fos = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".png");
348 fos2 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml");
349 fos3 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv");
350 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"), cc);
351 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),fos2, cc);
352 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),fos, cc);
353 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.xml"),fos3, cc);
354 } catch (Exception e){
272 log.error(e,e); 355 log.error(e,e);
273 } 356 fail();
274 } 357 }finally{
275 } 358 try {
276 359 fos.flush();
277 360 fos.close();
278 361 fos2.flush();
279 public void testVerticalProfileInstantaneousPointArtifact(){ 362 fos2.close();
280 log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); 363 fos3.flush();
281 String artefactName = "fis_instantaneouspoint"; 364 fos3.close();
282 ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); 365 } catch (Exception e) {
283 assertNotNull(artifactFactory); 366 log.error(e,e);
284 log.debug("VerticalProfile-ArtifactFactory is available"); 367 }
285 Artifact artifact = artifactFactory.createArtifact(""+System.currentTimeMillis(),bootstrap.getContext()); 368 }
286 assertNotNull(artifact); 369 } catch (Exception e) {
287 log.debug("VerticalProfile-Artifact is available");
288
289
290 CallContext cc = new TestCallContext(bootstrap.getContext());
291
292 // Erster Schritt
293 Document outputData = artifact.describe(null);
294 this.writeDocument2Log(outputData);
295 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml"), cc);
296 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"), cc);
297 this.writeDocument2Log(outputData);
298
299 // Zweiter Schritt
300 outputData = artifact.describe(null);
301 this.writeDocument2Log(outputData);
302 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml"), cc);
303 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"), cc);
304 this.writeDocument2Log(outputData);
305
306 // Dritter Schritt
307 outputData = artifact.describe(null);
308 this.writeDocument2Log(outputData);
309 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml"), cc);
310 outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"), cc);
311 this.writeDocument2Log(outputData);
312
313
314 // Vierter Schritt
315 outputData = artifact.describe(null);
316 FileOutputStream fos = null;
317 FileOutputStream fos2 = null;
318 FileOutputStream fos3 = null;
319 try{
320 fos = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".png");
321 fos2 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".xml");
322 fos3 = new FileOutputStream("src/test/results/verticalprofile_instantaneouspoint"+System.currentTimeMillis()+".csv");
323 artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"), cc);
324 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),fos2, cc);
325 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),fos, cc);
326 artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.xml"),fos3, cc);
327 } catch (Exception e){
328 log.error(e,e); 370 log.error(e,e);
329 fail(); 371 fail();
330 }finally{
331 try {
332 fos.flush();
333 fos.close();
334 fos2.flush();
335 fos2.close();
336 fos3.flush();
337 fos3.close();
338 } catch (Exception e) {
339 log.error(e,e);
340 }
341 } 372 }
342 } 373 }
343 374
344 protected void createFile(byte[] content, String fileName){ 375 protected void createFile(byte[] content, String fileName){
345 try { 376 try {
394 } 425 }
395 return returnValue; 426 return returnValue;
396 } 427 }
397 428
398 429
430 private void check4ExceptionReport(Document document) throws Exception{
431 document = new ArtifactXMLUtilities().reInitDocument(document);
432 String message = Config.getStringXPath(document,"/exceptionreport/exception");
433 if (message != null){
434 throw new Exception(message);
435 }
436 }
399 } 437 }

http://dive4elements.wald.intevation.org