Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java @ 345:c16c622ba2f3
Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
gnv-artifacts/trunk@412 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 11 Dec 2009 10:02:10 +0000 |
parents | |
children | 4939236c2dc9 |
comparison
equal
deleted
inserted
replaced
344:44adf8918155 | 345:c16c622ba2f3 |
---|---|
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 Artifact artifact = artifactFactory.createArtifact( | |
52 "" + System.currentTimeMillis(), bootstrap.getContext()); | |
53 assertNotNull(artifact); | |
54 log.debug("VerticalProfile-Artifact is available"); | |
55 | |
56 CallContext cc = createCallContext(); | |
57 Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_describe.xml"); | |
58 | |
59 int steps = 9; | |
60 | |
61 for (int i = 0; i < steps; i++){ | |
62 | |
63 this.doNextStep( | |
64 artifact, | |
65 cc, | |
66 "src/test/ressources/horizontalProfile_instantaneouspoint/" + | |
67 "horizontalprofile_step_0"+i+"_feed.xml", | |
68 "src/test/ressources/horizontalProfile_instantaneouspoint/" + | |
69 "horizontalprofile_step_0"+i+"_advance.xml", | |
70 describeDocument); | |
71 } | |
72 | |
73 Document outputData = artifact.describe(describeDocument, cc); | |
74 FileOutputStream fos = null; | |
75 FileOutputStream fos2 = null; | |
76 FileOutputStream fos3 = null; | |
77 FileOutputStream fos4 = null; | |
78 try { | |
79 fos = new FileOutputStream( | |
80 "src/test/results/horizontalprofile_instantaneouspoint" | |
81 + System.currentTimeMillis() + ".png"); | |
82 fos2 = new FileOutputStream( | |
83 "src/test/results/horizontalprofile_instantaneouspoint" | |
84 + System.currentTimeMillis() + ".xml"); | |
85 fos3 = new FileOutputStream( | |
86 "src/test/results/horizontalprofile_instantaneouspoint" | |
87 + System.currentTimeMillis() + ".csv"); | |
88 fos4 = new FileOutputStream( | |
89 "src/test/results/horizontalprofile_instantaneouspoint" | |
90 + System.currentTimeMillis() + ".odv"); | |
91 artifact.out(this.readDocument("src/test/ressources/" + | |
92 "horizontalProfile_instantaneouspoint/" + | |
93 "horizontalprofile_step_08_out_statistics.xml"), | |
94 fos2,cc); | |
95 artifact.out(this.readDocument("src/test/ressources/" + | |
96 "horizontalProfile_instantaneouspoint/" + | |
97 "horizontalprofile_step_08_out_chart.xml"), | |
98 fos,cc); | |
99 artifact.out(this.readDocument("src/test/ressources/" + | |
100 "horizontalProfile_instantaneouspoint/" + | |
101 "horizontalprofile_step_08_out_csv.xml"), | |
102 fos3,cc); | |
103 artifact.out(this.readDocument("src/test/ressources/" + | |
104 "horizontalProfile_instantaneouspoint/" + | |
105 "horizontalprofile_step_08_out_odv.xml"), | |
106 fos4,cc); | |
107 } catch (Exception e) { | |
108 log.error(e, e); | |
109 fail(); | |
110 } finally { | |
111 try { | |
112 fos.flush(); | |
113 fos.close(); | |
114 fos2.flush(); | |
115 fos2.close(); | |
116 fos3.flush(); | |
117 fos3.close(); | |
118 } catch (Exception e) { | |
119 log.error(e, e); | |
120 } | |
121 } | |
122 } catch (Exception e) { | |
123 log.error(e, e); | |
124 fail(); | |
125 } | |
126 } | |
127 | |
128 } |