Mercurial > dive4elements > gnv-client
changeset 139:9f2eaefe9dd4
Some Log Messages Added.
Testcases modified to test Spatialquery support.
geo-backend/trunk@105 c6561f87-3c4e-4783-a992-168aeb5c3f6f
line wrap: on
line diff
--- a/geo-backend/Changelog Sat Sep 12 09:56:09 2009 +0000 +++ b/geo-backend/Changelog Mon Sep 21 11:41:33 2009 +0000 @@ -1,3 +1,11 @@ +2009-09-21 Tim Englich <tim.englich@intevation.de> + + * src/test/ressources/QueryExecutorTestCase.properties Edited, + src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Edited: + Some tests for Spatialqueries added + * src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Edited: + Put the final Querystring into a Logmessage + 2009-09-09 Tim Englich <tim.englich@intevation.de> * target/**: Removed.
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Sat Sep 12 09:56:09 2009 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Mon Sep 21 11:41:33 2009 +0000 @@ -58,6 +58,9 @@ queryString = super.setFilterValues(queryString, filter); } + log.debug("############ QUERY ##################"); + log.debug(queryString); + log.debug("#######################################"); Connection connection = null; ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool(); try {
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Sat Sep 12 09:56:09 2009 +0000 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Mon Sep 21 11:41:33 2009 +0000 @@ -45,6 +45,18 @@ super(name); } + + public void testSpatialQuery(){ + try { + + this.testQuery(27031, "spatial_query", null); + } catch (QueryException e) { + log.error(e,e); + fail(); + } + } + + /** * Tests if the Databaseconnection can be established and * Data could be read from the Database @@ -52,54 +64,69 @@ public void testQueryExecutor(){ try { - QueryExecutor queryExecutor = QueryExecutorFactory.getInstance().getQueryExecutor(); - Collection<Result> results = queryExecutor.executeQuery("mesh", null); - if (results == null || results.size() == 0){ - log.error("Keine Daten erhalten"); - fail(); - }else { - assertEquals(6, results.size()); - log.debug("6 Datensätze erhalten"); - Iterator<Result> it = results.iterator(); - while (it.hasNext()){ - Result tmpResult = it.next(); - ResultDescriptor resultDescriptor = tmpResult.getResultDescriptor(); - int columns = resultDescriptor.getColumnCount(); - for (int i = 0; i < columns; i++){ - String columnName = resultDescriptor.getColumnName(i); - Object value = tmpResult.getObject(columnName); - log.debug(columnName + " ==> "+value.toString()); - } - } - } - // Quering Data with where clause - results = queryExecutor.executeQuery("mesh_id", new String[]{"5"}); - if (results == null || results.size() == 0){ - log.error("Keine Daten erhalten"); - fail(); - }else { - assertEquals(1, results.size()); - log.debug("1 Datensatz erhalten"); - log.debug("Daten erhalten"); - Iterator<Result> it = results.iterator(); - while (it.hasNext()){ - Result tmpResult = it.next(); - ResultDescriptor resultDescriptor = tmpResult.getResultDescriptor(); - int columns = resultDescriptor.getColumnCount(); - for (int i = 0; i < columns; i++){ - String columnName = resultDescriptor.getColumnName(i); - Object value = tmpResult.getObject(columnName); - log.debug(columnName + " ==> "+value.toString()); - } - } - } + this.testQuery(6, "mesh", null); + + this.testQuery(1, "mesh_id", new String[]{"5"}); + + } catch (QueryException e) { log.error(e,e); fail(); } } + + public void testTimeSeriesQueries(){ + + try{ + // Test zum initialisieren der umgebung + this.testQuery(6, "mesh", null); + + + this.testQuery(11, "timeseries_stations", new String[]{"4"}); + this.testQuery(11, "timeseries_stations_op", new String[]{"4"}); + this.testQuery(1, "timeseries_interval", new String[]{"500042 ", "54"}); + + } catch (QueryException e) { + log.error(e,e); + fail(); + } + + } + + /** + * @param resultsize + * @param queryID + * @param filter + * @throws QueryException + */ + private void testQuery(int resultsize, String queryID, String[] filter) + throws QueryException { + long start = System.currentTimeMillis(); + QueryExecutor queryExecutor = QueryExecutorFactory.getInstance().getQueryExecutor(); + Collection<Result> results = queryExecutor.executeQuery(queryID, filter); + if (results == null || results.size() == 0){ + log.error("Keine Daten erhalten"); + fail(); + }else { + assertEquals(resultsize, results.size()); + log.debug(resultsize+" Datensätze erhalten"); + Iterator<Result> it = results.iterator(); + while (it.hasNext()){ + Result tmpResult = it.next(); + ResultDescriptor resultDescriptor = tmpResult.getResultDescriptor(); + int columns = resultDescriptor.getColumnCount(); + for (int i = 0; i < columns; i++){ + String columnName = resultDescriptor.getColumnName(i); + Object value = tmpResult.getObject(columnName); + log.debug(columnName + " ==> "+value.toString()); + } + } + } + log.debug("Query dauerte: "+(System.currentTimeMillis()-start) +"ms"); + } + /**
--- a/geo-backend/src/test/ressources/QueryExecutorTestCase.properties Sat Sep 12 09:56:09 2009 +0000 +++ b/geo-backend/src/test/ressources/QueryExecutorTestCase.properties Mon Sep 21 11:41:33 2009 +0000 @@ -1,2 +1,12 @@ mesh=Select MESHID, NAME from MEDIAN.MESH -mesh_id=Select MESHID, NAME from MEDIAN.MESH where MESHID = ? \ No newline at end of file +mesh_id=Select MESHID, NAME from MEDIAN.MESH where MESHID = ? + + + +# Timeseries +timeseries_stations=SELECT tsp.FEATUREID, tsp.NAME FROM MEDIAN.TIMESERIESPOINT tsp WHERE tsp.FEATUREID IN (SELECT DISTINCT mmt.FEATUREID FROM MEDIAN.MEASUREMENT mmt WHERE mmt.SOURCEID IN ( 4 )) order by tsp.name +timeseries_stations_op=SELECT DISTINCT tsp.FEATUREID, tsp.NAME FROM MEDIAN.TIMESERIESPOINT tsp, MEDIAN.MEASUREMENT mmt WHERE tsp.FEATUREID = mmt.FEATUREID AND mmt.SOURCEID IN ( 4 ) order by tsp.name +timeseries_interval=select min(tv.TIMEVALUE) MIN, max(tv.TIMEVALUE) MAX from MEDIAN.TIMESERIES t , MEDIAN.TIMESERIESVALUE tv where tv.TIMESERIESID = t.TIMESERIESID and tv.MEASUREMENTID IN ( ? ) AND t.PARAMETERID IN ( ? ) + + + spatial_query=SELECT FEATUREID, SHAPE FROM MEDIAN.MESHPOINT WHERE MESHID = 3 AND KPOSITION = 1 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/target/surefire-reports/TEST-de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase.xml Mon Sep 21 11:41:33 2009 +0000 @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite failures="0" time="1.135" errors="0" skipped="0" tests="1" name="de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="sun.boot.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386"/> + <property name="java.vm.version" value="14.2-b01"/> + <property name="java.vm.vendor" value="Sun Microsystems Inc."/> + <property name="java.vendor.url" value="http://java.sun.com/"/> + <property name="path.separator" value=":"/> + <property name="java.vm.name" value="Java HotSpot(TM) Server VM"/> + <property name="file.encoding.pkg" value="sun.io"/> + <property name="user.country" value="DE"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="sun.os.patch.level" value="unknown"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="user.dir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/> + <property name="java.runtime.version" value="1.6.0_16-b01"/> + <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/> + <property name="basedir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/> + <property name="java.endorsed.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/endorsed"/> + <property name="os.arch" value="i386"/> + <property name="surefire.real.class.path" value="/tmp/surefirebooter6153140674202082692.jar"/> + <property name="java.io.tmpdir" value="/tmp"/> + <property name="line.separator" value=" +"/> + <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/> + <property name="os.name" value="Linux"/> + <property name="sun.jnu.encoding" value="ISO-8859-15"/> + <property name="java.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386/server:/vol1/opt/java/jdk1.6.0_16/jre/lib/i386:/vol1/opt/java/jdk1.6.0_16/jre/../lib/i386:/vol1/opt/java/maven2/current/lib:/vol1/opt/java/java6/lib:/vol1/opt/java/java5/lib:/vol1/opt/nethack/lib:/home/intevation/shared/lib:/usr/java/packages/lib/i386:/lib:/usr/lib"/> + <property name="surefire.test.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="java.class.version" value="50.0"/> + <property name="sun.management.compiler" value="HotSpot Tiered Compilers"/> + <property name="os.version" value="2.6.29.4-id1-k8-9"/> + <property name="user.home" value="/home/tim"/> + <property name="user.timezone" value=""/> + <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/> + <property name="file.encoding" value="ISO-8859-15"/> + <property name="java.specification.version" value="1.6"/> + <property name="user.name" value="tim"/> + <property name="java.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/> + <property name="java.vm.specification.version" value="1.0"/> + <property name="sun.arch.data.model" value="32"/> + <property name="java.home" value="/vol1/opt/java/jdk1.6.0_16/jre"/> + <property name="java.specification.vendor" value="Sun Microsystems Inc."/> + <property name="user.language" value="de"/> + <property name="java.vm.info" value="mixed mode"/> + <property name="java.version" value="1.6.0_16"/> + <property name="java.ext.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/ext:/usr/java/packages/lib/ext"/> + <property name="sun.boot.class.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/resources.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/rt.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/sunrsasign.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jsse.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jce.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/charsets.jar:/vol1/opt/java/jdk1.6.0_16/jre/classes"/> + <property name="java.vendor" value="Sun Microsystems Inc."/> + <property name="localRepository" value="/home/tim/.m2/repository"/> + <property name="file.separator" value="/"/> + <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/> + <property name="sun.cpu.endian" value="little"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="sun.cpu.isalist" value=""/> + </properties> + <testcase time="1.132" classname="de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase" name="testQueryExecutor"/> +</testsuite> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/target/surefire-reports/TEST-de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase.xml Mon Sep 21 11:41:33 2009 +0000 @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite failures="0" time="1.706" errors="0" skipped="0" tests="1" name="de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="sun.boot.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386"/> + <property name="java.vm.version" value="14.2-b01"/> + <property name="java.vm.vendor" value="Sun Microsystems Inc."/> + <property name="java.vendor.url" value="http://java.sun.com/"/> + <property name="path.separator" value=":"/> + <property name="java.vm.name" value="Java HotSpot(TM) Server VM"/> + <property name="file.encoding.pkg" value="sun.io"/> + <property name="user.country" value="DE"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="sun.os.patch.level" value="unknown"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="user.dir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/> + <property name="java.runtime.version" value="1.6.0_16-b01"/> + <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/> + <property name="basedir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/> + <property name="java.endorsed.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/endorsed"/> + <property name="os.arch" value="i386"/> + <property name="surefire.real.class.path" value="/tmp/surefirebooter6153140674202082692.jar"/> + <property name="java.io.tmpdir" value="/tmp"/> + <property name="line.separator" value=" +"/> + <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/> + <property name="os.name" value="Linux"/> + <property name="sun.jnu.encoding" value="ISO-8859-15"/> + <property name="java.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386/server:/vol1/opt/java/jdk1.6.0_16/jre/lib/i386:/vol1/opt/java/jdk1.6.0_16/jre/../lib/i386:/vol1/opt/java/maven2/current/lib:/vol1/opt/java/java6/lib:/vol1/opt/java/java5/lib:/vol1/opt/nethack/lib:/home/intevation/shared/lib:/usr/java/packages/lib/i386:/lib:/usr/lib"/> + <property name="surefire.test.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="java.class.version" value="50.0"/> + <property name="sun.management.compiler" value="HotSpot Tiered Compilers"/> + <property name="os.version" value="2.6.29.4-id1-k8-9"/> + <property name="user.home" value="/home/tim"/> + <property name="user.timezone" value=""/> + <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/> + <property name="file.encoding" value="ISO-8859-15"/> + <property name="java.specification.version" value="1.6"/> + <property name="user.name" value="tim"/> + <property name="java.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/> + <property name="java.vm.specification.version" value="1.0"/> + <property name="sun.arch.data.model" value="32"/> + <property name="java.home" value="/vol1/opt/java/jdk1.6.0_16/jre"/> + <property name="java.specification.vendor" value="Sun Microsystems Inc."/> + <property name="user.language" value="de"/> + <property name="java.vm.info" value="mixed mode"/> + <property name="java.version" value="1.6.0_16"/> + <property name="java.ext.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/ext:/usr/java/packages/lib/ext"/> + <property name="sun.boot.class.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/resources.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/rt.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/sunrsasign.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jsse.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jce.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/charsets.jar:/vol1/opt/java/jdk1.6.0_16/jre/classes"/> + <property name="java.vendor" value="Sun Microsystems Inc."/> + <property name="localRepository" value="/home/tim/.m2/repository"/> + <property name="file.separator" value="/"/> + <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/> + <property name="sun.cpu.endian" value="little"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="sun.cpu.isalist" value=""/> + </properties> + <testcase time="1.557" classname="de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase" name="testArcSDEConnectionPool"/> +</testsuite> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/target/surefire-reports/de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase.txt Mon Sep 21 11:41:33 2009 +0000 @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.142 sec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/target/surefire-reports/de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase.txt Mon Sep 21 11:41:33 2009 +0000 @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.716 sec