Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool
In directory sc8-pr-cvs1:/tmp/cvs-serv29834
Modified Files:
ConnectionPoolTests.java
Log Message:
New test for when maximum-connection-count = 1 and minimum-connection-count = 1
Index: ConnectionPoolTests.java
===================================================================
RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/ConnectionPoolTests.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ConnectionPoolTests.java 12 Mar 2003 00:14:12 -0000 1.8
--- ConnectionPoolTests.java 11 Sep 2003 23:14:57 -0000 1.9
***************
*** 64,67 ****
--- 64,111 ----
/**
+ * test what happens if maximum = minimum = 1
+ */
+ public void testMaximumEqualsMinimumConnectionCount() throws Exception {
+
+ String testName = "maximumEqualsMinimumConnectionCount";
+ 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);
+ info.setProperty(ProxoolConstants.MAXIMUM_CONNECTION_COUNT_PROPERTY, "1");
+ info.setProperty(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY, "1");
+ info.setProperty(ProxoolConstants.VERBOSE_PROPERTY, "true");
+ ProxoolFacade.registerConnectionPool(url, info);
+
+ // opening and closing a connection should have no effect
+ Connection c1 = DriverManager.getConnection(url);
+ c1.close();
+
+ // Leave this one open for a while
+ Connection c2 = DriverManager.getConnection(url);
+
+ try {
+ Connection c3 = DriverManager.getConnection(url);
+ c3.close();
+ fail("Didn't expect to get third connection");
+ } catch (SQLException e) {
+ LOG.debug("Ignoring expected exception", e);
+ }
+
+ assertEquals("activeConnectionCount", 1, ProxoolFacade.getSnapshot(alias, true).getActiveConnectionCount());
+ c2.close();
+
+ // Just check it all still works
+ DriverManager.getConnection(url).close();
+
+ assertEquals("activeConnectionCount", 0, ProxoolFacade.getSnapshot(alias, true).getActiveConnectionCount());
+
+ }
+
+ /**
* Checks whether shutdown is patient enough to wait for active connections
*/
***************
*** 151,154 ****
--- 195,201 ----
Revision history:
$Log$
+ Revision 1.9 2003/09/11 23:14:57 billhorsman
+ New test for when maximum-connection-count = 1 and minimum-connection-count = 1
+
Revision 1.8 2003/03/12 00:14:12 billhorsman
change thresholds
|