# HG changeset patch # User Tim Englich # Date 1260525730 0 # Node ID c16c622ba2f3bfa84a97cdba715b22cd1794a688 # Parent 44adf8918155b3647ff9d54046185d9e80697c95 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 diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Fri Dec 11 09:42:54 2009 +0000 +++ b/gnv-artifacts/ChangeLog Fri Dec 11 10:02:10 2009 +0000 @@ -1,3 +1,17 @@ +2009-12-11 Tim Englich + + * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java, + src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java, + src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java, + src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java, + src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java, + src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java, + src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java: + Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven. + 2009-12-11 Ingo Weinzierl * src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Fade out diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java --- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Fri Dec 11 09:42:54 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,935 +0,0 @@ -/** - * - */ -package de.intevation.gnv.artifacts; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import junit.framework.TestCase; - -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Logger; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import de.intevation.artifactdatabase.Config; -import de.intevation.artifactdatabase.DefaultCallMeta; -import de.intevation.artifactdatabase.DefaultPreferredLocale; -import de.intevation.artifactdatabase.FactoryBootstrap; -import de.intevation.artifacts.Artifact; -import de.intevation.artifacts.ArtifactFactory; -import de.intevation.artifacts.CallContext; -import de.intevation.artifacts.CallMeta; -import de.intevation.artifacts.PreferredLocale; -import de.intevation.gnv.artifacts.context.GNVArtifactContext; -import de.intevation.gnv.utils.ArtifactXMLUtilities; - -/** - * @author Tim Englich - * - */ -public class GNVArtifactsTestCase extends TestCase { - - /** - * the logger, used to log exceptions and additonaly information - */ - private static Logger log = null; - - static { - BasicConfigurator.configure(); - log = Logger.getLogger(GNVArtifactContext.class); - } - - private String configurationDir = "doc/conf"; - - private FactoryBootstrap bootstrap = null; - - /** - * Constructor - * - * @param name - */ - public GNVArtifactsTestCase(String name) { - super(name); - } - - /** - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - log.debug("GNVArtifactsTestCase.setUp"); - super.setUp(); - log.info(Config.CONFIG_DIR + " ==> " + configurationDir); - System.setProperty(Config.CONFIG_DIR, configurationDir); - log.info("Bootstrap wird initialisiert."); - bootstrap = new FactoryBootstrap(); - bootstrap.boot(); - } - - public void testTimeSeriesArtifact() { - try { - log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); - String artefactName = "fis_marnet"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("TimeSeries-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("TimeSeries-Artifact is available"); - - CallContext cc = createCallContext(); - - // Erster Schritt - - Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml"); - - int steps = 6; - - for (int i = 1; i <= steps; i++){ - - this.doNextStep( - artifact, - cc, - "src/test/ressources/timeseries/" + - "timeseries_step_0"+i+"_feed.xml", - "src/test/ressources/timeseries/" + - "timeseries_step_0"+i+"_advance.xml", - describeDocument); - } - - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - FileOutputStream fos4 = null; - try { - fos = new FileOutputStream("src/test/results/timeseries" - + System.currentTimeMillis() - + ".png"); - fos2 = new FileOutputStream("src/test/results/timeseries" - + System.currentTimeMillis() - + ".xml"); - fos3 = new FileOutputStream("src/test/results/timeseries" - + System.currentTimeMillis() - + ".csv"); - fos4 = new FileOutputStream("src/test/results/timeseries" - + System.currentTimeMillis() - + ".odv"); - - artifact.out(this - .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"), - fos, cc); - artifact.out(this - .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_statistics.xml"), - fos2, cc); - artifact.out(this - .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_csv.xml"), - fos3, cc); - artifact.out(this - .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_odv.xml"), - fos4, cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - /** - * @return - */ - private CallContext createCallContext() { - CallMeta callMeta = new DefaultCallMeta( - new PreferredLocale[] { new DefaultPreferredLocale("de_DE", - 1.0f) }); - CallContext cc = new TestCallContext(bootstrap.getContext(), callMeta); - return cc; - } - - /** - * @param artifact - * @param cc - * @param describeDocument TODO - * @throws Exception - */ - private void doNextStep(Artifact artifact, CallContext cc, - String feedDocument, String advanceDocument, Document describeDocument) - throws Exception { - Document outputData = artifact.describe(describeDocument,cc); -// this.writeDocument2Log(outputData); - outputData = artifact.feed(this.readDocument(feedDocument), cc); - this.check4ExceptionReport(outputData); - outputData = artifact.advance(this.readDocument(advanceDocument), cc); -// this.writeDocument2Log(outputData); - this.check4ExceptionReport(outputData); - - } - - public void testTimeSeriesMeshArtifact() { - try { - log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("TimeSeriesMesh-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("TimeSeriesMesh-Artifact is available"); - - CallContext cc = createCallContext(); - - Document describeDocument = this.readDocument("src/test/ressources/timeseries_mesh/timeseries_describe.xml"); - - int steps = 8; - - for (int i = 1; i <= steps; i++){ - this.doNextStep( - artifact, - cc, - "src/test/ressources/timeseries_mesh/" + - "timeseries_step_0"+i+"_feed.xml", - "src/test/ressources/timeseries_mesh/" + - "timeseries_step_0"+i+"_advance.xml", - describeDocument); - } - // Achter Schritt - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - FileOutputStream fos4 = null; - try { - fos = new FileOutputStream("src/test/results/timeseries_mesh" - + System.currentTimeMillis() - + ".png"); - fos2 = new FileOutputStream("src/test/results/timeseries_mesh" - + System.currentTimeMillis() - + ".xml"); - fos3 = new FileOutputStream("src/test/results/timeseries_mesh" - + System.currentTimeMillis() - + ".csv"); - fos4 = new FileOutputStream("src/test/results/timeseries_mesh" - + System.currentTimeMillis() - + ".odv"); - artifact - .out( - this - .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_statistics.xml"), - fos2, cc); - artifact - .out( - this - .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_chart.xml"), - fos, cc); - artifact - .out( - this - .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_csv.xml"), - fos3, cc); - artifact - .out( - this - .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_odv.xml"), - fos4, cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - public void testVerticalProfileArtifact() { - try { - log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); - String artefactName = "fis_marnet"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("VerticalProfile-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("VerticalProfile-Artifact is available"); - - CallContext cc = createCallContext(); - - Document describeDocument = this.readDocument("src/test/ressources/verticalprofile/verticalprofile_describe.xml"); - int steps = 6; - - for (int i = 1; i <= steps; i++){ - this.doNextStep( - artifact, - cc, - "src/test/ressources/verticalprofile/" + - "verticalprofile_step_0"+i+"_feed.xml", - "src/test/ressources/verticalprofile/" + - "verticalprofile_step_0"+i+"_advance.xml", - describeDocument); - } - - // Vierter Schritt - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - FileOutputStream fos4 = null; - try { - fos = new FileOutputStream("src/test/results/verticalprofile" - + System.currentTimeMillis() - + ".png"); - fos2 = new FileOutputStream("src/test/results/verticalprofile" - + System.currentTimeMillis() - + ".xml"); - fos3 = new FileOutputStream("src/test/results/verticalprofile" - + System.currentTimeMillis() - + ".csv"); - fos4 = new FileOutputStream("src/test/results/verticalprofile" - + System.currentTimeMillis() - + ".odv"); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile/" + - "verticalprofile_step_06_out_statistics.xml"), - fos2, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile/" + - "verticalprofile_step_06_out_chart.xml"), - fos, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile/" + - "verticalprofile_step_06_out_csv.xml"), - fos3, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile/" + - "verticalprofile_step_06_out_odv.xml"), - fos4, cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - fos4.flush(); - fos4.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - public void testVerticalProfileMeshArtifact() { - try { - log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("VerticalProfile-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("VerticalProfile-Artifact is available"); - - CallContext cc = createCallContext(); - Document describeDocument = this.readDocument("src/test/ressources/" + - "verticalprofile_mesh/" + - "verticalprofile_describe.xml"); - - int steps = 10; - - for (int i = 1; i <= steps; i++){ - String number = ""+i; - if (i < 10){ - number = "0"+number; - } - this.doNextStep( - artifact, - cc, - "src/test/ressources/verticalprofile_mesh/" + - "verticalprofile_step_"+number+"_feed.xml", - "src/test/ressources/verticalprofile_mesh/" + - "verticalprofile_step_"+number+"_advance.xml", - describeDocument); - } - // 10. Schritt - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - FileOutputStream fos4 = null; - try { - fos = new FileOutputStream( - "src/test/results/verticalprofile_mesh" - + System.currentTimeMillis() + ".png"); - fos2 = new FileOutputStream( - "src/test/results/verticalprofile_mesh" - + System.currentTimeMillis() + ".xml"); - fos3 = new FileOutputStream( - "src/test/results/verticalprofile_mesh" - + System.currentTimeMillis() + ".csv"); - fos4 = new FileOutputStream( - "src/test/results/verticalprofile_mesh" - + System.currentTimeMillis() + ".odv"); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_mesh/" + - "verticalprofile_step_10_out_statistics.xml"), - fos2, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_mesh/" + - "verticalprofile_step_10_out_chart.xml"), - fos, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_mesh/" + - "verticalprofile_step_10_out_csv.xml"), - fos3, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_mesh/" + - "verticalprofile_step_10_out_odv.xml"), - fos4, cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - fos4.flush(); - fos4.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - public void testVerticalProfileInstantaneousPointArtifact() { - try { - log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); - String artefactName = "fis_bsh_ctd"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("VerticalProfile-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("VerticalProfile-Artifact is available"); - - CallContext cc = createCallContext(); - Document describeDocument = this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_describe.xml"); - - int steps = 5; - - for (int i = 1; i <= steps; i++){ - this.doNextStep( - artifact, - cc, - "src/test/ressources/verticalprofile_instantaneouspoint/" + - "verticalprofile_step_0"+i+"_feed.xml", - "src/test/ressources/verticalprofile_instantaneouspoint/" + - "verticalprofile_step_0"+i+"_advance.xml", - describeDocument); - } - - // Vierter Schritt - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - FileOutputStream fos4 = null; - try { - fos = new FileOutputStream( - "src/test/results/verticalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".png"); - fos2 = new FileOutputStream( - "src/test/results/verticalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".xml"); - fos3 = new FileOutputStream( - "src/test/results/verticalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".csv"); - fos4 = new FileOutputStream( - "src/test/results/verticalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".odv"); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_instantaneouspoint/" + - "verticalprofile_step_05_out_statistics.xml"), - fos2, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_instantaneouspoint/" + - "verticalprofile_step_05_out_chart.xml"), - fos, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_instantaneouspoint/" + - "verticalprofile_step_05_out_csv.xml"), - fos3, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalprofile_instantaneouspoint/" + - "verticalprofile_step_05_out_odv.xml"), - fos4, cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - public void testHorizontalProfileInstantaneousPointArtifact() { - try { - log.debug("GNVArtifactsTestCase." + - "testHorizontalProfileInstantaneousPointArtifact"); - String artefactName = "fis_delphin"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("VerticalProfile-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("VerticalProfile-Artifact is available"); - - CallContext cc = createCallContext(); - Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_describe.xml"); - - int steps = 9; - - for (int i = 0; i < steps; i++){ - - this.doNextStep( - artifact, - cc, - "src/test/ressources/horizontalProfile_instantaneouspoint/" + - "horizontalprofile_step_0"+i+"_feed.xml", - "src/test/ressources/horizontalProfile_instantaneouspoint/" + - "horizontalprofile_step_0"+i+"_advance.xml", - describeDocument); - } - - Document outputData = artifact.describe(describeDocument, cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - FileOutputStream fos4 = null; - try { - fos = new FileOutputStream( - "src/test/results/horizontalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".png"); - fos2 = new FileOutputStream( - "src/test/results/horizontalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".xml"); - fos3 = new FileOutputStream( - "src/test/results/horizontalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".csv"); - fos4 = new FileOutputStream( - "src/test/results/horizontalprofile_instantaneouspoint" - + System.currentTimeMillis() + ".odv"); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_instantaneouspoint/" + - "horizontalprofile_step_08_out_statistics.xml"), - fos2,cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_instantaneouspoint/" + - "horizontalprofile_step_08_out_chart.xml"), - fos,cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_instantaneouspoint/" + - "horizontalprofile_step_08_out_csv.xml"), - fos3,cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_instantaneouspoint/" + - "horizontalprofile_step_08_out_odv.xml"), - fos4,cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - public void testHorizontalProfileMeshPointArtifact() { - try { - log.debug("GNVArtifactsTestCase." + - "testHorizontalProfileInstantaneousPointArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("VerticalProfile-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("VerticalProfile-Artifact is available"); - - CallContext cc = createCallContext(); - Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_describe.xml"); - - int steps = 10; - - for (int i = 1; i <= steps; i++){ - String number = ""+i; - if (i < 10){ - number = "0"+number; - } - this.doNextStep( - artifact, - cc, - "src/test/ressources/horizontalProfile_mesh/" + - "horizontalprofile_step_"+number+"_feed.xml", - "src/test/ressources/horizontalProfile_mesh/" + - "horizontalprofile_step_"+number+"_advance.xml", - describeDocument); - } - - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - FileOutputStream fos4 = null; - try { - fos = new FileOutputStream( - "src/test/results/horizontalProfile_mesh" - + System.currentTimeMillis() + ".png"); - fos2 = new FileOutputStream( - "src/test/results/horizontalProfile_mesh" - + System.currentTimeMillis() + ".xml"); - fos3 = new FileOutputStream( - "src/test/results/horizontalProfile_mesh" - + System.currentTimeMillis() + ".csv"); - fos4 = new FileOutputStream( - "src/test/results/horizontalProfile_mesh" - + System.currentTimeMillis() + ".odv"); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_mesh/" + - "horizontalprofile_step_10_out_statistics.xml"), - fos2, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_mesh/" + - "horizontalprofile_step_10_out_chart.xml"), - fos, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_mesh/" + - "horizontalprofile_step_10_out_csv.xml"), - fos3, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalProfile_mesh/" + - "horizontalprofile_step_10_out_odv.xml"), - fos4, cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - fos4.flush(); - fos4.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - public void testHorizontalCrossSectionMeshArtifact() { - try { - log.debug("GNVArtifactsTestCase.testHorizontalCrossSectionMeshArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("HorizontalCrossSectionMesh-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("HorizontalCrossSectionMesh-Artifact is available"); - - CallContext cc = createCallContext(); - Document describeDocument = this.readDocument("src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_describe.xml"); - int steps = 6; - - for (int i = 1; i <= steps; i++){ - this.doNextStep( - artifact, - cc, - "src/test/ressources/horizontalcrosssection_mesh/" + - "horizontalcrosssection_step_0"+i+"_feed.xml", - "src/test/ressources/horizontalcrosssection_mesh/" + - "horizontalcrosssection_step_0"+i+"_advance.xml", - describeDocument); - } - - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - try { - fos = new FileOutputStream( - "src/test/results/horizontalcrosssection_mesh" - + System.currentTimeMillis() + ".png"); - - fos2 = new FileOutputStream( - "src/test/results/horizontalcrosssection_mesh" - + System.currentTimeMillis() + ".csv"); - fos3 = new FileOutputStream( - "src/test/results/horizontalcrosssection_mesh" - + System.currentTimeMillis() + ".odv"); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalcrosssection_mesh/" + - "horizontalcrosssection_step_06_out_chart.xml"), - fos, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalcrosssection_mesh/" + - "horizontalcrosssection_step_06_out_csv.xml"), - fos2,cc); - artifact.out(this.readDocument("src/test/ressources/" + - "horizontalcrosssection_mesh/" + - "horizontalcrosssection_step_06_out_odv.xml"), - fos3,cc); - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - public void testVerticalCrossSectionMeshArtifact() { - try { - log.debug("GNVArtifactsTestCase." + - "testHVerticalCrossSectionMeshArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this - .getArtifactFactory(artefactName); - assertNotNull(artifactFactory); - log.debug("VerticalProfile-ArtifactFactory is available"); - Artifact artifact = artifactFactory.createArtifact( - "" + System.currentTimeMillis(), bootstrap.getContext()); - assertNotNull(artifact); - log.debug("VerticalProfile-Artifact is available"); - - CallContext cc = createCallContext(); - Document describeDocument = this.readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_describe.xml"); - - int steps = 8; - - for (int i = 1; i <= steps; i++){ - - this.doNextStep( - artifact, - cc, - "src/test/ressources/verticalcrosssection_mesh/" + - "verticalcrosssection_step_0"+i+"_feed.xml", - "src/test/ressources/verticalcrosssection_mesh/" + - "verticalcrosssection_step_0"+i+"_advance.xml", - describeDocument); - } - - Document outputData = artifact.describe(describeDocument,cc); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = null; - try { - fos = new FileOutputStream( - "src/test/results/verticalcrosssection_mesh" - + System.currentTimeMillis() + ".png"); - - fos2 = new FileOutputStream( - "src/test/results/verticalcrosssection_mesh" - + System.currentTimeMillis() + ".csv"); - fos3 = new FileOutputStream( - "src/test/results/verticalcrosssection_mesh" - + System.currentTimeMillis() + ".odv"); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalcrosssection_mesh/" + - "verticalcrosssection_step_08_out_chart.xml"), - fos, cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalcrosssection_mesh/" + - "verticalcrosssection_step_08_out_csv.xml"), - fos2,cc); - artifact.out(this.readDocument("src/test/ressources/" + - "verticalcrosssection_mesh/" + - "verticalcrosssection_step_08_out_odv.xml"), - fos3,cc); - - } catch (Exception e) { - log.error(e, e); - fail(); - } finally { - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e, e); - } - } - } catch (Exception e) { - log.error(e, e); - fail(); - } - } - - protected void createFile(byte[] content, String fileName) { - try { - FileOutputStream fos = new FileOutputStream(new File(fileName)); - ByteArrayInputStream bis = new ByteArrayInputStream(content); - byte[] buf = new byte[4096]; - while (bis.read(buf) > 0) { - fos.write(buf); - } - fos.flush(); - fos.close(); - } catch (FileNotFoundException e) { - log.error(e, e); - } catch (IOException e) { - log.error(e, e); - } - } - - /** - * @param artefactName - */ - private ArtifactFactory getArtifactFactory(String artefactName) { - log.debug("GNVArtifactsTestCase.getArtifactFactory"); - ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories(); - for (int i = 0; i < artifactFactories.length; i++) { - if (artifactFactories[i].getName().equals(artefactName)) { - log.debug("ArtifactFactory wurde gefunden."); - return artifactFactories[i]; - } - } - return null; - } - - protected void writeDocument2Log(Document document) { - log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); - } - - protected Document readDocument(String fileName) { - Document returnValue = null; - try { - DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory - .newInstance(); - DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); - returnValue = docBuilder.parse(new File(fileName)); - } catch (ParserConfigurationException e) { - log.error(e, e); - } catch (SAXException e) { - log.error(e, e); - } catch (IOException e) { - log.error(e, e); - } - return returnValue; - } - - private void check4ExceptionReport(Document document) throws Exception { - document = new ArtifactXMLUtilities().reInitDocument(document); - String message = Config.getStringXPath(document, - "/exceptionreport/exception"); - if (message != null) { - throw new Exception(message); - } - } -} \ No newline at end of file diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,176 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import junit.framework.TestCase; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import de.intevation.artifactdatabase.Config; +import de.intevation.artifactdatabase.DefaultCallMeta; +import de.intevation.artifactdatabase.DefaultPreferredLocale; +import de.intevation.artifactdatabase.FactoryBootstrap; +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.PreferredLocale; +import de.intevation.gnv.utils.ArtifactXMLUtilities; + +/** + * @author Tim Englich + * + */ +public abstract class GNVArtifactsTestCaseBase extends TestCase { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = null; + + static { + BasicConfigurator.configure(); + log = Logger.getLogger(GNVArtifactsTestCaseBase.class); + } + + private String configurationDir = "doc/conf"; + + protected FactoryBootstrap bootstrap = null; + + /** + * Constructor + */ + public GNVArtifactsTestCaseBase() { + } + + /** + * Constructor + * @param name + */ + public GNVArtifactsTestCaseBase(String name) { + super(name); + } + + public abstract void testArtifact(); + /** + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + log.debug("GNVArtifactsTestCase.setUp"); + super.setUp(); + log.info(Config.CONFIG_DIR + " ==> " + configurationDir); + System.setProperty(Config.CONFIG_DIR, configurationDir); + log.info("Bootstrap wird initialisiert."); + bootstrap = new FactoryBootstrap(); + bootstrap.boot(); + } + + protected void writeDocument2Log(Document document) { + log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); + } + + protected Document readDocument(String fileName) { + Document returnValue = null; + try { + DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); + returnValue = docBuilder.parse(new File(fileName)); + } catch (ParserConfigurationException e) { + log.error(e, e); + } catch (SAXException e) { + log.error(e, e); + } catch (IOException e) { + log.error(e, e); + } + return returnValue; + } + + protected void check4ExceptionReport(Document document) throws Exception { + document = new ArtifactXMLUtilities().reInitDocument(document); + String message = Config.getStringXPath(document, + "/exceptionreport/exception"); + if (message != null) { + throw new Exception(message); + } + } + + /** + * @return + */ + protected CallContext createCallContext() { + CallMeta callMeta = new DefaultCallMeta( + new PreferredLocale[] { new DefaultPreferredLocale("de_DE", + 1.0f) }); + CallContext cc = new TestCallContext(bootstrap.getContext(), callMeta); + return cc; + } + + /** + * @param artifact + * @param cc + * @param describeDocument TODO + * @throws Exception + */ + protected void doNextStep(Artifact artifact, CallContext cc, + String feedDocument, String advanceDocument, Document describeDocument) + throws Exception { + Document outputData = artifact.describe(describeDocument,cc); +// this.writeDocument2Log(outputData); + outputData = artifact.feed(this.readDocument(feedDocument), cc); + this.check4ExceptionReport(outputData); + outputData = artifact.advance(this.readDocument(advanceDocument), cc); +// this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + } + + protected void createFile(byte[] content, String fileName) { + try { + FileOutputStream fos = new FileOutputStream(new File(fileName)); + ByteArrayInputStream bis = new ByteArrayInputStream(content); + byte[] buf = new byte[4096]; + while (bis.read(buf) > 0) { + fos.write(buf); + } + fos.flush(); + fos.close(); + } catch (FileNotFoundException e) { + log.error(e, e); + } catch (IOException e) { + log.error(e, e); + } + } + + /** + * @param artefactName + */ + protected ArtifactFactory getArtifactFactory(String artefactName) { + log.debug("GNVArtifactsTestCase.getArtifactFactory"); + ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories(); + for (int i = 0; i < artifactFactories.length; i++) { + if (artifactFactories[i].getName().equals(artefactName)) { + log.debug("ArtifactFactory wurde gefunden."); + return artifactFactories[i]; + } + } + return null; + } + + + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,128 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class InstantaneousPointHorizontalProfileTestCase extends + GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(InstantaneousPointHorizontalProfileTestCase.class); + + /** + * Constructor + */ + public InstantaneousPointHorizontalProfileTestCase() { + } + + /** + * Constructor + * @param name + */ + public InstantaneousPointHorizontalProfileTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase." + + "testHorizontalProfileInstantaneousPointArtifact"); + String artefactName = "fis_delphin"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("VerticalProfile-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("VerticalProfile-Artifact is available"); + + CallContext cc = createCallContext(); + Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_describe.xml"); + + int steps = 9; + + for (int i = 0; i < steps; i++){ + + this.doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_instantaneouspoint/" + + "horizontalprofile_step_0"+i+"_feed.xml", + "src/test/ressources/horizontalProfile_instantaneouspoint/" + + "horizontalprofile_step_0"+i+"_advance.xml", + describeDocument); + } + + Document outputData = artifact.describe(describeDocument, cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + FileOutputStream fos4 = null; + try { + fos = new FileOutputStream( + "src/test/results/horizontalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".png"); + fos2 = new FileOutputStream( + "src/test/results/horizontalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".xml"); + fos3 = new FileOutputStream( + "src/test/results/horizontalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".csv"); + fos4 = new FileOutputStream( + "src/test/results/horizontalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".odv"); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_instantaneouspoint/" + + "horizontalprofile_step_08_out_statistics.xml"), + fos2,cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_instantaneouspoint/" + + "horizontalprofile_step_08_out_chart.xml"), + fos,cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_instantaneouspoint/" + + "horizontalprofile_step_08_out_csv.xml"), + fos3,cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_instantaneouspoint/" + + "horizontalprofile_step_08_out_odv.xml"), + fos4,cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,127 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class InstantaneousPointVerticalProfileTestCase extends + GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(InstantaneousPointVerticalProfileTestCase.class); + + /** + * Constructor + */ + public InstantaneousPointVerticalProfileTestCase() { + } + + /** + * Constructor + * @param name + */ + public InstantaneousPointVerticalProfileTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); + String artefactName = "fis_bsh_ctd"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("VerticalProfile-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("VerticalProfile-Artifact is available"); + + CallContext cc = createCallContext(); + Document describeDocument = this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_describe.xml"); + + int steps = 5; + + for (int i = 1; i <= steps; i++){ + this.doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_instantaneouspoint/" + + "verticalprofile_step_0"+i+"_feed.xml", + "src/test/ressources/verticalprofile_instantaneouspoint/" + + "verticalprofile_step_0"+i+"_advance.xml", + describeDocument); + } + + // Vierter Schritt + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + FileOutputStream fos4 = null; + try { + fos = new FileOutputStream( + "src/test/results/verticalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".png"); + fos2 = new FileOutputStream( + "src/test/results/verticalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".xml"); + fos3 = new FileOutputStream( + "src/test/results/verticalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".csv"); + fos4 = new FileOutputStream( + "src/test/results/verticalprofile_instantaneouspoint" + + System.currentTimeMillis() + ".odv"); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_instantaneouspoint/" + + "verticalprofile_step_05_out_statistics.xml"), + fos2, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_instantaneouspoint/" + + "verticalprofile_step_05_out_chart.xml"), + fos, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_instantaneouspoint/" + + "verticalprofile_step_05_out_csv.xml"), + fos3, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_instantaneouspoint/" + + "verticalprofile_step_05_out_odv.xml"), + fos4, cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,118 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class MeshHorizontalCrossSectionTestCase extends + GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(MeshHorizontalCrossSectionTestCase.class); + + /** + * Constructor + */ + public MeshHorizontalCrossSectionTestCase() { + } + + /** + * Constructor + * @param name + */ + public MeshHorizontalCrossSectionTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase.testHorizontalCrossSectionMeshArtifact"); + String artefactName = "fis_modeldata"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("HorizontalCrossSectionMesh-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("HorizontalCrossSectionMesh-Artifact is available"); + + CallContext cc = createCallContext(); + Document describeDocument = this.readDocument("src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_describe.xml"); + int steps = 6; + + for (int i = 1; i <= steps; i++){ + this.doNextStep( + artifact, + cc, + "src/test/ressources/horizontalcrosssection_mesh/" + + "horizontalcrosssection_step_0"+i+"_feed.xml", + "src/test/ressources/horizontalcrosssection_mesh/" + + "horizontalcrosssection_step_0"+i+"_advance.xml", + describeDocument); + } + + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + try { + fos = new FileOutputStream( + "src/test/results/horizontalcrosssection_mesh" + + System.currentTimeMillis() + ".png"); + + fos2 = new FileOutputStream( + "src/test/results/horizontalcrosssection_mesh" + + System.currentTimeMillis() + ".csv"); + fos3 = new FileOutputStream( + "src/test/results/horizontalcrosssection_mesh" + + System.currentTimeMillis() + ".odv"); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalcrosssection_mesh/" + + "horizontalcrosssection_step_06_out_chart.xml"), + fos, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalcrosssection_mesh/" + + "horizontalcrosssection_step_06_out_csv.xml"), + fos2,cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalcrosssection_mesh/" + + "horizontalcrosssection_step_06_out_odv.xml"), + fos3,cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,132 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class MeshHorizontalProfileTestCase extends GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(MeshHorizontalProfileTestCase.class); + + /** + * Constructor + */ + public MeshHorizontalProfileTestCase() { + } + + /** + * Constructor + * @param name + */ + public MeshHorizontalProfileTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase." + + "testHorizontalProfileInstantaneousPointArtifact"); + String artefactName = "fis_modeldata"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("VerticalProfile-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("VerticalProfile-Artifact is available"); + + CallContext cc = createCallContext(); + Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_describe.xml"); + + int steps = 10; + + for (int i = 1; i <= steps; i++){ + String number = ""+i; + if (i < 10){ + number = "0"+number; + } + this.doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/" + + "horizontalprofile_step_"+number+"_feed.xml", + "src/test/ressources/horizontalProfile_mesh/" + + "horizontalprofile_step_"+number+"_advance.xml", + describeDocument); + } + + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + FileOutputStream fos4 = null; + try { + fos = new FileOutputStream( + "src/test/results/horizontalProfile_mesh" + + System.currentTimeMillis() + ".png"); + fos2 = new FileOutputStream( + "src/test/results/horizontalProfile_mesh" + + System.currentTimeMillis() + ".xml"); + fos3 = new FileOutputStream( + "src/test/results/horizontalProfile_mesh" + + System.currentTimeMillis() + ".csv"); + fos4 = new FileOutputStream( + "src/test/results/horizontalProfile_mesh" + + System.currentTimeMillis() + ".odv"); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_mesh/" + + "horizontalprofile_step_10_out_statistics.xml"), + fos2, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_mesh/" + + "horizontalprofile_step_10_out_chart.xml"), + fos, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_mesh/" + + "horizontalprofile_step_10_out_csv.xml"), + fos3, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "horizontalProfile_mesh/" + + "horizontalprofile_step_10_out_odv.xml"), + fos4, cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + fos4.flush(); + fos4.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,130 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class MeshTimeSeriesTestCase extends GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(MeshTimeSeriesTestCase.class); + + /** + * Constructor + */ + public MeshTimeSeriesTestCase() { + } + + /** + * Constructor + * @param name + */ + public MeshTimeSeriesTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact"); + String artefactName = "fis_modeldata"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("TimeSeriesMesh-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("TimeSeriesMesh-Artifact is available"); + + CallContext cc = createCallContext(); + + Document describeDocument = this.readDocument("src/test/ressources/timeseries_mesh/timeseries_describe.xml"); + + int steps = 8; + + for (int i = 1; i <= steps; i++){ + this.doNextStep( + artifact, + cc, + "src/test/ressources/timeseries_mesh/" + + "timeseries_step_0"+i+"_feed.xml", + "src/test/ressources/timeseries_mesh/" + + "timeseries_step_0"+i+"_advance.xml", + describeDocument); + } + // Achter Schritt + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + FileOutputStream fos4 = null; + try { + fos = new FileOutputStream("src/test/results/timeseries_mesh" + + System.currentTimeMillis() + + ".png"); + fos2 = new FileOutputStream("src/test/results/timeseries_mesh" + + System.currentTimeMillis() + + ".xml"); + fos3 = new FileOutputStream("src/test/results/timeseries_mesh" + + System.currentTimeMillis() + + ".csv"); + fos4 = new FileOutputStream("src/test/results/timeseries_mesh" + + System.currentTimeMillis() + + ".odv"); + artifact + .out( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_statistics.xml"), + fos2, cc); + artifact + .out( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_chart.xml"), + fos, cc); + artifact + .out( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_csv.xml"), + fos3, cc); + artifact + .out( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_08_out_odv.xml"), + fos4, cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,121 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class MeshVerticalCrossSectionTestCase extends GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(MeshVerticalCrossSectionTestCase.class); + + /** + * Constructor + */ + public MeshVerticalCrossSectionTestCase() { + } + + /** + * Constructor + * @param name + */ + public MeshVerticalCrossSectionTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase." + + "testHVerticalCrossSectionMeshArtifact"); + String artefactName = "fis_modeldata"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("VerticalProfile-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("VerticalProfile-Artifact is available"); + + CallContext cc = createCallContext(); + Document describeDocument = this.readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_describe.xml"); + + int steps = 8; + + for (int i = 1; i <= steps; i++){ + + this.doNextStep( + artifact, + cc, + "src/test/ressources/verticalcrosssection_mesh/" + + "verticalcrosssection_step_0"+i+"_feed.xml", + "src/test/ressources/verticalcrosssection_mesh/" + + "verticalcrosssection_step_0"+i+"_advance.xml", + describeDocument); + } + + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + try { + fos = new FileOutputStream( + "src/test/results/verticalcrosssection_mesh" + + System.currentTimeMillis() + ".png"); + + fos2 = new FileOutputStream( + "src/test/results/verticalcrosssection_mesh" + + System.currentTimeMillis() + ".csv"); + fos3 = new FileOutputStream( + "src/test/results/verticalcrosssection_mesh" + + System.currentTimeMillis() + ".odv"); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalcrosssection_mesh/" + + "verticalcrosssection_step_08_out_chart.xml"), + fos, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalcrosssection_mesh/" + + "verticalcrosssection_step_08_out_csv.xml"), + fos2,cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalcrosssection_mesh/" + + "verticalcrosssection_step_08_out_odv.xml"), + fos3,cc); + + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,133 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class MeshVerticalProfileTestCase extends GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(MeshVerticalProfileTestCase.class); + + /** + * Constructor + */ + public MeshVerticalProfileTestCase() { + } + + /** + * Constructor + * @param name + */ + public MeshVerticalProfileTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); + String artefactName = "fis_modeldata"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("VerticalProfile-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("VerticalProfile-Artifact is available"); + + CallContext cc = createCallContext(); + Document describeDocument = this.readDocument("src/test/ressources/" + + "verticalprofile_mesh/" + + "verticalprofile_describe.xml"); + + int steps = 10; + + for (int i = 1; i <= steps; i++){ + String number = ""+i; + if (i < 10){ + number = "0"+number; + } + this.doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_mesh/" + + "verticalprofile_step_"+number+"_feed.xml", + "src/test/ressources/verticalprofile_mesh/" + + "verticalprofile_step_"+number+"_advance.xml", + describeDocument); + } + // 10. Schritt + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + FileOutputStream fos4 = null; + try { + fos = new FileOutputStream( + "src/test/results/verticalprofile_mesh" + + System.currentTimeMillis() + ".png"); + fos2 = new FileOutputStream( + "src/test/results/verticalprofile_mesh" + + System.currentTimeMillis() + ".xml"); + fos3 = new FileOutputStream( + "src/test/results/verticalprofile_mesh" + + System.currentTimeMillis() + ".csv"); + fos4 = new FileOutputStream( + "src/test/results/verticalprofile_mesh" + + System.currentTimeMillis() + ".odv"); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_mesh/" + + "verticalprofile_step_10_out_statistics.xml"), + fos2, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_mesh/" + + "verticalprofile_step_10_out_chart.xml"), + fos, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_mesh/" + + "verticalprofile_step_10_out_csv.xml"), + fos3, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile_mesh/" + + "verticalprofile_step_10_out_odv.xml"), + fos4, cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + fos4.flush(); + fos4.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,127 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class TimeSeriesPointTimeSeriesTestCase extends GNVArtifactsTestCaseBase { + + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = Logger.getLogger(TimeSeriesPointTimeSeriesTestCase.class); + + /** + * Constructor + */ + public TimeSeriesPointTimeSeriesTestCase() { + } + + /** + * Constructor + * @param name + */ + public TimeSeriesPointTimeSeriesTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); + try { + String artefactName = "fis_marnet"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("TimeSeries-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("TimeSeries-Artifact is available"); + + CallContext cc = createCallContext(); + + // Erster Schritt + + Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml"); + + int steps = 6; + + for (int i = 1; i <= steps; i++){ + + this.doNextStep( + artifact, + cc, + "src/test/ressources/timeseries/" + + "timeseries_step_0"+i+"_feed.xml", + "src/test/ressources/timeseries/" + + "timeseries_step_0"+i+"_advance.xml", + describeDocument); + } + + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + FileOutputStream fos4 = null; + try { + fos = new FileOutputStream("src/test/results/timeseries" + + System.currentTimeMillis() + + ".png"); + fos2 = new FileOutputStream("src/test/results/timeseries" + + System.currentTimeMillis() + + ".xml"); + fos3 = new FileOutputStream("src/test/results/timeseries" + + System.currentTimeMillis() + + ".csv"); + fos4 = new FileOutputStream("src/test/results/timeseries" + + System.currentTimeMillis() + + ".odv"); + + artifact.out(this + .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"), + fos, cc); + artifact.out(this + .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_statistics.xml"), + fos2, cc); + artifact.out(this + .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_csv.xml"), + fos3, cc); + artifact.out(this + .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_odv.xml"), + fos4, cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +} diff -r 44adf8918155 -r c16c622ba2f3 gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java Fri Dec 11 10:02:10 2009 +0000 @@ -0,0 +1,129 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import java.io.FileOutputStream; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich + * + */ +public class TimeSeriesPointVerticalProfileTestCase extends + GNVArtifactsTestCaseBase { + + private static Logger log = Logger.getLogger(TimeSeriesPointVerticalProfileTestCase.class); + + /** + * Constructor + */ + public TimeSeriesPointVerticalProfileTestCase() { + } + + /** + * Constructor + * @param name + */ + public TimeSeriesPointVerticalProfileTestCase(String name) { + super(name); + } + + /** + * @see de.intevation.gnv.artifacts.GNVArtifactsTestCaseBase#testArtifact() + */ + @Override + public void testArtifact() { + try { + log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); + String artefactName = "fis_marnet"; + ArtifactFactory artifactFactory = this + .getArtifactFactory(artefactName); + assertNotNull(artifactFactory); + log.debug("VerticalProfile-ArtifactFactory is available"); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); + assertNotNull(artifact); + log.debug("VerticalProfile-Artifact is available"); + + CallContext cc = createCallContext(); + + Document describeDocument = this.readDocument("src/test/ressources/verticalprofile/verticalprofile_describe.xml"); + int steps = 6; + + for (int i = 1; i <= steps; i++){ + this.doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile/" + + "verticalprofile_step_0"+i+"_feed.xml", + "src/test/ressources/verticalprofile/" + + "verticalprofile_step_0"+i+"_advance.xml", + describeDocument); + } + + // Vierter Schritt + Document outputData = artifact.describe(describeDocument,cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = null; + FileOutputStream fos4 = null; + try { + fos = new FileOutputStream("src/test/results/verticalprofile" + + System.currentTimeMillis() + + ".png"); + fos2 = new FileOutputStream("src/test/results/verticalprofile" + + System.currentTimeMillis() + + ".xml"); + fos3 = new FileOutputStream("src/test/results/verticalprofile" + + System.currentTimeMillis() + + ".csv"); + fos4 = new FileOutputStream("src/test/results/verticalprofile" + + System.currentTimeMillis() + + ".odv"); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile/" + + "verticalprofile_step_06_out_statistics.xml"), + fos2, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile/" + + "verticalprofile_step_06_out_chart.xml"), + fos, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile/" + + "verticalprofile_step_06_out_csv.xml"), + fos3, cc); + artifact.out(this.readDocument("src/test/ressources/" + + "verticalprofile/" + + "verticalprofile_step_06_out_odv.xml"), + fos4, cc); + } catch (Exception e) { + log.error(e, e); + fail(); + } finally { + try { + fos.flush(); + fos.close(); + fos2.flush(); + fos2.close(); + fos3.flush(); + fos3.close(); + fos4.flush(); + fos4.close(); + } catch (Exception e) { + log.error(e, e); + } + } + } catch (Exception e) { + log.error(e, e); + fail(); + } + } + +}