activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [2/6] https://issues.apache.org/jira/browse/AMQ-4757 activemq-jms-pool a generic jms xa pool derived from activemq-pool which activemq-pool now extends with amq specifics
Date Mon, 30 Sep 2013 22:10:20 GMT
http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/main/java/org/apache/activemq/pool/package.html
----------------------------------------------------------------------
diff --git a/activemq-pool/src/main/java/org/apache/activemq/pool/package.html b/activemq-pool/src/main/java/org/apache/activemq/pool/package.html
deleted file mode 100755
index 8eb8f0c..0000000
--- a/activemq-pool/src/main/java/org/apache/activemq/pool/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-    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.
--->
-<html>
-<head>
-</head>
-<body>
-
-A JMS provider which pools Connection, Session and MessageProducer instances so it can be used with tools like 
-Spring's <a href="http://activemq.org/Spring+Support">JmsTemplate</a>. <b>Note</b> that this package
-does not deal with pooling of consumers; for that look at a library like <a href="http://jencks.org/">Jencks</a>
-such as in <a href="http://jencks.org/Message+Driven+POJOs">this example</a>
-
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionExpiryEvictsFromPoolTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionExpiryEvictsFromPoolTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionExpiryEvictsFromPoolTest.java
deleted file mode 100644
index 3f66ece..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionExpiryEvictsFromPoolTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.pool;
-
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-import javax.jms.Session;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.TransportConnector;
-import org.apache.activemq.test.TestSupport;
-
-public class ConnectionExpiryEvictsFromPoolTest extends TestSupport {
-
-    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();
-        factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri());
-        pooledFactory = new PooledConnectionFactory(factory);
-        pooledFactory.setMaxConnections(1);
-    }
-
-    public void testEvictionOfIdle() throws Exception {
-        pooledFactory.setIdleTimeout(10);
-        PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
-        ActiveMQConnection amq1 = connection.getConnection();
-
-        connection.close();
-        // let it idle timeout
-        TimeUnit.SECONDS.sleep(1);
-
-        PooledConnection connection2 = (PooledConnection) pooledFactory.createConnection();
-        ActiveMQConnection amq2 = connection2.getConnection();
-        assertTrue("not equal", !amq1.equals(amq2));
-    }
-
-    public void testEvictionOfExpired() throws Exception {
-        pooledFactory.setExpiryTimeout(10);
-        Connection connection = pooledFactory.createConnection();
-        ActiveMQConnection amq1 = ((PooledConnection) connection).getConnection();
-
-        // let it expire while in use
-        TimeUnit.SECONDS.sleep(1);
-        connection.close();
-
-        Connection connection2 = pooledFactory.createConnection();
-        ActiveMQConnection amq2 = ((PooledConnection) connection2).getConnection();
-        assertTrue("not equal", !amq1.equals(amq2));
-    }
-
-    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);
-
-        // 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.
-        PooledConnection connection2 = (PooledConnection) pooledFactory.createConnection();
-        assertSame(connection.getConnection(), connection2.getConnection());
-
-        // now the session is closed even when it should not be
-        try {
-            // any operation on session first checks whether session is closed
-            s.getTransacted();
-        } catch (javax.jms.IllegalStateException e) {
-            assertTrue("Session should be fine, instead: " + e.getMessage(), false);
-        }
-
-        ActiveMQConnection original = connection.getConnection();
-
-        connection.close();
-        connection2.close();
-
-        // let connection to get idle
-        TimeUnit.SECONDS.sleep(1);
-
-        // 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/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionFailureEvictsFromPoolTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionFailureEvictsFromPoolTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionFailureEvictsFromPoolTest.java
index c02eb18..8c07111 100644
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionFailureEvictsFromPoolTest.java
+++ b/activemq-pool/src/test/java/org/apache/activemq/pool/ConnectionFailureEvictsFromPoolTest.java
@@ -21,15 +21,21 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
 import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
 import javax.jms.JMSException;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 
+import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQXAConnectionFactory;
+import org.apache.activemq.EnhancedConnection;
+import org.apache.activemq.advisory.DestinationSource;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.jms.pool.PooledConnection;
 import org.apache.activemq.test.TestSupport;
 import org.apache.activemq.transport.TransportListener;
 import org.apache.activemq.transport.mock.MockTransport;
@@ -39,22 +45,44 @@ import org.slf4j.LoggerFactory;
 public class ConnectionFailureEvictsFromPoolTest extends TestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ConnectionFailureEvictsFromPoolTest.class);
     private BrokerService broker;
