commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1027112 [4/4] - in /commons/proper/pool/trunk/src: java/org/apache/commons/pool2/impl/ test/org/apache/commons/pool2/impl/
Date Mon, 25 Oct 2010 13:35:45 GMT
Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java?rev=1027112&r1=1027111&r2=1027112&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java
Mon Oct 25 13:35:44 2010
@@ -46,7 +46,7 @@ public class TestGenericKeyedObjectPoolF
         GenericKeyedObjectPool<Object,Object> pool;
 
 
-        final GenericKeyedObjectPool.Config config = new GenericKeyedObjectPool.Config();
+        GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig();
         config.setMaxActive(1);
         config.setMaxIdle(2);
         config.setMaxWait(3);
@@ -76,13 +76,19 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1, WhenExhaustedAction.BLOCK, 125);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
+        config.setMaxWait(125);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(WhenExhaustedAction.BLOCK, pool.getWhenExhaustedAction());
@@ -90,7 +96,13 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1, WhenExhaustedAction.GROW, 2, true, false);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -100,7 +112,12 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -109,7 +126,13 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, 4);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setMaxTotal(4);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -119,7 +142,14 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, true, false);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -130,7 +160,18 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, true, false, 4, 5, 6, false);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setTimeBetweenEvictionRunsMillis(4);
+        config.setNumTestsPerEvictionRun(5);
+        config.setMinEvictableIdleTimeMillis(6);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        config.setTestWhileIdle(false);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -145,7 +186,19 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, 4, true, false, 5, 6, 7, true);
+        config = new GenericKeyedObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setMaxTotal(4);
+        config.setTimeBetweenEvictionRunsMillis(5);
+        config.setNumTestsPerEvictionRun(6);
+        config.setMinEvictableIdleTimeMillis(7);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        config.setTestWhileIdle(true);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java?rev=1027112&r1=1027111&r2=1027112&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java
Mon Oct 25 13:35:44 2010
@@ -708,10 +708,10 @@ public class TestGenericObjectPool exten
     public void testConstructors() throws Exception {
         {
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory());
-            assertConfiguration(new GenericObjectPool.Config(),pool);
+            assertConfiguration(new GenericObjectPoolConfig(),pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
             expected.setMaxIdle(3);
             expected.setMaxWait(5L);
@@ -726,51 +726,51 @@ public class TestGenericObjectPool exten
             assertConfiguration(expected,pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
-            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected.getMaxActive());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected);
             assertConfiguration(expected,pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
             expected.setMaxWait(5L);
             expected.setWhenExhaustedAction(WhenExhaustedAction.GROW);
-            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected.getMaxActive(),expected.getWhenExhaustedAction(),expected.getMaxWait());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected);
             assertConfiguration(expected,pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
             expected.setMaxWait(5L);
             expected.setTestOnBorrow(true);
             expected.setTestOnReturn(true);
             expected.setWhenExhaustedAction(WhenExhaustedAction.GROW);
-            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected.getMaxActive(),expected.getWhenExhaustedAction(),expected.getMaxWait(),expected.getTestOnBorrow(),expected.getTestOnReturn());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected);
             assertConfiguration(expected,pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
             expected.setMaxIdle(3);
             expected.setMaxWait(5L);
             expected.setWhenExhaustedAction(WhenExhaustedAction.GROW);
-            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected.getMaxActive(),expected.getWhenExhaustedAction(),expected.getMaxWait(),expected.getMaxIdle());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected);
             assertConfiguration(expected,pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
             expected.setMaxIdle(3);
             expected.setMaxWait(5L);
             expected.setWhenExhaustedAction(WhenExhaustedAction.GROW);
             expected.setTestOnBorrow(true);
             expected.setTestOnReturn(true);
-            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected.getMaxActive(),expected.getWhenExhaustedAction(),expected.getMaxWait(),expected.getMaxIdle(),expected.getTestOnBorrow(),expected.getTestOnReturn());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected);
             assertConfiguration(expected,pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
             expected.setMaxIdle(3);
             expected.setMaxWait(5L);
@@ -781,11 +781,11 @@ public class TestGenericObjectPool exten
             expected.setTestWhileIdle(true);
             expected.setTimeBetweenEvictionRunsMillis(11L);
             expected.setWhenExhaustedAction(WhenExhaustedAction.GROW);
-            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected.getMaxActive(), expected.getWhenExhaustedAction(), expected.getMaxWait(),
expected.getMaxIdle(), expected.getTestOnBorrow(), expected.getTestOnReturn(), expected.getTimeBetweenEvictionRunsMillis(),
expected.getNumTestsPerEvictionRun(), expected.getMinEvictableIdleTimeMillis(), expected.getTestWhileIdle());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected);
             assertConfiguration(expected,pool);
         }
         {
-            GenericObjectPool.Config expected = new GenericObjectPool.Config();
+            GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
             expected.setMaxActive(2);
             expected.setMaxIdle(3);
             expected.setMinIdle(1);
@@ -797,14 +797,14 @@ public class TestGenericObjectPool exten
             expected.setTestWhileIdle(true);
             expected.setTimeBetweenEvictionRunsMillis(11L);
             expected.setWhenExhaustedAction(WhenExhaustedAction.GROW);
-            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected.getMaxActive(), expected.getWhenExhaustedAction(), expected.getMaxWait(),
expected.getMaxIdle(), expected.getMinIdle(), expected.getTestOnBorrow(), expected.getTestOnReturn(),
expected.getTimeBetweenEvictionRunsMillis(), expected.getNumTestsPerEvictionRun(), expected.getMinEvictableIdleTimeMillis(),
expected.getTestWhileIdle());
+            GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new
SimpleFactory(),expected);
             assertConfiguration(expected,pool);
         }
     }
 
     @Test
     public void testSetConfig() throws Exception {
-        GenericObjectPool.Config expected = new GenericObjectPool.Config();
+        GenericObjectPoolConfig expected = new GenericObjectPoolConfig();
         GenericObjectPool<Object> pool = new GenericObjectPool<Object>(new SimpleFactory());
         assertConfiguration(expected,pool);
         expected.setMaxActive(2);
@@ -1269,7 +1269,7 @@ public class TestGenericObjectPool exten
     
     protected GenericObjectPool<Object> pool = null;
 
-    private void assertConfiguration(GenericObjectPool.Config expected, GenericObjectPool<Object>
actual) throws Exception {
+    private void assertConfiguration(GenericObjectPoolConfig expected, GenericObjectPool<Object>
actual) throws Exception {
         assertEquals("testOnBorrow",expected.getTestOnBorrow(),actual.getTestOnBorrow());
         assertEquals("testOnReturn",expected.getTestOnReturn(),actual.getTestOnReturn());
         assertEquals("testWhileIdle",expected.getTestWhileIdle(),actual.getTestWhileIdle());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java?rev=1027112&r1=1027111&r2=1027112&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java
Mon Oct 25 13:35:44 2010
@@ -50,7 +50,7 @@ public class TestGenericObjectPoolFactor
         GenericObjectPool<Object> pool;
         factory.createPool().close();
 
-        final GenericObjectPool.Config config = new GenericObjectPool.Config();
+        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
         config.setMaxActive(1);
         config.setMaxIdle(2);
         config.setMaxWait(3);
@@ -83,14 +83,20 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         pool.borrowObject();
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1, WhenExhaustedAction.BLOCK, 125);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
+        config.setMaxWait(125);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(WhenExhaustedAction.BLOCK, pool.getWhenExhaustedAction());
@@ -108,7 +114,13 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1, WhenExhaustedAction.GROW, 2, true, false);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        config.setMaxWait(2);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -119,7 +131,12 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -129,7 +146,14 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, true, false);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -141,7 +165,18 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, true, false, 4, 5, 6, false);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setTimeBetweenEvictionRunsMillis(4);
+        config.setNumTestsPerEvictionRun(5);
+        config.setMinEvictableIdleTimeMillis(6);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        config.setTestWhileIdle(false);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -157,7 +192,19 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, 4, true, false, 5, 6, 7, true);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setMinIdle(4);
+        config.setTimeBetweenEvictionRunsMillis(5);
+        config.setNumTestsPerEvictionRun(6);
+        config.setMinEvictableIdleTimeMillis(7);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        config.setTestWhileIdle(true);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -174,7 +221,21 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
1, WhenExhaustedAction.GROW, 2, 3, 4, true, false, 5, 6, 7, true, 8, false);
+        config = new GenericObjectPoolConfig();
+        config.setMaxActive(1);
+        config.setMaxWait(2);
+        config.setMaxIdle(3);
+        config.setMinIdle(4);
+        config.setTimeBetweenEvictionRunsMillis(5);
+        config.setNumTestsPerEvictionRun(6);
+        config.setMinEvictableIdleTimeMillis(7);
+        config.setSoftMinEvictableIdleTimeMillis(8);
+        config.setTestOnBorrow(true);
+        config.setTestOnReturn(false);
+        config.setTestWhileIdle(true);
+        config.setLifo(false);
+        config.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(),
config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java?rev=1027112&r1=1027111&r2=1027112&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPool.java
Mon Oct 25 13:35:44 2010
@@ -38,7 +38,9 @@ import org.junit.Test;
 public class TestStackKeyedObjectPool extends TestBaseKeyedObjectPool {
     @Override
     protected KeyedObjectPool<Object,Object> makeEmptyPool(int mincapacity) {
-        StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),mincapacity);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setInitIdleCapacity(mincapacity);
+        StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),config);
         return pool;
     }
 
