Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.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 MeshHorizontalProfileTestCase extends GNVArtifactsTestCaseBase { | |
26 | |
27 private static Logger log = Logger.getLogger(MeshHorizontalProfileTestCase.class); | |
28 | |
29 /** | |
30 * Constructor | |
31 */ | |
32 public MeshHorizontalProfileTestCase() { | |
33 } | |
34 | |
35 /** | |
36 * Constructor | |
37 * @param name | |
38 */ | |
39 public MeshHorizontalProfileTestCase(String name) { | |
40 super(name); | |
41 } | |
42 | |
43 /** | |
44 * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() | |
45 */ | |
46 @Override | |
47 public void testArtifact() { | |
48 try { | |
49 log.debug("GNVArtifactsTestCase." + | |
50 "testHorizontalProfileInstantaneousPointArtifact"); | |
51 String artefactName = "fis_modeldata"; | |
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/horizontalProfile_mesh/horizontalprofile_describe.xml"); | |
61 | |
62 int steps = 11; | |
63 | |
64 for (int i = 1; i <= steps; i++){ | |
65 String number = ""+i; | |
66 if (i < 10){ | |
67 number = "0"+number; | |
68 } | |
69 this.doNextStep( | |
70 artifact, | |
71 cc, | |
72 "src/test/ressources/horizontalProfile_mesh/" + | |
73 "horizontalprofile_step_"+number+"_feed.xml", | |
74 "src/test/ressources/horizontalProfile_mesh/" + | |
75 "horizontalprofile_step_"+number+"_advance.xml", | |
76 describeDocument); | |
77 } | |
78 | |
79 Document outputData = artifact.describe(describeDocument,cc); | |
80 FileOutputStream fos = null; | |
81 FileOutputStream fos2 = null; | |
82 FileOutputStream fos3 = null; | |
83 FileOutputStream fos4 = null; | |
84 try { | |
85 fos = new FileOutputStream( | |
86 "src/test/results/horizontalProfile_mesh" | |
87 + System.currentTimeMillis() + ".png"); | |
88 fos2 = new FileOutputStream( | |
89 "src/test/results/horizontalProfile_mesh" | |
90 + System.currentTimeMillis() + ".xml"); | |
91 fos3 = new FileOutputStream( | |
92 "src/test/results/horizontalProfile_mesh" | |
93 + System.currentTimeMillis() + ".csv"); | |
94 fos4 = new FileOutputStream( | |
95 "src/test/results/horizontalProfile_mesh" | |
96 + System.currentTimeMillis() + ".odv"); | |
97 artifact.out(this.readDocument("src/test/ressources/" + | |
98 "horizontalProfile_mesh/" + | |
99 "horizontalprofile_step_"+steps+"_out_statistics.xml"), | |
100 fos2, cc); | |
101 artifact.out(this.readDocument("src/test/ressources/" + | |
102 "horizontalProfile_mesh/" + | |
103 "horizontalprofile_step_"+steps+"_out_chart.xml"), | |
104 fos, cc); | |
105 artifact.out(this.readDocument("src/test/ressources/" + | |
106 "horizontalProfile_mesh/" + | |
107 "horizontalprofile_step_"+steps+"_out_csv.xml"), | |
108 fos3, cc); | |
109 artifact.out(this.readDocument("src/test/ressources/" + | |
110 "horizontalProfile_mesh/" + | |
111 "horizontalprofile_step_"+steps+"_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 fos2.flush(); | |
121 fos2.close(); | |
122 fos3.flush(); | |
123 fos3.close(); | |
124 fos4.flush(); | |
125 fos4.close(); | |
126 } catch (Exception e) { | |
127 log.error(e, e); | |
128 } | |
129 } | |
130 } catch (Exception e) { | |
131 log.error(e, e); | |
132 fail(); | |
133 } | |
134 } | |
135 | |
136 } |