From 069a5676f1687730192fa31b5e9bcb19c1563ab9 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Mon, 24 Dec 2007 09:42:25 +0000 Subject: [PATCH] multiple paths try to re-start the broker with vm:// trapnsport - changed URI to tcp:// git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@606682 13f79535-47bb-0310-9956-ffa450edef68 --- .../usecases/ReliableReconnectTest.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/ReliableReconnectTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/ReliableReconnectTest.java index 9642730a83..000e72cf01 100755 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/ReliableReconnectTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/ReliableReconnectTest.java @@ -34,6 +34,8 @@ import javax.jms.Topic; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerFactory; import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.store.PersistenceAdapter; +import org.apache.activemq.store.amq.AMQPersistenceAdapter; import org.apache.activemq.test.TestSupport; import org.apache.activemq.util.IdGenerator; @@ -43,7 +45,7 @@ import org.apache.activemq.util.IdGenerator; public class ReliableReconnectTest extends TestSupport { protected static final int MESSAGE_COUNT = 100; - protected static final String DEFAULT_BROKER_URL = "vm://localhost"; + protected static final String DEFAULT_BROKER_URL = ActiveMQConnectionFactory.DEFAULT_BROKER_URL; private static final int RECEIVE_TIMEOUT = 10000; protected int deliveryMode = DeliveryMode.PERSISTENT; @@ -80,10 +82,17 @@ public class ReliableReconnectTest extends TestSupport { return new ActiveMQConnectionFactory(url); } - protected void startBroker() throws JMSException { + protected void startBroker(boolean deleteOnStart) throws JMSException { try { broker = BrokerFactory.createBroker(new URI("broker://()/localhost")); broker.setUseShutdownHook(false); + broker.setDeleteAllMessagesOnStartup(deleteOnStart); + + broker.setUseJmx(false); + PersistenceAdapter adaptor = broker.getPersistenceAdapter(); + if (adaptor instanceof AMQPersistenceAdapter) { + ((AMQPersistenceAdapter)adaptor).setDisableLocking(true); + } broker.addConnector(DEFAULT_BROKER_URL); broker.start(); } catch (Exception e) { @@ -143,7 +152,7 @@ public class ReliableReconnectTest extends TestSupport { } public void testReconnect() throws Exception { - startBroker(); + startBroker(true); // register an interest as a durable subscriber Connection consumerConnection = createConsumerConnection(); createConsumer(consumerConnection); @@ -168,7 +177,7 @@ public class ReliableReconnectTest extends TestSupport { } // System.err.println("Stopping broker"); broker.stop(); - startBroker(); + startBroker(false); // System.err.println("Started Broker again"); synchronized (messagesReceived) { if (messagesReceived.get() < MESSAGE_COUNT) {