ingo@1115: /* ingo@1115: * Copyright (c) 2010 by Intevation GmbH ingo@1115: * ingo@1115: * This program is free software under the LGPL (>=v2.1) ingo@1115: * Read the file LGPL.txt coming with the software for details ingo@1115: * or visit http://www.gnu.org/licenses/ if it does not exist. ingo@1115: */ ingo@1115: tim@345: package de.intevation.gnv.artifacts; tim@345: sascha@779: import de.intevation.artifacts.Artifact; sascha@779: import de.intevation.artifacts.ArtifactFactory; sascha@779: import de.intevation.artifacts.CallContext; sascha@779: tim@345: import java.io.FileOutputStream; tim@345: tim@345: import org.apache.log4j.Logger; tim@345: sascha@779: import org.w3c.dom.Document; tim@345: tim@345: /** sascha@780: * @author Tim Englich tim@345: * tim@345: */ tim@345: public class MeshHorizontalProfileTestCase extends GNVArtifactsTestCaseBase { tim@345: tim@345: private static Logger log = Logger.getLogger(MeshHorizontalProfileTestCase.class); sascha@778: tim@345: /** tim@345: * Constructor tim@345: */ tim@345: public MeshHorizontalProfileTestCase() { tim@345: } tim@345: tim@345: /** tim@345: * Constructor tim@345: * @param name tim@345: */ tim@345: public MeshHorizontalProfileTestCase(String name) { tim@345: super(name); tim@345: } tim@345: tim@345: /** tim@345: * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() tim@345: */ tim@345: @Override tim@345: public void testArtifact() { tim@345: try { tim@345: log.debug("GNVArtifactsTestCase." + tim@345: "testHorizontalProfileInstantaneousPointArtifact"); tim@345: String artefactName = "fis_modeldata"; tim@345: ArtifactFactory artifactFactory = this tim@345: .getArtifactFactory(artefactName); tim@345: assertNotNull(artifactFactory); tim@345: log.debug("VerticalProfile-ArtifactFactory is available"); sascha@778: tim@595: Artifact artifact = createArtifact(artifactFactory); tim@345: tim@485: CallContext cc = createCallContext(artifactFactory); tim@345: Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_describe.xml"); sascha@778: tim@591: int steps = 11; sascha@778: tim@345: for (int i = 1; i <= steps; i++){ tim@345: String number = ""+i; tim@345: if (i < 10){ tim@345: number = "0"+number; tim@345: } tim@345: this.doNextStep( tim@345: artifact, tim@345: cc, tim@345: "src/test/ressources/horizontalProfile_mesh/" + tim@345: "horizontalprofile_step_"+number+"_feed.xml", tim@345: "src/test/ressources/horizontalProfile_mesh/" + sascha@778: "horizontalprofile_step_"+number+"_advance.xml", tim@345: describeDocument); tim@345: } sascha@778: tim@345: Document outputData = artifact.describe(describeDocument,cc); tim@345: FileOutputStream fos = null; tim@345: FileOutputStream fos2 = null; tim@345: FileOutputStream fos3 = null; tim@345: FileOutputStream fos4 = null; tim@345: try { tim@345: fos = new FileOutputStream( tim@345: "src/test/results/horizontalProfile_mesh" tim@345: + System.currentTimeMillis() + ".png"); tim@345: fos2 = new FileOutputStream( tim@345: "src/test/results/horizontalProfile_mesh" tim@345: + System.currentTimeMillis() + ".xml"); tim@345: fos3 = new FileOutputStream( tim@345: "src/test/results/horizontalProfile_mesh" tim@345: + System.currentTimeMillis() + ".csv"); tim@345: fos4 = new FileOutputStream( tim@345: "src/test/results/horizontalProfile_mesh" tim@345: + System.currentTimeMillis() + ".odv"); tim@345: artifact.out(this.readDocument("src/test/ressources/" + tim@345: "horizontalProfile_mesh/" + tim@591: "horizontalprofile_step_"+steps+"_out_statistics.xml"), tim@345: fos2, cc); tim@345: artifact.out(this.readDocument("src/test/ressources/" + tim@345: "horizontalProfile_mesh/" + tim@591: "horizontalprofile_step_"+steps+"_out_chart.xml"), tim@345: fos, cc); tim@345: artifact.out(this.readDocument("src/test/ressources/" + tim@345: "horizontalProfile_mesh/" + tim@591: "horizontalprofile_step_"+steps+"_out_csv.xml"), tim@345: fos3, cc); tim@345: artifact.out(this.readDocument("src/test/ressources/" + tim@345: "horizontalProfile_mesh/" + tim@591: "horizontalprofile_step_"+steps+"_out_odv.xml"), tim@345: fos4, cc); tim@345: } catch (Exception e) { tim@345: log.error(e, e); tim@345: fail(); tim@345: } finally { tim@345: try { tim@345: fos.flush(); tim@345: fos.close(); tim@345: fos2.flush(); tim@345: fos2.close(); tim@345: fos3.flush(); tim@345: fos3.close(); tim@345: fos4.flush(); tim@345: fos4.close(); tim@345: } catch (Exception e) { tim@345: log.error(e, e); tim@345: } tim@345: } tim@345: } catch (Exception e) { tim@345: log.error(e, e); tim@345: fail(); tim@345: } tim@345: } tim@345: tim@345: }