@@ -146,11 +148,17 @@ public class TestStackKeyedObjectPool ex
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),10);
+            StackObjectPoolConfig config = new StackObjectPoolConfig();
+            config.setMaxSleeping(10);
+            config.setInitIdleCapacity(5);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),config);
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),10,5);
+            StackObjectPoolConfig config = new StackObjectPoolConfig();
+            config.setMaxSleeping(10);
+            config.setInitIdleCapacity(5);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),config);
             assertNotNull(pool);
         }
     }

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java?rev=1027112&r1=1027111&r2=1027112&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackKeyedObjectPoolFactory.java
Mon Oct 25 13:35:44 2010
@@ -44,12 +44,15 @@ public class TestStackKeyedObjectPoolFac
         StackKeyedObjectPool<Object,Object> pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         pool.close();
 
-        factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
 1);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(1);
+        factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1,pool.getMaxSleeping());
         pool.close();
 
-        factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
 1, 2);
+        config.setInitIdleCapacity(2);
+        factory = new StackKeyedObjectPoolFactory<Object,Object>(createObjectFactory(),
config);
         pool = (StackKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1,pool.getMaxSleeping());
         assertEquals(2,pool.getInitSleepingCapacity());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPool.java?rev=1027112&r1=1027111&r2=1027112&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPool.java
