# HG changeset patch # User Tim Englich # Date 1254228987 0 # Node ID 10d9a440f52e1d6c5d9cad29f9828f5062773cae # Parent 11b2d43da90de82a846bfbee1e565ea1bafdac75 ExceptionTest for Responsdocuments added. UnitTests will now fail if the Artifact delivers an ExceptionReport using the advance Request. gnv-artifacts/trunk@155 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 11b2d43da90d -r 10d9a440f52e gnv-artifacts/Changelog --- a/gnv-artifacts/Changelog Tue Sep 29 12:37:05 2009 +0000 +++ b/gnv-artifacts/Changelog Tue Sep 29 12:56:27 2009 +0000 @@ -1,3 +1,9 @@ +2009-09-29 Tim Englich + + * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java (check4ExceptionReport) edited: + ExceptionTest for Responsdocuments added. + UnitTest will now fail if the Artifact delivers an ExceptionReport using the advance Request. + 2009-09-29 Tim Englich * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java (testVerticalProfileMeshArtifact) Edited: diff -r 11b2d43da90d -r 10d9a440f52e gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java --- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Tue Sep 29 12:37:05 2009 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Tue Sep 29 12:56:27 2009 +0000 @@ -69,275 +69,306 @@ } public void testTimeSeriesArtifact(){ - 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 = new TestCallContext(bootstrap.getContext()); - - // Erster Schritt - Document outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Zweiter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Dritter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc); - this.writeDocument2Log(outputData); - - - // Vierter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc); - this.writeDocument2Log(outputData); - - // Fünfter Schritt - outputData = artifact.describe(null); - FileOutputStream fos = null; - try{ - fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); - artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc); - artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, cc); - } catch (Exception e){ + 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 = new TestCallContext(bootstrap.getContext()); + + // Erster Schritt + Document outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Zweiter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), cc); + this.writeDocument2Log(outputData); + + // Dritter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + + // Vierter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"),cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Fünfter Schritt + outputData = artifact.describe(null); + FileOutputStream fos = null; + try{ + fos = new FileOutputStream("src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); + artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), cc); + artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, 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(); - }finally{ - try { - fos.flush(); - fos.close(); - } catch (Exception e) { - log.error(e,e); - } } } public void testVerticalProfileArtifact(){ - 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 = new TestCallContext(bootstrap.getContext()); - - // Erster Schritt - Document outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Zweiter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Dritter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"), cc); - this.writeDocument2Log(outputData); - - - // Vierter Schritt - outputData = artifact.describe(null); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = 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"); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"), cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),fos2, cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),fos, cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.xml"),fos3, cc); - } catch (Exception e){ + 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 = new TestCallContext(bootstrap.getContext()); + + // Erster Schritt + Document outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_01_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Zweiter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Dritter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Vierter Schritt + outputData = artifact.describe(null); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = 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"); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_feed.xml"), cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_statistics.xml"),fos2, cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_chart.xml"),fos, cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile/verticalprofile_step_04_out_csv.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(); - }finally{ - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e,e); - } } } public void testVerticalProfileMeshArtifact(){ - 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 = new TestCallContext(bootstrap.getContext()); - - // Erster Schritt - Document outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Zweiter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Dritter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"), cc); - this.writeDocument2Log(outputData); - - - // Vierter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Fünfter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Vierter Schritt - outputData = artifact.describe(null); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = 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"); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml"), cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_statistics.xml"),fos2, cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_chart.xml"),fos, cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_csv.xml"),fos3, cc); - } catch (Exception e){ + 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 = new TestCallContext(bootstrap.getContext()); + + // Erster Schritt + Document outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Zweiter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Dritter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Vierter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Fünfter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Sechster Schritt + outputData = artifact.describe(null); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = 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"); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_feed.xml"), cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_statistics.xml"),fos2, cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_chart.xml"),fos, cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile_mesh/verticalprofile_step_06_out_csv.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(); - }finally{ - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e,e); - } } } public void testVerticalProfileInstantaneousPointArtifact(){ - log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); - String artefactName = "fis_instantaneouspoint"; - 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 = new TestCallContext(bootstrap.getContext()); - - // Erster Schritt - Document outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Zweiter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"), cc); - this.writeDocument2Log(outputData); - - // Dritter Schritt - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"), cc); - this.writeDocument2Log(outputData); - - - // Vierter Schritt - outputData = artifact.describe(null); - FileOutputStream fos = null; - FileOutputStream fos2 = null; - FileOutputStream fos3 = 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"); - artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"), cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),fos2, cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),fos, cc); - artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.xml"),fos3, cc); - } catch (Exception e){ + try { + log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); + String artefactName = "fis_instantaneouspoint"; + 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 = new TestCallContext(bootstrap.getContext()); + + // Erster Schritt + Document outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Zweiter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Dritter Schritt + outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml"), cc); + outputData = artifact.advance(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + + // Vierter Schritt + outputData = artifact.describe(null); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = 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"); + artifact.feed(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_feed.xml"), cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_statistics.xml"),fos2, cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_chart.xml"),fos, cc); + artifact.out(this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_04_out_csv.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(); - }finally{ - try { - fos.flush(); - fos.close(); - fos2.flush(); - fos2.close(); - fos3.flush(); - fos3.close(); - } catch (Exception e) { - log.error(e,e); - } } } @@ -396,4 +427,11 @@ } + 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); + } + } }