commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandy...@apache.org
Subject svn commit: r389965 - in /jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool: TestObjectPool.java composite/TestCompositeObjectPool.java
Date Thu, 30 Mar 2006 02:19:42 GMT
Author: sandymac
Date: Wed Mar 29 18:19:39 2006
New Revision: 389965

URL: http://svn.apache.org/viewcvs?rev=389965&view=rev
Log:
Some more unit tests for CompositeObjectPool

Modified:
    jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java
    jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java

Modified: jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java?rev=389965&r1=389964&r2=389965&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java
Wed Mar 29 18:19:39 2006
@@ -330,6 +330,31 @@
         pool.close();
     }
 
+    public void testSetFactory() throws Exception {
+        ObjectPool pool;
+        try {
+            pool = makeEmptyPool(new MethodCallPoolableObjectFactory());
+        } catch (UnsupportedOperationException uoe) {
+            return; // test not supported
+        }
+        final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
+        try {
+            pool.setFactory(factory);
+        } catch (UnsupportedOperationException uoe) {
+            return;
+        }
+    }
+
+    public void testToString() {
+        ObjectPool pool;
+        try {
+            pool = makeEmptyPool(new MethodCallPoolableObjectFactory());
+        } catch (UnsupportedOperationException uoe) {
+            return; // test not supported
+        }
+        pool.toString();
+    }
+
     static void removeDestroyObjectCall(List calls) {
         Iterator iter = calls.iterator();
         while (iter.hasNext()) {

Modified: jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java?rev=389965&r1=389964&r2=389965&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/test/org/apache/commons/pool/composite/TestCompositeObjectPool.java
Wed Mar 29 18:19:39 2006
@@ -66,6 +66,57 @@
         return copf.createPool();
     }
 
+    public void testConstructors() {
+        try {
+            new CompositeObjectPool(null, new GrowManager(), new FifoLender(), new SimpleTracker(),
false);
+            fail("IllegalArgumentException expected on null PoolableObjectFactory.");
+        } catch (IllegalArgumentException iae) {
+            // expected
+        }
+
+        try {
+            new CompositeObjectPool(new MethodCallPoolableObjectFactory(), null, new FifoLender(),
new SimpleTracker(), false);
+            fail("IllegalArgumentException expected on null Manager.");
+        } catch (IllegalArgumentException iae) {
+            // expected
+        }
+
+        try {
+            new CompositeObjectPool(new MethodCallPoolableObjectFactory(), new GrowManager(),
null, new SimpleTracker(), false);
+            fail("IllegalArgumentException expected on null Lender.");
+        } catch (IllegalArgumentException iae) {
+            // expected
+        }
+
+        try {
+            new CompositeObjectPool(new MethodCallPoolableObjectFactory(), new GrowManager(),
new FifoLender(), null, false);
+            fail("IllegalArgumentException expected on null Tracker.");
+        } catch (IllegalArgumentException iae) {
+            // expected
+        }
+
+        try {
+            new CompositeObjectPool(new MethodCallPoolableObjectFactory(), null, new GrowManager(),
new FifoLender(), new SimpleTracker(), false, null);
+            fail("IllegalArgumentException expected on null List.");
+        } catch (IllegalArgumentException iae) {
+            // expected
+        }
+    }
+
+    public void testSetFactory() throws Exception {
+        super.testSetFactory();
+        final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
+        final CompositeObjectPoolFactory copf = new CompositeObjectPoolFactory(factory);
+        final CompositeObjectPool pool = (CompositeObjectPool)copf.createPool();
+        pool.setFactory(factory);
+    }
+
+    public void testToString() {
+        super.testToString();
+        final ObjectPool pool = new CompositeObjectPool(new MethodCallPoolableObjectFactory(),
new FailManager(), new FifoLender(), new DebugTracker(), false);
+        pool.toString();
+    }
+
     // Test Managers --------------------------------------
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message