diff --git a/openjpa-integration/daytrader/pom.xml b/openjpa-integration/daytrader/pom.xml
index 5b0d4239f..463bbf80e 100644
--- a/openjpa-integration/daytrader/pom.xml
+++ b/openjpa-integration/daytrader/pom.xml
@@ -69,22 +69,11 @@
tests
test
-
- commons-dbcp
- commons-dbcp
- test
-
commons-logging
commons-logging
test
-
- org.apache.derby
- derby
- ${derby.version}
- test
-
jakarta-regexp
jakarta-regexp
diff --git a/openjpa-integration/validation/pom.xml b/openjpa-integration/validation/pom.xml
index 54f816a41..794562f41 100644
--- a/openjpa-integration/validation/pom.xml
+++ b/openjpa-integration/validation/pom.xml
@@ -78,11 +78,6 @@
-
- commons-dbcp
- commons-dbcp
- test
-
javax.validation
validation-api
diff --git a/openjpa-jdbc/pom.xml b/openjpa-jdbc/pom.xml
index 3e215153d..8cb9ce191 100644
--- a/openjpa-jdbc/pom.xml
+++ b/openjpa-jdbc/pom.xml
@@ -62,7 +62,11 @@
postgresql
postgresql
- 8.4-701.jdbc3
+ provided
+
+
+ commons-dbcp
+ commons-dbcp
provided
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java
index f26e33413..f34639ed8 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java
@@ -29,6 +29,7 @@ import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.lib.conf.Configurable;
import org.apache.openjpa.lib.conf.Configuration;
import org.apache.openjpa.lib.conf.Configurations;
+import org.apache.openjpa.lib.util.Closeable;
import org.apache.openjpa.lib.util.ConcreteClassGenerator;
/**
@@ -38,7 +39,7 @@ import org.apache.openjpa.lib.util.ConcreteClassGenerator;
* usage of Commons DBCP when available, use AutoDriverDataSource instead.
*/
public abstract class DBCPDriverDataSource
-extends SimpleDriverDataSource implements Configurable {
+extends SimpleDriverDataSource implements Configurable, Closeable {
private static String DBCPPACKAGENAME = "org.apache.commons.dbcp";
private static String DBCPBASICDATASOURCENAME = "org.apache.commons.dbcp.BasicDataSource";
@@ -67,6 +68,20 @@ extends SimpleDriverDataSource implements Configurable {
return getDBCPConnection(props);
}
+ public void close() throws SQLException {
+ try {
+ if (_ds != null) {
+ if (isDBCPLoaded()) {
+ ((org.apache.commons.dbcp.BasicDataSource)_dbcpClass.cast(_ds)).close();
+ }
+ }
+ } catch (ClassCastException cce) {
+ // no-op
+ } finally {
+ _ds = null;
+ }
+ }
+
protected Connection getDBCPConnection(Properties props) throws SQLException {
Connection con = getDBCPDataSource(props).getConnection();
if (con == null) {
diff --git a/openjpa-persistence-jdbc/pom.xml b/openjpa-persistence-jdbc/pom.xml
index 8ede27cfc..6ddcdf002 100644
--- a/openjpa-persistence-jdbc/pom.xml
+++ b/openjpa-persistence-jdbc/pom.xml
@@ -134,7 +134,6 @@
- 8.4-701.jdbc3
org.postgresql.Driver
${openjpa.postgresql.url}
@@ -740,11 +739,6 @@
openjpa-persistence
${project.version}
-
- commons-dbcp
- commons-dbcp
- test
-
commons-collections
commons-collections
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jta/ContainerTest.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jta/ContainerTest.java
index d0ba55a1f..768c8bbbd 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jta/ContainerTest.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jta/ContainerTest.java
@@ -68,6 +68,21 @@ public abstract class ContainerTest extends SingleEMFTestCase {
@Override
public void tearDown() throws Exception {
+ try {
+ if (emf != null && emf.isOpen()) {
+ // can't use AbstractPersistenceTestCase.closeEMF() due to using managed transactions
+ // closeAllOpenEMs(emf);
+ emf.close();
+ }
+ } catch (Exception e) {
+ // if a test failed, swallow any exceptions that happen
+ // during tear-down, as these just mask the original problem.
+ if (testResult.wasSuccessful()) {
+ throw e;
+ }
+ } finally {
+ emf = null;
+ }
}
protected void commit() {
diff --git a/openjpa-persistence-locking/pom.xml b/openjpa-persistence-locking/pom.xml
index e2b6aac00..47af824a9 100644
--- a/openjpa-persistence-locking/pom.xml
+++ b/openjpa-persistence-locking/pom.xml
@@ -143,7 +143,6 @@
- 8.3-603.jdbc3
org.postgresql.Driver
${openjpa.postgresql.url}
${openjpa.postgresql.username}
@@ -675,16 +674,6 @@
test-jar
test
-
- commons-dbcp
- commons-dbcp
- test
-
-
- org.apache.derby
- derby
- test
-
jakarta-regexp
jakarta-regexp
diff --git a/pom.xml b/pom.xml
index 26e066188..78d4a9c36 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,7 @@
10.5.3.0_1
1.8.0.10
5.1.12
+ 8.4-701.jdbc3
1.6.1
@@ -595,6 +596,12 @@
hsqldb
${hsqldb.version}
+
+ postgresql
+ postgresql
+ ${postgresql.version}
+ provided
+
jakarta-regexp
jakarta-regexp
@@ -639,16 +646,16 @@
-
- net.sourceforge.findbugs
- annotations
- provided
-
junit
junit
test
+
+ commons-dbcp
+ commons-dbcp
+ test
+