-    private ActiveMQConnectionFactory factory;
-    private PooledConnectionFactory pooledFactory;
+    TransportConnector connector;
 
     protected void setUp() throws Exception {
         broker = new BrokerService();
         broker.setUseJmx(false);
         broker.setPersistent(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
+        connector = broker.addConnector("tcp://localhost:0");
         broker.start();
-        factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false");
-        pooledFactory = new PooledConnectionFactory(factory);
+    }
+
+    public void testEnhancedConnection() throws Exception {
+        XaPooledConnectionFactory pooledFactory =
+                new XaPooledConnectionFactory(new ActiveMQXAConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false"));
+
+        PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
+        EnhancedConnection enhancedConnection = (EnhancedConnection)connection.getConnection();
+        DestinationSource destinationSource = enhancedConnection.getDestinationSource();
+        assertNotNull(destinationSource);
+
+    }
+
+    public void testEvictionXA() throws Exception {
+        XaPooledConnectionFactory pooledFactory =
+                new XaPooledConnectionFactory(new ActiveMQXAConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false"));
+
+        doTestEviction(pooledFactory);
     }
 
     public void testEviction() throws Exception {
+        PooledConnectionFactory pooledFactory =
+                new PooledConnectionFactory(new ActiveMQConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false"));
+
+        doTestEviction(pooledFactory);
+    }
+
+    public void doTestEviction(ConnectionFactory pooledFactory) throws Exception {
         PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
-        ActiveMQConnection amqC = connection.getConnection();
+        ActiveMQConnection amqC = (ActiveMQConnection) connection.getConnection();
         final CountDownLatch gotExceptionEvent = new CountDownLatch(1);
         amqC.addTransportListener(new TransportListener() {
             public void onCommand(Object command) {
@@ -75,12 +103,12 @@ public class ConnectionFailureEvictsFromPoolTest extends TestSupport {
         createConnectionFailure(connection);
         try {
             sendMessage(connection);
-            fail("Expected Error");
+            TestCase.fail("Expected Error");
         } catch (JMSException e) {
         } finally {
             connection.close();
         }
-        assertTrue("exception event propagated ok", gotExceptionEvent.await(5, TimeUnit.SECONDS));
+        TestCase.assertTrue("exception event propagated ok", gotExceptionEvent.await(5, TimeUnit.SECONDS));
         // If we get another connection now it should be a new connection that
         // works.
         LOG.info("expect new connection after failure");
@@ -89,7 +117,7 @@ public class ConnectionFailureEvictsFromPoolTest extends TestSupport {
     }
 
     private void createConnectionFailure(Connection connection) throws Exception {
-        ActiveMQConnection c = ((PooledConnection)connection).getConnection();
+        ActiveMQConnection c = (ActiveMQConnection) ((PooledConnection)connection).getConnection();
         MockTransport t = (MockTransport)c.getTransportChannel().narrow(MockTransport.class);
         t.onException(new IOException("forcing exception for " + getName() + " to force pool eviction"));
         LOG.info("arranged for failure, chucked exception");

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java
deleted file mode 100644
index 8c01c39..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryMaximumActiveTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- * 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.pool;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-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;
-
-/**
- * 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 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.
-     *
-     */
-    public void testApp() throws Exception {
-        // Initialize JMS connection
-        ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
-        PooledConnectionFactory cf = new PooledConnectionFactory(amq);
-        cf.setMaxConnections(3);
-        cf.setMaximumActiveSessionPerConnection(1);
-        cf.setBlockIfSessionPoolIsFull(true);
-        conn = cf.createConnection();
-
-        // start test runner threads. It is expected that the second thread
-        // blocks on the call to createSession()
-
-        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
-        Thread.sleep(sleepTimeout);
-
-        // second task should not have finished, instead wait on getting a
-        // JMS Session
-        assertEquals(false, result2.isDone());
-
-        // Only 1 session should have been created
-        assertEquals(1, sessions.size());
-
-        // Take all threads down
-        executor.shutdownNow();
-    }
-}
-
-class TestRunner2 implements Callable<Boolean> {
-
-    public final static Logger LOG = Logger.getLogger(TestRunner2.class);
-
-    /**
-     * @return true if test succeeded, false otherwise
-     */
-    @Override
-    public Boolean call() {
-
-        Session one = null;
-
-        // wait at most 5 seconds for the call to createSession
-        try {
-
-            if (PooledConnectionFactoryMaximumActiveTest.conn == null) {
-                LOG.error("Connection not yet initialized. Aborting test.");
-                return new Boolean(false);
-            }
-
-            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);
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java
deleted file mode 100644
index 48e7069..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryTest.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/**
- * 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.pool;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-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.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.util.Wait;
-import org.apache.log4j.Logger;
-
-/**
- * Checks the behavior of the PooledConnectionFactory when the maximum amount of
- * sessions is being reached.
- *
- * Older versions simply block in the call to Connection.getSession(), which
- * isn't good. An exception being returned is the better option, so JMS clients
- * don't block. This test succeeds if an exception is returned and fails if the
- * call to getSession() blocks.
- */
-public class PooledConnectionFactoryTest extends TestCase {
-
-    public final static Logger LOG = Logger.getLogger(PooledConnectionFactoryTest.class);
-
-    /**
-     * Create the test case
-     *
-     * @param testName
-     *            name of the test case
-     */
-    public PooledConnectionFactoryTest(String testName) {
-        super(testName);
-    }
-
-    /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite() {
-        return new TestSuite(PooledConnectionFactoryTest.class);
-    }
-
-    public void testClearAllConnections() throws Exception {
-
-        ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
-        PooledConnectionFactory cf = new PooledConnectionFactory(amq);
-        cf.setMaxConnections(3);
-
-        PooledConnection conn1 = (PooledConnection) cf.createConnection();
-        PooledConnection conn2 = (PooledConnection) cf.createConnection();
-        PooledConnection conn3 = (PooledConnection) cf.createConnection();
-
-        assertNotSame(conn1.getConnection(), conn2.getConnection());
-        assertNotSame(conn1.getConnection(), conn3.getConnection());
-        assertNotSame(conn2.getConnection(), conn3.getConnection());
-
-        assertEquals(3, cf.getNumConnections());
-
-        cf.clear();
-
-        assertEquals(0, cf.getNumConnections());
-
-        conn1 = (PooledConnection) cf.createConnection();
-        conn2 = (PooledConnection) cf.createConnection();
-        conn3 = (PooledConnection) cf.createConnection();
-
-        assertNotSame(conn1.getConnection(), conn2.getConnection());
-        assertNotSame(conn1.getConnection(), conn3.getConnection());
-        assertNotSame(conn2.getConnection(), conn3.getConnection());
-    }
-
-    public void testMaxConnectionsAreCreated() throws Exception {
-
-        ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
-        PooledConnectionFactory cf = new PooledConnectionFactory(amq);
-        cf.setMaxConnections(3);
-
-        PooledConnection conn1 = (PooledConnection) cf.createConnection();
-        PooledConnection conn2 = (PooledConnection) cf.createConnection();
-        PooledConnection conn3 = (PooledConnection) cf.createConnection();
-
-        assertNotSame(conn1.getConnection(), conn2.getConnection());
-        assertNotSame(conn1.getConnection(), conn3.getConnection());
-        assertNotSame(conn2.getConnection(), conn3.getConnection());
-
-        assertEquals(3, cf.getNumConnections());
-    }
-
-    public void testConnectionsAreRotated() throws Exception {
-
-        ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
-        PooledConnectionFactory cf = new PooledConnectionFactory(amq);
-        cf.setMaxConnections(10);
-
-        ActiveMQConnection previous = null;
-
-        // Front load the pool.
-        for (int i = 0; i < 10; ++i) {
-            cf.createConnection();
-        }
-
-        for (int i = 0; i < 100; ++i) {
-            ActiveMQConnection current = ((PooledConnection) cf.createConnection()).getConnection();
-            assertNotSame(previous, current);
-            previous = current;
-        }
-    }
-
-    public void testConnectionsArePooled() throws Exception {
-
-        ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
-        PooledConnectionFactory cf = new PooledConnectionFactory(amq);
-        cf.setMaxConnections(1);
-
-        PooledConnection conn1 = (PooledConnection) cf.createConnection();
-        PooledConnection conn2 = (PooledConnection) cf.createConnection();
-        PooledConnection conn3 = (PooledConnection) cf.createConnection();
-
-        assertSame(conn1.getConnection(), conn2.getConnection());
-        assertSame(conn1.getConnection(), conn3.getConnection());
-        assertSame(conn2.getConnection(), conn3.getConnection());
-
-        assertEquals(1, cf.getNumConnections());
-    }
-
-    public void testConnectionsArePooledAsyncCreate() throws Exception {
-
-        final ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
-        final PooledConnectionFactory cf = new PooledConnectionFactory(amq);
-        cf.setMaxConnections(1);
-
-        final ConcurrentLinkedQueue<PooledConnection> connections = new ConcurrentLinkedQueue<PooledConnection>();
-
-        final PooledConnection primary = (PooledConnection) cf.createConnection();
-        final ExecutorService executor = Executors.newFixedThreadPool(10);
-        final int numConnections = 100;
-
-        for (int i = 0; i < numConnections; ++i) {
-            executor.execute(new Runnable() {
-
-                @Override
-                public void run() {
-                    try {
-                        connections.add((PooledConnection) cf.createConnection());
-                    } catch (JMSException e) {
-                    }
-                }
-            });
-        }
-
-        assertTrue("", Wait.waitFor(new Wait.Condition() {
-            @Override
-            public boolean isSatisified() throws Exception {
-                return connections.size() == numConnections;
-            }
-        }));
-
-        executor.shutdown();
-        assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS));
-
-        for(PooledConnection connection : connections) {
-            assertSame(primary.getConnection(), connection.getConnection());
-        }
-
-        connections.clear();
-    }
-
-    /**
-     * Tests the behavior of the sessionPool of the PooledConnectionFactory when
-     * maximum number of sessions are reached.
-     */
-    public void testApp() 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());
-
-        // test should not take > 5secs, so test fails i
-        Thread.sleep(5 * 1000);
-
-        if (!result.isDone() || !result.get().booleanValue()) {
-            PooledConnectionFactoryTest.LOG.error("2nd call to createSession() " +
-                                                  "is blocking but should have returned an error instead.");
-
-            executor.shutdownNow();
-
-            fail("SessionPool inside PooledConnectionFactory is blocking if " +
-                 "limit is exceeded but should return an exception instead.");
-        }
-    }
-
-    static class TestRunner implements Callable<Boolean> {
-
-        public final static Logger LOG = Logger.getLogger(TestRunner.class);
-
-        /**
-         * @return true if test succeeded, false otherwise
-         */
-        @Override
-        public Boolean call() {
-
-            Connection conn = null;
-            Session one = null;
-
-            // wait at most 5 seconds for the call to createSession
-            try {
-                ActiveMQConnectionFactory amq = new ActiveMQConnectionFactory("vm://broker1?marshal=false&broker.persistent=false");
-                PooledConnectionFactory cf = new PooledConnectionFactory(amq);
-                cf.setMaxConnections(3);
-                cf.setMaximumActiveSessionPerConnection(1);
-                cf.setBlockIfSessionPoolIsFull(false);
-
-                conn = cf.createConnection();
-                one = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-                Session two = null;
-                try {
-                    // this should raise an exception as we called
-                    // setMaximumActive(1)
-                    two = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-                    two.close();
-
-                    LOG.error("Expected JMSException wasn't thrown.");
-                    fail("seconds call to Connection.createSession() was supposed" +
-                         "to raise an JMSException as internal session pool" +
-                         "is exhausted. This did not happen and indiates a problem");
-                    return new Boolean(false);
-                } catch (JMSException ex) {
-                    if (ex.getCause().getClass() == java.util.NoSuchElementException.class) {
-                        // expected, ignore but log
-                        LOG.info("Caught expected " + ex);
-                    } else {
-                        LOG.error(ex);
-                        return new Boolean(false);
-                    }
-                } finally {
-                    if (one != null)
-                        one.close();
-                    if (conn != null)
-                        conn.close();
-                }
-            } catch (Exception ex) {
-                LOG.error(ex.getMessage());
-                return new Boolean(false);
-            }
-
-            // all good, test succeeded
-            return new Boolean(true);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java
deleted file mode 100644
index ed13e2f..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionFactoryWithTemporaryDestinationsTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * 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.pool;
-
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.Connection;
-
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @version $Revision: 1.1 $
- */
-public class PooledConnectionFactoryWithTemporaryDestinationsTest extends TestSupport {
-
-    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();
-        factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false");
-        pooledFactory = new PooledConnectionFactory(factory);
-    }
-
-    protected void tearDown() throws Exception {
-        broker.stop();
-    }
-
-    public void testTemporaryQueueWithMultipleConnectionUsers() throws Exception {
-        Connection pooledConnection = null;
-        Connection pooledConnection2 = null;
-        Session session = null;
-        Session session2 = null;
-        Queue tempQueue = null;
-        Queue normalQueue = null;
-
-        pooledConnection = pooledFactory.createConnection();
-        session = pooledConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        tempQueue = session.createTemporaryQueue();
-        LOG.info("Created queue named: " + tempQueue.getQueueName());
-
-        assertEquals(1, countBrokerTemporaryQueues());
-
-        pooledConnection2 = pooledFactory.createConnection();
-        session2 = pooledConnection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        normalQueue = session2.createQueue("queue:FOO.TEST");
-        LOG.info("Created queue named: " + normalQueue.getQueueName());
-
-        // didn't create a temp queue on pooledConnection2 so we should still have a temp queue
-        pooledConnection2.close();
-        assertEquals(1, countBrokerTemporaryQueues());
-
-        // after closing pooledConnection, where we created the temp queue, there should
-        // be no temp queues left
-        pooledConnection.close();
-        assertEquals(0, countBrokerTemporaryQueues());
-    }
-
-    public void testTemporaryQueueLeakAfterConnectionClose() throws Exception {
-        Connection pooledConnection = null;
-        Session session = null;
-        Queue tempQueue = null;
-        for (int i = 0; i < 2; i++) {
-            pooledConnection = pooledFactory.createConnection();
-            session = pooledConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            tempQueue = session.createTemporaryQueue();
-            LOG.info("Created queue named: " + tempQueue.getQueueName());
-            pooledConnection.close();
-        }
-
-        assertEquals(0, countBrokerTemporaryQueues());
-    }
-
-    public void testTemporaryTopicLeakAfterConnectionClose() throws Exception {
-        Connection pooledConnection = null;
-        Session session = null;
-        Topic tempTopic = null;
-        for (int i = 0; i < 2; i++) {
-            pooledConnection = pooledFactory.createConnection();
-            session = pooledConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            tempTopic = session.createTemporaryTopic();
-            LOG.info("Created topic named: " + tempTopic.getTopicName());
-            pooledConnection.close();
-        }
-
-        assertEquals(0, countBrokerTemporaryTopics());
-    }
-
-    private int countBrokerTemporaryQueues() throws Exception {
-        return ((RegionBroker) broker.getRegionBroker()).getTempQueueRegion().getDestinationMap().size();
-    }
-
-    private int countBrokerTemporaryTopics() throws Exception {
-        return ((RegionBroker) broker.getRegionBroker()).getTempTopicRegion().getDestinationMap().size();
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionSessionCleanupTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionSessionCleanupTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionSessionCleanupTest.java
deleted file mode 100644
index 57219a2..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionSessionCleanupTest.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/**
- * 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.pool;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-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;
-import org.apache.activemq.broker.jmx.QueueViewMBean;
-import org.apache.activemq.command.ActiveMQQueue;
-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;
-
-    protected ActiveMQConnectionFactory directConnFact;
-    protected Connection directConn1;
-    protected Connection directConn2;
-
-    protected PooledConnectionFactory pooledConnFact;
-    protected Connection pooledConn1;
-    protected Connection pooledConn2;
-
-    private final ActiveMQQueue queue = new ActiveMQQueue("ContendedQueue");
-    private final int MESSAGE_COUNT = 50;
-
-    /**
-     * Prepare to run a test case: create, configure, and start the embedded
-     * broker, as well as creating the client connections to the broker.
-     */
-    @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();
-
-        // 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());
-        pooledConnFact = new PooledConnectionFactory(directConnFact);
-        pooledConnFact.setIdleTimeout((int)TimeUnit.MINUTES.toMillis(60));
-        pooledConnFact.setMaxConnections(1);
-
-        // Prepare the connections
-        directConn1 = directConnFact.createConnection();
-        directConn1.start();
-        directConn2 = directConnFact.createConnection();
-        directConn2.start();
-
-        // The pooled Connections should have the same underlying connection
-        pooledConn1 = pooledConnFact.createConnection();
-        pooledConn1.start();
-        pooledConn2 = pooledConnFact.createConnection();
-        pooledConn2.start();
-    }
-
-    @After
-    public void cleanupTest() throws java.lang.Exception {
-        try {
-            if (pooledConn1 != null) {
-                pooledConn1.close();
-            }
-        } catch (JMSException jms_exc) {
-        }
-        try {
-            if (pooledConn2 != null) {
-                pooledConn2.close();
-            }
-        } catch (JMSException jms_exc) {
-        }
-        try {
-            if (directConn1 != null) {
-                directConn1.close();
-            }
-        } catch (JMSException jms_exc) {
-        }
-        try {
-            if (directConn2 != null) {
-                directConn2.close();
-            }
-        } catch (JMSException jms_exc) {
-        }
-        try {
-            if (service != null) {
-                service.stop();
-                service.waitUntilStopped();
-                service = null;
-            }
-        } catch (JMSException jms_exc) {
-        }
-    }
-
-    private void produceMessages() throws Exception {
-
-        Session session = directConn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        MessageProducer producer = session.createProducer(queue);
-        for (int i = 0; i < MESSAGE_COUNT; ++i) {
-            producer.send(session.createTextMessage("Test Message: " + i));
-        }
-        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
-    public void testLingeringPooledSessionsHoldingPrefetchedMessages() throws Exception {
-
-        produceMessages();
-
-        Session pooledSession1 = pooledConn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        pooledSession1.createConsumer(queue);
-
-        final QueueViewMBean view = getProxyToQueue(queue.getPhysicalName());
-
-        assertTrue("Should have all sent messages in flight:", Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisified() throws Exception {
-                return view.getInFlightCount() == MESSAGE_COUNT;
-            }
-        }));
-
-        // 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));
-
-        pooledConn1.close();
-
-        assertTrue("Should have only one consumer now:", Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisified() throws Exception {
-                return view.getSubscriptions().length == 1;
-            }
-        }));
-
-        // 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
-    public void testNonPooledConnectionCloseNotHoldingPrefetchedMessages() throws Exception {
-
-        produceMessages();
-
-        Session directSession = directConn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        directSession.createConsumer(queue);
-
-        final QueueViewMBean view = getProxyToQueue(queue.getPhysicalName());
-
-        assertTrue("Should have all sent messages in flight:", Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisified() throws Exception {
-                return view.getInFlightCount() == MESSAGE_COUNT;
-            }
-        }));
-
-        // 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));
-
-        directConn2.close();
-
-        assertTrue("Should have only one consumer now:", Wait.waitFor(new Wait.Condition() {
-
-            @Override
-            public boolean isSatisified() throws Exception {
-                return view.getSubscriptions().length == 1;
-            }
-        }));
-
-        // 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.
-        assertNotNull(consumer.receive(10000));
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTempDestCleanupTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTempDestCleanupTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTempDestCleanupTest.java
deleted file mode 100644
index 005cb58..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTempDestCleanupTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * 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.pool;
-
-import static org.junit.Assert.assertTrue;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.jms.TemporaryQueue;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-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
- * underlying connections are reused. Also tests that closing one
- * PooledConnection does not delete the temporary destinations of another
- * PooledConnection that uses the same underlying ConnectionPool.
- *
- * jira: AMQ-3457
- */
-public class PooledConnectionTempDestCleanupTest {
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(PooledConnectionTempDestCleanupTest.class);
-
-    protected BrokerService embeddedBroker;
-
-    protected ActiveMQConnectionFactory directConnFact;
-    protected Connection directConn1;
-    protected Connection directConn2;
-
-    protected PooledConnectionFactory pooledConnFact;
-    protected Connection pooledConn1;
-    protected Connection pooledConn2;
-
-    protected TemporaryQueue tempDest;
-    protected TemporaryQueue otherTempDest;
-
-    /**
-     * Prepare to run a test case: create, configure, and start the embedded
-     * broker, as well as creating the client connections to the broker.
-     */
-    @Before
-    public void prepTest() throws java.lang.Exception {
-        embeddedBroker = new BrokerService();
-        configureBroker(embeddedBroker);
-        embeddedBroker.start();
-        embeddedBroker.waitUntilStarted();
-
-        // Create the ActiveMQConnectionFactory and the PooledConnectionFactory.
-        directConnFact = new ActiveMQConnectionFactory(embeddedBroker.getVmConnectorURI());
-        pooledConnFact = new PooledConnectionFactory(directConnFact);
-
-        // Prepare the connections
-        directConn1 = directConnFact.createConnection();
-        directConn1.start();
-        directConn2 = directConnFact.createConnection();
-        directConn2.start();
-
-        pooledConn1 = pooledConnFact.createConnection();
-        pooledConn1.start();
-        pooledConn2 = pooledConnFact.createConnection();
-        pooledConn2.start();
-    }
-
-    @After
-    public void cleanupTest() throws java.lang.Exception {
-        try {
-            pooledConn1.stop();
-        } catch (JMSException jms_exc) {
-        }
-        try {
-            pooledConn2.stop();
-        } catch (JMSException jms_exc) {
-        }
-        try {
-            directConn1.stop();
-        } catch (JMSException jms_exc) {
-        }
-        try {
-            directConn2.stop();
-        } catch (JMSException jms_exc) {
-        }
-
-        try {
-            embeddedBroker.stop();
-        } catch (JMSException jms_exc) {
-        }
-    }
-
-    protected void configureBroker(BrokerService broker_svc) throws Exception {
-        broker_svc.setBrokerName("testbroker1");
-        broker_svc.setUseJmx(false);
-        broker_svc.setPersistent(false);
-    }
-
-    /**
-     * Test for lingering temporary destinations after closing a
-     * PooledConnection. Here are the steps:
-     *
-     * 1. create a session on the first pooled connection 2. create a session on
-     * the second pooled connection 3. create a temporary destination on the
-     * first session 4. confirm the temporary destination exists in the broker
-     * 5. close the first connection 6. check that the temporary destination no
-     * longer exists in the broker
-     */
-    @Test
-    public void testPooledLingeringTempDests() throws java.lang.Exception {
-        Session session1;
-        Session session2;
-
-        session1 = pooledConn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        session2 = pooledConn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-        tempDest = session1.createTemporaryQueue();
-
-        assertTrue("TEST METHOD FAILURE - NEW TEMP DESTINATION DOES NOT EXIST", destinationExists(tempDest));
-
-        pooledConn1.close();
-
-        assertTrue("FAILED: temp dest from closed pooled connection is lingering", !destinationExists(tempDest));
-
-        session2.close();
-    }
-
-    /**
-     * Test that closing one PooledConnection does not delete the temporary
-     * destinations of another.
-     *
-     * 1. create a session on the first pooled connection 2. create a session on
-     * the second pooled connection 3. create a temporary destination on the
-     * first session 4. create a temporary destination on the second session 5.
-     * confirm both temporary destinations exist in the broker 6. close the
-     * first connection 7. check that the first temporary destination no longer
-     * exists in the broker 8. check that the second temporary destination does
-     * still exist in the broker
-     */
-    @Test
-    public void testPooledTempDestsCleanupOverzealous() throws java.lang.Exception {
-        Session session1;
-        Session session2;
-
-        session1 = pooledConn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        session2 = pooledConn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-        tempDest = session1.createTemporaryQueue();
-        otherTempDest = session2.createTemporaryQueue();
-
-        assertTrue("TEST METHOD FAILURE - NEW TEMP DESTINATION DOES NOT EXIST", destinationExists(tempDest));
-        assertTrue("TEST METHOD FAILURE - NEW TEMP DESTINATION DOES NOT EXIST", destinationExists(otherTempDest));
-
-        pooledConn1.close();
-
-        // Now confirm the first temporary destination no longer exists and the
-        // second does.
-        assertTrue("FAILED: temp dest from closed pooled connection is lingering", !destinationExists(tempDest));
-        assertTrue("FAILED: second PooledConnectin's temporary destination was incorrectly deleted", destinationExists(otherTempDest));
-    }
-
-    /**
-     * CONTROL CASE
-     *
-     * Test for lingering temporary destinations after closing a Connection that
-     * is NOT pooled. This demonstrates the standard JMS operation and helps to
-     * validate the test methodology.
-     *
-     * 1. create a session on the first direct connection 2. create a session on
-     * the second direct connection 3. create a temporary destination on the
-     * first session 4. confirm the destination exists in the broker 5. close
-     * the first connection 6. check that the destination no longer exists in
-     * the broker
-     */
-    @Test
-    public void testDirectLingeringTempDests() throws java.lang.Exception {
-        Session session1;
-        Session session2;
-
-        session1 = directConn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        session2 = directConn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-        tempDest = session1.createTemporaryQueue();
-
-        assertTrue("TEST METHOD FAILURE - NEW TEMP DESTINATION DOES NOT EXIST", destinationExists(tempDest));
-
-        directConn1.close();
-
-        // Now confirm the temporary destination no longer exists.
-        assertTrue("CONTROL TEST FAILURE - TEST METHOD IS SUSPECT", (!destinationExists(tempDest)));
-
-        session2.close();
-    }
-
-    private boolean destinationExists(Destination dest) throws Exception {
-        RegionBroker rb = (RegionBroker) embeddedBroker.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/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTest.java
deleted file mode 100644
index e45bdb5..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledConnectionTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * 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.pool;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.IllegalStateException;
-
-import junit.framework.TestCase;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A couple of tests against the PooledConnection class.
- *
- */
-public class PooledConnectionTest extends TestCase {
-
-    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.");
-    }
-
-    /**
-     * AMQ-3752:
-     * Tests how the ActiveMQConnection reacts to repeated calls to
-     * setClientID().
-     *
-     * @throws Exception
-     */
-    public void testRepeatedSetClientIDCalls() throws Exception {
-        log.debug("running testRepeatedSetClientIDCalls()");
-
-        // 1st test: call setClientID("newID") twice
-        // this should be tolerated and not result in an exception
-        //
-        ConnectionFactory cf = createPooledConnectionFactory();
-        Connection conn = cf.createConnection();
-        conn.setClientID("newID");
-
-        try {
-            conn.setClientID("newID");
-            conn.start();
-            conn.close();
-            cf = null;
-        } catch (IllegalStateException ise) {
-            log.error("Repeated calls to ActiveMQConnection.setClientID(\"newID\") caused " + ise.getMessage());
-            fail("Repeated calls to ActiveMQConnection.setClientID(\"newID\") caused " + ise.getMessage());
-        }
-
-        // 2nd test: call setClientID() twice with different IDs
-        // this should result in an IllegalStateException
-        //
-        cf = createPooledConnectionFactory();
-        conn = cf.createConnection();
-        conn.setClientID("newID1");
-        try {
-            conn.setClientID("newID2");
-            fail("calling ActiveMQConnection.setClientID() twice with different clientID must raise an IllegalStateException");
-        } catch (IllegalStateException ise) {
-            log.debug("Correctly received " + ise);
-        } finally {
-            conn.close();
-        }
-
-        // 3rd test: try to call setClientID() after start()
-        // should result in an exception
-        cf = createPooledConnectionFactory();
-        conn = cf.createConnection();
-        try {
-        conn.start();
-        conn.setClientID("newID3");
-        fail("Calling setClientID() after start() mut raise a JMSException.");
-        } catch (IllegalStateException ise) {
-            log.debug("Correctly received " + ise);
-        } finally {
-            conn.close();
-        }
-
-        log.debug("Test finished.");
-    }
-
-    protected ConnectionFactory createPooledConnectionFactory() {
-        ConnectionFactory cf = new PooledConnectionFactory("vm://localhost?broker.persistent=false");
-        ((PooledConnectionFactory)cf).setMaxConnections(1);
-        log.debug("ConnectionFactory initialized.");
-        return cf;
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionExhaustionTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionExhaustionTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionExhaustionTest.java
deleted file mode 100644
index 6954e9e..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionExhaustionTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * 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.pool;
-
-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 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;
-
-public class PooledSessionExhaustionTest extends TestCase {
-    private static final String QUEUE = "FOO";
-    private static final int NUM_MESSAGES = 700;
-
-    private Logger logger = Logger.getLogger(getClass());
-
-    private BrokerService broker;
-    private ActiveMQConnectionFactory factory;
-    private PooledConnectionFactory pooledFactory;
-    private String connectionUri;
-    private int numReceived = 0;
-
-    @Override
-    protected void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
-        connectionUri = connector.getPublishableConnectString();
-        factory = new ActiveMQConnectionFactory(connectionUri);
-        pooledFactory = new PooledConnectionFactory(factory);
-        pooledFactory.setMaxConnections(1);
-        pooledFactory.setBlockIfSessionPoolIsFull(false);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
-        broker = null;
-    }
-
-    public void sendMessages(ConnectionFactory connectionFactory) throws Exception {
-        for (int i = 0; i < NUM_MESSAGES; i++) {
-            Connection connection = connectionFactory.createConnection();
-            connection.start();
-
-            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Destination destination = session.createQueue(QUEUE);
-            MessageProducer producer = session.createProducer(destination);
-
-            String msgTo = "hello";
-            TextMessage message = session.createTextMessage(msgTo);
-            producer.send(message);
-            connection.close();
-            logger.debug("sent " + i + " messages using " + connectionFactory.getClass());
-        }
-    }
-
-    public void testCanExhaustSessions() throws Exception {
-        Thread thread = new Thread(new Runnable() {
-            public void run() {
-                try {
-                    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(connectionUri);
-                    Connection connection = connectionFactory.createConnection();
-                    connection.start();
-
-                    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-                    Destination destination = session.createQueue(QUEUE);
-                    MessageConsumer consumer = session.createConsumer(destination);
-                    for (int i = 0; i < NUM_MESSAGES; ++i) {
-                        Message msg = consumer.receive(5000);
-                        if (msg == null) {
-                            return;
-                        }
-                        numReceived++;
-                        if (numReceived % 20 == 0) {
-                            logger.debug("received " + numReceived + " messages ");
-                            System.runFinalization();
-                        }
-                    }
-                } catch (Exception e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        });
-        thread.start();
-
-        sendMessages(pooledFactory);
-        thread.join();
-
-        assertEquals(NUM_MESSAGES, numReceived);
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionTest.java
deleted file mode 100644
index d875f7b..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledSessionTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.pool;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.jms.Session;
-
-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 {
-
-    private BrokerService broker;
-    private ActiveMQConnectionFactory factory;
-    private PooledConnectionFactory pooledFactory;
-    private String connectionUri;
-
-    @Before
-    public void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        TransportConnector connector = broker.addConnector("tcp://localhost:0");
-        broker.start();
-        connectionUri = connector.getPublishableConnectString();
-        factory = new ActiveMQConnectionFactory(connectionUri);
-        pooledFactory = new PooledConnectionFactory(factory);
-        pooledFactory.setMaxConnections(1);
-        pooledFactory.setBlockIfSessionPoolIsFull(false);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
-        broker = null;
-    }
-
-    @Test
-    public void testPooledSessionStats() throws Exception {
-        PooledConnection connection = (PooledConnection) pooledFactory.createConnection();
-
-        assertEquals(0, connection.getNumActiveSessions());
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        assertEquals(1, connection.getNumActiveSessions());
-        session.close();
-        assertEquals(0, connection.getNumActiveSessions());
-        assertEquals(1, connection.getNumtIdleSessions());
-        assertEquals(1, connection.getNumSessions());
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java
deleted file mode 100644
index 7df11f9..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.pool;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.jms.TopicConnection;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-
-import org.apache.activemq.ActiveMQConnection;
-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;
-
-/**
- *
- */
-public class PooledTopicPublisherTest extends TestSupport {
-
-    private TopicConnection connection;
-
-    public void testPooledConnectionFactory() throws Exception {
-        ActiveMQTopic topic = new ActiveMQTopic("test");
-        PooledConnectionFactory pcf = new PooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));
-
-        connection = (TopicConnection) pcf.createConnection();
-        TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-        TopicPublisher publisher = session.createPublisher(topic);
-        publisher.publish(session.createMessage());
-    }
-
-
-    public void testSetGetExceptionListener() throws Exception {
-        PooledConnectionFactory pcf = new PooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));
-
-        connection = (TopicConnection) pcf.createConnection();
-        ExceptionListener listener = new ExceptionListener() {
-            public void onException(JMSException exception) {
-            }
-        };
-        connection.setExceptionListener(listener);
-        assertEquals(listener, connection.getExceptionListener());
-    }
-
-    public void testPooledConnectionAfterInactivity() throws Exception {
-        BrokerService broker = new BrokerService();
-        TransportConnector networkConnector = broker.addConnector("tcp://localhost:0");
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        broker.start();
-
-        SocketProxy proxy = new SocketProxy(networkConnector.getConnectUri());
-
-        PooledConnectionFactory pcf = new PooledConnectionFactory();
-        String uri = proxy.getUrl().toString() + "?trace=true&wireFormat.maxInactivityDuration=500&wireFormat.maxInactivityDurationInitalDelay=500";
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory(uri));
-
-        PooledConnection conn =  (PooledConnection) pcf.createConnection();
-        ActiveMQConnection amq = conn.getConnection();
-        assertNotNull(amq);
-        final CountDownLatch gotException = new CountDownLatch(1);
-        conn.setExceptionListener(new ExceptionListener() {
-            public void onException(JMSException exception) {
-                gotException.countDown();
-            }});
-        conn.setClientID(getName());
-
-        // 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;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java b/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
index 56c4f60..8223f2d 100644
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
+++ b/activemq-pool/src/test/java/org/apache/activemq/pool/XAConnectionPoolTest.java
@@ -18,7 +18,6 @@ package org.apache.activemq.pool;
 
 import java.util.Hashtable;
 import java.util.Vector;
-
 import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
 import javax.jms.QueueSender;
@@ -40,11 +39,11 @@ import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAResource;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.ActiveMQXAConnectionFactory;
 import org.apache.activemq.ActiveMQXASession;
 import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.jms.pool.PooledSession;
 import org.apache.activemq.test.TestSupport;
 
 public class XAConnectionPoolTest extends TestSupport {
@@ -54,7 +53,7 @@ public class XAConnectionPoolTest extends TestSupport {
         final Vector<Synchronization> syncs = new Vector<Synchronization>();
         ActiveMQTopic topic = new ActiveMQTopic("test");
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false"));
+        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test?broker.persistent=false"));
 
         // simple TM that is in a tx and will track syncs
         pcf.setTransactionManager(new TransactionManager(){
@@ -135,8 +134,8 @@ public class XAConnectionPoolTest extends TestSupport {
         TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
 
         assertTrue(session instanceof PooledSession);
-        PooledSession pooledSession = (PooledSession) session;
-        assertTrue(pooledSession.getInternalSession() instanceof ActiveMQXASession);
+//        PooledSession pooledSession = (PooledSession) session;
+//        assertTrue(pooledSession.getInternalSession() instanceof ActiveMQXASession);
 
         TopicPublisher publisher = session.createPublisher(topic);
         publisher.publish(session.createMessage());
@@ -155,7 +154,7 @@ public class XAConnectionPoolTest extends TestSupport {
         final Vector<Synchronization> syncs = new Vector<Synchronization>();
         ActiveMQTopic topic = new ActiveMQTopic("test");
         XaPooledConnectionFactory pcf = new XaPooledConnectionFactory();
-        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test?broker.persistent=false"));
+        pcf.setConnectionFactory(new ActiveMQXAConnectionFactory("vm://test?broker.persistent=false&jms.xaAckMode=" + Session.CLIENT_ACKNOWLEDGE));
 
         // simple TM that is in a tx and will track syncs
         pcf.setTransactionManager(new TransactionManager(){

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/java/org/apache/activemq/pool/bugs/AMQ4441Test.java
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/java/org/apache/activemq/pool/bugs/AMQ4441Test.java b/activemq-pool/src/test/java/org/apache/activemq/pool/bugs/AMQ4441Test.java
deleted file mode 100644
index 0775aa6..0000000
--- a/activemq-pool/src/test/java/org/apache/activemq/pool/bugs/AMQ4441Test.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.apache.activemq.pool.bugs;
-
-import static org.junit.Assert.fail;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.jms.JMSException;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.pool.PooledConnection;
-import org.apache.activemq.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 {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AMQ4441Test.class);
-    private BrokerService broker;
-
-    @Before
-    public void setUp() throws Exception {
-        broker = new BrokerService();
-        broker.setDeleteAllMessagesOnStartup(true);
-        broker.setPersistent(false);
-        broker.setUseJmx(false);
-        broker.start();
-        broker.waitUntilStarted();
-    }
-
-    @After
-    public void stopBroker() throws Exception {
-        broker.stop();
-        broker.waitUntilStopped();
-    }
-
-    @Test(timeout=120000)
-    public void demo() throws JMSException, InterruptedException {
-        final CountDownLatch latch = new CountDownLatch(1);
-        final AtomicBoolean done = new AtomicBoolean(false);
-        final PooledConnectionFactory pooled = new PooledConnectionFactory("vm://localhost?create=false");
-
-        pooled.setMaxConnections(2);
-        pooled.setExpiryTimeout(10L);
-        pooled.start();
-        Thread[] threads = new Thread[10];
-        for (int i = 0; i < threads.length; i++) {
-            threads[i] = new Thread(new Runnable() {
-                @Override
-                public void run() {
-                    while (!done.get() && latch.getCount() > 0) {
-                        try {
-                            final PooledConnection pooledConnection = (PooledConnection) pooled.createConnection();
-                            if (pooledConnection.getConnection() == null) {
-                                LOG.info("Found broken connection.");
-                                latch.countDown();
-                            }
-                            pooledConnection.close();
-                        } catch (JMSException e) {
-                            LOG.warn("Caught Exception", e);
-                        }
-                    }
-                }
-            });
-        }
-        for (Thread thread : threads) {
-            thread.start();
-        }
-
-        if (latch.await(1, TimeUnit.MINUTES)) {
-            fail("A thread obtained broken connection");
-        }
-
-        done.set(true);
-        for (Thread thread : threads) {
-            thread.join();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/resources/activemq-spring-jdbc.xml
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/resources/activemq-spring-jdbc.xml b/activemq-pool/src/test/resources/activemq-spring-jdbc.xml
deleted file mode 100644
index e406d69..0000000
--- a/activemq-pool/src/test/resources/activemq-spring-jdbc.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<!--
-    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.
--->
-<!-- START SNIPPET: example -->
-<beans
-  xmlns="http://www.springframework.org/schema/beans"
-  xmlns:amq="http://activemq.apache.org/schema/core"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd   
-  http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
-
-    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="target/" useJmx="false" deleteAllMessagesOnStartup="true">
-         
-        <persistenceAdapter>
-            <jdbcPersistenceAdapter dataSource="#derby-ds" dataDirectory="target/"/>
-        </persistenceAdapter>
-        
-        <destinationPolicy>
-            <policyMap>
-                <policyEntries>
-                    <policyEntry queue=">" memoryLimit="10240"/>
-                    <policyEntry topic=">" memoryLimit="10240">
-                    </policyEntry>
-                </policyEntries>
-            </policyMap>
-        </destinationPolicy>
-        
-        
-        <systemUsage>
-            <systemUsage>
-                <memoryUsage>
-                    <memoryUsage limit="102400"/>
-                </memoryUsage>
-                <storeUsage>
-                    <storeUsage limit="1 gb" name="foo"/>
-                </storeUsage>
-                <tempUsage>
-                    <tempUsage limit="100 mb"/>
-                </tempUsage>
-            </systemUsage>
-        </systemUsage>
-
-        <transportConnectors>
-            <transportConnector name="openwire" uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
-        </transportConnectors>
-    </broker>
-
-
-    <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
-      <property name="databaseName" value="derbydb"/>
-      <property name="createDatabase" value="create"/>
-    </bean>
-
-</beans>
-<!-- END SNIPPET: example -->

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-pool/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/activemq-pool/src/test/resources/log4j.properties b/activemq-pool/src/test/resources/log4j.properties
deleted file mode 100755
index b42af1a..0000000
--- a/activemq-pool/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out, stdout
-
-log4j.logger.org.apache.activemq.spring=WARN
-#log4j.logger.org.apache.activemq.usecases=DEBUG
-#log4j.logger.org.apache.activemq.broker.region=DEBUG
-log4j.logger.org.apache.activemq.pool=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-spring/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
----------------------------------------------------------------------
diff --git a/activemq-spring/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java b/activemq-spring/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
index 1524f34..afd380f 100644
--- a/activemq-spring/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
+++ b/activemq-spring/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java
@@ -20,7 +20,7 @@ import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.jms.ConnectionFactory;
 import javax.transaction.TransactionManager;
-
+import org.apache.activemq.jms.pool.PooledConnectionFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.FactoryBean;
@@ -38,7 +38,7 @@ import org.springframework.beans.factory.FactoryBean;
  * </bean>
  * </pre>
  *
- * The <code>resourceName</code> property should be used along with the {@link ActiveMQResourceManager} and have
+ * The <code>resourceName</code> property should be used along with the {@link org.apache.activemq.jms.pool.GenericResourceManager} and have
  * the same value than its <code>resourceName</code> property. This will make sure the transaction manager
  * maps correctly the connection factory to the recovery process.
  *

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/activemq-spring/src/test/java/org/apache/bugs/AMQ2754Test.java
----------------------------------------------------------------------
diff --git a/activemq-spring/src/test/java/org/apache/bugs/AMQ2754Test.java b/activemq-spring/src/test/java/org/apache/bugs/AMQ2754Test.java
index 22a2ba0..932f7ca 100644
--- a/activemq-spring/src/test/java/org/apache/bugs/AMQ2754Test.java
+++ b/activemq-spring/src/test/java/org/apache/bugs/AMQ2754Test.java
@@ -39,7 +39,6 @@ import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.core.MessageCreator;
 import org.springframework.jms.listener.DefaultMessageListenerContainer;
-//import org.apache.activemq.pool.PooledConnectionFactory;
 
 public class AMQ2754Test extends TestCase {
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/assembly/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/pom.xml b/assembly/pom.xml
index a11abf1..49f4ab7 100755
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -152,6 +152,14 @@
     </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
+      <artifactId>activemq-jms-pool</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>activemq-pool</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
       <artifactId>activemq-web</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/activemq/blob/b66559ee/assembly/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/assembly/src/main/descriptors/common-bin.xml b/assembly/src/main/descriptors/common-bin.xml
index 82ded4b..f1978f5 100644
--- a/assembly/src/main/descriptors/common-bin.xml
+++ b/assembly/src/main/descriptors/common-bin.xml
@@ -177,6 +177,7 @@
         <include>${pom.groupId}:activemq-jdbc-store</include>
         <include>${pom.groupId}:activemq-leveldb-store</include>
         <include>${pom.groupId}:activemq-log4j-appender</include>
+        <include>${pom.groupId}:activemq-jms-pool</include>
         <include>${pom.groupId}:activemq-pool</include>
         <include>${pom.groupId}:activeio-core</include>
         <include>commons-beanutils:commons-beanutils</include>


Mime
View raw message