Update test so that its not using a fixed port for the brokerUri.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1239283 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-02-01 19:37:29 +00:00
parent 179d95e7be
commit e25e5dee86
1 changed files with 8 additions and 4 deletions

View File

@ -59,11 +59,13 @@ public class TempStorageBlockedBrokerTest extends TestSupport {
Destination destination = new ActiveMQTopic("FooTwo"); Destination destination = new ActiveMQTopic("FooTwo");
private String connectionUri;
public void testRunProducerWithHungConsumer() throws Exception { public void testRunProducerWithHungConsumer() throws Exception {
final long origTempUsage = broker.getSystemUsage().getTempUsage().getUsage(); final long origTempUsage = broker.getSystemUsage().getTempUsage().getUsage();
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61618"); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionUri);
// ensure messages are spooled to disk for this consumer // ensure messages are spooled to disk for this consumer
ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy(); ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
prefetch.setTopicPrefetch(10); prefetch.setTopicPrefetch(10);
@ -107,7 +109,7 @@ public class TempStorageBlockedBrokerTest extends TestSupport {
producingThread.start(); producingThread.start();
assertTrue("producer has sent 10 in a reasonable time", producerHasSentTenMessages.await(30, TimeUnit.SECONDS)); assertTrue("producer has sent 10 in a reasonable time", producerHasSentTenMessages.await(30, TimeUnit.SECONDS));
int count = 0; int count = 0;
Message m = null; Message m = null;
@ -169,7 +171,7 @@ public class TempStorageBlockedBrokerTest extends TestSupport {
broker.getSystemUsage().setSendFailIfNoSpace(true); broker.getSystemUsage().setSendFailIfNoSpace(true);
destination = new ActiveMQQueue("Foo"); destination = new ActiveMQQueue("Foo");
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61618"); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionUri);
final ActiveMQConnection producerConnection = (ActiveMQConnection) factory.createConnection(); final ActiveMQConnection producerConnection = (ActiveMQConnection) factory.createConnection();
// so we can easily catch the ResourceAllocationException on send // so we can easily catch the ResourceAllocationException on send
producerConnection.setAlwaysSyncSend(true); producerConnection.setAlwaysSyncSend(true);
@ -247,8 +249,10 @@ public class TempStorageBlockedBrokerTest extends TestSupport {
broker.setDestinationPolicy(policyMap); broker.setDestinationPolicy(policyMap);
broker.setSystemUsage(sysUsage); broker.setSystemUsage(sysUsage);
broker.addConnector("tcp://localhost:61618").setName("Default"); broker.addConnector("tcp://localhost:0").setName("Default");
broker.start(); broker.start();
connectionUri = broker.getTransportConnectors().get(0).getPublishableConnectString();
} }
@Override @Override