commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1021517 [5/5] - in /commons/proper/pool/trunk: ./ src/java/org/apache/commons/pool/ src/java/org/apache/commons/pool/impl/ src/test/org/apache/commons/pool/ src/test/org/apache/commons/pool/impl/ src/test/org/apache/commons/pool/performance/
Date Mon, 11 Oct 2010 21:39:16 GMT
Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPoolFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPoolFactory.java Mon Oct 11 21:39:15 2010
@@ -32,14 +32,14 @@ public class TestGenericKeyedObjectPoolF
         super(name);
     }
 
-    protected KeyedObjectPoolFactory makeFactory(final KeyedPoolableObjectFactory objectFactory) {
-        return new GenericKeyedObjectPoolFactory(objectFactory);
+    protected KeyedObjectPoolFactory<Object,Object> makeFactory(final KeyedPoolableObjectFactory<Object,Object> objectFactory) {
+        return new GenericKeyedObjectPoolFactory<Object,Object>(objectFactory);
     }
 
     public void testConstructors() throws Exception {
-        GenericKeyedObjectPoolFactory factory = new GenericKeyedObjectPoolFactory(createObjectFactory());
+        GenericKeyedObjectPoolFactory<Object,Object> factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory());
         factory.createPool().close();
-        GenericKeyedObjectPool pool;
+        GenericKeyedObjectPool<Object,Object> pool;
 
 
         final GenericKeyedObjectPool.Config config = new GenericKeyedObjectPool.Config();
@@ -55,8 +55,8 @@ public class TestGenericKeyedObjectPoolF
         config.timeBetweenEvictionRunsMillis = 8;
         config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
         config.lifo = false;
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), config);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), config);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxIdle());
         assertEquals(3, pool.getMaxWait());
@@ -72,22 +72,22 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, 125);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, 125);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, pool.getWhenExhaustedAction());
         assertEquals(125, pool.getMaxWait());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, true, false);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, true, false);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(true, pool.getTestOnBorrow());
@@ -96,8 +96,8 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -105,8 +105,8 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -115,8 +115,8 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -126,8 +126,8 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false, 4, 5, 6, false);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false, 4, 5, 6, false);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -141,8 +141,8 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true);
-        pool = (GenericKeyedObjectPool)factory.createPool();
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true);
+        pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java Mon Oct 11 21:39:15 2010
@@ -39,15 +39,15 @@ public class TestGenericObjectPool exten
         super(testName);
     }
 
-    protected ObjectPool makeEmptyPool(int mincap) {
-       GenericObjectPool pool = new GenericObjectPool(new SimpleFactory());
+    protected ObjectPool<Object> makeEmptyPool(int mincap) {
+       GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new SimpleFactory());
        pool.setMaxActive(mincap);
        pool.setMaxIdle(mincap);
        return pool;
     }
 
