mirror of https://github.com/apache/activemq.git
Update test to not use a static port for the broker Uri. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1303113 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
926fdd7e92
commit
1419103c18
|
@ -49,6 +49,7 @@ public class DurableSubSelectorDelayTest {
|
||||||
|
|
||||||
private BrokerService broker;
|
private BrokerService broker;
|
||||||
private ActiveMQTopic topic;
|
private ActiveMQTopic topic;
|
||||||
|
private String connectionUri;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProcess() throws Exception {
|
public void testProcess() throws Exception {
|
||||||
|
@ -67,12 +68,7 @@ public class DurableSubSelectorDelayTest {
|
||||||
msgProducer.join();
|
msgProducer.join();
|
||||||
|
|
||||||
for (int j = 0; j < subscribers.length; j++) {
|
for (int j = 0; j < subscribers.length; j++) {
|
||||||
|
|
||||||
LOG.info("Unsubscribing subscriber " + subscribers[j]);
|
LOG.info("Unsubscribing subscriber " + subscribers[j]);
|
||||||
|
|
||||||
// broker.getAdminView().destroyDurableSubscriber(clientID,
|
|
||||||
// Client.SUBSCRIPTION_NAME);
|
|
||||||
|
|
||||||
subscribers[j].unsubscribe();
|
subscribers[j].unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,9 +165,7 @@ public class DurableSubSelectorDelayTest {
|
||||||
*/
|
*/
|
||||||
private final class DurableSubscriber {
|
private final class DurableSubscriber {
|
||||||
|
|
||||||
String url = "tcp://localhost:61656";
|
final ConnectionFactory cf = new ActiveMQConnectionFactory(connectionUri);
|
||||||
|
|
||||||
final ConnectionFactory cf = new ActiveMQConnectionFactory(url);
|
|
||||||
|
|
||||||
private final String subName ;
|
private final String subName ;
|
||||||
|
|
||||||
|
@ -194,13 +188,10 @@ public class DurableSubSelectorDelayTest {
|
||||||
Connection con = openConnection();
|
Connection con = openConnection();
|
||||||
|
|
||||||
Session sess = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
Session sess = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
MessageConsumer consumer = sess.createDurableSubscriber(topic, subName, selector, false);
|
||||||
|
|
||||||
|
|
||||||
MessageConsumer consumer = sess.createDurableSubscriber(topic,
|
|
||||||
subName, selector, false);
|
|
||||||
|
|
||||||
//MessageConsumer consumer = sess.createDurableSubscriber(topic,SUBSCRIPTION_NAME);
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
long max = end - System.currentTimeMillis();
|
long max = end - System.currentTimeMillis();
|
||||||
|
|
||||||
|
@ -209,14 +200,16 @@ public class DurableSubSelectorDelayTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
Message message = consumer.receive(max);
|
Message message = consumer.receive(max);
|
||||||
if (message == null)
|
if (message == null) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
LOG.info("Received Trans[id="
|
LOG.info("Received Trans[id="
|
||||||
+ message.getIntProperty("TRANS") + ", count="
|
+ message.getIntProperty("TRANS") + ", count="
|
||||||
+ transCount + "] in " + this + ".");
|
+ transCount + "] in " + this + ".");
|
||||||
|
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
sess.close();
|
sess.close();
|
||||||
con.close();
|
con.close();
|
||||||
|
@ -281,7 +274,7 @@ public class DurableSubSelectorDelayTest {
|
||||||
kahadb.setJournalMaxFileLength( 500 * 1024);
|
kahadb.setJournalMaxFileLength( 500 * 1024);
|
||||||
broker.setPersistenceAdapter(kahadb);
|
broker.setPersistenceAdapter(kahadb);
|
||||||
|
|
||||||
broker.addConnector("tcp://localhost:61656");
|
connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();
|
||||||
|
|
||||||
broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
|
broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
|
||||||
broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024);
|
broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024);
|
||||||
|
|
Loading…
Reference in New Issue