org.apache.commons.pool.impl
Class TestGenericKeyedObjectPool

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.TestGenericKeyedObjectPool
All Implemented Interfaces:
junit.framework.Test

public class TestGenericKeyedObjectPool
extends TestBaseKeyedObjectPool

Version:
$Revision: 791860 $ $Date: 2009-07-07 11:10:30 -0400 (Tue, 07 Jul 2009) $
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
TestGenericKeyedObjectPool(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  org.apache.commons.pool.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  org.apache.commons.pool.KeyedObjectPool makeEmptyPool(org.apache.commons.pool.KeyedPoolableObjectFactory factory)
          Create an KeyedObjectPool with the specified factory.
protected  Object makeKey(int n)
           
 void runTestThreads(int numThreads, int iterations, int delay)
          Kicks off test threads, each of which will go through borrow-return cycles with random delay times <= delay in between.
 void setUp()
           
static junit.framework.Test suite()
           
 void tearDown()
           
 void testBlockedKeyDoesNotBlockPool()
           
 void testConstructors()
           
 void testEviction()
           
 void testEviction2()
           
 void testEvictionOrder()
          Test to make sure evictor visits least recently used objects first, regardless of FIFO/LIFO JIRA: POOL-86
 void testEvictorVisiting()
          Verifies that the evictor visits objects in expected order and frequency.
 void testExceptionOnActivateDuringBorrow()
           
 void testExceptionOnDestroyDuringBorrow()
           
 void testExceptionOnDestroyDuringReturn()
           
 void testExceptionOnPassivateDuringReturn()
           
 void testFIFO()
           
 void testLIFO()
           
 void testMaxActive()
           
 void testMaxActiveZero()
           
 void testMaxIdle()
           
 void testMaxTotal()
           
 void testMaxTotalInvariant()
          Verifies that maxTotal is not exceeded when factory destroyObject has high latency, testOnReturn is set and there is high incidence of validation failures.
 void testMaxTotalLRU()
           
 void testMaxTotalZero()
           
 void testMinIdle()
           
 void testMinIdleMaxActive()
           
 void testMinIdleNoPopulateImmediately()
           
 void testMinIdleNoPreparePool()
           
 void testNegativeMaxActive()
           
 void testNumActiveNumIdle2()
           
 void testSettersAndGetters()
           
 void testThreaded1()
           
 void testWhenExhaustedGrow()
           
 
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, testToString
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestGenericKeyedObjectPool

public TestGenericKeyedObjectPool(String testName)
Method Detail

suite

public static junit.framework.Test suite()

makeEmptyPool

protected org.apache.commons.pool.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 org.apache.commons.pool.KeyedObjectPool makeEmptyPool(org.apache.commons.pool.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

testNegativeMaxActive

public void testNegativeMaxActive()
                           throws Exception
Throws:
Exception

testNumActiveNumIdle2

public void testNumActiveNumIdle2()
                           throws Exception
Throws:
Exception

testMaxIdle

public void testMaxIdle()
                 throws Exception
Throws:
Exception

testMaxActive

public void testMaxActive()
                   throws Exception
Throws:
Exception

testMaxActiveZero

public void testMaxActiveZero()
                       throws Exception
Throws:
Exception

testWhenExhaustedGrow

public void testWhenExhaustedGrow()
                           throws Exception
Throws:
Exception

testMaxTotal

public void testMaxTotal()
                  throws Exception
Throws:
Exception

testMaxTotalZero

public void testMaxTotalZero()
                      throws Exception
Throws:
Exception

testMaxTotalLRU

public void testMaxTotalLRU()
                     throws Exception
Throws:
Exception

testSettersAndGetters

public void testSettersAndGetters()
                           throws Exception
Throws:
Exception

testEviction

public void testEviction()
                  throws Exception
Throws:
Exception

testEviction2

public void testEviction2()
                   throws Exception
Throws:
Exception

runTestThreads

public void runTestThreads(int numThreads,
                           int iterations,
                           int delay)
Kicks off test threads, each of which will go through borrow-return cycles with random delay times <= delay in between.


testThreaded1

public void testThreaded1()
                   throws Exception
Throws:
Exception

testMaxTotalInvariant

public void testMaxTotalInvariant()
                           throws Exception
Verifies that maxTotal is not exceeded when factory destroyObject has high latency, testOnReturn is set and there is high incidence of validation failures.

Throws:
Exception

testMinIdle

public void testMinIdle()
                 throws Exception
Throws:
Exception

testMinIdleMaxActive

public void testMinIdleMaxActive()
                          throws Exception
Throws:
Exception

testMinIdleNoPopulateImmediately

public void testMinIdleNoPopulateImmediately()
                                      throws Exception
Throws:
Exception

testMinIdleNoPreparePool

public void testMinIdleNoPreparePool()
                              throws Exception
Throws:
Exception

testFIFO

public void testFIFO()
              throws Exception
Throws:
Exception

testLIFO

public void testLIFO()
              throws Exception
Throws:
Exception

testEvictionOrder

public void testEvictionOrder()
                       throws Exception
Test to make sure evictor visits least recently used objects first, regardless of FIFO/LIFO JIRA: POOL-86

Throws:
Exception

testEvictorVisiting

public void testEvictorVisiting()
                         throws Exception
Verifies that the evictor visits objects in expected order and frequency.

Throws:
Exception

testConstructors

public void testConstructors()

testExceptionOnPassivateDuringReturn

public void testExceptionOnPassivateDuringReturn()
                                          throws Exception
Throws:
Exception

testExceptionOnDestroyDuringBorrow

public void testExceptionOnDestroyDuringBorrow()
                                        throws Exception
Throws:
Exception

testExceptionOnDestroyDuringReturn

public void testExceptionOnDestroyDuringReturn()
                                        throws Exception
Throws:
Exception

testExceptionOnActivateDuringBorrow

public void testExceptionOnActivateDuringBorrow()
                                         throws Exception
Throws:
Exception

testBlockedKeyDoesNotBlockPool

public void testBlockedKeyDoesNotBlockPool()
                                    throws Exception
Throws:
Exception

isLifo

protected boolean isLifo()
Overrides:
isLifo in class TestBaseKeyedObjectPool

isFifo

protected boolean isFifo()
Overrides:
isFifo in class TestBaseKeyedObjectPool


Copyright © 2001-2009 Apache Software Foundation. All Rights Reserved.