# HG changeset patch # User Tim Englich # Date 1254236383 0 # Node ID 678aad19a08d541a75c0b6fa6392c551c5dc08ea # Parent 2aae4a78e5559de54c67360a21938f0278cfe4e4 Some Coderedundances refactored. gnv-artifacts/trunk@158 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 2aae4a78e555 -r 678aad19a08d gnv-artifacts/Changelog --- a/gnv-artifacts/Changelog Tue Sep 29 14:19:34 2009 +0000 +++ b/gnv-artifacts/Changelog Tue Sep 29 14:59:43 2009 +0000 @@ -1,3 +1,8 @@ +2009-09-29 Tim Englich + + * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Edited: + Some Coderedundances refactored. + 2009-09-29 Tim Englich * src/test/ressources/queries.properties Edited: diff -r 2aae4a78e555 -r 678aad19a08d 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 14:19:34 2009 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Tue Sep 29 14:59:43 2009 +0000 @@ -83,37 +83,27 @@ 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); + + this.doNextStep(artifact, cc, + "src/test/ressources/timeseries/timeseries_step_01_feed.xml", + "src/test/ressources/timeseries/timeseries_step_01_advance.xml"); // 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); + this.doNextStep(artifact, cc, + "src/test/ressources/timeseries/timeseries_step_02_feed.xml", + "src/test/ressources/timeseries/timeseries_step_02_advance.xml"); // 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); - + this.doNextStep(artifact, cc, + "src/test/ressources/timeseries/timeseries_step_03_feed.xml", + "src/test/ressources/timeseries/timeseries_step_03_advance.xml"); // 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); + 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(null); FileOutputStream fos = null; @@ -137,6 +127,20 @@ fail(); } } + + /** + * @param artifact + * @param cc + * @throws Exception + */ + private void doNextStep(Artifact artifact, CallContext cc, String feedDocument, String advanceDocument) throws Exception { + Document outputData = artifact.describe(null); + this.writeDocument2Log(outputData); + artifact.feed(this.readDocument(feedDocument), cc); + outputData = artifact.advance(this.readDocument(advanceDocument), cc); + this.writeDocument2Log(outputData); + this.check4ExceptionReport(outputData); + } public void testTimeSeriesMeshArtifact(){ try { @@ -153,55 +157,38 @@ CallContext cc = new TestCallContext(bootstrap.getContext()); // Erster Schritt - Document outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_01_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_01_advance.xml"), cc); - this.writeDocument2Log(outputData); - this.check4ExceptionReport(outputData); + 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 - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_02_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_02_advance.xml"), cc); - this.writeDocument2Log(outputData); + 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 - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_03_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_03_advance.xml"), cc); - this.writeDocument2Log(outputData); - this.check4ExceptionReport(outputData); + 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 - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_04_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_04_advance.xml"),cc); - this.writeDocument2Log(outputData); - this.check4ExceptionReport(outputData); + 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 - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_05_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_05_advance.xml"),cc); - this.writeDocument2Log(outputData); - this.check4ExceptionReport(outputData); + 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 - outputData = artifact.describe(null); - this.writeDocument2Log(outputData); - artifact.feed(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_06_feed.xml"), cc); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries_mesh/timeseries_step_06_advance.xml"),cc); - this.writeDocument2Log(outputData); - this.check4ExceptionReport(outputData); + 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 - outputData = artifact.describe(null); + Document outputData = artifact.describe(null); FileOutputStream fos = null; FileOutputStream fos2 = null; FileOutputStream fos3 = null; @@ -249,31 +236,25 @@ 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); + this.doNextStep(artifact, cc, + "src/test/ressources/verticalprofile/verticalprofile_step_01_feed.xml", + "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); + // 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); + this.doNextStep(artifact, cc, + "src/test/ressources/verticalprofile/verticalprofile_step_02_feed.xml", + "src/test/ressources/verticalprofile/verticalprofile_step_02_advance.xml"); + // 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); + this.doNextStep(artifact, cc, + "src/test/ressources/verticalprofile/verticalprofile_step_03_feed.xml", + "src/test/ressources/verticalprofile/verticalprofile_step_03_advance.xml"); + // Vierter Schritt - outputData = artifact.describe(null); + Document outputData = artifact.describe(null); FileOutputStream fos = null; FileOutputStream fos2 = null; FileOutputStream fos3 = null; @@ -321,47 +302,32 @@ 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); + 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 - 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); + 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 - 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); + 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 - 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); + 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 - 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); + 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 - outputData = artifact.describe(null); + Document outputData = artifact.describe(null); FileOutputStream fos = null; FileOutputStream fos2 = null; FileOutputStream fos3 = null; @@ -411,31 +377,22 @@ 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); + 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 - 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); + 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 - 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); + 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 - outputData = artifact.describe(null); + Document outputData = artifact.describe(null); FileOutputStream fos = null; FileOutputStream fos2 = null; FileOutputStream fos3 = null;