Mon Oct 25 13:35:44 2010
@@ -80,7 +80,11 @@ public class TestStackObjectPool extends
         SelectiveFactory factory = new SelectiveFactory();
         factory.setValidateSelectively(true);  // Even numbers fail validation
         factory.setPassivateSelectively(true); // Multiples of 3 fail passivation
-        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 20);
+
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(20);
+
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, config);
         Integer[] obj = new Integer[10];
         for(int i=0;i<10;i++) {
             Integer object = null;
@@ -123,7 +127,9 @@ public class TestStackObjectPool extends
     @Test
     public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 20);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(20);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, config);
 
         Integer[] obj = new Integer[10];
         for(int i=0;i<10;i++) {
@@ -150,11 +156,16 @@ public class TestStackObjectPool extends
             assertNotNull(pool);
         }
         {
-            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(null,10);
+            StackObjectPoolConfig config = new StackObjectPoolConfig();
+            config.setMaxSleeping(10);
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(null,config);
             assertNotNull(pool);
         }
         {
-            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(null,10,5);
+            StackObjectPoolConfig config = new StackObjectPoolConfig();
+            config.setMaxSleeping(20);
+            config.setInitIdleCapacity(5);
+            StackObjectPool<Integer> pool = new StackObjectPool<Integer>(null,config);
             assertNotNull(pool);
         }
     }
