ARTEMIS-740 Test on redeployment divert

This commit is contained in:
Clebert Suconic 2016-09-21 17:07:02 -04:00
parent 589adbccac
commit 911ec30be1
2 changed files with 21 additions and 0 deletions

View File

@ -20,6 +20,7 @@ package org.apache.activemq.artemis.tests.integration.jms;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import java.net.URL;
@ -75,6 +76,18 @@ public class RedeployTest extends ActiveMQTestBase {
Assert.assertEquals("jms.queue.NewQueue", embeddedJMS.getActiveMQServer().getAddressSettingsRepository().getMatch("jms").getDeadLetterAddress().toString());
Assert.assertEquals("jms.queue.NewQueue", embeddedJMS.getActiveMQServer().getAddressSettingsRepository().getMatch("jms").getExpiryAddress().toString());
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
try (Connection connection = factory.createConnection()) {
Session session = connection.createSession();
Queue queue = session.createQueue("DivertQueue");
MessageProducer producer = session.createProducer(queue);
producer.send(session.createTextMessage("text"));
connection.start();
MessageConsumer consumer = session.createConsumer(session.createQueue("NewQueue"));
Assert.assertNotNull("Divert wasn't redeployed accordingly", consumer.receive(5000));
}
}
finally {
embeddedJMS.stop();

View File

@ -26,6 +26,7 @@ under the License.
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
<queue name="NewQueue"/>
<queue name="DivertQueue"/>
</jms>
@ -83,6 +84,13 @@ under the License.
</acceptors>
<diverts>
<divert name="myDivert">
<address>jms.queue.DivertQueue</address>
<forwarding-address>jms.queue.NewQueue</forwarding-address>
</divert>
</diverts>
<security-settings>
<security-setting match="#">