public void testSingleGetPutPoolCheck() throws Exception
{
BufferedLogger logger = new BufferedLogger();
ClassInstanceObjectFactory factory =
new ClassInstanceObjectFactory( PoolableTestObject.class, logger );
ResourceLimitingPool pool = new ResourceLimitingPool( factory, 0, false, false, 0, 0 );
pool.enableLogging( logger );
assertEquals( "1) Pool Ready Size", 0, pool.getReadySize() );
assertEquals( "1) Pool Size", 0, pool.getSize() );
Poolable p1 = pool.get();
assertEquals( "2) Pool Ready Size", 0, pool.getReadySize() );
assertEquals( "2) Pool Size", 1, pool.getSize() );
pool.put( p1 );
assertEquals( "3) Pool Ready Size", 1, pool.getReadySize() );
assertEquals( "3) Pool Size", 1, pool.getSize() );
Poolable p2 = pool.get();
assertEquals( "4) Pool Ready Size", 0, pool.getReadySize() );
assertEquals( "4) Pool Size", 1, pool.getSize() );
assertEquals( "Pooled Object reuse check", p1, p2 );
pool.put( p2 );
assertEquals( "5) Pool Ready Size", 1, pool.getReadySize() );
assertEquals( "5) Pool Size", 1, pool.getSize() );
pool.dispose();
// Make sure the logger output check out.
assertEquals( "Logger output",
"DEBUG - ClassInstanceObjectFactory.newInstance() id:1\n" +
"DEBUG - Created a new org.apache.avalon.excalibur.pool.test.PoolableTestObject from the object factory.\n" +