Mercurial > dive4elements > gnv-client
changeset 106:10d9a440f52e
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
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 12:56:27 +0000 |
parents | 11b2d43da90d |
children | 4ebf9ad2e7eb |
files | gnv-artifacts/Changelog gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java |
diffstat | 2 files changed, 291 insertions(+), 247 deletions(-) [+] |
line wrap: on
line diff
--- 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 <tim.englich@intevation.de> + + * 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 <tim.englich@intevation.de> * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java (testVerticalProfileMeshArtifact) Edited:
--- 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); + } + } }