You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2015/02/18 18:56:02 UTC

activemq git commit: https://issues.apache.org/jira/browse/AMQ-4441

Repository: activemq
Updated Branches:
  refs/heads/master 05c311240 -> e6597c460


https://issues.apache.org/jira/browse/AMQ-4441

Cleanup the test suite, disble unused broker features and add timeouts
etc. 

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/e6597c46
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/e6597c46
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/e6597c46

Branch: refs/heads/master
Commit: e6597c460411e790fb609a17c5675c9a21237bc3
Parents: 05c3112
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Feb 18 12:55:44 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Feb 18 12:55:54 2015 -0500

----------------------------------------------------------------------
 .../ConnectionExpiryEvictsFromPoolTest.java     |  44 ++++----
 .../activemq/jms/pool/JmsPoolTestSupport.java   | 104 +++++++++++++++++++
 ...ooledConnectionFactoryMaximumActiveTest.java |  97 +++++++----------
 .../jms/pool/PooledConnectionFactoryTest.java   |  41 +++++---
 ...ionFactoryWithTemporaryDestinationsTest.java |  44 ++++----
 .../PooledConnectionSessionCleanupTest.java     |  72 +++++--------
 .../PooledConnectionTempDestCleanupTest.java    |  50 ++++-----
 .../jms/pool/PooledConnectionTempQueueTest.java |  16 +--
 .../activemq/jms/pool/PooledConnectionTest.java |  36 +++----
 ...PooledSessionExhaustionBlockTimeoutTest.java |  65 +++++++-----
 .../jms/pool/PooledSessionExhaustionTest.java   |  54 +++++-----
 .../PooledSessionNoPublisherCachingTest.java    |  35 +++----
 .../activemq/jms/pool/PooledSessionTest.java    |  33 +++---
 .../jms/pool/PooledTopicPublisherTest.java      |  70 ++++++++-----
 .../activemq/jms/pool/XAConnectionPoolTest.java |  26 ++++-
 .../activemq/jms/pool/bugs/AMQ4441Test.java     |  32 +++---
 16 files changed, 468 insertions(+), 351 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/ConnectionExpiryEvictsFromPoolTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/ConnectionExpiryEvictsFromPoolTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/ConnectionExpiryEvictsFromPoolTest.java
index d0eb78f..be1ae5e 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/ConnectionExpiryEvictsFromPoolTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/ConnectionExpiryEvictsFromPoolTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.activemq.jms.pool;
 
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
 import java.util.concurrent.TimeUnit;
 
 import javax.jms.Connection;
@@ -24,48 +28,56 @@ import javax.jms.Session;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
-import org.apache.activemq.test.TestSupport;
+import org.junit.Before;
+import org.junit.Test;
 
