Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13866/src/java-test/org/logicalcobwebs/proxool
Modified Files:
ConnectionResetterTest.java
Log Message:
Test deliberate exception durinng reset
Index: ConnectionResetterTest.java
===================================================================
RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/ConnectionResetterTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ConnectionResetterTest.java 4 Mar 2003 10:58:43 -0000 1.14
--- ConnectionResetterTest.java 7 Oct 2005 08:12:58 -0000 1.15
***************
*** 50,56 ****
Connection c1 = DriverManager.getConnection(url);
! ;
Connection c2 = DriverManager.getConnection(url);
! ;
c1.setAutoCommit(false);
--- 50,56 ----
Connection c1 = DriverManager.getConnection(url);
!
Connection c2 = DriverManager.getConnection(url);
!
c1.setAutoCommit(false);
***************
*** 62,65 ****
--- 62,98 ----
c2.close();
c1.close();
+ assertEquals("connectionCount", 2, ProxoolFacade.getSnapshot(alias).getConnectionCount());
+
+ }
+
+ /**
+ * Test connectionCount when we deliberately introduce an exception during connection reset.
+ */
+ public void testFailedReset() throws Exception {
+
+ try {
+ // This is a bit of a hack to force an exception during reset
+ ConnectionResetter.setTriggerResetException(true);
+
+ String testName = "failedReset";
+ String alias = testName;
+
+ String url = TestHelper.buildProxoolUrl(alias,
+ TestConstants.HYPERSONIC_DRIVER,
+ TestConstants.HYPERSONIC_TEST_URL);
+ Properties info = new Properties();
+ info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER);
+ info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD);
+ ProxoolFacade.registerConnectionPool(url, info);
+
+ Connection c1 = DriverManager.getConnection(url);
+ c1.setAutoCommit(false);
+ c1.close();
+
+ assertEquals("connectionCount", 0, ProxoolFacade.getSnapshot(alias).getConnectionCount());
+ } finally {
+ // Back to normal
+ ConnectionResetter.setTriggerResetException(false);
+ }
}
***************
*** 106,109 ****
--- 139,145 ----
Revision history:
$Log$
+ Revision 1.15 2005/10/07 08:12:58 billhorsman
+ Test deliberate exception durinng reset
+
Revision 1.14 2003/03/04 10:58:43 billhorsman
checkstyle
|