Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 171:7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
gnv-artifacts/trunk@208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 09 Oct 2009 07:54:48 +0000 |
parents | 4841808819d9 |
children | 08b8b79b30ff |
line wrap: on
line diff
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Fri Oct 09 07:49:47 2009 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Fri Oct 09 07:54:48 2009 +0000 @@ -34,7 +34,7 @@ /** * @author Tim Englich <tim.englich@intevation.de> - * + * */ public class GNVArtifactsTestCase extends TestCase { @@ -42,17 +42,19 @@ * 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 = "src/test/ressources/"; - + private FactoryBootstrap bootstrap = null; + /** * Constructor + * * @param name */ public GNVArtifactsTestCase(String name) { @@ -65,68 +67,92 @@ protected void setUp() throws Exception { log.debug("GNVArtifactsTestCase.setUp"); super.setUp(); - log.info(Config.CONFIG_DIR + " ==> "+configurationDir); + 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(){ + + public void testTimeSeriesArtifact() { try { log.debug("GNVArtifactsTestCase.testTimeSeriesArtifact"); - String artefactName = "fis_marnet"; - ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); + 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()); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); assertNotNull(artifact); log.debug("TimeSeries-Artifact is available"); - + CallContext cc = createCallContext(); - + // Erster Schritt - - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries/timeseries_step_01_feed.xml", - "src/test/ressources/timeseries/timeseries_step_01_advance.xml"); - + + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries/timeseries_step_01_feed.xml", + "src/test/ressources/timeseries/timeseries_step_01_advance.xml"); + // Zweiter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries/timeseries_step_02_feed.xml", - "src/test/ressources/timeseries/timeseries_step_02_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries/timeseries_step_02_feed.xml", + "src/test/ressources/timeseries/timeseries_step_02_advance.xml"); + // Dritter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries/timeseries_step_03_feed.xml", - "src/test/ressources/timeseries/timeseries_step_03_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries/timeseries_step_03_feed.xml", + "src/test/ressources/timeseries/timeseries_step_03_advance.xml"); + // Vierter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries/timeseries_step_04_feed.xml", - "src/test/ressources/timeseries/timeseries_step_04_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries/timeseries_step_04_feed.xml", + "src/test/ressources/timeseries/timeseries_step_04_advance.xml"); + Document outputData; // Fünfter Schritt outputData = artifact.describe(cc); 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); + 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{ + } finally { try { fos.flush(); fos.close(); } catch (Exception e) { - log.error(e,e); + log.error(e, e); } } } catch (Exception e) { - log.error(e,e); + log.error(e, e); fail(); } } @@ -135,8 +161,10 @@ * @return */ private CallContext createCallContext() { - CallMeta callMeta = new DefaultCallMeta(new PreferredLocale[]{new DefaultPreferredLocale("de_DE", 1.0f)}); - CallContext cc = new TestCallContext(bootstrap.getContext(),callMeta); + CallMeta callMeta = new DefaultCallMeta( + new PreferredLocale[] { new DefaultPreferredLocale("de_DE", + 1.0f) }); + CallContext cc = new TestCallContext(bootstrap.getContext(), callMeta); return cc; } @@ -145,7 +173,9 @@ * @param cc * @throws Exception */ - private void doNextStep(Artifact artifact, CallContext cc, String feedDocument, String advanceDocument) throws Exception { + private void doNextStep(Artifact artifact, CallContext cc, + String feedDocument, String advanceDocument) + throws Exception { Document outputData = artifact.describe(cc); this.writeDocument2Log(outputData); outputData = artifact.feed(this.readDocument(feedDocument), cc); @@ -153,138 +183,111 @@ outputData = artifact.advance(this.readDocument(advanceDocument), cc); this.writeDocument2Log(outputData); this.check4ExceptionReport(outputData); - - + } - - public void testTimeSeriesMeshArtifact(){ + + public void testTimeSeriesMeshArtifact() { try { log.debug("GNVArtifactsTestCase.testTimeSeriesMeshArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); + 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()); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); assertNotNull(artifact); log.debug("TimeSeriesMesh-Artifact is available"); - - + CallContext cc = createCallContext(); - + // Erster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml", - "src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml", + "src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml"); + // Zweiter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml", - "src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml", + "src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml"); + // Dritter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml", - "src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml"); - - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml", + "src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml"); + // Vierter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml", - "src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml", + "src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml"); + // Fünfter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml", - "src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml", + "src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml"); + // Sechster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml", - "src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml", + "src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml"); + // Siebter Schritt Document outputData = artifact.describe(cc); FileOutputStream fos = null; FileOutputStream fos2 = null; FileOutputStream fos3 = 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"); - artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_feed.xml"), cc); - artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_statistics.xml"),fos2, cc); - artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_chart.xml"),fos, cc); - artifact.out(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_csv.xml"),fos3, cc); - } catch (Exception e){ - log.error(e,e); + 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"); + artifact + .feed( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_feed.xml"), + cc); + artifact + .out( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_statistics.xml"), + fos2, cc); + artifact + .out( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_out_chart.xml"), + fos, cc); + artifact + .out( + this + .readDocument("src/test/ressources/timeseries_mesh/timeseries_step_07_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(); - } - } - - 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(); - - // Erster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml", - "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); - - - // Zweiter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml", - "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); - - - // Dritter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml", - "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"); - - - // Vierter Schritt - Document outputData = artifact.describe(cc); - 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{ + } finally { try { fos.flush(); fos.close(); @@ -293,136 +296,93 @@ fos3.flush(); fos3.close(); } catch (Exception e) { - log.error(e,e); + log.error(e, e); } } } catch (Exception e) { - log.error(e,e); + log.error(e, e); fail(); } } - - public void testVerticalProfileMeshArtifact(){ + + public void testVerticalProfileArtifact() { try { log.debug("GNVArtifactsTestCase.testVerticalProfileArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); + 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()); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); assertNotNull(artifact); log.debug("VerticalProfile-Artifact is available"); - - + CallContext cc = createCallContext(); - + // Erster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml", - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml", + "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); + // Zweiter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml", - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml", + "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); + // Dritter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml", - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"); - - // Vierter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml", - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"); - - // Fünfter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml", - "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"); - - // Sechster Schritt - Document outputData = artifact.describe(cc); - 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(); - } - } - - - - 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(); - - // Erster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml", - "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"); - - // Zweiter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml", - "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"); - - // Dritter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml", - "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml", + "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"); + // Vierter Schritt Document outputData = artifact.describe(cc); 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); + 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{ + } finally { try { fos.flush(); fos.close(); @@ -431,74 +391,109 @@ fos3.flush(); fos3.close(); } catch (Exception e) { - log.error(e,e); + log.error(e, e); } } } catch (Exception e) { - log.error(e,e); + log.error(e, e); fail(); } } - - public void testHorizontalProfileInstantaneousPointArtifact(){ + + public void testVerticalProfileMeshArtifact() { try { - log.debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact"); - String artefactName = "fis_delphin"; - ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); + 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()); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); assertNotNull(artifact); log.debug("VerticalProfile-Artifact is available"); - - + CallContext cc = createCallContext(); - + // Erster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_feed.xml", - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_advance.xml"); - - - // Erster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_feed.xml", - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_feed.xml", + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_01_advance.xml"); + // Zweiter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_feed.xml", - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_advance.xml"); + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_feed.xml", + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_02_advance.xml"); + // Dritter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_feed.xml", - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_advance.xml"); + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_feed.xml", + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_03_advance.xml"); + // Vierter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_feed.xml", - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_advance.xml"); - // Fünfter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_feed.xml", - "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_advance.xml"); - - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_feed.xml", + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_04_advance.xml"); + + // Fünfter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_feed.xml", + "src/test/ressources/verticalprofile_mesh/verticalprofile_step_05_advance.xml"); + + // Sechster Schritt Document outputData = artifact.describe(cc); FileOutputStream fos = null; FileOutputStream fos2 = null; FileOutputStream fos3 = 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"); - artifact.feed(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_feed.xml"), cc); - //artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_statistics.xml"),fos2, cc); - artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_chart.xml"),fos, cc); -// artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_csv.xml"),fos3, cc); - } catch (Exception e){ - log.error(e,e); + 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{ + } finally { try { fos.flush(); fos.close(); @@ -507,79 +502,93 @@ fos3.flush(); fos3.close(); } catch (Exception e) { - log.error(e,e); + log.error(e, e); } } } catch (Exception e) { - log.error(e,e); + log.error(e, e); fail(); } } - - public void testHorizontalProfileMeshPointArtifact(){ + + public void testVerticalProfileInstantaneousPointArtifact() { try { - log.debug("GNVArtifactsTestCase.testHorizontalProfileInstantaneousPointArtifact"); - String artefactName = "fis_modeldata"; - ArtifactFactory artifactFactory = this.getArtifactFactory(artefactName); + 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()); + Artifact artifact = artifactFactory.createArtifact( + "" + System.currentTimeMillis(), bootstrap.getContext()); assertNotNull(artifact); log.debug("VerticalProfile-Artifact is available"); - - + CallContext cc = createCallContext(); - - - + // Erster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_feed.xml", - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_advance.xml"); - + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_feed.xml", + "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_01_advance.xml"); + // Zweiter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_feed.xml", - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_advance.xml"); + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_feed.xml", + "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_02_advance.xml"); + // Dritter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_feed.xml", - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_advance.xml"); + this + .doNextStep( + artifact, + cc, + "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_feed.xml", + "src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_step_03_advance.xml"); + // Vierter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_feed.xml", - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_advance.xml"); - // Fünfter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_feed.xml", - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_advance.xml"); - - // Sechster Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_feed.xml", - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_advance.xml"); - - // Siebter Schritt - this.doNextStep(artifact, cc, - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_feed.xml", - "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_advance.xml"); - Document outputData = artifact.describe(cc); FileOutputStream fos = null; FileOutputStream fos2 = null; FileOutputStream fos3 = 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"); - artifact.feed(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_feed.xml"), cc); - artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_statistics.xml"),fos2, cc); - artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_chart.xml"),fos, cc); -// artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_csv.xml"),fos3, cc); - } catch (Exception e){ - log.error(e,e); + 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{ + } finally { try { fos.flush(); fos.close(); @@ -588,74 +597,304 @@ fos3.flush(); fos3.close(); } catch (Exception e) { - log.error(e,e); + log.error(e, e); } } } catch (Exception e) { - log.error(e,e); + log.error(e, e); fail(); } } - - protected void createFile(byte[] content, String fileName){ + + 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(); + + // Erster Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_feed.xml", + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_00_advance.xml"); + + // Erster Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_feed.xml", + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_01_advance.xml"); + + // Zweiter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_feed.xml", + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_02_advance.xml"); + // Dritter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_feed.xml", + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_03_advance.xml"); + // Vierter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_feed.xml", + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_04_advance.xml"); + // Fünfter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_feed.xml", + "src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_05_advance.xml"); + + Document outputData = artifact.describe(cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = 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"); + artifact + .feed( + this + .readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_feed.xml"), + cc); + // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_statistics.xml"),fos2, + // cc); + artifact + .out( + this + .readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_step_06_out_chart.xml"), + fos, cc); + // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_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(); + } + } + + 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(); + + // Erster Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_feed.xml", + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_01_advance.xml"); + + // Zweiter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_feed.xml", + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_02_advance.xml"); + // Dritter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_feed.xml", + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_03_advance.xml"); + // Vierter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_feed.xml", + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_04_advance.xml"); + // Fünfter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_feed.xml", + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_05_advance.xml"); + + // Sechster Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_feed.xml", + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_06_advance.xml"); + + // Siebter Schritt + this + .doNextStep( + artifact, + cc, + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_feed.xml", + "src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_07_advance.xml"); + + Document outputData = artifact.describe(cc); + FileOutputStream fos = null; + FileOutputStream fos2 = null; + FileOutputStream fos3 = 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"); + artifact + .feed( + this + .readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_feed.xml"), + cc); + artifact + .out( + this + .readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_statistics.xml"), + fos2, cc); + artifact + .out( + this + .readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_out_chart.xml"), + fos, cc); + // artifact.out(this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_08_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(); + } + } + + 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); + while (bis.read(buf) > 0) { + fos.write(buf); } fos.flush(); fos.close(); } catch (FileNotFoundException e) { - log.error(e,e); + log.error(e, e); } catch (IOException e) { - log.error(e,e); + log.error(e, e); } } - /** * @param artefactName */ - private ArtifactFactory getArtifactFactory(String 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)){ + 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){ + + protected void writeDocument2Log(Document document) { log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); } - - - protected Document readDocument(String fileName){ + + protected Document readDocument(String fileName) { Document returnValue = null; try { - DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory + .newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); - returnValue = docBuilder.parse (new File(fileName)); + returnValue = docBuilder.parse(new File(fileName)); } catch (ParserConfigurationException e) { - log.error(e,e); + log.error(e, e); } catch (SAXException e) { - log.error(e,e); + log.error(e, e); } catch (IOException e) { - log.error(e,e); + log.error(e, e); } return returnValue; } - - private void check4ExceptionReport(Document document) throws Exception{ + private void check4ExceptionReport(Document document) throws Exception { document = new ArtifactXMLUtilities().reInitDocument(document); - String message = Config.getStringXPath(document,"/exceptionreport/exception"); - if (message != null){ + String message = Config.getStringXPath(document, + "/exceptionreport/exception"); + if (message != null) { throw new Exception(message); } }