# HG changeset patch # User Tim Englich # Date 1252569450 0 # Node ID f24c825144bc9f14e417b11a785932c3d3af9176 # Parent d117fd4b82e58d3c9be9de822100378d9fd92bad TestCase Refactored to the new Folder-Based Configuration. Also added further steps to the Testcase. gnv-artifacts/trunk@56 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/Changelog --- a/gnv-artifacts/Changelog Wed Sep 09 15:28:18 2009 +0000 +++ b/gnv-artifacts/Changelog Thu Sep 10 07:57:30 2009 +0000 @@ -1,3 +1,24 @@ +2009-09-10 Tim Englich + + * src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Edited: + src/test/ressources/conf.xml Renamed: + Project Structure changed in artifact-database. So we have to rename + the Testconfigurationfile in conf.xml. + + * src/test/ressources/results Added: + Integrated Folder for temporal storing Resultfiles of the TestCases + + * src/test/ressources/queries.properties Edited: + Further Queries for Testcases integrated + * src/test/ressources/timeseries/timeseries_step_05_out.xml Added, + src/test/ressources/timeseries/timeseries_step_05_feed.xml Added: + Integrated the last step of the TimeSeries-Workflow. + Now the TestCase is able to render Charts. + + * src/test/ressources/timeseries/timeseries_step_04_feed.xml Edited, + src/test/ressources/timeseries/timeseries_step_03_feed.xml Edited: + Names of the feed-Parametes changed to the Syntax of BSH-Spelling + 2009-09-09 Tim Englich * src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java: diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java --- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Wed Sep 09 15:28:18 2009 +0000 +++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java Thu Sep 10 07:57:30 2009 +0000 @@ -3,7 +3,10 @@ */ package de.intevation.gnv.artifacts; +import java.io.ByteArrayInputStream; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; import java.io.StringWriter; @@ -28,7 +31,6 @@ import de.intevation.artifacts.Artifact; import de.intevation.artifacts.ArtifactFactory; import de.intevation.gnv.artifacts.context.GNVArtifactContext; -import de.intevation.gnv.artifacts.context.GNVArtifactContextFactory; import junit.framework.TestCase; /** @@ -47,7 +49,7 @@ log = Logger.getLogger(GNVArtifactContext.class); } - private String configurationFile = "src/test/ressources/GNVArtifactsTestCase_Configuration.xml"; + private String configurationDir = "src/test/ressources/"; private FactoryBootstrap bootstrap = null; /** @@ -64,8 +66,8 @@ protected void setUp() throws Exception { log.debug("GNVArtifactsTestCase.setUp"); super.setUp(); - log.info(Config.CONFIG_PROPERTY + " ==> "+configurationFile); - System.setProperty(Config.CONFIG_PROPERTY, configurationFile); + log.info(Config.CONFIG_DIR + " ==> "+configurationDir); + System.setProperty(Config.CONFIG_DIR, configurationDir); log.info("Bootstrap wird initialisiert."); bootstrap = new FactoryBootstrap(); bootstrap.boot(); @@ -112,25 +114,28 @@ // Fünfter Schritt outputData = artifact.describe(bootstrap.getContext()); - this.writeDocument2Log(outputData); - - } - private Document getDocument(){ - return this.createOutputDocument(); + artifact.feed(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_feed.xml"), bootstrap.getContext()); + byte[] result = artifact.out(this.readDocument("src/test/ressources/timeseries/timeseries_step_05_out.xml"), bootstrap.getContext()); + this.createFile(result, "src/test/results/timeseriesdiagramm"+System.currentTimeMillis()+".png"); } - private Document createOutputDocument(){ + protected void createFile(byte[] content, String fileName){ try { - return DocumentBuilderFactory - .newInstance() - .newDocumentBuilder() - .newDocument(); - } - catch (ParserConfigurationException e) { + 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); + } + fos.flush(); + fos.close(); + } catch (FileNotFoundException e) { + log.error(e,e); + } catch (IOException e) { log.error(e,e); } - return null; } + /** * @param artefactName diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/ressources/GNVArtifactsTestCase_Configuration.xml --- a/gnv-artifacts/src/test/ressources/GNVArtifactsTestCase_Configuration.xml Wed Sep 09 15:28:18 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ - - - - de.intevation.gnv.artifacts.context.GNVArtifactContextFactory - - de.intevation.artifactdatabase.DefaultArtifactFactory - - - - - - - - timeseries_timeseriespoint - - timeseries_parameter - - - - - - - - timeseries_parameter - - timeseries_depth_height - - - - - - - - timeseries_depth_height - - timeseries_interval - - - - - - - - - timeseries_interval - - timeseries_calculate_results - - - - - - - - - timeseries_calculate_resulst - - - - - - - - - - - - - ../geo-backend/src/test/ressources/ArcSDEConnectionPoolTestCase.properties - src/test/ressources/queries.properties - - - - - - - - - diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/ressources/conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/ressources/conf.xml Thu Sep 10 07:57:30 2009 +0000 @@ -0,0 +1,86 @@ + + + + de.intevation.gnv.artifacts.context.GNVArtifactContextFactory + + de.intevation.artifactdatabase.DefaultArtifactFactory + + + + + + + + timeseries_timeseriespoint + + timeseries_parameter + + + + + + + + timeseries_parameter + + timeseries_depth_height + + + + + + + + timeseries_depth_height + + timeseries_interval + + + + + + + + + timeseries_interval + + timeseries_calculate_results + + + + + + + + + timeseries_chart_data + + + + + + + + + + + + + + + + + + ../geo-backend/src/test/ressources/ArcSDEConnectionPoolTestCase.properties + src/test/ressources/queries.properties + + + + + + + + + diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/ressources/queries.properties --- a/gnv-artifacts/src/test/ressources/queries.properties Wed Sep 09 15:28:18 2009 +0000 +++ b/gnv-artifacts/src/test/ressources/queries.properties Thu Sep 10 07:57:30 2009 +0000 @@ -1,4 +1,5 @@ timeseries_timeseriespoint=SELECT DISTINCT tsp.FEATUREID KEY, tsp.NAME VALUE FROM MEDIAN.TIMESERIESPOINT tsp, MEDIAN.MEASUREMENT mmt WHERE tsp.FEATUREID = mmt.FEATUREID AND mmt.SOURCEID = ? order by tsp.name timeseries_parameter=SELECT DISTINCT p.PARAMETERID KEY, p.GERMANNAME VALUE from MEDIAN.PARAMETER p where p.PARAMETERID in (select distinct ts.PARAMETERID from MEDIAN.TIMESERIES ts where ts.TIMESERIESID in (select distinct tsv.TIMESERIESID from MEDIAN.TIMESERIESVALUE tsv where tsv.MEASUREMENTID in (select m.MEASUREMENTID from MEDIAN.MEASUREMENT m, MEDIAN.TIMESERIESPOINT tsp where m.FEATUREID = tsp.FEATUREID and tsp.FEATUREID IN ( ? )))) ORDER BY p.GERMANNAME timeseries_depth_height=SELECT DISTINCT m.MEASUREMENTID KEY, m.ZLOCATION VALUE from MEDIAN.MEASUREMENT m where m.MEASUREMENTID in (SELECT DISTINCT t_v.MEASUREMENTID from MEDIAN.TIMESERIESVALUE t_v where t_v.TIMESERIESID in (SELECT DISTINCT t.TIMESERIESID from MEDIAN.TIMESERIES t where t.PARAMETERID in (SELECT DISTINCT p.PARAMETERID from MEDIAN.PARAMETER p where m.FEATUREID IN ( ? ) and p.PARAMETERID IN (?))))ORDER BY m.ZLOCATION DESC -timeseries_interval=select min(tv.TIMEVALUE) MIN, max(tv.TIMEVALUE) MAX from MEDIAN.TIMESERIES t , MEDIAN.TIMESERIESVALUE tv where tv.TIMESERIESID = t.TIMESERIESID AND t.PARAMETERID IN ( ? ) AND tv.MEASUREMENTID IN ( ? ) \ No newline at end of file +timeseries_interval=select min(tv.TIMEVALUE) MIN, max(tv.TIMEVALUE) MAX from MEDIAN.TIMESERIES t , MEDIAN.TIMESERIESVALUE tv where tv.TIMESERIESID = t.TIMESERIESID AND t.PARAMETERID IN ( ? ) AND tv.MEASUREMENTID IN ( ? ) +timeseries_chart_data=SELECT tv.TIMEVALUE, tv.DATAVALUE, t.PARAMETERID, tv.MEASUREMENTID, tv.TIMESERIESID FROM MEDIAN.TIMESERIESVALUE tv, MEDIAN.TIMESERIES t 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') ORDER BY tv.MEASUREMENTID ,tv.TIMESERIESID ,t.PARAMETERID ,tv.TIMEVALUE diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/ressources/timeseries/timeseries_step_03_feed.xml --- a/gnv-artifacts/src/test/ressources/timeseries/timeseries_step_03_feed.xml Wed Sep 09 15:28:18 2009 +0000 +++ b/gnv-artifacts/src/test/ressources/timeseries/timeseries_step_03_feed.xml Thu Sep 10 07:57:30 2009 +0000 @@ -5,6 +5,6 @@ - + \ No newline at end of file diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/ressources/timeseries/timeseries_step_04_feed.xml --- a/gnv-artifacts/src/test/ressources/timeseries/timeseries_step_04_feed.xml Wed Sep 09 15:28:18 2009 +0000 +++ b/gnv-artifacts/src/test/ressources/timeseries/timeseries_step_04_feed.xml Thu Sep 10 07:57:30 2009 +0000 @@ -5,6 +5,6 @@ - + \ No newline at end of file diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/ressources/timeseries/timeseries_step_05_feed.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/ressources/timeseries/timeseries_step_05_feed.xml Thu Sep 10 07:57:30 2009 +0000 @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff -r d117fd4b82e5 -r f24c825144bc gnv-artifacts/src/test/ressources/timeseries/timeseries_step_05_out.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/test/ressources/timeseries/timeseries_step_05_out.xml Thu Sep 10 07:57:30 2009 +0000 @@ -0,0 +1,12 @@ + + + + + + + + + + + +