Update the test case so that its not dependent on port 61616

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1086378 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-03-28 20:10:41 +00:00
parent 442232514c
commit b0a38ff6c1
1 changed files with 94 additions and 92 deletions

View File

@ -60,6 +60,7 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
public ActiveMQDestination dlqDestination = new ActiveMQQueue("ActiveMQ.DLQ");
public boolean useTextMessage = true;
public boolean useVMCursor = true;
protected String brokerUri;
public static Test suite() {
return suite(ExpiredMessagesTest.class);
@ -72,11 +73,12 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
protected void setUp() throws Exception {
final boolean deleteAllMessages = true;
broker = createBroker(deleteAllMessages, 100);
brokerUri = broker.getTransportConnectors().get(0).getPublishableConnectString();
}
public void testExpiredMessages() throws Exception {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUri);
connection = factory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
producer = session.createProducer(destination);
@ -218,7 +220,7 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
public void testRecoverExpiredMessages() throws Exception {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
"failover://tcp://localhost:61616");
"failover://"+brokerUri);
connection = factory.createConnection();
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -302,7 +304,7 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
policyMap.setDefaultEntry(defaultPolicy);
broker.setDestinationPolicy(policyMap);
broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
broker.addConnector("tcp://localhost:61616");
broker.addConnector("tcp://localhost:0");
broker.start();
broker.waitUntilStarted();
return broker;