Mercurial > dive4elements > gnv-client
annotate geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java @ 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 | |
children | 02cd2935b5fa |
rev | line source |
---|---|
896
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.geobackend.base.query.cache; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 import java.io.FileInputStream; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 import java.io.InputStream; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 import java.util.Properties; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 import junit.framework.TestCase; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.BasicConfigurator; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 import org.apache.log4j.Logger; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 public class CacheCleanerTestCase extends TestCase { |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 /** |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 * the logger, used to log exceptions and additonaly information |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 */ |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 private static Logger log = null; |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 static{ |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 BasicConfigurator.configure(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 log = Logger.getLogger(CacheCleanerTestCase.class); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 } |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 public void testCachCleaner(){ |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 log.debug("CacheCleanerTestCase.testCachCleaner"); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 CacheCleaner cc = new CacheCleaner(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 boolean success = cc.test(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 if (!success){ |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 log.error("TestCase failed."); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 fail(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 } |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 } |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 /** |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 * @see junit.framework.TestCase#setUp() |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 */ |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 @Override |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 protected void setUp() throws Exception { |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 super.setUp(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 Properties properties = new Properties(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 properties.load(inputStream); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 cpf.initializeConnectionPool(properties); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties"); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 properties = new Properties(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 properties.load(inputStream); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 QueryContainerFactory qcf = QueryContainerFactory.getInstance(); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 qcf.initializeQueryContainer(properties); |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 } |
c7756576044f
Integrated Testcase for testing the Basefunctionality of the CacheCleaner
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 } |