You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2003/09/14 00:44:32 UTC
cvs commit: jakarta-commons/dbcp/src/test/org/apache/commons/dbcp TestAbandonedBasicDataSource.java TestBasicDataSource.java
dirkv 2003/09/13 15:44:32
Modified: dbcp/src/test/org/apache/commons/dbcp
TestAbandonedBasicDataSource.java
TestBasicDataSource.java
Log:
Bugzilla Bug 23138: getDelegate no longer useful
- junit test
Revision Changes Path
1.4 +12 -4 jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestAbandonedBasicDataSource.java
Index: TestAbandonedBasicDataSource.java
===================================================================
RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestAbandonedBasicDataSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestAbandonedBasicDataSource.java 22 Aug 2003 16:08:32 -0000 1.3
+++ TestAbandonedBasicDataSource.java 13 Sep 2003 22:44:32 -0000 1.4
@@ -108,6 +108,14 @@
ds = null;
}
+ public void testPooling() throws Exception {
+ // this also needs access to the undelying connection
+ ds.setAccessToUnderlyingConnectionAllowed(true);
+ super.testPooling();
+ }
+
+ // ---------- Abandoned Test -----------
+
private void getConnection1() throws Exception {
System.err.println("BEGIN getConnection1()");
Connection conn = ds.getConnection();
1.8 +35 -3 jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestBasicDataSource.java
Index: TestBasicDataSource.java
===================================================================
RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestBasicDataSource.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestBasicDataSource.java 26 Aug 2003 14:20:15 -0000 1.7
+++ TestBasicDataSource.java 13 Sep 2003 22:44:32 -0000 1.8
@@ -160,4 +160,36 @@
PreparedStatement stmt4 = conn.prepareStatement("select 'a' from dual");
assertNotNull(stmt4);
}
+
+ public void testPooling() throws Exception {
+ // this also needs access to the undelying connection
+ ds.setAccessToUnderlyingConnectionAllowed(true);
+ super.testPooling();
+ }
+
+ public void testNoAccessToUnderlyingConnectionAllowed() throws Exception {
+ // default: false
+ assertEquals(false, ds.isAccessToUnderlyingConnectionAllowed());
+
+ Connection conn = getConnection();
+ Connection dconn = ((DelegatingConnection) conn).getDelegate();
+ assertNull(dconn);
+
+ dconn = ((DelegatingConnection) conn).getInnermostDelegate();
+ assertNull(dconn);
+ }
+
+ public void testAccessToUnderlyingConnectionAllowed() throws Exception {
+ ds.setAccessToUnderlyingConnectionAllowed(true);
+ assertEquals(true, ds.isAccessToUnderlyingConnectionAllowed());
+
+ Connection conn = getConnection();
+ Connection dconn = ((DelegatingConnection) conn).getDelegate();
+ assertNotNull(dconn);
+
+ dconn = ((DelegatingConnection) conn).getInnermostDelegate();
+ assertNotNull(dconn);
+
+ assertTrue(dconn instanceof TesterConnection);
+ }
}