@@ -165,8 +176,11 @@ public class TestStackObjectPool extends
     @Test
     public void testMaxIdleInitCapacityOutOfRange() throws Exception {
         SimpleFactory factory = new SimpleFactory();
-        StackObjectPool<Object> pool = new StackObjectPool<Object>(factory, -1,
0);
-        assertEquals(pool.getMaxSleeping(), StackObjectPool.DEFAULT_MAX_SLEEPING);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(-1);
+        config.setInitIdleCapacity(0);
+        StackObjectPool<Object> pool = new StackObjectPool<Object>(factory, config);
+        assertEquals(pool.getMaxSleeping(), StackObjectPoolConfig.DEFAULT_MAX_SLEEPING);
         pool.addObject();
         pool.close();
     }
@@ -178,7 +192,9 @@ public class TestStackObjectPool extends
     @Test
     public void testReturnObjectDiscardOrder() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 3);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(3);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, config);
 
         // borrow more objects than the pool can hold
         Integer i0 = pool.borrowObject();
@@ -233,7 +249,9 @@ public class TestStackObjectPool extends
     @Test
     public void testExceptionOnDestroy() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 2);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(2);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, config);
         factory.setThrowOnDestroy(true);
         for (int i = 0; i < 3; i++) {
             pool.addObject(); // Third one will destroy, exception should be swallowed
@@ -257,7 +275,9 @@ public class TestStackObjectPool extends
     @Test
     public void testExceptionOnPassivate() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 2);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(2);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, config);
         factory.setThrowOnPassivate(true);
         
         // addObject propagates
@@ -282,7 +302,9 @@ public class TestStackObjectPool extends
     @Test
     public void testExceptionOnValidate() throws Exception {
         SelectiveFactory factory = new SelectiveFactory();
-        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, 2);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(2);
+        ObjectPool<Integer> pool = new StackObjectPool<Integer>(factory, config);
         factory.setThrowOnValidate(true);
         
         // addObject
@@ -359,12 +381,17 @@ public class TestStackObjectPool extends
     @Test
     public void testInitIdleCapacityExceeded() throws Exception {
         PoolableObjectFactory<Object> factory = new SimpleFactory();
-        ObjectPool<Object> pool = new StackObjectPool<Object>(factory, 2, 1);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(2);
+        config.setInitIdleCapacity(1);
+        ObjectPool<Object> pool = new StackObjectPool<Object>(factory, config);
         pool.addObject();
         pool.addObject();
         assertEquals(2, pool.getNumIdle());
         pool.close();
-        pool = new StackObjectPool<Object>(factory, 1, 2);
+        config.setMaxSleeping(1);
+        config.setInitIdleCapacity(2);
+        pool = new StackObjectPool<Object>(factory, config);
         pool.addObject();
         pool.addObject();
         assertEquals(1, pool.getNumIdle());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPoolFactory.java?rev=1027112&r1=1027111&r2=1027112&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPoolFactory.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestStackObjectPoolFactory.java
Mon Oct 25 13:35:44 2010
@@ -41,7 +41,9 @@ public class TestStackObjectPoolFactory 
 
     @Test
     public void testConstructors() throws Exception {
-        StackObjectPoolFactory<Object> factory = new StackObjectPoolFactory<Object>(new
MethodCallPoolableObjectFactory(), 1);
+        StackObjectPoolConfig config = new StackObjectPoolConfig();
+        config.setMaxSleeping(1);
+        StackObjectPoolFactory<Object> factory = new StackObjectPoolFactory<Object>(new
MethodCallPoolableObjectFactory(), config);
         ObjectPool<Object> pool = factory.createPool();
         Object a = pool.borrowObject();
         Object b = pool.borrowObject();



Mime
View raw message