org.apache.commons.pool.impl
Class TestStackKeyedObjectPool

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.pool.TestKeyedObjectPool
              extended by org.apache.commons.pool.TestBaseKeyedObjectPool
                  extended by org.apache.commons.pool.impl.TestStackKeyedObjectPool
All Implemented Interfaces:
junit.framework.Test

public class TestStackKeyedObjectPool
extends TestBaseKeyedObjectPool

Version:
$Revision: 958393 $ $Date: 2010-06-27 09:32:43 -0700 (Sun, 27 Jun 2010) $
Author:
Rodney Waldhoff

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.commons.pool.TestKeyedObjectPool
TestKeyedObjectPool.FailingKeyedPoolableObjectFactory
 
Field Summary
 
Fields inherited from class org.apache.commons.pool.TestKeyedObjectPool
KEY
 
Constructor Summary
TestStackKeyedObjectPool(String testName)
           
 
Method Summary
protected  Object getNthObject(Object key, int n)
          Return what we expect to be the nth object (zero indexed) created by the pool for the given key.
protected  boolean isFifo()
           
protected  boolean isLifo()
           
protected  KeyedObjectPool makeEmptyPool(int mincapacity)
          Create an KeyedObjectPool instance that can contain at least mincapacity idle and active objects, or throw IllegalArgumentException if such a pool cannot be created.
protected  KeyedObjectPool makeEmptyPool(KeyedPoolableObjectFactory factory)
          Create an KeyedObjectPool with the specified factory.
protected  Object makeKey(int n)
           
 void setUp()
           
 void tearDown()
           
 void testBorrowFromEmptyPoolWithNullFactory()
           
 void testBorrowReturnWithSometimesInvalidObjects()
           
 void testCanResetFactoryWithoutActiveObjects()
           
 void testCantResetFactoryWithActiveObjects()
           
 void testCloseBug()
           
 void testIdleCap()
           
 void testPoolWithNullFactory()
           
 void testRemoveOldest()
          Verifies maxSleeping contract: When returnObject triggers maxSleeping exceeded, the bottom (oldest) instance in the pool is destroyed to make room for the newly returning instance, which is pushed onto the idle object stack.
 void testSetFactory()
           
 void testToString()
           
 void testVariousConstructors()
           
 
Methods inherited from class org.apache.commons.pool.TestBaseKeyedObjectPool
testBaseAddObject, testBaseBorrow, testBaseBorrowReturn, testBaseClear, testBaseInvalidateObject, testBaseNumActiveNumIdle, testBaseNumActiveNumIdle2, testUnsupportedOperations
 
Methods inherited from class org.apache.commons.pool.TestKeyedObjectPool
testClosedPoolBehavior, testKPOFAddObjectUsage, testKPOFBorrowObjectUsages, testKPOFClearUsages, testKPOFCloseUsages, testKPOFInvalidateObjectUsages, testKPOFReturnObjectUsages
 
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestStackKeyedObjectPool

public TestStackKeyedObjectPool(String testName)
Method Detail

makeEmptyPool

protected KeyedObjectPool makeEmptyPool(int mincapacity)
Description copied from class: TestBaseKeyedObjectPool
Create an KeyedObjectPool instance that can contain at least mincapacity idle and active objects, or throw IllegalArgumentException if such a pool cannot be created.

Overrides:
makeEmptyPool in class TestBaseKeyedObjectPool

makeEmptyPool

protected KeyedObjectPool makeEmptyPool(KeyedPoolableObjectFactory factory)
Description copied from class: TestKeyedObjectPool
Create an KeyedObjectPool with the specified factory. The pool should be in a default configuration and conform to the expected behaviors described in KeyedObjectPool. Generally speaking there should be no limits on the various object counts.

Overrides:
makeEmptyPool in class TestBaseKeyedObjectPool

getNthObject

protected Object getNthObject(Object key,
                              int n)
Description copied from class: TestBaseKeyedObjectPool
Return what we expect to be the nth object (zero indexed) created by the pool for the given key.

Overrides:
getNthObject in class TestBaseKeyedObjectPool

makeKey

protected Object makeKey(int n)
Overrides:
makeKey in class TestBaseKeyedObjectPool

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class TestBaseKeyedObjectPool
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Overrides:
tearDown in class TestBaseKeyedObjectPool
Throws:
Exception

testCloseBug

public void testCloseBug()
                  throws Exception
Throws:
Exception

testIdleCap

public void testIdleCap()
                 throws Exception
Throws:
Exception

testRemoveOldest

public void testRemoveOldest()
                      throws Exception
Verifies maxSleeping contract: When returnObject triggers maxSleeping exceeded, the bottom (oldest) instance in the pool is destroyed to make room for the newly returning instance, which is pushed onto the idle object stack.

Throws:
Exception

testPoolWithNullFactory

public void testPoolWithNullFactory()
                             throws Exception
Throws:
Exception

testVariousConstructors

public void testVariousConstructors()
                             throws Exception
Throws:
Exception

testToString

public void testToString()
                  throws Exception
Overrides:
testToString in class TestKeyedObjectPool
Throws:
Exception

testBorrowFromEmptyPoolWithNullFactory

public void testBorrowFromEmptyPoolWithNullFactory()
                                            throws Exception
Throws:
Exception

testSetFactory

public void testSetFactory()
                    throws Exception
Throws:
Exception

testCantResetFactoryWithActiveObjects

public void testCantResetFactoryWithActiveObjects()
                                           throws Exception
Throws:
Exception

testCanResetFactoryWithoutActiveObjects

public void testCanResetFactoryWithoutActiveObjects()
                                             throws Exception
Throws:
Exception

testBorrowReturnWithSometimesInvalidObjects

public void testBorrowReturnWithSometimesInvalidObjects()
                                                 throws Exception
Throws:
Exception

isLifo

protected boolean isLifo()
Overrides:
isLifo in class TestBaseKeyedObjectPool

isFifo

protected boolean isFifo()
Overrides:
isFifo in class TestBaseKeyedObjectPool


Copyright © 2001-2014 The Apache Software Foundation. All Rights Reserved.