tim@345: /** tim@345: * tim@345: */ tim@345: package de.intevation.gnv.artifacts; tim@345: tim@345: import java.io.FileOutputStream; tim@345: tim@345: import org.apache.log4j.Logger; tim@345: import org.w3c.dom.Document; tim@345: tim@345: import de.intevation.artifacts.Artifact; tim@345: import de.intevation.artifacts.ArtifactFactory; tim@345: import de.intevation.artifacts.CallContext; tim@345: tim@345: /** tim@345: * @author Tim Englich tim@345: * tim@345: */ tim@345: public class MeshHorizontalCrossSectionTestCase extends tim@345: GNVArtifactsTestCaseBase { tim@345: tim@345: private static Logger log = Logger.getLogger(MeshHorizontalCrossSectionTestCase.class); tim@345: tim@345: /** tim@345: * Constructor tim@345: */ tim@345: public MeshHorizontalCrossSectionTestCase() { tim@345: } tim@345: tim@345: /** tim@345: * Constructor tim@345: * @param name tim@345: */ tim@345: public MeshHorizontalCrossSectionTestCase(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.testHorizontalCrossSectionMeshArtifact"); tim@345: String artefactName = "fis_modeldata"; tim@345: ArtifactFactory artifactFactory = this tim@345: .getArtifactFactory(artefactName); tim@345: assertNotNull(artifactFactory); tim@345: log.debug("HorizontalCrossSectionMesh-ArtifactFactory is available"); tim@345: Artifact artifact = artifactFactory.createArtifact( tim@345: "" + System.currentTimeMillis(), bootstrap.getContext()); tim@345: assertNotNull(artifact); tim@345: log.debug("HorizontalCrossSectionMesh-Artifact is available"); tim@345: tim@485: CallContext cc = createCallContext(artifactFactory); tim@345: Document describeDocument = this.readDocument("src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_describe.xml"); tim@591: int steps = 8; tim@345: tim@345: for (int i = 1; i <= steps; i++){ tim@345: this.doNextStep( tim@345: artifact, tim@345: cc, tim@345: "src/test/ressources/horizontalcrosssection_mesh/" + tim@345: "horizontalcrosssection_step_0"+i+"_feed.xml", tim@345: "src/test/ressources/horizontalcrosssection_mesh/" + tim@345: "horizontalcrosssection_step_0"+i+"_advance.xml", tim@345: describeDocument); tim@345: } tim@345: tim@345: Document outputData = artifact.describe(describeDocument,cc); tim@345: FileOutputStream fos = null; tim@345: FileOutputStream fos2 = null; tim@345: try { tim@345: fos = new FileOutputStream( tim@345: "src/test/results/horizontalcrosssection_mesh" tim@485: + System.currentTimeMillis() + ".zip"); tim@345: fos2 = new FileOutputStream( tim@345: "src/test/results/horizontalcrosssection_mesh" tim@485: + System.currentTimeMillis() + ".txt"); tim@345: artifact.out(this.readDocument("src/test/ressources/" + tim@345: "horizontalcrosssection_mesh/" + tim@591: "horizontalcrosssection_step_0"+steps+"_out_zip.xml"), tim@345: fos, cc); tim@345: artifact.out(this.readDocument("src/test/ressources/" + tim@345: "horizontalcrosssection_mesh/" + tim@591: "horizontalcrosssection_step_0"+steps+"_out_wms.xml"), tim@345: fos2,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: } 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: }