-    protected ObjectPool makeEmptyPool(final PoolableObjectFactory factory) {
-        return new GenericObjectPool(factory);
+    protected ObjectPool<Object> makeEmptyPool(final PoolableObjectFactory<Object> factory) {
+        return new GenericObjectPool<Object>(factory);
     }
 
     protected Object getNthObject(int n) {
@@ -56,7 +56,7 @@ public class TestGenericObjectPool exten
 
     public void setUp() throws Exception {
         super.setUp();
-        pool = new GenericObjectPool(new SimpleFactory());
+        pool = new GenericObjectPool<Object>(new SimpleFactory());
     }
 
     public void tearDown() throws Exception {
@@ -164,7 +164,7 @@ public class TestGenericObjectPool exten
         SimpleFactory factory = new SimpleFactory();
         factory.setMakeLatency(300);
         factory.setMaxActive(2);
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         pool.setMaxActive(2);
         pool.setMinIdle(1);
         pool.borrowObject(); // numActive = 1, numIdle = 0
@@ -191,7 +191,7 @@ public class TestGenericObjectPool exten
     public void checkEvict(boolean lifo) throws Exception {
         // yea this is hairy but it tests all the code paths in GOP.evict()
         final SimpleFactory factory = new SimpleFactory();
-        final GenericObjectPool pool = new GenericObjectPool(factory);
+        final GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         pool.setSoftMinEvictableIdleTimeMillis(10);
         pool.setMinIdle(2);
         pool.setTestWhileIdle(true);
@@ -227,7 +227,7 @@ public class TestGenericObjectPool exten
     
     private void checkEvictionOrder(boolean lifo) throws Exception {
         SimpleFactory factory = new SimpleFactory();
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         pool.setNumTestsPerEvictionRun(2);
         pool.setMinEvictableIdleTimeMillis(100);
         pool.setLifo(lifo);
@@ -245,7 +245,7 @@ public class TestGenericObjectPool exten
         
         // Two eviction runs in sequence
         factory = new SimpleFactory();
-        pool = new GenericObjectPool(factory);
+        pool = new GenericObjectPool<Object>(factory);
         pool.setNumTestsPerEvictionRun(2);
         pool.setMinEvictableIdleTimeMillis(100);
         pool.setLifo(lifo);
@@ -269,8 +269,8 @@ public class TestGenericObjectPool exten
     }
     
     private void checkEvictorVisiting(boolean lifo) throws Exception {
-        VisitTrackerFactory factory = new VisitTrackerFactory();
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        VisitTrackerFactory<Object> factory = new VisitTrackerFactory<Object>();
+        GenericObjectPool<VisitTracker<Object>> pool = new GenericObjectPool<VisitTracker<Object>>(factory);
         pool.setNumTestsPerEvictionRun(2);
         pool.setMinEvictableIdleTimeMillis(-1);
         pool.setTestWhileIdle(true);
@@ -281,7 +281,7 @@ public class TestGenericObjectPool exten
             pool.addObject();
         }
         pool.evict(); // Visit oldest 2 - 0 and 1
-        Object obj = pool.borrowObject();
+        VisitTracker<Object> obj = pool.borrowObject();
         pool.returnObject(obj);
         obj = pool.borrowObject();
         pool.returnObject(obj);
@@ -290,7 +290,7 @@ public class TestGenericObjectPool exten
         //  LIFO, 7 out, then in, then out, then in
         pool.evict();  // Should visit 2 and 3 in either case
         for (int i = 0; i < 8; i++) {
-            VisitTracker tracker = (VisitTracker) pool.borrowObject();    
+            VisitTracker<Object> tracker = pool.borrowObject();
             if (tracker.getId() >= 4) {
                 assertEquals("Unexpected instance visited " + tracker.getId(),
                         0, tracker.getValidateCount());
@@ -301,8 +301,8 @@ public class TestGenericObjectPool exten
             }
         } 
 
-        factory = new VisitTrackerFactory();
-        pool = new GenericObjectPool(factory);
+        factory = new VisitTrackerFactory<Object>();
+        pool = new GenericObjectPool<VisitTracker<Object>>(factory);
         pool.setNumTestsPerEvictionRun(3);
         pool.setMinEvictableIdleTimeMillis(-1);
         pool.setTestWhileIdle(true);
@@ -327,7 +327,7 @@ public class TestGenericObjectPool exten
         pool.evict();
         // Should hit 6,7,0 - 0 for second time
         for (int i = 0; i < 8; i++) {
-            VisitTracker tracker = (VisitTracker) pool.borrowObject();
+            VisitTracker<Object> tracker = pool.borrowObject();
             if (tracker.getId() != 0) {
                 assertEquals("Instance " +  tracker.getId() + 
                         " visited wrong number of times.",
@@ -346,7 +346,7 @@ public class TestGenericObjectPool exten
         for (int i = 0; i < 4; i++) {
             pool.setNumTestsPerEvictionRun(smallPrimes[i]);
             for (int j = 0; j < 5; j++) {
-                pool = new GenericObjectPool(factory);
+                pool = new GenericObjectPool<VisitTracker<Object>>(factory);
                 pool.setNumTestsPerEvictionRun(3);
                 pool.setMinEvictableIdleTimeMillis(-1);
                 pool.setTestWhileIdle(true);
@@ -372,10 +372,10 @@ public class TestGenericObjectPool exten
 
                 // Look at elements and make sure they are visited cycleCount
                 // or cycleCount + 1 times
-                VisitTracker tracker = null;
+                VisitTracker<Object> tracker = null;
                 int visitCount = 0;
                 for (int k = 0; k < instanceCount; k++) {
-                    tracker = (VisitTracker) pool.borrowObject(); 
+                    tracker = pool.borrowObject(); 
                     assertTrue(pool.getNumActive() <= pool.getMaxActive());
                     visitCount = tracker.getValidateCount();                  
                     assertTrue(visitCount >= cycleCount && 
@@ -387,7 +387,7 @@ public class TestGenericObjectPool exten
 
     public void testExceptionOnPassivateDuringReturn() throws Exception {
         SimpleFactory factory = new SimpleFactory();        
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         Object obj = pool.borrowObject();
         factory.setThrowExceptionOnPassivate(true);
         pool.returnObject(obj);
@@ -398,7 +398,7 @@ public class TestGenericObjectPool exten
     public void testExceptionOnDestroyDuringBorrow() throws Exception {
         SimpleFactory factory = new SimpleFactory(); 
         factory.setThrowExceptionOnDestroy(true);
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         pool.setTestOnBorrow(true);
         pool.borrowObject();
         factory.setValid(false); // Make validation fail on next borrow attempt
@@ -415,7 +415,7 @@ public class TestGenericObjectPool exten
     public void testExceptionOnDestroyDuringReturn() throws Exception {
         SimpleFactory factory = new SimpleFactory(); 
         factory.setThrowExceptionOnDestroy(true);
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         pool.setTestOnReturn(true);
         Object obj1 = pool.borrowObject();
         pool.borrowObject();
@@ -427,7 +427,7 @@ public class TestGenericObjectPool exten
     
     public void testExceptionOnActivateDuringBorrow() throws Exception {
         SimpleFactory factory = new SimpleFactory(); 
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         Object obj1 = pool.borrowObject();
         Object obj2 = pool.borrowObject();
         pool.returnObject(obj1);
@@ -455,7 +455,7 @@ public class TestGenericObjectPool exten
     }
 
     public void testSetFactoryWithActiveObjects() throws Exception {
-        GenericObjectPool pool = new GenericObjectPool();
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>();
         pool.setMaxIdle(10);
         pool.setFactory(new SimpleFactory());
         Object obj = pool.borrowObject();
@@ -475,7 +475,7 @@ public class TestGenericObjectPool exten
     }
 
     public void testSetFactoryWithNoActiveObjects() throws Exception {
-        GenericObjectPool pool = new GenericObjectPool();
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>();
         pool.setMaxIdle(10);
         pool.setFactory(new SimpleFactory());
         Object obj = pool.borrowObject();
@@ -658,7 +658,7 @@ public class TestGenericObjectPool exten
         }
 
         try {
-            ObjectPool pool = new GenericObjectPool(
+            ObjectPool<Object> pool = new GenericObjectPool<Object>(
                 new SimpleFactory(),
                 GenericObjectPool.DEFAULT_MAX_ACTIVE, 
                 Byte.MAX_VALUE,
@@ -679,7 +679,7 @@ public class TestGenericObjectPool exten
     }
 
     public void testSettersAndGetters() throws Exception {
-        GenericObjectPool pool = new GenericObjectPool();
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>();
         {
             pool.setFactory(new SimpleFactory());
         }
@@ -740,17 +740,17 @@ public class TestGenericObjectPool exten
     }
     
     public void testDefaultConfiguration() throws Exception {
-        GenericObjectPool pool = new GenericObjectPool();
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>();
         assertConfiguration(new GenericObjectPool.Config(),pool);
     }
 
     public void testConstructors() throws Exception {
         {
-            GenericObjectPool pool = new GenericObjectPool();
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>();
             assertConfiguration(new GenericObjectPool.Config(),pool);
         }
         {
-            GenericObjectPool pool = new GenericObjectPool(new SimpleFactory());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new SimpleFactory());
             assertConfiguration(new GenericObjectPool.Config(),pool);
         }
         {
@@ -765,13 +765,13 @@ public class TestGenericObjectPool exten
             expected.testWhileIdle = true;
             expected.timeBetweenEvictionRunsMillis = 11L;
             expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-            GenericObjectPool pool = new GenericObjectPool(null,expected);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected);
             assertConfiguration(expected,pool);
         }
         {
             GenericObjectPool.Config expected = new GenericObjectPool.Config();
             expected.maxActive = 2;
-            GenericObjectPool pool = new GenericObjectPool(null,expected.maxActive);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive);
             assertConfiguration(expected,pool);
         }
         {
@@ -779,7 +779,7 @@ public class TestGenericObjectPool exten
             expected.maxActive = 2;
             expected.maxWait = 5L;
             expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-            GenericObjectPool pool = new GenericObjectPool(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait);
             assertConfiguration(expected,pool);
         }
         {
@@ -789,7 +789,7 @@ public class TestGenericObjectPool exten
             expected.testOnBorrow = true;
             expected.testOnReturn = true;
             expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-            GenericObjectPool pool = new GenericObjectPool(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.testOnBorrow,expected.testOnReturn);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.testOnBorrow,expected.testOnReturn);
             assertConfiguration(expected,pool);
         }
         {
@@ -798,7 +798,7 @@ public class TestGenericObjectPool exten
             expected.maxIdle = 3;
             expected.maxWait = 5L;
             expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-            GenericObjectPool pool = new GenericObjectPool(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.maxIdle);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.maxIdle);
             assertConfiguration(expected,pool);
         }
         {
@@ -809,7 +809,7 @@ public class TestGenericObjectPool exten
             expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
             expected.testOnBorrow = true;
             expected.testOnReturn = true;
-            GenericObjectPool pool = new GenericObjectPool(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.maxIdle,expected.testOnBorrow,expected.testOnReturn);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.maxIdle,expected.testOnBorrow,expected.testOnReturn);
             assertConfiguration(expected,pool);
         }
         {
@@ -824,7 +824,7 @@ public class TestGenericObjectPool exten
             expected.testWhileIdle = true;
             expected.timeBetweenEvictionRunsMillis = 11L;
             expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-            GenericObjectPool pool = new GenericObjectPool(null,expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle);
             assertConfiguration(expected,pool);
         }
         {
@@ -840,14 +840,14 @@ public class TestGenericObjectPool exten
             expected.testWhileIdle = true;
             expected.timeBetweenEvictionRunsMillis = 11L;
             expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-            GenericObjectPool pool = new GenericObjectPool(null,expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.minIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle);
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.minIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle);
             assertConfiguration(expected,pool);
         }
     }
 
     public void testSetConfig() throws Exception {
         GenericObjectPool.Config expected = new GenericObjectPool.Config();
-        GenericObjectPool pool = new GenericObjectPool();
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>();
         assertConfiguration(expected,pool);
         expected.maxActive = 2;
         expected.maxIdle = 3;
@@ -864,7 +864,7 @@ public class TestGenericObjectPool exten
     }
 
     public void testDebugInfo() throws Exception {
-        GenericObjectPool pool = new GenericObjectPool(new SimpleFactory());
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new SimpleFactory());
         pool.setMaxIdle(3);
         assertNotNull(pool.debugInfo());
         Object obj = pool.borrowObject();
@@ -986,14 +986,12 @@ public class TestGenericObjectPool exten
     }
  
     public void testEvictionSoftMinIdle() throws Exception {
-        GenericObjectPool pool = null;
-        
-        class TimeTest extends BasePoolableObjectFactory {
+        class TimeTest extends BasePoolableObjectFactory<TimeTest> {
             private final long createTime;
             public TimeTest() {
                 createTime = System.currentTimeMillis();
             }
-            public Object makeObject() throws Exception {
+            public TimeTest makeObject() throws Exception {
                 return new TimeTest();
             }
             public long getCreateTime() {
@@ -1001,7 +999,7 @@ public class TestGenericObjectPool exten
             }
         }
         
-        pool = new GenericObjectPool(new TimeTest());
+        GenericObjectPool<TimeTest> pool = new GenericObjectPool<TimeTest>(new TimeTest());
         
         pool.setMaxIdle(5);
         pool.setMaxActive(5);
@@ -1010,7 +1008,7 @@ public class TestGenericObjectPool exten
         pool.setSoftMinEvictableIdleTimeMillis(1000L);
         pool.setMinIdle(2);
 
-        Object[] active = new Object[5];
+        TimeTest[] active = new TimeTest[5];
         Long[] creationTime = new Long[5] ;
         for(int i=0;i<5;i++) {
             active[i] = pool.borrowObject();
@@ -1156,7 +1154,7 @@ public class TestGenericObjectPool exten
         factory.setDestroyLatency(100);  // Destroy takes 100 ms
         factory.setMaxActive(maxActive); // (makes - destroys) bound
         factory.setValidationEnabled(true);
-        pool = new GenericObjectPool(factory);
+        pool = new GenericObjectPool<Object>(factory);
         pool.setMaxActive(maxActive);
         pool.setMaxIdle(-1);
         pool.setTestOnReturn(true);
@@ -1168,7 +1166,7 @@ public class TestGenericObjectPool exten
         private final java.util.Random _random = new java.util.Random();
         
         // Thread config items
-        private final ObjectPool _pool;
+        private final ObjectPool<Object> _pool;
         private final int _iter;
         private final int _delay;
         private final boolean _randomDelay;
@@ -1178,24 +1176,24 @@ public class TestGenericObjectPool exten
         private volatile boolean _failed = false;
         private volatile Throwable _error;
 
-        public TestThread(ObjectPool pool) {
+        public TestThread(ObjectPool<Object> pool) {
             this(pool, 100, 50, true, null);
         }
 
-        public TestThread(ObjectPool pool, int iter) {
+        public TestThread(ObjectPool<Object> pool, int iter) {
             this(pool, iter, 50, true, null);
         }
 
-        public TestThread(ObjectPool pool, int iter, int delay) {
+        public TestThread(ObjectPool<Object> pool, int iter, int delay) {
             this(pool, iter, delay, true, null);
         }
         
-        public TestThread(ObjectPool pool, int iter, int delay,
+        public TestThread(ObjectPool<Object> pool, int iter, int delay,
                 boolean randomDelay) {
             this(pool, iter, delay, randomDelay, null);
         }
 
-        public TestThread(ObjectPool pool, int iter, int delay,
+        public TestThread(ObjectPool<Object> pool, int iter, int delay,
                 boolean randomDelay, Object obj) {
             _pool = pool;
             _iter = iter;
@@ -1296,7 +1294,7 @@ public class TestGenericObjectPool exten
         assertEquals("should be one idle", 1, pool.getNumIdle());
         assertEquals("should be zero active", 0, pool.getNumActive());
 
-        ObjectPool op = new GenericObjectPool();
+        ObjectPool<Object> op = new GenericObjectPool<Object>();
         try {
             op.addObject();
             fail("Expected IllegalStateException when there is no factory.");
@@ -1306,9 +1304,9 @@ public class TestGenericObjectPool exten
         op.close();
     }
     
-    protected GenericObjectPool pool = null;
+    protected GenericObjectPool<Object> pool = null;
 
-    private void assertConfiguration(GenericObjectPool.Config expected, GenericObjectPool actual) throws Exception {
+    private void assertConfiguration(GenericObjectPool.Config expected, GenericObjectPool<Object> actual) throws Exception {
         assertEquals("testOnBorrow",expected.testOnBorrow,actual.getTestOnBorrow());
         assertEquals("testOnReturn",expected.testOnReturn,actual.getTestOnReturn());
         assertEquals("testWhileIdle",expected.testWhileIdle,actual.getTestWhileIdle());
@@ -1321,7 +1319,7 @@ public class TestGenericObjectPool exten
         assertEquals("timeBetweenEvictionRunsMillis",expected.timeBetweenEvictionRunsMillis,actual.getTimeBetweenEvictionRunsMillis());
     }
 
-    public class SimpleFactory implements PoolableObjectFactory {
+    public class SimpleFactory implements PoolableObjectFactory<Object> {
         public SimpleFactory() {
             this(true);
         }
@@ -1594,7 +1592,7 @@ public class TestGenericObjectPool exten
      * the provided pool returns it after a wait
      */
     static class WaitingTestThread extends Thread {
-        private final GenericObjectPool _pool;
+        private final GenericObjectPool<Object> _pool;
         private final long _pause;
         private Throwable _thrown;
         
@@ -1604,7 +1602,7 @@ public class TestGenericObjectPool exten
         private long ended;
         private String objectId;
 
-        public WaitingTestThread(GenericObjectPool pool, long pause) {
+        public WaitingTestThread(GenericObjectPool<Object> pool, long pause) {
             _pool = pool;
             _pause = pause;
             _thrown = null;
@@ -1646,7 +1644,7 @@ public class TestGenericObjectPool exten
         final long holdTime = 2 * maxWait; // how long to hold connection
         final int threads = 10; // number of threads to grab the object initially
         SimpleFactory factory = new SimpleFactory();
-        GenericObjectPool pool = new GenericObjectPool(factory);
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
         pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
         pool.setMaxWait(maxWait);
         pool.setMaxActive(threads);
@@ -1698,7 +1696,7 @@ public class TestGenericObjectPool exten
      */
     public void testMakeConcurrentWithReturn() throws Exception {
         SimpleFactory factory = new SimpleFactory();
-        GenericObjectPool pool = new GenericObjectPool(factory); 
+        GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory); 
         pool.setTestOnBorrow(true);
         factory.setValid(true);
         // Borrow and return an instance, with a short wait

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPoolFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPoolFactory.java Mon Oct 11 21:39:15 2010
@@ -35,13 +35,13 @@ public class TestGenericObjectPoolFactor
         super(name);
     }
 
-    protected ObjectPoolFactory makeFactory(final PoolableObjectFactory objectFactory) throws UnsupportedOperationException {
-        return new GenericObjectPoolFactory(objectFactory);
+    protected ObjectPoolFactory<Object> makeFactory(final PoolableObjectFactory<Object> objectFactory) throws UnsupportedOperationException {
+        return new GenericObjectPoolFactory<Object>(objectFactory);
     }
 
     public void testConstructors() throws Exception {
-        GenericObjectPoolFactory factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory());
-        GenericObjectPool pool;
+        GenericObjectPoolFactory<Object> factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory());
+        GenericObjectPool<Object> pool;
         factory.createPool().close();
 
         final GenericObjectPool.Config config = new GenericObjectPool.Config();
@@ -58,8 +58,8 @@ public class TestGenericObjectPoolFactor
         config.lifo = false;
         config.timeBetweenEvictionRunsMillis = 8;
         config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), config);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), config);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxIdle());
         assertEquals(3, pool.getMaxWait());
@@ -77,15 +77,15 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         pool.borrowObject();
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, 125);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, 125);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK, pool.getWhenExhaustedAction());
         assertEquals(125, pool.getMaxWait());
@@ -102,8 +102,8 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, true, false);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, true, false);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(true, pool.getTestOnBorrow());
@@ -113,8 +113,8 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -123,8 +123,8 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -135,8 +135,8 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false, 4, 5, 6, false);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false, 4, 5, 6, false);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -151,8 +151,8 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
@@ -168,8 +168,8 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true, 8, false);
-        pool = (GenericObjectPool)factory.createPool();
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true, 8, false);
+        pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftRefOutOfMemory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftRefOutOfMemory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftRefOutOfMemory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftRefOutOfMemory.java Mon Oct 11 21:39:15 2010
@@ -32,7 +32,7 @@ import org.apache.commons.pool.PoolableO
  * @version $Revision$ $Date$
  */
 public class TestSoftRefOutOfMemory extends TestCase {
-    private SoftReferenceObjectPool pool;
+    private SoftReferenceObjectPool<String> pool;
 
     public TestSoftRefOutOfMemory(String testName) {
         super(testName);
@@ -47,16 +47,16 @@ public class TestSoftRefOutOfMemory exte
     }
 
     public void testOutOfMemory() throws Exception {
-        pool = new SoftReferenceObjectPool(new SmallPoolableObjectFactory());
+        pool = new SoftReferenceObjectPool<String>(new SmallPoolableObjectFactory());
 
-        Object obj = pool.borrowObject();
+        String obj = pool.borrowObject();
         assertEquals("1", obj);
         pool.returnObject(obj);
         obj = null;
 
         assertEquals(1, pool.getNumIdle());
 
-        final List garbage = new LinkedList();
+        final List<byte[]> garbage = new LinkedList<byte[]>();
         final Runtime runtime = Runtime.getRuntime();
         while (pool.getNumIdle() > 0) {
             try {
@@ -78,20 +78,20 @@ public class TestSoftRefOutOfMemory exte
     }
 
     public void testOutOfMemory1000() throws Exception {
-        pool = new SoftReferenceObjectPool(new SmallPoolableObjectFactory());
+        pool = new SoftReferenceObjectPool<String>(new SmallPoolableObjectFactory());
 
         for (int i = 0 ; i < 1000 ; i++) {
             pool.addObject();
         }
 
-        Object obj = pool.borrowObject();
+        String obj = pool.borrowObject();
         assertEquals("1000", obj);
         pool.returnObject(obj);
         obj = null;
 
         assertEquals(1000, pool.getNumIdle());
 
-        final List garbage = new LinkedList();
+        final List<byte[]> garbage = new LinkedList<byte[]>();
         final Runtime runtime = Runtime.getRuntime();
         while (pool.getNumIdle() > 0) {
             try {
@@ -113,16 +113,16 @@ public class TestSoftRefOutOfMemory exte
     }
 
     public void testOutOfMemoryLarge() throws Exception {
-        pool = new SoftReferenceObjectPool(new LargePoolableObjectFactory(1000000));
+        pool = new SoftReferenceObjectPool<String>(new LargePoolableObjectFactory(1000000));
 
-        Object obj = pool.borrowObject();
+        String obj = pool.borrowObject();
         assertTrue(((String)obj).startsWith("1."));
         pool.returnObject(obj);
         obj = null;
 
         assertEquals(1, pool.getNumIdle());
 
-        final List garbage = new LinkedList();
+        final List<byte[]> garbage = new LinkedList<byte[]>();
         final Runtime runtime = Runtime.getRuntime();
         while (pool.getNumIdle() > 0) {
             try {
@@ -147,8 +147,8 @@ public class TestSoftRefOutOfMemory exte
      * Makes sure an {@link OutOfMemoryError} isn't swallowed.
      */
     public void testOutOfMemoryError() throws Exception {
-        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
-            public Object makeObject() throws Exception {
+        pool = new SoftReferenceObjectPool<String>(new BasePoolableObjectFactory<String>() {
+            public String makeObject() throws Exception {
                 throw new OutOfMemoryError();
             }
         });
@@ -162,12 +162,12 @@ public class TestSoftRefOutOfMemory exte
         }
         pool.close();
 
-        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
-            public Object makeObject() throws Exception {
-                return new Object();
+        pool = new SoftReferenceObjectPool<String>(new BasePoolableObjectFactory<String>() {
+            public String makeObject() throws Exception {
+                return new String();
             }
 
-            public boolean validateObject(Object obj) {
+            public boolean validateObject(String obj) {
                 throw new OutOfMemoryError();
             }
         });
@@ -181,16 +181,16 @@ public class TestSoftRefOutOfMemory exte
         }
         pool.close();
         
-        pool = new SoftReferenceObjectPool(new BasePoolableObjectFactory() {
-            public Object makeObject() throws Exception {
-                return new Object();
+        pool = new SoftReferenceObjectPool<String>(new BasePoolableObjectFactory<String>() {
+            public String makeObject() throws Exception {
+                return new String();
             }
 
-            public boolean validateObject(Object obj) {
+            public boolean validateObject(String obj) {
                 throw new IllegalAccessError();
             }
 
-            public void destroyObject(Object obj) throws Exception {
+            public void destroyObject(String obj) throws Exception {
                 throw new OutOfMemoryError();
             }
         });
@@ -207,10 +207,10 @@ public class TestSoftRefOutOfMemory exte
     }
 
 
-    public static class SmallPoolableObjectFactory implements PoolableObjectFactory {
+    public static class SmallPoolableObjectFactory implements PoolableObjectFactory<String> {
         private int counter = 0;
 
-        public Object makeObject() {
+        public String makeObject() {
             counter++;
             // It seems that as of Java 1.4 String.valueOf may return an
             // intern()'ed String this may cause problems when the tests
@@ -219,15 +219,15 @@ public class TestSoftRefOutOfMemory exte
             // is returned eliminated false failures.
             return new String(String.valueOf(counter));
         }
-        public boolean validateObject(Object obj) {
+        public boolean validateObject(String obj) {
             return true;
         }
-        public void activateObject(Object obj) { }
-        public void passivateObject(Object obj) { }
-        public void destroyObject(Object obj) { }
+        public void activateObject(String obj) { }
+        public void passivateObject(String obj) { }
+        public void destroyObject(String obj) { }
     }
 
-    public static class LargePoolableObjectFactory implements PoolableObjectFactory {
+    public static class LargePoolableObjectFactory implements PoolableObjectFactory<String> {
         private String buffer;
         private int counter = 0;
 
@@ -237,15 +237,15 @@ public class TestSoftRefOutOfMemory exte
             buffer = new String(data);
         }
 
-        public Object makeObject() {
+        public String makeObject() {
             counter++;
             return String.valueOf(counter) + buffer;
         }
-        public boolean validateObject(Object obj) {
+        public boolean validateObject(String obj) {
             return true;
         }
-        public void activateObject(Object obj) { }
-        public void passivateObject(Object obj) { }
-        public void destroyObject(Object obj) { }
+        public void activateObject(String obj) { }
+        public void passivateObject(String obj) { }
+        public void destroyObject(String obj) { }
     }
 }
\ No newline at end of file

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftReferenceObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftReferenceObjectPool.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftReferenceObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestSoftReferenceObjectPool.java Mon Oct 11 21:39:15 2010
@@ -31,9 +31,9 @@ public class TestSoftReferenceObjectPool
         super(testName);
     }
 
-    protected ObjectPool makeEmptyPool(int cap) {
-        return new SoftReferenceObjectPool(
-            new PoolableObjectFactory()  {
+    protected ObjectPool<Object> makeEmptyPool(int cap) {
+        return new SoftReferenceObjectPool<Object>(
+            new PoolableObjectFactory<Object>()  {
                 int counter = 0;
                 public Object makeObject() { return String.valueOf(counter++); }
                 public void destroyObject(Object obj) { }
@@ -44,8 +44,8 @@ public class TestSoftReferenceObjectPool
             );
     }
 
-    protected ObjectPool makeEmptyPool(final PoolableObjectFactory factory) {
-        return new SoftReferenceObjectPool(factory);
+    protected ObjectPool<Object> makeEmptyPool(final PoolableObjectFactory<Object> factory) {
+        return new SoftReferenceObjectPool<Object>(factory);
     }
 
     protected Object getNthObject(int n) {

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java Mon Oct 11 21:39:15 2010
@@ -34,13 +34,13 @@ public class TestStackKeyedObjectPool ex
         super(testName);
     }
 
-    protected KeyedObjectPool makeEmptyPool(int mincapacity) {
-        StackKeyedObjectPool pool = new StackKeyedObjectPool(new SimpleFactory(),mincapacity);
+    protected KeyedObjectPool<Object,Object> makeEmptyPool(int mincapacity) {
+        StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new SimpleFactory(),mincapacity);
         return pool;
     }
 
-    protected KeyedObjectPool makeEmptyPool(KeyedPoolableObjectFactory factory) {
-        return new StackKeyedObjectPool(factory);
+    protected KeyedObjectPool<Object,Object> makeEmptyPool(KeyedPoolableObjectFactory<Object,Object> factory) {
+        return new StackKeyedObjectPool<Object,Object>(factory);
     }
 
     protected Object getNthObject(Object key, int n) {
@@ -51,18 +51,18 @@ public class TestStackKeyedObjectPool ex
         return String.valueOf(n);
     }
 
-    private StackKeyedObjectPool pool = null;
+    private StackKeyedObjectPool<String,String> pool = null;
 
     public void setUp() throws Exception {
         super.setUp();
-        pool = new StackKeyedObjectPool(
-            new KeyedPoolableObjectFactory()  {
+        pool = new StackKeyedObjectPool<String,String>(
+            new KeyedPoolableObjectFactory<String,String>()  {
                 int counter = 0;
-                public Object makeObject(Object key) { return String.valueOf(key) + String.valueOf(counter++); }
-                public void destroyObject(Object key, Object obj) { }
-                public boolean validateObject(Object key, Object obj) { return true; }
-                public void activateObject(Object key, Object obj) { }
-                public void passivateObject(Object key, Object obj) { }
+                public String makeObject(String key) { return String.valueOf(key) + String.valueOf(counter++); }
+                public void destroyObject(String key, String obj) { }
+                public boolean validateObject(String key, String obj) { return true; }
+                public void activateObject(String key, String obj) { }
+                public void passivateObject(String key, String obj) { }
             }
             );
     }
@@ -75,8 +75,8 @@ public class TestStackKeyedObjectPool ex
 
     public void testCloseBug() throws Exception {
         {
-            Object obj0 = pool.borrowObject("");
-            Object obj1 = pool.borrowObject("");
+            String obj0 = pool.borrowObject("");
+            String obj1 = pool.borrowObject("");
             assertEquals(2,pool.getNumActive(""));
             assertEquals(0,pool.getNumIdle(""));
             pool.returnObject("",obj1);
@@ -85,8 +85,8 @@ public class TestStackKeyedObjectPool ex
             assertEquals(2,pool.getNumIdle(""));
         }
         {
-            Object obj0 = pool.borrowObject("2");
-            Object obj1 = pool.borrowObject("2");
+            String obj0 = pool.borrowObject("2");
+            String obj1 = pool.borrowObject("2");
             assertEquals(2,pool.getNumActive("2"));
             assertEquals(0,pool.getNumIdle("2"));
             pool.returnObject("2",obj1);
@@ -98,7 +98,7 @@ public class TestStackKeyedObjectPool ex
     }
 
     public void testIdleCap() throws Exception {
-        Object[] active = new Object[100];
+        String[] active = new String[100];
         for(int i=0;i<100;i++) {
             active[i] = pool.borrowObject("");
         }
@@ -118,9 +118,9 @@ public class TestStackKeyedObjectPool ex
      */
     public void testRemoveOldest() throws Exception {
         pool._maxSleeping = 2;
-        Object obj0 = pool.borrowObject("");
-        Object obj1 = pool.borrowObject("");
-        Object obj2 = pool.borrowObject("");
+        String obj0 = pool.borrowObject("");
+        String obj1 = pool.borrowObject("");
+        String obj2 = pool.borrowObject("");
         pool.returnObject("", obj0); // Push 0 onto bottom of stack
         pool.returnObject("", obj1); // Push 1
         pool.returnObject("", obj2); // maxSleeping exceeded -> 0 destroyed, 2 pushed
@@ -130,7 +130,7 @@ public class TestStackKeyedObjectPool ex
     }
 
     public void testPoolWithNullFactory() throws Exception {
-        KeyedObjectPool pool = new StackKeyedObjectPool(10);
+        KeyedObjectPool<String,Integer> pool = new StackKeyedObjectPool<String,Integer>(10);
         for(int i=0;i<10;i++) {
             pool.returnObject("X",new Integer(i));
         }
@@ -155,33 +155,33 @@ public class TestStackKeyedObjectPool ex
 
     public void testVariousConstructors() throws Exception {
         {
-            StackKeyedObjectPool pool = new StackKeyedObjectPool();
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>();
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool pool = new StackKeyedObjectPool(10);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(10);
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool pool = new StackKeyedObjectPool(10,5);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(10,5);
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool pool = new StackKeyedObjectPool(null);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(null);
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool pool = new StackKeyedObjectPool(null,10);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(null,10);
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool pool = new StackKeyedObjectPool(null,10,5);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(null,10,5);
             assertNotNull(pool);
         }
     }
 
     public void testToString() throws Exception {
-        StackKeyedObjectPool pool = new StackKeyedObjectPool(new SimpleFactory());
+        StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new SimpleFactory());
         assertNotNull(pool.toString());
         Object obj = pool.borrowObject("key");
         assertNotNull(pool.toString());
@@ -190,7 +190,7 @@ public class TestStackKeyedObjectPool ex
     }
 
     public void testBorrowFromEmptyPoolWithNullFactory() throws Exception {
-        KeyedObjectPool pool = new StackKeyedObjectPool();
+        KeyedObjectPool<String,Object> pool = new StackKeyedObjectPool<String,Object>();
         try {
             pool.borrowObject("x");
             fail("Expected NoSuchElementException");
@@ -200,7 +200,7 @@ public class TestStackKeyedObjectPool ex
     }
 
     public void testSetFactory() throws Exception {
-        KeyedObjectPool pool = new StackKeyedObjectPool();
+        KeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>();
         try {
             pool.borrowObject("x");
             fail("Expected NoSuchElementException");
@@ -214,7 +214,7 @@ public class TestStackKeyedObjectPool ex
     }
 
     public void testCantResetFactoryWithActiveObjects() throws Exception {
-        KeyedObjectPool pool = new StackKeyedObjectPool();
+        KeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>();
         pool.setFactory(new SimpleFactory());
         Object obj = pool.borrowObject("x");
         assertNotNull(obj);
@@ -228,7 +228,7 @@ public class TestStackKeyedObjectPool ex
     }
 
     public void testCanResetFactoryWithoutActiveObjects() throws Exception {
-        KeyedObjectPool pool = new StackKeyedObjectPool();
+        KeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>();
         {
             pool.setFactory(new SimpleFactory());
             Object obj = pool.borrowObject("x");
@@ -244,8 +244,8 @@ public class TestStackKeyedObjectPool ex
     }
 
     public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {
-        KeyedObjectPool pool = new StackKeyedObjectPool(
-            new KeyedPoolableObjectFactory() {
+        KeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(
+            new KeyedPoolableObjectFactory<Object,Object>() {
                 int counter = 0;
                 public Object makeObject(Object key) { return new Integer(counter++); }
                 public void destroyObject(Object key, Object obj) { }
@@ -300,11 +300,11 @@ public class TestStackKeyedObjectPool ex
         assertEquals(new Integer(1), pool.borrowObject("key"));   
     }
 
-    class SimpleFactory implements KeyedPoolableObjectFactory {
-        HashMap map = new HashMap();
+    class SimpleFactory implements KeyedPoolableObjectFactory<Object,Object> {
+        HashMap<Object,Integer> map = new HashMap<Object,Integer>();
         public Object makeObject(Object key) {
             int counter = 0;
-            Integer Counter = (Integer)(map.get(key));
+            Integer Counter = map.get(key);
             if(null != Counter) {
                 counter = Counter.intValue();
             }

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPoolFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPoolFactory.java Mon Oct 11 21:39:15 2010
@@ -32,36 +32,36 @@ public class TestStackKeyedObjectPoolFac
         super(name);
     }
 
-    protected KeyedObjectPoolFactory makeFactory(final KeyedPoolableObjectFactory objectFactory) throws UnsupportedOperationException {
-        return new StackKeyedObjectPoolFactory(objectFactory);
+    protected KeyedObjectPoolFactory<Object,Object> makeFactory(final KeyedPoolableObjectFactory<Object,Object> objectFactory) throws UnsupportedOperationException {
+        return new StackKeyedObjectPoolFactory<Object,Object>(objectFactory);
     }
 
     public void testConstructors() throws Exception {
-        StackKeyedObjectPoolFactory factory = new StackKeyedObjectPoolFactory();
+        StackKeyedObjectPoolFactory<Object,Object> factory = new StackKeyedObjectPoolFactory<Object,Object>();
         factory.createPool().close();
 
-        factory = new StackKeyedObjectPoolFactory(1);
-        StackKeyedObjectPool pool = (StackKeyedObjectPool)factory.createPool();
+        factory = new StackKeyedObjectPoolFactory<Object,Object>(1);
+        StackKeyedObjectPool<Object,Object> pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1,pool._maxSleeping);
         pool.close();
 
-        factory = new StackKeyedObjectPoolFactory(1, 2);
-        pool = (StackKeyedObjectPool)factory.createPool();
+        factory = new StackKeyedObjectPoolFactory<Object,Object>(1, 2);
+        pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1,pool._maxSleeping);
         assertEquals(2,pool._initSleepingCapacity);
         pool.close();
 
-        factory = new StackKeyedObjectPoolFactory(createObjectFactory());
-        pool = (StackKeyedObjectPool)factory.createPool();
+        factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory());
+        pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         pool.close();
 
-        factory = new StackKeyedObjectPoolFactory(createObjectFactory(),  1);
-        pool = (StackKeyedObjectPool)factory.createPool();
+        factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),  1);
+        pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1,pool._maxSleeping);
         pool.close();
 
-        factory = new StackKeyedObjectPoolFactory(createObjectFactory(),  1, 2);
-        pool = (StackKeyedObjectPool)factory.createPool();
+        factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),  1, 2);
+        pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1,pool._maxSleeping);
         assertEquals(2,pool._initSleepingCapacity);
         pool.close();

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java Mon Oct 11 21:39:15 2010
@@ -37,12 +37,12 @@ public class TestStackObjectPool extends
         super(testName);
     }
 
-    protected ObjectPool makeEmptyPool(int mincap) {
-        return new StackObjectPool(new SimpleFactory());
+    protected ObjectPool<Object> makeEmptyPool(int mincap) {
+        return new StackObjectPool<Object>(new SimpleFactory());
     }
 
-    protected ObjectPool makeEmptyPool(final PoolableObjectFactory factory) {
-        return new StackObjectPool(factory);
+    protected ObjectPool<Object> makeEmptyPool(final PoolableObjectFactory<Object> factory) {
+        return new StackObjectPool<Object>(factory);
     }
 
     protected Object getNthObject(int n) {
@@ -50,7 +50,7 @@ public class TestStackObjectPool extends
     }
 
     public void testIdleCap() throws Exception {
-        ObjectPool pool = makeEmptyPool(8);
+        ObjectPool<Object> pool = makeEmptyPool(8);
         Object[] active = new Object[100];
         for(int i=0;i<100;i++) {
             active[i] = pool.borrowObject();
@@ -68,7 +68,7 @@ public class TestStackObjectPool extends
      * @deprecated - to be removed in pool 2.0
      */
     public void testPoolWithNullFactory() throws Exception {
-        ObjectPool pool = new StackObjectPool(10);
+        ObjectPool<Object> pool = new StackObjectPool<Object>(10);
         for(int i=0;i<10;i++) {
             pool.returnObject(new Integer(i));
         }
@@ -94,7 +94,7 @@ public class TestStackObjectPool extends
      * @deprecated - to be removed in pool 2.0
      */
     public void testBorrowFromEmptyPoolWithNullFactory() throws Exception {
-        ObjectPool pool = new StackObjectPool();
+        ObjectPool<Object> pool = new StackObjectPool<Object>();
         try {
             pool.borrowObject();
             fail("Expected NoSuchElementException");
@@ -107,7 +107,7 @@ public class TestStackObjectPool extends
      * @deprecated - to be removed in pool 2.0
      */
     public void testSetFactory() throws Exception {
-        ObjectPool pool = new StackObjectPool();
+        ObjectPool<Object> pool = new StackObjectPool<Object>();
         try {
             pool.borrowObject();
             fail("Expected NoSuchElementException");
@@ -124,7 +124,7 @@ public class TestStackObjectPool extends
      * @deprecated - to be removed in pool 2.0
      */
     public void testCantResetFactoryWithActiveObjects() throws Exception {
-        ObjectPool pool = new StackObjectPool();
+        ObjectPool<Object> pool = new StackObjectPool<Object>();
         pool.setFactory(new SimpleFactory());
         Object obj = pool.borrowObject();
         assertNotNull(obj);
@@ -141,7 +141,7 @@ public class TestStackObjectPool extends
      * @deprecated - to be removed in pool 2.0
      */
     public void testCanResetFactoryWithoutActiveObjects() throws Exception {
-        ObjectPool pool = new StackObjectPool();
+        ObjectPool<Object> pool = new StackObjectPool<Object>();
         {
             pool.setFactory(new SimpleFactory());
             Object obj = pool.borrowObject();        
@@ -165,10 +165,10 @@ public class TestStackObjectPool extends
         SelectiveFactory factory = new SelectiveFactory();
         factory.setValidateSelectively(true);  // Even numbers fail validation
         factory.setPassivateSelectively(true); // Multiples of 3 fail passivation
-        ObjectPool pool = new StackObjectPool(factory, 20);
-        Object[] obj = new Object[10];
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 20);
+        Integer[] obj = new Integer[10];
         for(int i=0;i<10;i++) {
-            Object object = null;
+            Integer object = null;
             int k = 0;
             while (object == null && k < 100) { // bound not really needed
                 try {
@@ -207,9 +207,9 @@ public class TestStackObjectPool extends
      */
     public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory, 20);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 20);
 
-        Object[] obj = new Object[10];
+        Integer[] obj = new Integer[10];
         for(int i=0;i<10;i++) {
             obj[i] = pool.borrowObject();
             assertEquals("Each time we borrow, get one more active.", i+1, pool.getNumActive());
@@ -229,27 +229,27 @@ public class TestStackObjectPool extends
      
     public void testVariousConstructors() throws Exception {
         {
-            StackObjectPool pool = new StackObjectPool();
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>();
             assertNotNull(pool);
         }
         {
-            StackObjectPool pool = new StackObjectPool(10);
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(10);
             assertNotNull(pool);
         }
         {
-            StackObjectPool pool = new StackObjectPool(10,5);
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(10,5);
             assertNotNull(pool);
         }
         {
-            StackObjectPool pool = new StackObjectPool(null);
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(null);
             assertNotNull(pool);
         }
         {
-            StackObjectPool pool = new StackObjectPool(null,10);
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(null,10);
             assertNotNull(pool);
         }
         {
-            StackObjectPool pool = new StackObjectPool(null,10,5);
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(null,10,5);
             assertNotNull(pool);
         }
     }
@@ -259,7 +259,7 @@ public class TestStackObjectPool extends
      */
     public void testMaxIdleInitCapacityOutOfRange() throws Exception {
         SimpleFactory factory = new SimpleFactory();
-        StackObjectPool pool = new StackObjectPool(factory, -1, 0);
+        StackObjectPool<Object> pool = new StackObjectPool<Object>(factory, -1, 0);
         assertEquals(pool.getMaxSleeping(), StackObjectPool.DEFAULT_MAX_SLEEPING);
         pool.addObject();
         pool.close();
@@ -271,7 +271,7 @@ public class TestStackObjectPool extends
      */
     public void testReturnObjectDiscardOrder() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory, 3);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 3);
 
         // borrow more objects than the pool can hold
         Integer i0 = (Integer)pool.borrowObject();
@@ -304,7 +304,7 @@ public class TestStackObjectPool extends
      */
     public void testExceptionOnActivate() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory);
         pool.addObject();
         pool.addObject();
         factory.setThrowOnActivate(true);
@@ -324,14 +324,14 @@ public class TestStackObjectPool extends
      */
     public void testExceptionOnDestroy() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory, 2);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 2);
         factory.setThrowOnDestroy(true);
         for (int i = 0; i < 3; i++) {
             pool.addObject(); // Third one will destroy, exception should be swallowed
         }
         assertEquals(2, pool.getNumIdle());
         
-        Object[] objects = new Object[3];
+        Integer[] objects = new Integer[3];
         for (int i = 0; i < 3; i++) {
             objects[i] = pool.borrowObject();
         }
@@ -347,7 +347,7 @@ public class TestStackObjectPool extends
      */
     public void testExceptionOnPassivate() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory, 2);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 2);
         factory.setThrowOnPassivate(true);
         
         // addObject propagates
@@ -361,7 +361,7 @@ public class TestStackObjectPool extends
         assertEquals(0, pool.getNumIdle());
         
         // returnObject swallows 
-        Object obj = pool.borrowObject();
+        Integer obj = pool.borrowObject();
         pool.returnObject(obj);
         assertEquals(0, pool.getNumIdle());
     }
@@ -371,7 +371,7 @@ public class TestStackObjectPool extends
      */
     public void testExceptionOnValidate() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory, 2);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 2);
         factory.setThrowOnValidate(true);
         
         // addObject
@@ -385,7 +385,7 @@ public class TestStackObjectPool extends
         
         // returnObject 
         factory.setThrowOnValidate(false);
-        Object obj = pool.borrowObject();
+        Integer obj = pool.borrowObject();
         factory.setThrowOnValidate(true);
         try {
             pool.returnObject(obj);
@@ -410,7 +410,7 @@ public class TestStackObjectPool extends
     public void testExceptionOnMake() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
         factory.setThrowOnMake(true);
-        ObjectPool pool = new StackObjectPool(factory);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory);
         try {
             pool.borrowObject();
             fail("Expecting IntegerFactoryException");
@@ -430,7 +430,7 @@ public class TestStackObjectPool extends
      */
     public void testMakeNull() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory);
         factory.setMakeNull(true);
         try {
             pool.borrowObject();
@@ -444,13 +444,13 @@ public class TestStackObjectPool extends
      * Verifies that initIdleCapacity is not a hard limit, but maxIdle is.
      */
     public void testInitIdleCapacityExceeded() throws Exception {
-        PoolableObjectFactory factory = new SimpleFactory();
-        ObjectPool pool = new StackObjectPool(factory, 2, 1);
+        PoolableObjectFactory<Object> factory = new SimpleFactory();
+        ObjectPool<Object> pool = new StackObjectPool<Object>(factory, 2, 1);
         pool.addObject();
         pool.addObject();
         assertEquals(2, pool.getNumIdle());
         pool.close();
-        pool = new StackObjectPool(factory, 1, 2);
+        pool = new StackObjectPool<Object>(factory, 1, 2);
         pool.addObject();
         pool.addObject();
         assertEquals(1, pool.getNumIdle());
@@ -462,7 +462,7 @@ public class TestStackObjectPool extends
      */
     public void testClose() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool pool = new StackObjectPool(factory);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory);
         pool.addObject(); // 0
         pool.addObject(); // 1
         pool.addObject(); // 2
@@ -471,7 +471,7 @@ public class TestStackObjectPool extends
         pool.close();
         assertEquals(0, pool.getNumIdle());
         assertEquals(1, pool.getNumActive());
-        List destroyed = factory.getDestroyed();
+        List<Integer> destroyed = factory.getDestroyed();
         assertEquals(2, destroyed.size());
         assertTrue(destroyed.contains(new Integer(0)));
         assertTrue(destroyed.contains(new Integer(0)));
@@ -495,7 +495,7 @@ public class TestStackObjectPool extends
      * Simple factory that creates Integers. Validation and other factory methods
      * always succeed.
      */
-    static class SimpleFactory implements PoolableObjectFactory {
+    static class SimpleFactory implements PoolableObjectFactory<Object> {
         int counter = 0;
         public Object makeObject() { return String.valueOf(counter++); }
         public void destroyObject(Object obj) { }
@@ -508,8 +508,8 @@ public class TestStackObjectPool extends
      * Integer factory that fails validation and other factory methods "selectively" and
      * tracks object destruction.
      */
-    static class SelectiveFactory implements PoolableObjectFactory {
-        private List destroyed = new ArrayList();
+    static class SelectiveFactory implements PoolableObjectFactory<Integer> {
+        private List<Integer> destroyed = new ArrayList<Integer>();
         private int counter = 0;
         private boolean validateSelectively = false;  // true <-> validate returns false for even Integers
         private boolean passivateSelectively = false; // true <-> passivate throws RTE if Integer = 0 mod 3
@@ -519,7 +519,7 @@ public class TestStackObjectPool extends
         private boolean throwOnValidate= false;       // true <-> validate throws RTE (always)
         private boolean throwOnPassivate = false;     // true <-> passivate throws RTE (always)
         private boolean makeNull = false;             // true <-> make returns null
-        public Object makeObject() {
+        public Integer makeObject() {
             if (throwOnMake) {
                 final int next = counter + 1;
                 throw new IntegerFactoryException("makeObject", next);
@@ -527,14 +527,14 @@ public class TestStackObjectPool extends
                 return makeNull? null : new Integer(counter++);
             }
         }
-        public void destroyObject(Object obj) {
+        public void destroyObject(Integer obj) {
             if (throwOnDestroy) {
                 final Integer integer = (Integer)obj;
                 throw new IntegerFactoryException("destroyObject", integer.intValue());
             }
             destroyed.add(obj);
         }
-        public boolean validateObject(Object obj) {
+        public boolean validateObject(Integer obj) {
             if (throwOnValidate) {
                 final Integer integer = (Integer)obj;
                 throw new IntegerFactoryException("validateObject", integer.intValue());
@@ -549,13 +549,13 @@ public class TestStackObjectPool extends
             }
             return true;
         }
-        public void activateObject(Object obj) {
+        public void activateObject(Integer obj) {
             if (throwOnActivate) {
                 final Integer integer = (Integer)obj;
                 throw new IntegerFactoryException("activateObject", integer.intValue());
             }
         }
-        public void passivateObject(Object obj) { 
+        public void passivateObject(Integer obj) { 
             if (throwOnPassivate) {
                 final Integer integer = (Integer)obj;
                 throw new IntegerFactoryException("passivateObject", integer.intValue());
@@ -567,7 +567,7 @@ public class TestStackObjectPool extends
                 }
             }
         }
-        public List getDestroyed() {
+        public List<Integer> getDestroyed() {
             return destroyed;
         }
         public void setCounter(int counter) {

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java Mon Oct 11 21:39:15 2010
@@ -33,27 +33,27 @@ public class TestStackObjectPoolFactory 
         super(name);
     }
 
-    protected ObjectPoolFactory makeFactory(final PoolableObjectFactory objectFactory) throws UnsupportedOperationException {
-        return new StackObjectPoolFactory(objectFactory);
+    protected ObjectPoolFactory<Object> makeFactory(final PoolableObjectFactory<Object> objectFactory) throws UnsupportedOperationException {
+        return new StackObjectPoolFactory<Object>(objectFactory);
     }
 
     public void testConstructors() throws Exception {
-        StackObjectPoolFactory factory = new StackObjectPoolFactory();
+        StackObjectPoolFactory<Object> factory = new StackObjectPoolFactory<Object>();
         factory.createPool().close();
 
         
-        factory = new StackObjectPoolFactory(1);
-        StackObjectPool pool = (StackObjectPool)factory.createPool();
+        factory = new StackObjectPoolFactory<Object>(1);
+        StackObjectPool<Object> pool = (StackObjectPool<Object>)factory.createPool();
         pool.close();
 
 
-        factory = new StackObjectPoolFactory(1, 1);
-        pool = (StackObjectPool)factory.createPool();
+        factory = new StackObjectPoolFactory<Object>(1, 1);
+        pool = (StackObjectPool<Object>)factory.createPool();
         pool.close();
 
 
-        factory = new StackObjectPoolFactory(new MethodCallPoolableObjectFactory(), 1);
-        pool = (StackObjectPool)factory.createPool();
+        factory = new StackObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1);
+        pool = (StackObjectPool<Object>)factory.createPool();
         Object a = pool.borrowObject();
         Object b = pool.borrowObject();
         pool.returnObject(a);

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java Mon Oct 11 21:39:15 2010
@@ -29,7 +29,7 @@ public class PerformanceTest {
     private int logLevel = 0;
     private int nrIterations = 5;
 
-    private GenericObjectPool pool;
+    private GenericObjectPool<Integer> pool;
     private boolean start = false;
     private volatile int waiting = 0;
     private volatile int complete = 0;
@@ -62,7 +62,7 @@ public class PerformanceTest {
                     System.out.println(name + "   waiting: " + waiting + "   complete: " + complete);
                 }
                 long bbegin = System.currentTimeMillis();
-                Object o = pool.borrowObject();
+                Integer o = pool.borrowObject();
                 long bend = System.currentTimeMillis();
                 waiting--;
                 do {
@@ -111,7 +111,7 @@ public class PerformanceTest {
         
         SleepingObjectFactory factory = new SleepingObjectFactory();
         if (logLevel >= 4) { factory.setDebug(true); } 
-        pool = new GenericObjectPool(factory);
+        pool = new GenericObjectPool<Integer>(factory);
         pool.setMaxActive(maxActive);
         pool.setMaxIdle(maxIdle);
         pool.setTestOnBorrow(true);

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/SleepingObjectFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/SleepingObjectFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/SleepingObjectFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/SleepingObjectFactory.java Mon Oct 11 21:39:15 2010
@@ -25,40 +25,40 @@ import org.apache.commons.pool.PoolableO
  * @author Dirk Verbeeck
  * @version $Revision$ $Date$ 
  */
-public class SleepingObjectFactory implements PoolableObjectFactory {
+public class SleepingObjectFactory implements PoolableObjectFactory<Integer> {
 
     private int counter = 0;
     private boolean debug = false;
 
-    public Object makeObject() throws Exception {
-        Object obj = new Integer(counter++);
+    public Integer makeObject() throws Exception {
+        Integer obj = new Integer(counter++);
         debug("makeObject", obj);
         sleep(500);
         return obj;
     }
 
-    public void destroyObject(Object obj) throws Exception {
+    public void destroyObject(Integer obj) throws Exception {
         debug("destroyObject", obj);
         sleep(250);
     }
 
-    public boolean validateObject(Object obj) {
+    public boolean validateObject(Integer obj) {
         debug("validateObject", obj);
         sleep(30);
         return true;
     }
 
-    public void activateObject(Object obj) throws Exception {
+    public void activateObject(Integer obj) throws Exception {
         debug("activateObject", obj);
         sleep(10);
     }
 
-    public void passivateObject(Object obj) throws Exception {
+    public void passivateObject(Integer obj) throws Exception {
         debug("passivateObject", obj);
         sleep(10);
     }
     
-    private void debug(String method, Object obj) {
+    private void debug(String method, Integer obj) {
         if (debug) {
             String thread = "thread" + Thread.currentThread().getName();
             System.out.println(thread + ": " + method + " " + obj);



Mime
View raw message