fix timing issue with test, fails under load

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1296368 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-03-02 18:31:45 +00:00
parent 9b7347087d
commit d2f8eded57
1 changed files with 17 additions and 6 deletions

View File

@ -39,6 +39,7 @@ import org.apache.activemq.broker.region.policy.StorePendingDurableSubscriberMes
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.util.Wait;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -119,16 +120,26 @@ abstract public class MessagePriorityTest extends CombinationTestSupport {
} }
public void testStoreConfigured() throws Exception { public void testStoreConfigured() throws Exception {
Queue queue = sess.createQueue("TEST"); final Queue queue = sess.createQueue("TEST");
Topic topic = sess.createTopic("TEST"); final Topic topic = sess.createTopic("TEST");
MessageProducer queueProducer = sess.createProducer(queue); MessageProducer queueProducer = sess.createProducer(queue);
MessageProducer topicProducer = sess.createProducer(topic); MessageProducer topicProducer = sess.createProducer(topic);
Wait.waitFor(new Wait.Condition() {
Thread.sleep(500); // get it all propagated @Override
public boolean isSatisified() throws Exception {
return broker.getRegionBroker().getDestinationMap().get(queue) != null;
}
});
assertTrue(broker.getRegionBroker().getDestinationMap().get(queue).getMessageStore().isPrioritizedMessages()); assertTrue(broker.getRegionBroker().getDestinationMap().get(queue).getMessageStore().isPrioritizedMessages());
Wait.waitFor(new Wait.Condition(){
@Override
public boolean isSatisified() throws Exception {
return broker.getRegionBroker().getDestinationMap().get(topic) != null;
}
});
assertTrue(broker.getRegionBroker().getDestinationMap().get(topic).getMessageStore().isPrioritizedMessages()); assertTrue(broker.getRegionBroker().getDestinationMap().get(topic).getMessageStore().isPrioritizedMessages());
queueProducer.close(); queueProducer.close();