commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r784440 - /commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
Date Sat, 13 Jun 2009 17:41:00 GMT
Author: markt
Date: Sat Jun 13 17:41:00 2009
New Revision: 784440

URL: http://svn.apache.org/viewvc?rev=784440&view=rev
Log:
Add a test case for POOL-144. Patch by Phil Steitz.

Modified:
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java

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=784440&r1=784439&r2=784440&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
Sat Jun 13 17:41:00 2009
@@ -506,6 +506,25 @@
             // expected
         }
     }
+    
+    public void testTimeoutNoLeak() throws Exception {
+        pool.setMaxActive(2);
+        pool.setMaxWait(10);
+        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        Object obj = pool.borrowObject();
+        Object obj2 = pool.borrowObject();
+        try {
+            pool.borrowObject();
+            fail("Expecting NoSuchElementException");
+        } catch (NoSuchElementException ex) {
+            //xpected
+        }
+        pool.returnObject(obj2);
+        pool.returnObject(obj);
+        
+        obj = pool.borrowObject();
+        obj2 = pool.borrowObject();
+    }
 
     public void testMaxActiveZero() throws Exception {
         pool.setMaxActive(0);



Mime
View raw message