Mercurial > dive4elements > gnv-client
changeset 109:678aad19a08d
Some Coderedundances refactored.
gnv-artifacts/trunk@158 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 14:59:43 +0000 (2009-09-29) |
parents | 2aae4a78e555 |
children | b465f1bbe368 |
files | gnv-artifacts/Changelog gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java |
diffstat | 2 files changed, 91 insertions(+), 129 deletions(-) [+] |
line wrap: on
line diff
--- 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 <tim.englich@intevation.de> + + * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Edited: + Some Coderedundances refactored. + 2009-09-29 Tim Englich <tim.englich@intevation.de> * src/test/ressources/queries.properties Edited:
--- 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;