Mercurial > dive4elements > gnv-client
changeset 896:c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
geo-backend/trunk@959 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 20 Apr 2010 12:46:40 +0000 |
parents | eb777022b628 |
children | 02cd2935b5fa |
files | geo-backend/ChangeLog geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java geo-backend/src/test/ressources/QueryExecutorTestCase.properties |
diffstat | 3 files changed, 71 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/geo-backend/ChangeLog Tue Apr 20 12:42:17 2010 +0000 +++ b/geo-backend/ChangeLog Tue Apr 20 12:46:40 2010 +0000 @@ -1,3 +1,9 @@ +2010-04-20 Tim Englich <tim.englich@intevation.de> + + * src/test/ressources/QueryExecutorTestCase.properties, + src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java: + Integrated Testcase for testing the Basefunctionality of the CacheCleaner. + 2010-04-20 Tim Englich <tim.englich@intevation.de> * src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java Tue Apr 20 12:46:40 2010 +0000 @@ -0,0 +1,59 @@ +package de.intevation.gnv.geobackend.base.query.cache; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +import junit.framework.TestCase; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; + +import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; +import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; + +public class CacheCleanerTestCase extends TestCase { + + /** + * the logger, used to log exceptions and additonaly information + */ + private static Logger log = null; + + static{ + BasicConfigurator.configure(); + log = Logger.getLogger(CacheCleanerTestCase.class); + } + + public void testCachCleaner(){ + log.debug("CacheCleanerTestCase.testCachCleaner"); + CacheCleaner cc = new CacheCleaner(); + boolean success = cc.test(); + if (!success){ + log.error("TestCase failed."); + fail(); + } + } + + /** + * @see junit.framework.TestCase#setUp() + */ + @Override + protected void setUp() throws Exception { + + super.setUp(); + InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); + Properties properties = new Properties(); + properties.load(inputStream); + + ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); + cpf.initializeConnectionPool(properties); + + + inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties"); + properties = new Properties(); + properties.load(inputStream); + + QueryContainerFactory qcf = QueryContainerFactory.getInstance(); + qcf.initializeQueryContainer(properties); + } +}
--- a/geo-backend/src/test/ressources/QueryExecutorTestCase.properties Tue Apr 20 12:42:17 2010 +0000 +++ b/geo-backend/src/test/ressources/QueryExecutorTestCase.properties Tue Apr 20 12:46:40 2010 +0000 @@ -96,3 +96,9 @@ (SELECT st_astext(SHAPE) FROM MEDIAN.FEATUREAREA WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND FEATURECODE = 41 )\ ) \ order by M.NAME +test_regionfilter = SELECT M.OBJECTID KEY, M.NAME VALUE FROM MEDIAN.MESHPOINT, MEDIAN.MESH M WHERE M.SOURCEID IN (2) AND M.MESHID = MEDIAN.MESHPOINT.MESHID AND INTERSECTS(SHAPE, (SELECT st_astext(SHAPE) FROM MEDIAN.FEATUREAREA WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND FEATURECODE = ? )) order by M.NAME + + +updated_tables = SELECT FULLTABLENAME \ + FROM MEDIAN.LASTUPDATED \ + WHERE LASTUPDATE >= to_date('?', 'YYYY.MM.DD HH24:MI:SS')