mirror of https://github.com/apache/activemq.git
StompTest - make it run more reliable on slower machines
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1442537 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8d560fe39a
commit
a57108cfa6
|
@ -1491,7 +1491,7 @@ public class StompTest extends StompTestSupport {
|
||||||
String domain = "org.apache.activemq";
|
String domain = "org.apache.activemq";
|
||||||
ObjectName brokerName = new ObjectName(domain + ":type=Broker,brokerName=localhost");
|
ObjectName brokerName = new ObjectName(domain + ":type=Broker,brokerName=localhost");
|
||||||
|
|
||||||
BrokerViewMBean view = (BrokerViewMBean)
|
final BrokerViewMBean view = (BrokerViewMBean)
|
||||||
brokerService.getManagementContext().newProxyInstance(brokerName, BrokerViewMBean.class, true);
|
brokerService.getManagementContext().newProxyInstance(brokerName, BrokerViewMBean.class, true);
|
||||||
|
|
||||||
// connect
|
// connect
|
||||||
|
@ -1505,17 +1505,22 @@ public class StompTest extends StompTestSupport {
|
||||||
// subscribe
|
// subscribe
|
||||||
frame = "SUBSCRIBE\n" + "destination:/topic/" + getQueueName() + "\n" + "ack:auto\nactivemq.subscriptionName:test\n\n" + Stomp.NULL;
|
frame = "SUBSCRIBE\n" + "destination:/topic/" + getQueueName() + "\n" + "ack:auto\nactivemq.subscriptionName:test\n\n" + Stomp.NULL;
|
||||||
stompConnection.sendFrame(frame);
|
stompConnection.sendFrame(frame);
|
||||||
|
|
||||||
// wait a bit for MBean to get refreshed
|
// wait a bit for MBean to get refreshed
|
||||||
try {
|
Wait.waitFor(new Wait.Condition(){
|
||||||
Thread.sleep(400);
|
@Override
|
||||||
} catch (InterruptedException e){}
|
public boolean isSatisified() throws Exception {
|
||||||
|
return view.getDurableTopicSubscribers().length == 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
assertEquals(view.getDurableTopicSubscribers().length, 1);
|
assertEquals(view.getDurableTopicSubscribers().length, 1);
|
||||||
|
|
||||||
// disconnect
|
// disconnect
|
||||||
frame = "DISCONNECT\nclient-id:test\n\n" + Stomp.NULL;
|
frame = "DISCONNECT\nclient-id:test\n\n" + Stomp.NULL;
|
||||||
stompConnection.sendFrame(frame);
|
stompConnection.sendFrame(frame);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(400);
|
Thread.sleep(2000);
|
||||||
} catch (InterruptedException e){}
|
} catch (InterruptedException e){}
|
||||||
|
|
||||||
//reconnect
|
//reconnect
|
||||||
|
@ -1531,9 +1536,14 @@ public class StompTest extends StompTestSupport {
|
||||||
stompConnection.sendFrame(frame);
|
stompConnection.sendFrame(frame);
|
||||||
frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
|
frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
|
||||||
stompConnection.sendFrame(frame);
|
stompConnection.sendFrame(frame);
|
||||||
try {
|
|
||||||
Thread.sleep(400);
|
Wait.waitFor(new Wait.Condition(){
|
||||||
} catch (InterruptedException e){}
|
@Override
|
||||||
|
public boolean isSatisified() throws Exception {
|
||||||
|
return view.getDurableTopicSubscribers().length == 0 && view.getInactiveDurableTopicSubscribers().length == 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
assertEquals(view.getDurableTopicSubscribers().length, 0);
|
assertEquals(view.getDurableTopicSubscribers().length, 0);
|
||||||
assertEquals(view.getInactiveDurableTopicSubscribers().length, 0);
|
assertEquals(view.getInactiveDurableTopicSubscribers().length, 0);
|
||||||
}
|
}
|
||||||
|
@ -1677,7 +1687,7 @@ public class StompTest extends StompTestSupport {
|
||||||
sendMessage("message 4");
|
sendMessage("message 4");
|
||||||
sendMessage("message 5");
|
sendMessage("message 5");
|
||||||
|
|
||||||
StompFrame frame = stompConnection.receive();
|
StompFrame frame = stompConnection.receive(20000);
|
||||||
assertEquals(frame.getBody(), "message 1");
|
assertEquals(frame.getBody(), "message 1");
|
||||||
|
|
||||||
stompConnection.begin("tx1");
|
stompConnection.begin("tx1");
|
||||||
|
@ -1703,18 +1713,18 @@ public class StompTest extends StompTestSupport {
|
||||||
stompConnection.ack(frame, "tx2");
|
stompConnection.ack(frame, "tx2");
|
||||||
stompConnection.ack(frame1, "tx2");
|
stompConnection.ack(frame1, "tx2");
|
||||||
|
|
||||||
StompFrame frame3 = stompConnection.receive();
|
StompFrame frame3 = stompConnection.receive(20000);
|
||||||
assertEquals(frame3.getBody(), "message 3");
|
assertEquals(frame3.getBody(), "message 3");
|
||||||
stompConnection.ack(frame3, "tx2");
|
stompConnection.ack(frame3, "tx2");
|
||||||
|
|
||||||
StompFrame frame4 = stompConnection.receive();
|
StompFrame frame4 = stompConnection.receive(20000);
|
||||||
assertEquals(frame4.getBody(), "message 4");
|
assertEquals(frame4.getBody(), "message 4");
|
||||||
stompConnection.ack(frame4, "tx2");
|
stompConnection.ack(frame4, "tx2");
|
||||||
|
|
||||||
stompConnection.commit("tx2");
|
stompConnection.commit("tx2");
|
||||||
|
|
||||||
stompConnection.begin("tx3");
|
stompConnection.begin("tx3");
|
||||||
StompFrame frame5 = stompConnection.receive();
|
StompFrame frame5 = stompConnection.receive(20000);
|
||||||
assertEquals(frame5.getBody(), "message 5");
|
assertEquals(frame5.getBody(), "message 5");
|
||||||
stompConnection.ack(frame5, "tx3");
|
stompConnection.ack(frame5, "tx3");
|
||||||
stompConnection.commit("tx3");
|
stompConnection.commit("tx3");
|
||||||
|
@ -2317,7 +2327,7 @@ public class StompTest extends StompTestSupport {
|
||||||
|
|
||||||
stompConnection.sendFrame(frame);
|
stompConnection.sendFrame(frame);
|
||||||
|
|
||||||
sframe = stompConnection.receive(30000);
|
sframe = stompConnection.receive(60000);
|
||||||
assertNotNull(sframe);
|
assertNotNull(sframe);
|
||||||
assertEquals("MESSAGE", sframe.getAction());
|
assertEquals("MESSAGE", sframe.getAction());
|
||||||
assertEquals(bigBody, sframe.getBody());
|
assertEquals(bigBody, sframe.getBody());
|
||||||
|
|
Loading…
Reference in New Issue