Permalink
Browse files

[GEOT-4217] H2DataStoreFactory does not create a manageable data source

  • Loading branch information...
1 parent 1f15185 commit 6f293ca79da0a7ff06e2e3554079772c1fb48317 @aaime aaime committed Aug 7, 2012
@@ -23,6 +23,7 @@
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
+import org.geotools.data.jdbc.datasource.DBCPDataSource;
import org.geotools.jdbc.JDBCDataStore;
import org.geotools.jdbc.JDBCDataStoreFactory;
import org.geotools.jdbc.SQLDialect;
@@ -164,7 +165,7 @@ protected DataSource createDataSource(Map params, SQLDialect dialect) throws IOE
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setPoolPreparedStatements(false);
- return dataSource;
+ return new DBCPDataSource(dataSource);
}
protected JDBCDataStore createDataStoreInternal(JDBCDataStore dataStore, Map params)
@@ -22,6 +22,7 @@
import junit.framework.TestCase;
import org.geotools.data.DataStore;
+import org.geotools.data.jdbc.datasource.ManageableDataSource;
import org.geotools.jdbc.JDBCDataStore;
import org.geotools.jdbc.JDBCDataStoreFactory;
import org.h2.tools.Server;
@@ -52,6 +53,7 @@ public void testCanProcess() throws Exception {
public void testCreateDataStore() throws Exception {
JDBCDataStore ds = factory.createDataStore( params );
assertNotNull( ds );
+ assertTrue(ds.getDataSource() instanceof ManageableDataSource);
}
public void testTCP() throws Exception {

0 comments on commit 6f293ca

Please sign in to comment.