Turn off JMX for these tests to avoid instance already exists exceptions when creating a brokerService.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1178622 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-10-03 22:32:54 +00:00
parent e6254c2f8a
commit 26b69e42bf
3 changed files with 21 additions and 18 deletions

View File

@ -34,6 +34,7 @@ public class ConnectionExpiryEvictsFromPoolTest extends TestSupport {
protected void setUp() throws Exception {
broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistent(false);
TransportConnector connector = broker.addConnector("tcp://localhost:0");
broker.start();
@ -46,32 +47,32 @@ public class ConnectionExpiryEvictsFromPoolTest extends TestSupport {
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));
}
protected void tearDown() throws Exception {
broker.stop();
}

View File

@ -44,6 +44,7 @@ public class ConnectionFailureEvictsFromPoolTest extends TestSupport {
protected void setUp() throws Exception {
broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistent(false);
TransportConnector connector = broker.addConnector("tcp://localhost:0");
broker.start();
@ -68,7 +69,7 @@ public class ConnectionFailureEvictsFromPoolTest extends TestSupport {
public void transportResumed() {
}
});
sendMessage(connection);
LOG.info("sent one message worked fine");
createConnectionFailure(connection);

View File

@ -42,6 +42,7 @@ public class PooledConnectionFactoryWithTemporaryDestinationsTest extends TestSu
protected void setUp() throws Exception {
broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistent(false);
TransportConnector connector = broker.addConnector("tcp://localhost:0");
broker.start();
@ -60,29 +61,29 @@ public class PooledConnectionFactoryWithTemporaryDestinationsTest extends TestSu
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());
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();
pooledConnection2.close();
assertEquals(1, countBrokerTemporaryQueues());
// after closing pooledConnection, where we created the temp queue, there should
// after closing pooledConnection, where we created the temp queue, there should
// be no temp queues left
pooledConnection.close();
pooledConnection.close();
assertEquals(0, countBrokerTemporaryQueues());
}
public void testTemporaryQueueLeakAfterConnectionClose() throws Exception {
Connection pooledConnection = null;
Session session = null;