public void testGetConnection() throws Exception
{
cf = new C3p0ConnectionFactory();
cf.setConfig(config);
cf.start();
PooledDataSource internalDs = (PooledDataSource) cf.getDataSource();
Connection c1 = cf.getConnection();
Connection c2 = cf.getConnection();
assertEquals("There should be two connections checked out", 2, internalDs.getNumBusyConnectionsDefaultUser());
cf.close(c1);
Thread.sleep(100);
assertEquals("There should be one connection checked out", 1, internalDs.getNumBusyConnectionsDefaultUser());
cf.close(c2);
Thread.sleep(100);
assertEquals("There should be no connections checked out", 0, internalDs.getNumBusyConnectionsDefaultUser());
}