Author: markt Date: Thu Aug 1 15:39:15 2013 New Revision: 1509302 URL: http://svn.apache.org/r1509302 Log: Remove JMX notification 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=1509302&r1=1509301&r2=1509302&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 Thu Aug 1 15:39:15 2013 @@ -28,7 +28,6 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.lang.management.ManagementFactory; import java.util.ArrayList; -import java.util.List; import java.util.NoSuchElementException; import java.util.Random; import java.util.Set; @@ -36,8 +35,6 @@ import java.util.concurrent.ConcurrentHa import java.util.concurrent.atomic.AtomicInteger; import javax.management.MBeanServer; -import javax.management.Notification; -import javax.management.NotificationListener; import javax.management.ObjectName; import org.apache.commons.pool2.BaseKeyedPoolableObjectFactory; @@ -1813,39 +1810,6 @@ public class TestGenericKeyedObjectPool Set<ObjectName> result = mbs.queryNames(oname, null); Assert.assertEquals(1, result.size()); } - - @Test(timeout=60000) - public void testJmxNotification() throws Exception { - factory.setThrowExceptionOnPassivate(true); - ObjectName oname = pool.getJmxName(); - MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); - JmxNotificationListener listener = new JmxNotificationListener(); - mbs.addNotificationListener(oname, listener, null, null); - - String obj = pool.borrowObject("one"); - pool.returnObject("one", obj); - - List<String> messages = listener.getMessages(); - Assert.assertEquals(1, messages.size()); - Assert.assertNotNull(messages.get(0)); - Assert.assertTrue(messages.get(0).length() > 0); - } - - private static class JmxNotificationListener - implements NotificationListener { - - private List<String> messages = new ArrayList<String>(); - - public List<String> getMessages() { - return messages; - } - - @Override - public void handleNotification(Notification notification, - Object handback) { - messages.add(notification.getMessage()); - } - } } 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=1509302&r1=1509301&r2=1509302&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 Thu Aug 1 15:39:15 2013 @@ -25,15 +25,12 @@ import static junit.framework.Assert.fai import java.lang.management.ManagementFactory; import java.util.ArrayList; -import java.util.List; import java.util.NoSuchElementException; import java.util.Random; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import javax.management.MBeanServer; -import javax.management.Notification; -import javax.management.NotificationListener; import javax.management.ObjectName; import org.apache.commons.pool2.BasePoolableObjectFactory; @@ -1968,37 +1965,4 @@ public class TestGenericObjectPool exten Set<ObjectName> result = mbs.queryNames(oname, null); Assert.assertEquals(1, result.size()); } - - @Test(timeout=60000) - public void testJmxNotification() throws Exception { - factory.setThrowExceptionOnPassivate(true); - ObjectName oname = pool.getJmxName(); - MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); - JmxNotificationListener listener = new JmxNotificationListener(); - mbs.addNotificationListener(oname, listener, null, null); - - Object obj = pool.borrowObject(); - pool.returnObject(obj); - - List<String> messages = listener.getMessages(); - Assert.assertEquals(1, messages.size()); - Assert.assertNotNull(messages.get(0)); - Assert.assertTrue(messages.get(0).length() > 0); - } - - private static class JmxNotificationListener - implements NotificationListener { - - private List<String> messages = new ArrayList<String>(); - - public List<String> getMessages() { - return messages; - } - - @Override - public void handleNotification(Notification notification, - Object handback) { - messages.add(notification.getMessage()); - } - } }