You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2011/06/13 23:52:42 UTC

svn commit: r1135308 - in /commons/proper/pool/trunk/src: changes/changes.xml test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

Author: markt
Date: Mon Jun 13 21:52:41 2011
New Revision: 1135308

URL: http://svn.apache.org/viewvc?rev=1135308&view=rev
Log:
POOL-150
GKOP already throws the required exception. Add a test case to ensure it stays that way.

Modified:
    commons/proper/pool/trunk/src/changes/changes.xml
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java

Modified: commons/proper/pool/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1135308&r1=1135307&r2=1135308&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/changes/changes.xml (original)
+++ commons/proper/pool/trunk/src/changes/changes.xml Mon Jun 13 21:52:41 2011
@@ -54,6 +54,10 @@
     <action dev="markt" type="update">
       Guard against multiple returns of the same object to the pool.
     </action>
+    <action dev="markt" type="fix" issue="POOL-150">
+      Ensure GKOP.preparePool() throws an exception if no factory has been
+      defined.
+    </action>
   </release>
   <release version="1.5.6" date="2011-04-03" description="This is a patch release, including bugfixes only.">
     <action dev="markt" type="fix" issue="POOL-179" due-to="Axel Grossmann">

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1135308&r1=1135307&r2=1135308&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java Mon Jun 13 21:52:41 2011
@@ -1317,6 +1317,23 @@ public class TestGenericKeyedObjectPool 
         pool.returnObject("1", waiter);  // Will throw IllegalStateException if dead
     }
     
+    /**
+     * Test case for POOL-150.
+     */
+    @Test
+    public void testPreparePoolNullFactory() throws Exception {
+        GenericKeyedObjectPool<Object, Object> gkop =
+            new GenericKeyedObjectPool<Object, Object>();
+        gkop.setMinIdlePerKey(1);
+        Exception e = null;
+        try {
+            gkop.preparePool("foo");
+        } catch (IllegalStateException ise) {
+            e = ise;
+        }
+        assertNotNull(e);
+    }
+
     /*
      * Very simple test thread that just tries to borrow an object from
      * the provided pool with the specified key and returns it