Mercurial > dive4elements > gnv-client
changeset 102:994a39b084d6
Imporved JUnitTest and Bugfixing as a Result of this Improvement.
gnv-artifacts/trunk@150 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 29 Sep 2009 09:55:40 +0000 |
parents | e01c163ea5b0 |
children | 4042844339ee |
files | gnv-artifacts/Changelog gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestCallContext.java gnv-artifacts/src/test/ressources/conf.xml gnv-artifacts/src/test/ressources/queries.properties |
diffstat | 5 files changed, 75 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/Changelog Tue Sep 29 09:50:25 2009 +0000 +++ b/gnv-artifacts/Changelog Tue Sep 29 09:55:40 2009 +0000 @@ -1,3 +1,14 @@ +2009-09-29 Tim Englich <tim.englich@intevation.de> + + * src/test/ressources/queries.properties Edited: + Remove to_date from TimeSeries-Quueries becaus of Changes in the conf.xml-File + * src/test/ressources/conf.xml Edited: + Correct Types for min- and max-Values from Integer to Date + * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java (testTimeSeriesArtifact) Edited: + Add CallContext to the Tests. + * src/test/java/de/intevation/gnv/artifacts/TestCallContext.java Add: + A CallContext used only in Junit-Tests + 2009-09-29 Tim Englich <tim.englich@intevation.de> * pom.xml Edited:
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Tue Sep 29 09:50:25 2009 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Tue Sep 29 09:55:40 2009 +0000 @@ -22,8 +22,10 @@ import de.intevation.artifactdatabase.Config; import de.intevation.artifactdatabase.FactoryBootstrap; +import de.intevation.artifactdatabase.ArtifactDatabaseImpl.CallContextImpl; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.CallContext; import de.intevation.gnv.artifacts.context.GNVArtifactContext; import de.intevation.gnv.utils.ArtifactXMLUtilities; @@ -77,33 +79,36 @@ 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"), null); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_01_advance.xml"), null); + 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"), null); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_02_advance.xml"), null); + 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"), null); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_03_advance.xml"), null); + 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"), null); - outputData = artifact.advance(this.readDocument("src/test/ressources/timeseries/timeseries_step_04_advance.xml"), null); + 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 @@ -111,8 +116,8 @@ 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"), null); - artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"),fos, null); + 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();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestCallContext.java Tue Sep 29 09:55:40 2009 +0000 @@ -0,0 +1,41 @@ +/** + * + */ +package de.intevation.gnv.artifacts; + +import de.intevation.artifacts.CallContext; + +/** + * @author Tim Englich <tim.englich@intevation.de> + * + */ +public class TestCallContext implements CallContext { + + private Object globalContext = null; + /** + * Constructor + */ + public TestCallContext(Object globalContext) { + this.globalContext = globalContext; + } + + /** + * @see de.intevation.artifacts.CallContext#afterBackground(int) + */ + public void afterBackground(int action) { + } + + /** + * @see de.intevation.artifacts.CallContext#afterCall(int) + */ + public void afterCall(int action) { + } + + /** + * @see de.intevation.artifacts.CallContext#globalContext() + */ + public Object globalContext() { + return this.globalContext; + } + +}
--- a/gnv-artifacts/src/test/ressources/conf.xml Tue Sep 29 09:50:25 2009 +0000 +++ b/gnv-artifacts/src/test/ressources/conf.xml Tue Sep 29 09:55:40 2009 +0000 @@ -182,8 +182,8 @@ <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="1"/> <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/> <inputvalue name="measurementid" type="Integer" multiselect="false" usedinquery="1"/> - <inputvalue name="minvalue" type="Integer" multiselect="false" usedinquery="1"/> - <inputvalue name="maxvalue" type="Integer" multiselect="false" usedinquery="1"/> + <inputvalue name="minvalue" type="Date" multiselect="false" usedinquery="1"/> + <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="1"/> </inputvalues> <outputsModes> <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png"> @@ -258,8 +258,8 @@ <inputvalues> <inputvalue name="parameterid" type="Integer" multiselect="true"/> <inputvalue name="measurementid" type="Integer" multiselect="true"/> - <inputvalue name="minvalue" type="Integer" multiselect="false"/> - <inputvalue name="maxvalue" type="Integer" multiselect="false"/> + <inputvalue name="minvalue" type="Date" multiselect="false"/> + <inputvalue name="maxvalue" type="Date" multiselect="false"/> </inputvalues> <outputsModes> <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
--- a/gnv-artifacts/src/test/ressources/queries.properties Tue Sep 29 09:50:25 2009 +0000 +++ b/gnv-artifacts/src/test/ressources/queries.properties Tue Sep 29 09:55:40 2009 +0000 @@ -77,8 +77,8 @@ WHERE tv.TIMESERIESID = t.TIMESERIESID AND \ t.PARAMETERID IN ( ? ) AND \ tv.MEASUREMENTID IN ( ? ) AND \ - tv.TIMEVALUE > TO_DATE ('?', 'YYYY.MM.DD HH24:MI:SS') AND \ - tv.TIMEVALUE < TO_DATE ('?', 'YYYY.MM.DD HH24:MI:SS') \ + tv.TIMEVALUE > ? AND \ + tv.TIMEVALUE < ? \ ORDER BY tv.MEASUREMENTID , \ tv.TIMESERIESID , \ t.PARAMETERID , \ @@ -153,8 +153,8 @@ msv.FEATUREID in ( ? ) AND \ msv.PARAMETERID in ( ? ) AND \ mp.FEATUREID = ? AND \ - msv.TIMEVALUE >= to_date('?', 'YYYY.MM.DD HH24:MI:SS') AND \ - msv.TIMEVALUE <= to_date('?', 'YYYY.MM.DD HH24:MI:SS') \ + msv.TIMEVALUE >= ? AND \ + msv.TIMEVALUE <= ? \ order by msv.FEATUREID, \ msv.PARAMETERID, \ msv.TIMEVALUE