comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java @ 1119:7c4f81f74c47

merged gnv-artifacts
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:00 +0200 (2012-09-28)
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 TimeSeriesPointTimeSeriesTestCase extends GNVArtifactsTestCaseBase {
26
27
28 /**
29 * the logger, used to log exceptions and additonaly information
30 */
31 private static Logger log = Logger.getLogger(TimeSeriesPointTimeSeriesTestCase.class);
32
33 /**
34 * Constructor
35 */
36 public TimeSeriesPointTimeSeriesTestCase() {
37 }
38
39 /**
40 * Constructor
41 * @param name
42 */
43 public TimeSeriesPointTimeSeriesTestCase(String name) {
44 super(name);
45 }
46
47 /**
48 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact()
49 */
50 @Override
51 public void testArtifact() {
52 log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact");
53 try {
54 String artefactName = "fis_marnet";
55 ArtifactFactory artifactFactory = this
56 .getArtifactFactory(artefactName);
57 assertNotNull(artifactFactory);
58 log.debug("TimeSeries-ArtifactFactory is available");
59
60 Artifact artifact = createArtifact(artifactFactory);
61
62 CallContext cc = createCallContext(artifactFactory);
63
64 // Erster Schritt
65
66 Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml");
67
68 int steps = 6;
69
70 for (int i = 1; i <= steps; i++){
71
72 this.doNextStep(
73 artifact,
74 cc,
75 "src/test/ressources/timeseries/" +
76 "timeseries_step_0"+i+"_feed.xml",
77 "src/test/ressources/timeseries/" +
78 "timeseries_step_0"+i+"_advance.xml",
79 describeDocument);
80 }
81
82 Document outputData = artifact.describe(describeDocument,cc);
83 FileOutputStream fos = null;
84 FileOutputStream fos2 = null;
85 FileOutputStream fos3 = null;
86 FileOutputStream fos4 = null;
87 try {
88 fos = new FileOutputStream("src/test/results/timeseries"
89 + System.currentTimeMillis()
90 + ".png");
91 fos2 = new FileOutputStream("src/test/results/timeseries"
92 + System.currentTimeMillis()
93 + ".xml");
94 fos3 = new FileOutputStream("src/test/results/timeseries"
95 + System.currentTimeMillis()
96 + ".csv");
97 fos4 = new FileOutputStream("src/test/results/timeseries"
98 + System.currentTimeMillis()
99 + ".odv");
100
101 artifact.out(this
102 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"),
103 fos, cc);
104 artifact.out(this
105 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_statistics.xml"),
106 fos2, cc);
107 artifact.out(this
108 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_csv.xml"),
109 fos3, cc);
110 artifact.out(this
111 .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_odv.xml"),
112 fos4, cc);
113 } catch (Exception e) {
114 log.error(e, e);
115 fail();
116 } finally {
117 try {
118 fos.flush();
119 fos.close();
120 } catch (Exception e) {
121 log.error(e, e);
122 }
123 }
124 } catch (Exception e) {
125 log.error(e, e);
126 fail();
127 }
128 }
129
130 }

http://dive4elements.wald.intevation.org