pp.maxSize = 10;
pp.blockingTimeout = 100;
pp.idleTimeout = 500;
pp.prefill = false;
BaseConnectionManager2 cm = getCM(pp);
try
{
ManagedConnectionPool ps = cm.getPoolingStrategy();
assertTrue("0: Initial check", ps.getConnectionCount() == 0);
// Get a connection
ConnectionListener cl = cm.getManagedConnection(null, null);
assertTrue("1: Got a null connection!", cl.getManagedConnection() != null);
assertTrue("1: One connection", ps.getConnectionCount() == 1);
// Get another connection
ConnectionListener cl2 = cm.getManagedConnection(null, null);
assertTrue("2: Got a null connection!", cl2.getManagedConnection() != null);
assertTrue("2: Two connections", ps.getConnectionCount() == 2);
// Return first
cm.returnManagedConnection(cl, true);
assertTrue("3: One connection", ps.getConnectionCount() == 1);
// Return second
cm.returnManagedConnection(cl2, true);
assertTrue("4: Zero connections", ps.getConnectionCount() == 0);
}
finally
{
shutdown(cm);