-public class ConnectionExpiryEvictsFromPoolTest extends TestSupport {
+public class ConnectionExpiryEvictsFromPoolTest extends JmsPoolTestSupport {
 
-    private BrokerService broker;
     private ActiveMQConnectionFactory factory;
     private PooledConnectionFactory pooledFactory;
 
     @Override
-    protected void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setUseJmx(false);
-        broker.setPersistent(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        brokerService = new BrokerService();
+        brokerService.setUseJmx(false);
+        brokerService.setPersistent(false);
+        brokerService.setSchedulerSupport(false);
+        brokerService.setAdvisorySupport(false);
+        TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
+        brokerService.start();
         factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri());
         pooledFactory = new PooledConnectionFactory();
         pooledFactory.setConnectionFactory(factory);
         pooledFactory.setMaxConnections(1);
     }
 
+    @Test(timeout = 60000)
     public void testEvictionOfIdle() throws Exception {
         pooledFactory.setIdleTimeout(10);
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
         Connection amq1 = connection.getConnection();
 
         connection.close();
+
         // let it idle timeout
-        TimeUnit.SECONDS.sleep(1);
+        TimeUnit.MILLISECONDS.sleep(500);
 
         PooledConnection connection2 = (PooledConnection) pooledFactory.createConnection();
         Connection amq2 = connection2.getConnection();
         assertTrue("not equal", !amq1.equals(amq2));
     }
 
+    @Test(timeout = 60000)
     public void testEvictionOfExpired() throws Exception {
         pooledFactory.setExpiryTimeout(10);
         Connection connection = pooledFactory.createConnection();
         Connection amq1 = ((PooledConnection) connection).getConnection();
 
         // let it expire while in use
-        TimeUnit.SECONDS.sleep(1);
+        TimeUnit.MILLISECONDS.sleep(500);
         connection.close();
 
         Connection connection2 = pooledFactory.createConnection();
@@ -73,13 +85,14 @@ public class ConnectionExpiryEvictsFromPoolTest extends TestSupport {
         assertTrue("not equal", !amq1.equals(amq2));
     }
 
+    @Test(timeout = 60000)
     public void testNotIdledWhenInUse() throws Exception {
         pooledFactory.setIdleTimeout(10);
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
         Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
         // let connection to get idle
-        TimeUnit.SECONDS.sleep(1);
+        TimeUnit.MILLISECONDS.sleep(500);
 
         // get a connection from pool again, it should be the same underlying connection
         // as before and should not be idled out since an open session exists.
@@ -100,16 +113,11 @@ public class ConnectionExpiryEvictsFromPoolTest extends TestSupport {
         connection2.close();
 
         // let connection to get idle
-        TimeUnit.SECONDS.sleep(1);
+        TimeUnit.MILLISECONDS.sleep(500);
 
         // get a connection from pool again, it should be a new Connection instance as the
         // old one should have been inactive and idled out.
         PooledConnection connection3 = (PooledConnection) pooledFactory.createConnection();
         assertNotSame(original, connection3.getConnection());
     }
-
-    @Override
-    protected void tearDown() throws Exception {
-        broker.stop();
-    }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/JmsPoolTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/JmsPoolTestSupport.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/JmsPoolTestSupport.java
new file mode 100644
index 0000000..54a8eba
--- /dev/null
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/JmsPoolTestSupport.java
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jms.pool;
+
+import java.util.Set;
+
+import javax.jms.JMSException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.jmx.BrokerViewMBean;
+import org.apache.activemq.broker.jmx.ConnectorViewMBean;
+import org.apache.activemq.broker.jmx.QueueViewMBean;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JmsPoolTestSupport {
+
+    @Rule public TestName name = new TestName();
+
+    protected static final Logger LOG = LoggerFactory.getLogger(JmsPoolTestSupport.class);
+
+    protected BrokerService brokerService;
+
+    @Before
+    public void setUp() throws Exception {
+        LOG.info("========== start " + getTestName() + " ==========");
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (brokerService != null) {
+            try {
+                brokerService.stop();
+                brokerService.waitUntilStopped();
+                brokerService = null;
+            } catch (Exception ex) {
+                LOG.warn("Suppress error on shutdown: {}", ex);
+            }
+        }
+
+        LOG.info("========== tearDown " + getTestName() + " ==========");
+    }
+
+    public String getTestName() {
+        return name.getMethodName();
+    }
+
+    protected BrokerViewMBean getProxyToBroker() throws MalformedObjectNameException, JMSException {
+        ObjectName brokerViewMBean = new ObjectName(
+            "org.apache.activemq:type=Broker,brokerName=" + brokerService.getBrokerName());
+        BrokerViewMBean proxy = (BrokerViewMBean) brokerService.getManagementContext()
+                .newProxyInstance(brokerViewMBean, BrokerViewMBean.class, true);
+        return proxy;
+    }
+
+    protected ConnectorViewMBean getProxyToConnectionView(String connectionType) throws Exception {
+        ObjectName connectorQuery = new ObjectName(
+            "org.apache.activemq:type=Broker,brokerName=" + brokerService.getBrokerName() + ",connector=clientConnectors,connectorName="+connectionType+"_//*");
+
+        Set<ObjectName> results = brokerService.getManagementContext().queryNames(connectorQuery, null);
+
+        if (results == null || results.isEmpty() || results.size() > 1) {
+            throw new Exception("Unable to find the exact Connector instance.");
+        }
+
+        ConnectorViewMBean proxy = (ConnectorViewMBean) brokerService.getManagementContext()
+                .newProxyInstance(results.iterator().next(), ConnectorViewMBean.class, true);
+        return proxy;
+    }
+
+    protected QueueViewMBean getProxyToQueue(String name) throws MalformedObjectNameException, JMSException {
+        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerService.getBrokerName() + ",destinationType=Queue,destinationName="+name);
+        QueueViewMBean proxy = (QueueViewMBean) brokerService.getManagementContext()
+                .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
+        return proxy;
+    }
+
+    protected QueueViewMBean getProxyToTopic(String name) throws MalformedObjectNameException, JMSException {
+        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerService.getBrokerName() + ",destinationType=Topic,destinationName="+name);
+        QueueViewMBean proxy = (QueueViewMBean) brokerService.getManagementContext()
+                .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
+        return proxy;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java
index 895b482..02a91ab 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.jms.pool;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
@@ -26,58 +28,39 @@ import javax.jms.Connection;
 import javax.jms.JMSException;
 import javax.jms.Session;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.log4j.Logger;
+import org.junit.Test;
 
 /**
  * Checks the behavior of the PooledConnectionFactory when the maximum amount of sessions is being reached
  * (maximumActive). When using setBlockIfSessionPoolIsFull(true) on the ConnectionFactory, further requests for sessions
  * should block. If it does not block, its a bug.
- *
- * @author: tmielke
  */
-public class PooledConnectionFactoryMaximumActiveTest extends TestCase {
+public class PooledConnectionFactoryMaximumActiveTest extends JmsPoolTestSupport {
+
     public final static Logger LOG = Logger.getLogger(PooledConnectionFactoryMaximumActiveTest.class);
     public static Connection conn = null;
     public static int sleepTimeout = 5000;
 
     private static ConcurrentHashMap<Integer, Session> sessions = new ConcurrentHashMap<Integer, Session>();
 
-    /**
-     * Create the test case
-     *
-     * @param testName
-     *            name of the test case
-     */
-    public PooledConnectionFactoryMaximumActiveTest(String testName) {
-        super(testName);
-    }
-
     public static void addSession(Session s) {
         sessions.put(s.hashCode(), s);
     }
 
     /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite() {
-        return new TestSuite(PooledConnectionFactoryMaximumActiveTest.class);
-    }
-
-    /**
      * Tests the behavior of the sessionPool of the PooledConnectionFactory when maximum number of sessions are reached.
      * This test uses maximumActive=1. When creating two threads that both try to create a JMS session from the same JMS
      * connection, the thread that is second to call createSession() should block (as only 1 session is allowed) until
      * the session is returned to pool. If it does not block, its a bug.
-     *
      */
+    @Test(timeout = 60000)
     public void testApp() throws Exception {
         // Initialize JMS connection
-        ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
+        ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory(
+            "vm://broker1?marshal=false&broker.useJmx=false&broker.persistent=false");
+
         PooledConnectionFactory cf = new PooledConnectionFactory();
         cf.setConnectionFactory(amq);
         cf.setMaxConnections(3);
@@ -90,7 +73,6 @@ public class PooledConnectionFactoryMaximumActiveTest extends TestCase {
 
         ExecutorService executor = Executors.newFixedThreadPool(2);
         executor.submit(new TestRunner2());
-        // Thread.sleep(100);
         Future<Boolean> result2 = executor.submit(new TestRunner2());
 
         // sleep to allow threads to run
@@ -106,46 +88,45 @@ public class PooledConnectionFactoryMaximumActiveTest extends TestCase {
         // Take all threads down
         executor.shutdownNow();
     }
-}
 
-class TestRunner2 implements Callable<Boolean> {
+    static class TestRunner2 implements Callable<Boolean> {
 
-    public final static Logger LOG = Logger.getLogger(TestRunner2.class);
+        public final static Logger TASK_LOG = Logger.getLogger(TestRunner2.class);
 
-    /**
-     * @return true if test succeeded, false otherwise
-     */
-    @Override
-    public Boolean call() {
+        /**
+         * @return true if test succeeded, false otherwise
+         */
+        @Override
+        public Boolean call() {
+
+            Session one = null;
 
-        Session one = null;
+            // wait at most 5 seconds for the call to createSession
+            try {
 
-        // wait at most 5 seconds for the call to createSession
-        try {
+                if (PooledConnectionFactoryMaximumActiveTest.conn == null) {
+                    TASK_LOG.error("Connection not yet initialized. Aborting test.");
+                    return new Boolean(false);
+                }
 
-            if (PooledConnectionFactoryMaximumActiveTest.conn == null) {
-                LOG.error("Connection not yet initialized. Aborting test.");
+                one = PooledConnectionFactoryMaximumActiveTest.conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+                TASK_LOG.info("Created new Session with id" + one);
+                PooledConnectionFactoryMaximumActiveTest.addSession(one);
+                Thread.sleep(2 * PooledConnectionFactoryMaximumActiveTest.sleepTimeout);
+            } catch (Exception ex) {
+                TASK_LOG.error(ex.getMessage());
                 return new Boolean(false);
+            } finally {
+                if (one != null)
+                    try {
+                        one.close();
+                    } catch (JMSException e) {
+                        TASK_LOG.error(e.getMessage());
+                    }
             }
 
-            one = PooledConnectionFactoryMaximumActiveTest.conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            LOG.info("Created new Session with id" + one);
-            PooledConnectionFactoryMaximumActiveTest.addSession(one);
-            Thread.sleep(2 * PooledConnectionFactoryMaximumActiveTest.sleepTimeout);
-        } catch (Exception ex) {
-            LOG.error(ex.getMessage());
-            return new Boolean(false);
-
-        } finally {
-            if (one != null)
-                try {
-                    one.close();
-                } catch (JMSException e) {
-                    LOG.error(e.getMessage());
-                }
+            // all good, test succeeded
+            return new Boolean(true);
         }
-
-        // all good, test succeeded
-        return new Boolean(true);
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
index 511d7cb..1052573 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
@@ -53,18 +53,18 @@ import org.junit.Test;
  * don't block. This test succeeds if an exception is returned and fails if the
  * call to getSession() blocks.
  */
-public class PooledConnectionFactoryTest {
+public class PooledConnectionFactoryTest extends JmsPoolTestSupport {
 
     public final static Logger LOG = Logger.getLogger(PooledConnectionFactoryTest.class);
 
-    @Test
+    @Test(timeout = 60000)
     public void testInstanceOf() throws  Exception {
         PooledConnectionFactory pcf = new PooledConnectionFactory();
         assertTrue(pcf instanceof QueueConnectionFactory);
         assertTrue(pcf instanceof TopicConnectionFactory);
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testClearAllConnections() throws Exception {
 
         ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory(
@@ -96,7 +96,7 @@ public class PooledConnectionFactoryTest {
         assertNotSame(conn2.getConnection(), conn3.getConnection());
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testMaxConnectionsAreCreated() throws Exception {
 
         ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory(
@@ -116,7 +116,7 @@ public class PooledConnectionFactoryTest {
         assertEquals(3, cf.getNumConnections());
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testConnectionsAreRotated() throws Exception {
 
         ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory(
@@ -139,7 +139,7 @@ public class PooledConnectionFactoryTest {
         }
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testConnectionsArePooled() throws Exception {
 
         ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
@@ -158,7 +158,7 @@ public class PooledConnectionFactoryTest {
         assertEquals(1, cf.getNumConnections());
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testConnectionsArePooledAsyncCreate() throws Exception {
 
         final ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory(
@@ -186,12 +186,12 @@ public class PooledConnectionFactoryTest {
             });
         }
 
-        assertTrue("", Wait.waitFor(new Wait.Condition() {
+        assertTrue("All connections should have been created.", Wait.waitFor(new Wait.Condition() {
             @Override
             public boolean isSatisified() throws Exception {
                 return connections.size() == numConnections;
             }
-        }));
+        }, TimeUnit.SECONDS.toMillis(10), TimeUnit.MILLISECONDS.toMillis(50)));
 
         executor.shutdown();
         assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS));
@@ -204,12 +204,12 @@ public class PooledConnectionFactoryTest {
         cf.stop();
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testConcurrentCreateGetsUniqueConnectionCreateOnDemand() throws Exception {
         doTestConcurrentCreateGetsUniqueConnection(false);
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testConcurrentCreateGetsUniqueConnectionCreateOnStart() throws Exception {
         doTestConcurrentCreateGetsUniqueConnection(true);
     }
@@ -268,18 +268,24 @@ public class PooledConnectionFactoryTest {
      * Tests the behavior of the sessionPool of the PooledConnectionFactory when
      * maximum number of sessions are reached.
      */
-    public void testApp() throws Exception {
+    @Test(timeout = 60000)
+    public void testCreateSessionDoesNotBlockWhenNotConfiguredTo() throws Exception {
         // using separate thread for testing so that we can interrupt the test
         // if the call to get a new session blocks.
 
         // start test runner thread
         ExecutorService executor = Executors.newSingleThreadExecutor();
-        Future<Boolean> result = executor.submit(new TestRunner());
+        final Future<Boolean> result = executor.submit(new TestRunner());
 
-        // test should not take > 5secs, so test fails i
-        Thread.sleep(5 * 1000);
+        boolean testPassed = Wait.waitFor(new Wait.Condition() {
 
-        if (!result.isDone() || !result.get().booleanValue()) {
+            @Override
+            public boolean isSatisified() throws Exception {
+                return result.isDone() && result.get().booleanValue();
+            }
+        }, TimeUnit.SECONDS.toMillis(10), TimeUnit.MILLISECONDS.toMillis(50));
+
+        if (!testPassed) {
             PooledConnectionFactoryTest.LOG.error("2nd call to createSession() " +
                                                   "is blocking but should have returned an error instead.");
             executor.shutdownNow();
@@ -303,7 +309,8 @@ public class PooledConnectionFactoryTest {
 
             // wait at most 5 seconds for the call to createSession
             try {
-                ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
+                ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory(
+                    "vm://broker1?marshal=false&broker.persistent=false&broker.useJmx=false");
                 PooledConnectionFactory cf = new PooledConnectionFactory();
                 cf.setConnectionFactory(amq);
                 cf.setMaxConnections(3);

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java
index 9438828..86b4e27 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java
@@ -16,45 +16,47 @@
  */
 package org.apache.activemq.jms.pool;
 
+import static org.junit.Assert.assertEquals;
+
+import javax.jms.Connection;
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.Topic;
-import javax.jms.Connection;
 
+import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.activemq.broker.region.RegionBroker;
-import org.apache.activemq.test.TestSupport;
-import org.apache.activemq.ActiveMQConnectionFactory;
+import org.junit.Before;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- * @version $Revision: 1.1 $
- */
-public class PooledConnectionFactoryWithTemporaryDestinationsTest extends TestSupport {
+public class PooledConnectionFactoryWithTemporaryDestinationsTest extends JmsPoolTestSupport {
 
     private static final Logger LOG = LoggerFactory.getLogger(PooledConnectionFactoryWithTemporaryDestinationsTest.class);
 
-    private BrokerService broker;
     private ActiveMQConnectionFactory factory;
     private PooledConnectionFactory pooledFactory;
 
-    protected void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setUseJmx(false);
-        broker.setPersistent(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        brokerService = new BrokerService();
+        brokerService.setUseJmx(false);
+        brokerService.setPersistent(false);
+        brokerService.setSchedulerSupport(false);
+        brokerService.setAdvisorySupport(false);
+        TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
+        brokerService.start();
         factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false");
         pooledFactory = new PooledConnectionFactory();
         pooledFactory.setConnectionFactory(factory);
     }
 
-    protected void tearDown() throws Exception {
-        broker.stop();
-    }
-
+    @Test(timeout = 60000)
     public void testTemporaryQueueWithMultipleConnectionUsers() throws Exception {
         Connection pooledConnection = null;
         Connection pooledConnection2 = null;
@@ -85,6 +87,7 @@ public class PooledConnectionFactoryWithTemporaryDestinationsTest extends TestSu
         assertEquals(0, countBrokerTemporaryQueues());
     }
 
+    @Test(timeout = 60000)
     public void testTemporaryQueueLeakAfterConnectionClose() throws Exception {
         Connection pooledConnection = null;
         Session session = null;
@@ -100,6 +103,7 @@ public class PooledConnectionFactoryWithTemporaryDestinationsTest extends TestSu
         assertEquals(0, countBrokerTemporaryQueues());
     }
 
+    @Test(timeout = 60000)
     public void testTemporaryTopicLeakAfterConnectionClose() throws Exception {
         Connection pooledConnection = null;
         Session session = null;
@@ -116,10 +120,10 @@ public class PooledConnectionFactoryWithTemporaryDestinationsTest extends TestSu
     }
 
     private int countBrokerTemporaryQueues() throws Exception {
-        return ((RegionBroker) broker.getRegionBroker()).getTempQueueRegion().getDestinationMap().size();
+        return ((RegionBroker) brokerService.getRegionBroker()).getTempQueueRegion().getDestinationMap().size();
     }
 
     private int countBrokerTemporaryTopics() throws Exception {
-        return ((RegionBroker) broker.getRegionBroker()).getTempTopicRegion().getDestinationMap().size();
+        return ((RegionBroker) brokerService.getRegionBroker()).getTempTopicRegion().getDestinationMap().size();
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSessionCleanupTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSessionCleanupTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSessionCleanupTest.java
index ec6b5b2..877b5b2 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSessionCleanupTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSessionCleanupTest.java
@@ -28,8 +28,6 @@ import javax.jms.JMSException;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
@@ -39,15 +37,8 @@ import org.apache.activemq.util.Wait;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class PooledConnectionSessionCleanupTest {
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(PooledConnectionSessionCleanupTest.class);
-
-    protected BrokerService service;
+public class PooledConnectionSessionCleanupTest extends JmsPoolTestSupport {
 
     protected ActiveMQConnectionFactory directConnFact;
     protected Connection directConn1;
@@ -64,20 +55,25 @@ public class PooledConnectionSessionCleanupTest {
      * Prepare to run a test case: create, configure, and start the embedded
      * broker, as well as creating the client connections to the broker.
      */
+    @Override
     @Before
-    public void prepTest() throws java.lang.Exception {
-        service = new BrokerService();
-        service.setBrokerName("PooledConnectionSessionCleanupTestBroker");
-        service.setUseJmx(true);
-        service.setPersistent(false);
-        service.setSchedulerSupport(false);
-        service.start();
-        service.waitUntilStarted();
+    public void setUp() throws java.lang.Exception {
+        super.setUp();
+
+        brokerService = new BrokerService();
+        brokerService.setBrokerName("PooledConnectionSessionCleanupTestBroker");
+        brokerService.setUseJmx(true);
+        brokerService.getManagementContext().setCreateConnector(false);
+        brokerService.setPersistent(false);
+        brokerService.setSchedulerSupport(false);
+        brokerService.setAdvisorySupport(false);
+        brokerService.start();
+        brokerService.waitUntilStarted();
 
         // Create the ActiveMQConnectionFactory and the PooledConnectionFactory.
         // Set a long idle timeout on the pooled connections to better show the
         // problem of holding onto created resources on close.
-        directConnFact = new ActiveMQConnectionFactory(service.getVmConnectorURI());
+        directConnFact = new ActiveMQConnectionFactory(brokerService.getVmConnectorURI());
         pooledConnFact = new PooledConnectionFactory();
         pooledConnFact.setConnectionFactory(directConnFact);
         pooledConnFact.setIdleTimeout((int)TimeUnit.MINUTES.toMillis(60));
@@ -96,8 +92,9 @@ public class PooledConnectionSessionCleanupTest {
         pooledConn2.start();
     }
 
+    @Override
     @After
-    public void cleanupTest() throws java.lang.Exception {
+    public void tearDown() throws java.lang.Exception {
         try {
             if (pooledConn1 != null) {
                 pooledConn1.close();
@@ -122,14 +119,8 @@ public class PooledConnectionSessionCleanupTest {
             }
         } catch (JMSException jms_exc) {
         }
-        try {
-            if (service != null) {
-                service.stop();
-                service.waitUntilStopped();
-                service = null;
-            }
-        } catch (JMSException jms_exc) {
-        }
+
+        super.tearDown();
     }
 
     private void produceMessages() throws Exception {
@@ -142,16 +133,7 @@ public class PooledConnectionSessionCleanupTest {
         producer.close();
     }
 
-    private QueueViewMBean getProxyToQueue(String name) throws MalformedObjectNameException, JMSException {
-        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq"
-                + ":destinationType=Queue,destinationName=" + name
-                + ",type=Broker,brokerName=" + service.getBrokerName());
-        QueueViewMBean proxy = (QueueViewMBean) service.getManagementContext()
-                .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
-        return proxy;
-    }
-
-    @Test
+    @Test(timeout = 60000)
     public void testLingeringPooledSessionsHoldingPrefetchedMessages() throws Exception {
 
         produceMessages();
@@ -167,12 +149,12 @@ public class PooledConnectionSessionCleanupTest {
             public boolean isSatisified() throws Exception {
                 return view.getInFlightCount() == MESSAGE_COUNT;
             }
-        }));
+        }, TimeUnit.SECONDS.toMillis(20), TimeUnit.MILLISECONDS.toMillis(25)));
 
         // While all the message are in flight we should get anything on this consumer.
         Session session = directConn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer consumer = session.createConsumer(queue);
-        assertNull(consumer.receive(2000));
+        assertNull(consumer.receive(1000));
 
         pooledConn1.close();
 
@@ -182,14 +164,14 @@ public class PooledConnectionSessionCleanupTest {
             public boolean isSatisified() throws Exception {
                 return view.getSubscriptions().length == 1;
             }
-        }));
+        }, TimeUnit.SECONDS.toMillis(20), TimeUnit.MILLISECONDS.toMillis(25)));
 
         // Now we'd expect that the message stuck in the prefetch of the pooled session's
         // consumer would be rerouted to the non-pooled session's consumer.
         assertNotNull(consumer.receive(10000));
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testNonPooledConnectionCloseNotHoldingPrefetchedMessages() throws Exception {
 
         produceMessages();
@@ -205,12 +187,12 @@ public class PooledConnectionSessionCleanupTest {
             public boolean isSatisified() throws Exception {
                 return view.getInFlightCount() == MESSAGE_COUNT;
             }
-        }));
+        }, TimeUnit.SECONDS.toMillis(20), TimeUnit.MILLISECONDS.toMillis(25)));
 
         // While all the message are in flight we should get anything on this consumer.
         Session session = directConn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer consumer = session.createConsumer(queue);
-        assertNull(consumer.receive(2000));
+        assertNull(consumer.receive(1000));
 
         directConn2.close();
 
@@ -220,7 +202,7 @@ public class PooledConnectionSessionCleanupTest {
             public boolean isSatisified() throws Exception {
                 return view.getSubscriptions().length == 1;
             }
-        }));
+        }, TimeUnit.SECONDS.toMillis(20), TimeUnit.MILLISECONDS.toMillis(25)));
 
         // Now we'd expect that the message stuck in the prefetch of the first session's
         // consumer would be rerouted to the alternate session's consumer.

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempDestCleanupTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempDestCleanupTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempDestCleanupTest.java
index 8afdf90..17b2387 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempDestCleanupTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempDestCleanupTest.java
@@ -31,8 +31,6 @@ import org.apache.activemq.broker.region.RegionBroker;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Test of lingering temporary destinations on pooled connections when the
@@ -42,12 +40,7 @@ import org.slf4j.LoggerFactory;
  *
  * jira: AMQ-3457
  */
-public class PooledConnectionTempDestCleanupTest {
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(PooledConnectionTempDestCleanupTest.class);
-
-    protected BrokerService embeddedBroker;
+public class PooledConnectionTempDestCleanupTest extends JmsPoolTestSupport {
 
     protected ActiveMQConnectionFactory directConnFact;
     protected Connection directConn1;
@@ -64,15 +57,18 @@ public class PooledConnectionTempDestCleanupTest {
      * Prepare to run a test case: create, configure, and start the embedded
      * broker, as well as creating the client connections to the broker.
      */
+    @Override
     @Before
-    public void prepTest() throws java.lang.Exception {
-        embeddedBroker = new BrokerService();
-        configureBroker(embeddedBroker);
-        embeddedBroker.start();
-        embeddedBroker.waitUntilStarted();
+    public void setUp() throws java.lang.Exception {
+        super.setUp();
+
+        brokerService = new BrokerService();
+        configureBroker(brokerService);
+        brokerService.start();
+        brokerService.waitUntilStarted();
 
         // Create the ActiveMQConnectionFactory and the PooledConnectionFactory.
-        directConnFact = new ActiveMQConnectionFactory(embeddedBroker.getVmConnectorURI());
+        directConnFact = new ActiveMQConnectionFactory(brokerService.getVmConnectorURI());
         pooledConnFact = new PooledConnectionFactory();
         pooledConnFact.setConnectionFactory(directConnFact);
 
@@ -88,8 +84,9 @@ public class PooledConnectionTempDestCleanupTest {
         pooledConn2.start();
     }
 
+    @Override
     @After
-    public void cleanupTest() throws java.lang.Exception {
+    public void tearDown() throws java.lang.Exception {
         try {
             pooledConn1.stop();
         } catch (JMSException jms_exc) {
@@ -107,16 +104,15 @@ public class PooledConnectionTempDestCleanupTest {
         } catch (JMSException jms_exc) {
         }
 
-        try {
-            embeddedBroker.stop();
-        } catch (JMSException jms_exc) {
-        }
+        super.tearDown();
     }
 
-    protected void configureBroker(BrokerService broker_svc) throws Exception {
-        broker_svc.setBrokerName("testbroker1");
-        broker_svc.setUseJmx(false);
-        broker_svc.setPersistent(false);
+    protected void configureBroker(BrokerService brokerService) throws Exception {
+        brokerService.setBrokerName("testbroker1");
+        brokerService.setUseJmx(false);
+        brokerService.setPersistent(false);
+        brokerService.setAdvisorySupport(false);
+        brokerService.setSchedulerSupport(false);
     }
 
     /**
@@ -129,7 +125,7 @@ public class PooledConnectionTempDestCleanupTest {
      * 5. close the first connection 6. check that the temporary destination no
      * longer exists in the broker
      */
-    @Test
+    @Test(timeout = 60000)
     public void testPooledLingeringTempDests() throws java.lang.Exception {
         Session session1;
         Session session2;
@@ -160,7 +156,7 @@ public class PooledConnectionTempDestCleanupTest {
      * exists in the broker 8. check that the second temporary destination does
      * still exist in the broker
      */
-    @Test
+    @Test(timeout = 60000)
     public void testPooledTempDestsCleanupOverzealous() throws java.lang.Exception {
         Session session1;
         Session session2;
@@ -195,7 +191,7 @@ public class PooledConnectionTempDestCleanupTest {
      * the first connection 6. check that the destination no longer exists in
      * the broker
      */
-    @Test
+    @Test(timeout = 60000)
     public void testDirectLingeringTempDests() throws java.lang.Exception {
         Session session1;
         Session session2;
@@ -216,7 +212,7 @@ public class PooledConnectionTempDestCleanupTest {
     }
 
     private boolean destinationExists(Destination dest) throws Exception {
-        RegionBroker rb = (RegionBroker) embeddedBroker.getBroker().getAdaptor(RegionBroker.class);
+        RegionBroker rb = (RegionBroker) brokerService.getBroker().getAdaptor(RegionBroker.class);
         return rb.getTopicRegion().getDestinationMap().containsKey(dest) || rb.getQueueRegion().getDestinationMap().containsKey(dest)
                 || rb.getTempTopicRegion().getDestinationMap().containsKey(dest) || rb.getTempQueueRegion().getDestinationMap().containsKey(dest);
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempQueueTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempQueueTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempQueueTest.java
index 8af7960..4122527 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempQueueTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTempQueueTest.java
@@ -33,15 +33,16 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class PooledConnectionTempQueueTest {
+public class PooledConnectionTempQueueTest extends JmsPoolTestSupport {
 
     private final Logger LOG = LoggerFactory.getLogger(PooledConnectionTempQueueTest.class);
 
     protected static final String SERVICE_QUEUE = "queue1";
 
-    @Test
+    @Test(timeout = 60000)
     public void testTempQueueIssue() throws JMSException, InterruptedException {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
+            "vm://localhost?broker.persistent=false&broker.useJmx=false");
         final PooledConnectionFactory cf = new PooledConnectionFactory();
         cf.setConnectionFactory(factory);
 
@@ -81,11 +82,11 @@ public class PooledConnectionTempQueueTest {
         producer.send(msg);
 
         // This sleep also seems to matter
-        Thread.sleep(5000);
+        Thread.sleep(3000);
 
         MessageConsumer consumer = session.createConsumer(tempQueue);
         Message replyMsg = consumer.receive();
-        System.out.println(replyMsg.getJMSCorrelationID());
+        LOG.debug("Reply message: {}", replyMsg);
 
         consumer.close();
 
@@ -102,11 +103,11 @@ public class PooledConnectionTempQueueTest {
         final javax.jms.Message inMessage = consumer.receive();
 
         String requestMessageId = inMessage.getJMSMessageID();
-        System.out.println("Received message " + requestMessageId);
+        LOG.debug("Received message " + requestMessageId);
         final TextMessage replyMessage = session.createTextMessage("Result");
         replyMessage.setJMSCorrelationID(inMessage.getJMSMessageID());
         final MessageProducer producer = session.createProducer(inMessage.getJMSReplyTo());
-        System.out.println("Sending reply to " + inMessage.getJMSReplyTo());
+        LOG.debug("Sending reply to " + inMessage.getJMSReplyTo());
         producer.send(replyMessage);
 
         producer.close();
@@ -114,5 +115,4 @@ public class PooledConnectionTempQueueTest {
         session.close();
         con.close();
     }
-
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTest.java
index 3198f1a..8b78426 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionTest.java
@@ -16,13 +16,14 @@
  */
 package org.apache.activemq.jms.pool;
 
+import static org.junit.Assert.fail;
+
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.IllegalStateException;
 
-import junit.framework.TestCase;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,20 +31,9 @@ import org.slf4j.LoggerFactory;
  * A couple of tests against the PooledConnection class.
  *
  */
-public class PooledConnectionTest extends TestCase {
+public class PooledConnectionTest extends JmsPoolTestSupport {
 
-    private final Logger log = LoggerFactory.getLogger(PooledConnectionTest.class);
-
-    @Override
-    public void setUp() throws Exception {
-        log.debug("setUp() called.");
-    }
-
-
-    @Override
-    public void tearDown() throws Exception {
-        log.debug("tearDown() called.");
-    }
+    private final Logger LOG = LoggerFactory.getLogger(PooledConnectionTest.class);
 
     /**
      * AMQ-3752:
@@ -52,8 +42,9 @@ public class PooledConnectionTest extends TestCase {
      *
      * @throws Exception
      */
+    @Test(timeout = 60000)
     public void testRepeatedSetClientIDCalls() throws Exception {
-        log.debug("running testRepeatedSetClientIDCalls()");
+        LOG.debug("running testRepeatedSetClientIDCalls()");
 
         // 1st test: call setClientID("newID") twice
         // this should be tolerated and not result in an exception
@@ -68,7 +59,7 @@ public class PooledConnectionTest extends TestCase {
             conn.close();
             cf = null;
         } catch (IllegalStateException ise) {
-            log.error("Repeated calls to ActiveMQConnection.setClientID(\"newID\") caused " + ise.getMessage());
+            LOG.error("Repeated calls to ActiveMQConnection.setClientID(\"newID\") caused " + ise.getMessage());
             fail("Repeated calls to ActiveMQConnection.setClientID(\"newID\") caused " + ise.getMessage());
         }
 
@@ -82,7 +73,7 @@ public class PooledConnectionTest extends TestCase {
             conn.setClientID("newID2");
             fail("calling ActiveMQConnection.setClientID() twice with different clientID must raise an IllegalStateException");
         } catch (IllegalStateException ise) {
-            log.debug("Correctly received " + ise);
+            LOG.debug("Correctly received " + ise);
         } finally {
             conn.close();
         }
@@ -96,19 +87,20 @@ public class PooledConnectionTest extends TestCase {
         conn.setClientID("newID3");
         fail("Calling setClientID() after start() mut raise a JMSException.");
         } catch (IllegalStateException ise) {
-            log.debug("Correctly received " + ise);
+            LOG.debug("Correctly received " + ise);
         } finally {
             conn.close();
         }
 
-        log.debug("Test finished.");
+        LOG.debug("Test finished.");
     }
 
     protected ConnectionFactory createPooledConnectionFactory() {
         PooledConnectionFactory cf = new PooledConnectionFactory();
-        cf.setConnectionFactory(new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"));
+        cf.setConnectionFactory(new ActiveMQConnectionFactory(
+            "vm://localhost?broker.persistent=false&broker.useJmx=false&broker.schedulerSupport=false"));
         cf.setMaxConnections(1);
-        log.debug("ConnectionFactory initialized.");
+        LOG.debug("ConnectionFactory initialized.");
         return cf;
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java
index ab857ef..d5457a6 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java
@@ -16,38 +16,55 @@
  */
 package org.apache.activemq.jms.pool;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.log4j.Logger;
+import org.junit.Test;
 
-import javax.jms.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.*;
-
-public class PooledSessionExhaustionBlockTimeoutTest extends TestCase {
+public class PooledSessionExhaustionBlockTimeoutTest extends JmsPoolTestSupport {
     private static final String QUEUE = "FOO";
     private static final int NUM_MESSAGES = 500;
 
-    private Logger logger = Logger.getLogger(getClass());
+    private final Logger LOG = Logger.getLogger(getClass());
 
-    private BrokerService broker;
     private ActiveMQConnectionFactory factory;
     private PooledConnectionFactory pooledFactory;
     private String connectionUri;
     private int numReceived = 0;
     private final List<Exception> exceptionList = new ArrayList<Exception>();
 
-
     @Override
-    protected void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
+    public void setUp() throws Exception {
+        super.setUp();
+
+        brokerService = new BrokerService();
+        brokerService.setPersistent(false);
+        brokerService.setUseJmx(false);
+        brokerService.setSchedulerSupport(false);
+        brokerService.setAdvisorySupport(false);
+        TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
+        brokerService.start();
+
         connectionUri = connector.getPublishableConnectString();
         factory = new ActiveMQConnectionFactory(connectionUri);
         pooledFactory = new PooledConnectionFactory();
@@ -58,13 +75,6 @@ public class PooledSessionExhaustionBlockTimeoutTest extends TestCase {
         pooledFactory.setMaximumActiveSessionPerConnection(1);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
-        broker = null;
-    }
-
     class TestRunner implements Runnable {
 
         CyclicBarrier barrier;
@@ -100,14 +110,16 @@ public class PooledSessionExhaustionBlockTimeoutTest extends TestCase {
             TextMessage message = session.createTextMessage(msgTo);
             producer.send(message);
             connection.close();
-            logger.info("sent " + i + " messages using " + connectionFactory.getClass());
+            LOG.debug("sent " + i + " messages using " + connectionFactory.getClass());
         }
     }
 
+    @Test(timeout = 60000)
     public void testCanExhaustSessions() throws Exception {
         final int totalMessagesExpected =  NUM_MESSAGES * 2;
         final CountDownLatch latch = new CountDownLatch(2);
         Thread thread = new Thread(new Runnable() {
+            @Override
             public void run() {
                 try {
                     ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(connectionUri);
@@ -124,7 +136,7 @@ public class PooledSessionExhaustionBlockTimeoutTest extends TestCase {
                         }
                         numReceived++;
                         if (numReceived % 20 == 0) {
-                            logger.debug("received " + numReceived + " messages ");
+                            LOG.debug("received " + numReceived + " messages ");
                             System.runFinalization();
                         }
                     }
@@ -140,7 +152,7 @@ public class PooledSessionExhaustionBlockTimeoutTest extends TestCase {
 
             @Override
             public void run() {
-                System.out.println("Starting threads to send messages!");
+                LOG.trace("Starting threads to send messages!");
             }
         });
 
@@ -151,6 +163,5 @@ public class PooledSessionExhaustionBlockTimeoutTest extends TestCase {
         thread.join();
 
         assertEquals(totalMessagesExpected, numReceived);
-
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java
index 119d4a9..89ee46e 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java
@@ -16,6 +16,14 @@
  */
 package org.apache.activemq.jms.pool;
 
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.Destination;
@@ -25,39 +33,38 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 
-import junit.framework.TestCase;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.log4j.Logger;
+import org.junit.Before;
+import org.junit.Test;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+public class PooledSessionExhaustionTest extends JmsPoolTestSupport {
 
-public class PooledSessionExhaustionTest extends TestCase {
     private static final String QUEUE = "FOO";
     private static final int NUM_MESSAGES = 500;
 
-    private Logger logger = Logger.getLogger(getClass());
+    private static final Logger LOG = Logger.getLogger(PooledSessionExhaustionTest.class);
 
-    private BrokerService broker;
     private ActiveMQConnectionFactory factory;
     private PooledConnectionFactory pooledFactory;
     private String connectionUri;
     private int numReceived = 0;
     private final List<Exception> exceptionList = new ArrayList<Exception>();
 
+    @Before
     @Override
-    protected void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
+    public void setUp() throws Exception {
+        super.setUp();
+
+        brokerService = new BrokerService();
+        brokerService.setPersistent(false);
+        brokerService.setUseJmx(false);
+        brokerService.setAdvisorySupport(false);
+        brokerService.setSchedulerSupport(false);
+        TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
+        brokerService.start();
         connectionUri = connector.getPublishableConnectString();
         factory = new ActiveMQConnectionFactory(connectionUri);
         pooledFactory = new PooledConnectionFactory();
@@ -67,13 +74,6 @@ public class PooledSessionExhaustionTest extends TestCase {
         pooledFactory.setMaximumActiveSessionPerConnection(1);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
-        broker = null;
-    }
-
     class TestRunner implements Runnable {
 
         CyclicBarrier barrier;
@@ -106,12 +106,14 @@ public class PooledSessionExhaustionTest extends TestCase {
             TextMessage message = session.createTextMessage(msgTo);
             producer.send(message);
             connection.close();
-            logger.info("sent " + i + " messages using " + connectionFactory.getClass());
+            LOG.debug("sent " + i + " messages using " + connectionFactory.getClass());
         }
     }
 
+    @Test(timeout = 60000)
     public void testCanExhaustSessions() throws Exception {
         Thread thread = new Thread(new Runnable() {
+            @Override
             public void run() {
                 try {
                     ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(connectionUri);
@@ -128,7 +130,7 @@ public class PooledSessionExhaustionTest extends TestCase {
                         }
                         numReceived++;
                         if (numReceived % 20 == 0) {
-                            logger.debug("received " + numReceived + " messages ");
+                            LOG.debug("received " + numReceived + " messages ");
                             System.runFinalization();
                         }
                     }
@@ -144,7 +146,7 @@ public class PooledSessionExhaustionTest extends TestCase {
 
             @Override
             public void run() {
-                System.out.println("Starting threads to send messages!");
+                LOG.trace("Starting threads to send messages!");
             }
         });
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionNoPublisherCachingTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionNoPublisherCachingTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionNoPublisherCachingTest.java
index 6671376..4719a20 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionNoPublisherCachingTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionNoPublisherCachingTest.java
@@ -28,24 +28,28 @@ import javax.jms.TopicSession;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-public class PooledSessionNoPublisherCachingTest {
+public class PooledSessionNoPublisherCachingTest extends JmsPoolTestSupport {
 
-    private BrokerService broker;
     private ActiveMQConnectionFactory factory;
     private PooledConnectionFactory pooledFactory;
     private String connectionUri;
 
+    @Override
     @Before
     public void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
+        super.setUp();
+
+        brokerService = new BrokerService();
+        brokerService.setPersistent(false);
+        brokerService.setUseJmx(false);
+        brokerService.setAdvisorySupport(false);
+        brokerService.setSchedulerSupport(false);
+        TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
+        brokerService.start();
+
         connectionUri = connector.getPublishableConnectString();
         factory = new ActiveMQConnectionFactory(connectionUri);
         pooledFactory = new PooledConnectionFactory();
@@ -55,14 +59,7 @@ public class PooledSessionNoPublisherCachingTest {
         pooledFactory.setUseAnonymousProducers(false);
     }
 
-    @After
-    public void tearDown() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
-        broker = null;
-    }
-
-    @Test
+    @Test(timeout = 60000)
     public void testMessageProducersAreUnique() throws Exception {
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -76,7 +73,7 @@ public class PooledSessionNoPublisherCachingTest {
         assertNotSame(producer1.getMessageProducer(), producer2.getMessageProducer());
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testThrowsWhenDestinationGiven() throws Exception {
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -99,7 +96,7 @@ public class PooledSessionNoPublisherCachingTest {
         }
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testCreateTopicPublisher() throws Exception {
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
         TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -113,7 +110,7 @@ public class PooledSessionNoPublisherCachingTest {
         assertNotSame(publisher1.getMessageProducer(), publisher2.getMessageProducer());
     }
 
-    @Test
+    @Test(timeout = 60000)
     public void testQueueSender() throws Exception {
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
         QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionTest.java
index 9432add..c689344 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionTest.java
@@ -33,25 +33,29 @@ import javax.jms.TopicSession;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-public class PooledSessionTest {
+public class PooledSessionTest extends JmsPoolTestSupport {
 
-    private BrokerService broker;
     private ActiveMQConnectionFactory factory;
     private PooledConnectionFactory pooledFactory;
     private String connectionUri;
 
+    @Override
     @Before
     public void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setPersistent(false);
-        broker.setUseJmx(true);
-        broker.getManagementContext().setCreateMBeanServer(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
+        super.setUp();
+
+        brokerService = new BrokerService();
+        brokerService.setPersistent(false);
+        brokerService.setUseJmx(true);
+        brokerService.getManagementContext().setCreateConnector(false);
+        brokerService.setAdvisorySupport(false);
+        brokerService.setSchedulerSupport(false);
+        TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
+        brokerService.start();
+
         connectionUri = connector.getPublishableConnectString();
         factory = new ActiveMQConnectionFactory(connectionUri);
         pooledFactory = new PooledConnectionFactory();
@@ -60,13 +64,6 @@ public class PooledSessionTest {
         pooledFactory.setBlockIfSessionPoolIsFull(false);
     }
 
-    @After
-    public void tearDown() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
-        broker = null;
-    }
-
     @Test(timeout = 60000)
     public void testPooledSessionStats() throws Exception {
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
@@ -166,7 +163,7 @@ public class PooledSessionTest {
         assertNotNull(original);
         session.close();
 
-        assertEquals(1, broker.getAdminView().getDynamicDestinationProducers().length);
+        assertEquals(1, brokerService.getAdminView().getDynamicDestinationProducers().length);
 
         for (int i = 0; i < 20; ++i) {
             session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -175,7 +172,7 @@ public class PooledSessionTest {
             session.close();
         }
 
-        assertEquals(1, broker.getAdminView().getDynamicDestinationProducers().length);
+        assertEquals(1, brokerService.getAdminView().getDynamicDestinationProducers().length);
 
         connection.close();
         pooledFactory.clear();

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledTopicPublisherTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledTopicPublisherTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledTopicPublisherTest.java
index 1d1760d..c0781ba 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledTopicPublisherTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledTopicPublisherTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.activemq.jms.pool;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -31,20 +35,32 @@ import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.activemq.command.ActiveMQTopic;
-import org.apache.activemq.test.TestSupport;
 import org.apache.activemq.util.SocketProxy;
+import org.apache.activemq.util.Wait;
+import org.junit.After;
+import org.junit.Test;
 
-/**
- *
- */
-public class PooledTopicPublisherTest extends TestSupport {
+public class PooledTopicPublisherTest extends JmsPoolTestSupport {
 
     private TopicConnection connection;
 
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        if (connection != null) {
+            connection.close();
+            connection = null;
+        }
+
+        super.tearDown();
+    }
+
+    @Test(timeout = 60000)
     public void testPooledConnectionFactory() throws Exception {
         ActiveMQTopic topic = new ActiveMQTopic("test");
         PooledConnectionFactory pcf = new PooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));
+        pcf.setConnectionFactory(new ActiveMQConnectionFactory(
+            "vm://test?broker.persistent=false&broker.useJmx=false"));
 
         connection = (TopicConnection) pcf.createConnection();
         TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -52,13 +68,15 @@ public class PooledTopicPublisherTest extends TestSupport {
         publisher.publish(session.createMessage());
     }
 
-
+    @Test(timeout = 60000)
     public void testSetGetExceptionListener() throws Exception {
         PooledConnectionFactory pcf = new PooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));
+        pcf.setConnectionFactory(new ActiveMQConnectionFactory(
+            "vm://test?broker.persistent=false&broker.useJmx=false"));
 
         connection = (TopicConnection) pcf.createConnection();
         ExceptionListener listener = new ExceptionListener() {
+            @Override
             public void onException(JMSException exception) {
             }
         };
@@ -66,12 +84,16 @@ public class PooledTopicPublisherTest extends TestSupport {
         assertEquals(listener, connection.getExceptionListener());
     }
 
+    @Test(timeout = 60000)
     public void testPooledConnectionAfterInactivity() throws Exception {
-        BrokerService broker = new BrokerService();
-        TransportConnector networkConnector = broker.addConnector("tcp://localhost:0");
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        broker.start();
+        brokerService = new BrokerService();
+        TransportConnector networkConnector = brokerService.addConnector("tcp://localhost:0");
+        brokerService.setPersistent(false);
+        brokerService.setUseJmx(true);
+        brokerService.getManagementContext().setCreateConnector(false);
+        brokerService.setAdvisorySupport(false);
+        brokerService.setSchedulerSupport(false);
+        brokerService.start();
 
         SocketProxy proxy = new SocketProxy(networkConnector.getConnectUri());
 
@@ -84,23 +106,23 @@ public class PooledTopicPublisherTest extends TestSupport {
         assertNotNull(amq);
         final CountDownLatch gotException = new CountDownLatch(1);
         conn.setExceptionListener(new ExceptionListener() {
+            @Override
             public void onException(JMSException exception) {
                 gotException.countDown();
             }});
-        conn.setClientID(getName());
+        conn.setClientID(getTestName());
 
         // let it hang, simulate a server hang so inactivity timeout kicks in
         proxy.pause();
-        //assertTrue("got an exception", gotException.await(5, TimeUnit.SECONDS));
-        TimeUnit.SECONDS.sleep(2);
-        conn.close();
-    }
 
-    @Override
-    protected void tearDown() throws Exception {
-        if (connection != null) {
-            connection.close();
-            connection = null;
-        }
+        assertTrue(Wait.waitFor(new Wait.Condition() {
+
+            @Override
+            public boolean isSatisified() throws Exception {
+                return brokerService.getAdminView().getCurrentConnectionsCount() == 0;
+            }
+        }, TimeUnit.SECONDS.toMillis(15), TimeUnit.MILLISECONDS.toMillis(100)));
+
+        conn.close();
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
index c56f8de..6944414 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/XAConnectionPoolTest.java
@@ -16,6 +16,11 @@
  */
 package org.apache.activemq.jms.pool;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Hashtable;
 import java.util.Vector;
 
@@ -47,11 +52,12 @@ import javax.transaction.xa.XAResource;
 import org.apache.activemq.ActiveMQXAConnectionFactory;
 import org.apache.activemq.ActiveMQXASession;
 import org.apache.activemq.command.ActiveMQTopic;
-import org.apache.activemq.test.TestSupport;
+import org.junit.Test;
 
-public class XAConnectionPoolTest extends TestSupport {
+public class XAConnectionPoolTest extends JmsPoolTestSupport {
 
     // https://issues.apache.org/jira/browse/AMQ-3251
+    @Test(timeout = 60000)
     public void testAfterCompletionCanClose() throws Exception {
         final Vector<Synchronization> syncs = new Vector<Synchronization>();
         ActiveMQTopic topic = new ActiveMQTopic("test");
@@ -152,11 +158,13 @@ public class XAConnectionPoolTest extends TestSupport {
         connection.close();
     }
 
+    @Test(timeout = 60000)
     public void testAckModeOfPoolNonXAWithTM() throws Exception {
         final Vector<Synchronization> syncs = new Vector<Synchronization>();
         ActiveMQTopic topic = new ActiveMQTopic("test");
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new XAConnectionFactoryOnly(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE)));
+        pcf.setConnectionFactory(new XAConnectionFactoryOnly(new ActiveMQXAConnectionFactory(
+            "vm://test?broker.persistent=false&broker.useJmx=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE)));
 
         // simple TM that is in a tx and will track syncs
         pcf.setTransactionManager(new TransactionManager(){
@@ -250,12 +258,14 @@ public class XAConnectionPoolTest extends TestSupport {
         connection.close();
     }
 
+    @Test(timeout = 60000)
     public void testInstanceOf() throws  Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
         assertTrue(pcf instanceof QueueConnectionFactory);
         assertTrue(pcf instanceof TopicConnectionFactory);
     }
 
+    @Test(timeout = 60000)
     public void testBindable() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
         assertTrue(pcf instanceof ObjectFactory);
@@ -263,6 +273,7 @@ public class XAConnectionPoolTest extends TestSupport {
         assertTrue(pcf.isTmFromJndi());
     }
 
+    @Test(timeout = 60000)
     public void testBindableEnvOverrides() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
         assertTrue(pcf instanceof ObjectFactory);
@@ -272,9 +283,11 @@ public class XAConnectionPoolTest extends TestSupport {
         assertFalse(pcf.isTmFromJndi());
     }
 
+    @Test(timeout = 60000)
     public void testSenderAndPublisherDest() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
+        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory(
+            "vm://test?broker.persistent=false&broker.useJmx=false"));
 
         QueueConnection connection = pcf.createQueueConnection();
         QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -291,9 +304,12 @@ public class XAConnectionPoolTest extends TestSupport {
         topicConnection.close();
     }
 
+    @Test(timeout = 60000)
     public void testSessionArgsIgnoredWithTm() throws Exception {
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
+        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory(
+            "vm://test?broker.persistent=false&broker.useJmx=false"));
+
         // simple TM that with no tx
         pcf.setTransactionManager(new TransactionManager() {
             @Override

http://git-wip-us.apache.org/repos/asf/activemq/blob/e6597c46/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/bugs/AMQ4441Test.java
----------------------------------------------------------------------
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/bugs/AMQ4441Test.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/bugs/AMQ4441Test.java
index a26b5a8..5f51029 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/bugs/AMQ4441Test.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/bugs/AMQ4441Test.java
@@ -26,36 +26,34 @@ import javax.jms.JMSException;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.jms.pool.JmsPoolTestSupport;
 import org.apache.activemq.jms.pool.PooledConnection;
 import org.apache.activemq.jms.pool.PooledConnectionFactory;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class AMQ4441Test {
+public class AMQ4441Test extends JmsPoolTestSupport {
 
     private static final Logger LOG = LoggerFactory.getLogger(AMQ4441Test.class);
-    private BrokerService broker;
 
+    @Override
     @Before
     public void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setDeleteAllMessagesOnStartup(true);
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        broker.start();
-        broker.waitUntilStarted();
-    }
+        super.setUp();
 
-    @After
-    public void stopBroker() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
+        brokerService = new BrokerService();
+        brokerService.setDeleteAllMessagesOnStartup(true);
+        brokerService.setPersistent(false);
+        brokerService.setUseJmx(false);
+        brokerService.setAdvisorySupport(false);
+        brokerService.setSchedulerSupport(false);
+        brokerService.start();
+        brokerService.waitUntilStarted();
     }
 
-    @Test(timeout=120000)
+    @Test(timeout = 120000)
     public void demo() throws JMSException, InterruptedException {
         final CountDownLatch latch = new CountDownLatch(1);
         final AtomicBoolean done = new AtomicBoolean(false);
@@ -85,11 +83,12 @@ public class AMQ4441Test {
                 }
             });
         }
+
         for (Thread thread : threads) {
             thread.start();
         }
 
-        if (latch.await(1, TimeUnit.MINUTES)) {
+        if (latch.await(20, TimeUnit.SECONDS)) {
             fail("A thread obtained broken connection");
         }
 
@@ -98,5 +97,4 @@ public class AMQ4441Test {
             thread.join();
         }
     }
-
 }