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 2004/02/21 14:26:30 UTC
cvs commit: jakarta-commons/dbcp/src/test/org/apache/commons/dbcp TestConnectionPool.java TestDelegatingConnection.java
dirkv 2004/02/21 05:26:30
Modified: dbcp/src/test/org/apache/commons/dbcp
TestConnectionPool.java
TestDelegatingConnection.java
Log:
Bugzilla Bug 26966: Connectionpool's connections always returns same
=> test is OK
Revision Changes Path
1.12 +13 -3 jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestConnectionPool.java
Index: TestConnectionPool.java
===================================================================
RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestConnectionPool.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TestConnectionPool.java 22 Dec 2003 14:58:39 -0000 1.11
+++ TestConnectionPool.java 21 Feb 2004 13:26:30 -0000 1.12
@@ -522,4 +522,14 @@
stmt.close();
conn.close();
}
+
+ // Bugzilla Bug 26966: Connectionpool's connections always returns same
+ public void testHashCode() throws Exception {
+ Connection conn1 = getConnection();
+ assertNotNull(conn1);
+ Connection conn2 = getConnection();
+ assertNotNull(conn2);
+
+ assertTrue(conn1.hashCode() != conn2.hashCode());
+ }
}
1.5 +12 -4 jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestDelegatingConnection.java
Index: TestDelegatingConnection.java
===================================================================
RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TestDelegatingConnection.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestDelegatingConnection.java 15 Oct 2003 19:53:30 -0000 1.4
+++ TestDelegatingConnection.java 21 Feb 2004 13:26:30 -0000 1.5
@@ -82,9 +82,11 @@
private DelegatingConnection conn = null;
private Connection delegateConn = null;
+ private Connection delegateConn2 = null;
public void setUp() throws Exception {
delegateConn = new TesterConnection("test", "test");
+ delegateConn2 = new TesterConnection("test", "test");
conn = new DelegatingConnection(delegateConn);
}
@@ -93,10 +95,16 @@
assertEquals(delegateConn,conn.getDelegate());
}
- public void testHashCode() {
+ public void testHashCodeEqual() {
DelegatingConnection conn = new DelegatingConnection(delegateConn);
DelegatingConnection conn2 = new DelegatingConnection(delegateConn);
assertEquals(conn.hashCode(), conn2.hashCode());
+ }
+
+ public void testHashCodeNotEqual() {
+ DelegatingConnection conn = new DelegatingConnection(delegateConn);
+ DelegatingConnection conn2 = new DelegatingConnection(delegateConn2);
+ assertTrue(conn.hashCode() != conn2.hashCode());
}
public void testEquals() {
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org