mirror of
https://github.com/apache/activemq.git
synced 2025-02-17 07:24:51 +00:00
NO-JIRA: Add a delay to fail in case an async operation has not fully
created the DLQ yet.
This commit is contained in:
parent
4c1a6b4c2b
commit
8be1486508
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
@ -37,13 +37,12 @@ import org.apache.activemq.broker.region.RegionBroker;
|
||||
import org.apache.activemq.broker.region.policy.DeadLetterStrategy;
|
||||
import org.apache.activemq.broker.region.policy.PolicyEntry;
|
||||
import org.apache.activemq.broker.region.policy.PolicyMap;
|
||||
import org.apache.activemq.util.Wait;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class DeadLetterTestSupport extends TestSupport {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DeadLetterTestSupport.class);
|
||||
|
||||
protected int messageCount = 10;
|
||||
@ -62,6 +61,7 @@ public abstract class DeadLetterTestSupport extends TestSupport {
|
||||
protected int acknowledgeMode = Session.CLIENT_ACKNOWLEDGE;
|
||||
protected Destination destination;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
broker = createBroker();
|
||||
@ -77,6 +77,7 @@ public abstract class DeadLetterTestSupport extends TestSupport {
|
||||
return toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
@ -127,9 +128,20 @@ public abstract class DeadLetterTestSupport extends TestSupport {
|
||||
verifyIsDlq((Queue) dlqDestination);
|
||||
}
|
||||
|
||||
protected void verifyIsDlq(Queue dlqQ) throws Exception {
|
||||
final QueueViewMBean queueViewMBean = getProxyToQueue(dlqQ.getQueueName());
|
||||
assertTrue("is dlq", queueViewMBean.isDLQ());
|
||||
protected void verifyIsDlq(final Queue dlqQ) throws Exception {
|
||||
assertTrue("Need to verify a DLQ exists: " + dlqQ.getQueueName(), Wait.waitFor(new Wait.Condition() {
|
||||
|
||||
@Override
|
||||
public boolean isSatisified() throws Exception {
|
||||
QueueViewMBean dlqView = null;
|
||||
try {
|
||||
dlqView = getProxyToQueue(dlqQ.getQueueName());
|
||||
} catch (Throwable error) {
|
||||
}
|
||||
|
||||
return dlqView != null ? dlqView.isDLQ() : false;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
protected void sendMessages() throws JMSException {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
@ -35,10 +35,8 @@ import org.apache.activemq.command.ActiveMQTopic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class IndividualDeadLetterTest extends DeadLetterTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(IndividualDeadLetterTest.class);
|
||||
|
||||
@Override
|
||||
@ -99,7 +97,6 @@ public class IndividualDeadLetterTest extends DeadLetterTest {
|
||||
Queue testQueue = new ActiveMQQueue("ActiveMQ.DLQ.Queue.ActiveMQ.DLQ.Queue." + getClass().getName() + "." + getName());
|
||||
MessageConsumer testConsumer = session.createConsumer(testQueue);
|
||||
assertNull("The message shouldn't be sent to another DLQ", testConsumer.receive(1000));
|
||||
|
||||
}
|
||||
|
||||
protected void browseDlq() throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user