no-jira - fix flaky test that depends on the broker processing the previous ack

This commit is contained in:
gtully 2018-10-22 11:50:54 +01:00
parent 0e02b678d1
commit 87087fc930
1 changed files with 9 additions and 0 deletions

View File

@ -32,6 +32,7 @@ import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
import org.apache.activemq.broker.region.policy.SharedDeadLetterStrategy;
import org.apache.activemq.broker.util.RedeliveryPlugin;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.util.Wait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -160,6 +161,14 @@ public class BrokerRedeliveryTest extends org.apache.activemq.TestSupport {
assertNotNull("got message", message);
message.acknowledge();
Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
// wait for ack to be processes
LOG.info("Total message count: " + broker.getAdminView().getTotalMessageCount());
return broker.getAdminView().getTotalMessageCount() == 0;
}
});
// send it again
// should go to dlq as a duplicate from the store
producerConnection.getTransport().request(message);