[Proxool-cvs] proxool/src/java-test/org/logicalcobwebs/proxool HouseKeeperTest.java, 1.13, 1.14 Con
UNMAINTAINED!
Brought to you by:
billhorsman
From: <bil...@us...> - 2007-01-25 00:10:26
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5577/src/java-test/org/logicalcobwebs/proxool Modified Files: HouseKeeperTest.java ConnectionListenerTest.java Log Message: New onAboutToDie event for ConnectionListenerIF that gets called if the maximum-active-time is exceeded. Index: HouseKeeperTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/HouseKeeperTest.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** HouseKeeperTest.java 24 Mar 2006 00:17:32 -0000 1.13 --- HouseKeeperTest.java 25 Jan 2007 00:10:24 -0000 1.14 *************** *** 54,57 **** --- 54,59 ---- ProxoolFacade.registerConnectionPool(url, info); + Listener listener = new Listener(); + ProxoolFacade.addConnectionListener(alias, listener); assertEquals("Shouldn't be any active connections yet", 0, ProxoolFacade.getSnapshot(alias, false).getServedCount()); *************** *** 76,79 **** --- 78,82 ---- long elapsed = System.currentTimeMillis() - start; assertTrue("Connection has not been closed after " + elapsed + " milliseconds as expected", connection.isClosed()); + assertTrue("onAboutToDie not called as expected", listener.called); assertEquals("Expected the connection to be inactive", 0, ProxoolFacade.getSnapshot(alias, false).getActiveConnectionCount()); *************** *** 323,326 **** --- 326,353 ---- } + class Listener implements ConnectionListenerIF { + + boolean called; + + public void onBirth(Connection connection) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void onDeath(Connection connection) throws SQLException { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void onExecute(String command, long elapsedTime) { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void onFail(String command, Exception exception) { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void onAboutToDie(Connection connection, int reason) throws SQLException { + called = true; + } + } } *************** *** 328,331 **** --- 355,361 ---- Revision history: $Log$ + Revision 1.14 2007/01/25 00:10:24 billhorsman + New onAboutToDie event for ConnectionListenerIF that gets called if the maximum-active-time is exceeded. + Revision 1.13 2006/03/24 00:17:32 billhorsman Correct alias name Index: ConnectionListenerTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/ConnectionListenerTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ConnectionListenerTest.java 23 Mar 2006 11:42:20 -0000 1.15 --- ConnectionListenerTest.java 25 Jan 2007 00:10:24 -0000 1.16 *************** *** 9,19 **** import org.apache.commons.logging.LogFactory; ! import java.sql.Connection; ! import java.sql.Date; ! import java.sql.DriverManager; ! import java.sql.PreparedStatement; ! import java.sql.SQLException; ! import java.sql.Statement; ! import java.util.Calendar; import java.util.Properties; --- 9,13 ---- import org.apache.commons.logging.LogFactory; ! import java.sql.*; import java.util.Properties; *************** *** 241,244 **** --- 235,242 ---- command = null; } + + public void onAboutToDie(Connection connection, int reason) throws SQLException { + // Ignore + } } } *************** *** 247,250 **** --- 245,251 ---- Revision history: $Log$ + Revision 1.16 2007/01/25 00:10:24 billhorsman + New onAboutToDie event for ConnectionListenerIF that gets called if the maximum-active-time is exceeded. + Revision 1.15 2006/03/23 11:42:20 billhorsman Create dummy table so test statements work. With HSQL 1.8 it is the prepareStatement() that throws the exception, not the execute() which means the listeners never gets the event. |