commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1334485 - in /commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl: TestGenericKeyedObjectPool.java TestGenericObjectPool.java
Date Sat, 05 May 2012 20:24:14 GMT
Author: markt
Date: Sat May  5 20:24:14 2012
New Revision: 1334485

URL: http://svn.apache.org/viewvc?rev=1334485&view=rev
Log:
Fix problem with MBean attribute names. Add same tearDown debug code to GKOP tests.

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

Modified: commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1334485&r1=1334484&r2=1334485&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
Sat May  5 20:24:14 2012
@@ -126,6 +126,7 @@ public class TestGenericKeyedObjectPool 
     @After
     public void tearDown() throws Exception {
         super.tearDown();
+        String poolName = pool.getJmxName().toString();
         pool.clear();
         pool.close();
         pool = null;
@@ -137,11 +138,18 @@ public class TestGenericKeyedObjectPool 
                 null);
         // There should be no registered pools at this point
         int registeredPoolCount = result.size();
+        StringBuffer msg = new StringBuffer("Current pool is: ");
+        msg.append(poolName);
+        msg.append("  Still open pools are: ");
         for (ObjectName name : result) {
             // Clean these up ready for the next test
+            msg.append(name.toString());
+            msg.append(" created via\n");
+            msg.append(mbs.getAttribute(name, "CreationStackTrace"));
+            msg.append('\n');
             mbs.unregisterMBean(name);
         }
-        Assert.assertEquals("Should not be any registered pools remaining", 0, registeredPoolCount);
+        Assert.assertEquals(msg.toString(), 0, registeredPoolCount);
     }
 
     @Test(timeout=60000)
@@ -1046,12 +1054,12 @@ public class TestGenericKeyedObjectPool 
         long timeBetweenEvictionRunsMillis = 8;
         boolean blockWhenExhausted = false;
         boolean lifo = false;
-        KeyedPoolableObjectFactory<Object,Object> factory = new BaseKeyedPoolableObjectFactory<Object,Object>()
{ 
+        KeyedPoolableObjectFactory<Object,Object> factory = new BaseKeyedPoolableObjectFactory<Object,Object>()
{
             @Override
             public Object makeObject(Object key) throws Exception {
                 return null;
             }
-        };   
+        };
 
         GenericKeyedObjectPool<Object,Object> pool =
             new GenericKeyedObjectPool<Object,Object>(factory);

Modified: commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java?rev=1334485&r1=1334484&r2=1334485&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
Sat May  5 20:24:14 2012
@@ -31,7 +31,6 @@ import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import javax.management.AttributeNotFoundException;
 import javax.management.MBeanServer;
 import javax.management.Notification;
 import javax.management.NotificationListener;
@@ -101,11 +100,7 @@ public class TestGenericObjectPool exten
             // Clean these up ready for the next test
             msg.append(name.toString());
             msg.append(" created via\n");
-            try {
-                msg.append(mbs.getAttribute(name, "creationStackTrace"));
-            } catch (AttributeNotFoundException e) {
-                msg.append(e.getMessage());
-            }
+            msg.append(mbs.getAttribute(name, "CreationStackTrace"));
             msg.append('\n');
             mbs.unregisterMBean(name);
         }
@@ -136,12 +131,12 @@ public class TestGenericObjectPool exten
         long timeBetweenEvictionRunsMillis = 8;
         boolean blockWhenExhausted = false;
         boolean lifo = false;
-        PoolableObjectFactory<Object> factory = new BasePoolableObjectFactory<Object>()
{ 
+        PoolableObjectFactory<Object> factory = new BasePoolableObjectFactory<Object>()
{
             @Override
             public Object makeObject() throws Exception {
                 return null;
             }
-        };   
+        };
 
         GenericObjectPool<Object> pool =
             new GenericObjectPool<Object>(factory);



Mime
View raw message