ARTEMIS-1068 Add Routing Exclusivity test for JMS AMQP

This commit is contained in:
Martyn Taylor 2017-03-24 16:05:18 +00:00 committed by Clebert Suconic
parent 91ee5272bd
commit a9c3e437d8
3 changed files with 45 additions and 2 deletions

View File

@ -79,6 +79,7 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.activemq.artemis.utils.ByteUtil;
import org.apache.activemq.artemis.utils.TimeUtils;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.VersionLoader;
import org.apache.activemq.transport.amqp.client.AmqpClient;
import org.apache.activemq.transport.amqp.client.AmqpConnection;
@ -1855,6 +1856,50 @@ public class ProtonTest extends ProtonTestBase {
}
}
/**
* If we have an address configured with both ANYCAST and MULTICAST routing types enabled, we must ensure that any
* messages sent specifically to MULTICAST (e.g. JMS TopicProducer) are only delivered to MULTICAST queues (e.g.
* i.e. subscription queues) and **NOT** to ANYCAST queues (e.g. JMS Queue).
*
* @throws Exception
*/
@Test
public void testRoutingExclusivity() throws Exception {
// Create Address with both ANYCAST and MULTICAST enabled
String testAddress = "testRoutingExclusivity";
SimpleString ssTestAddress = new SimpleString(testAddress);
AddressInfo addressInfo = new AddressInfo(ssTestAddress);
addressInfo.addRoutingType(RoutingType.MULTICAST);
addressInfo.addRoutingType(RoutingType.ANYCAST);
server.addAddressInfo(addressInfo);
server.createQueue(ssTestAddress, RoutingType.ANYCAST, ssTestAddress, null, true, false);
Connection connection = createConnection(UUIDGenerator.getInstance().generateStringUUID());
try {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic(testAddress);
javax.jms.Queue queue = session.createQueue(testAddress);
MessageProducer producer = session.createProducer(topic);
MessageConsumer queueConsumer = session.createConsumer(queue);
MessageConsumer topicConsumer = session.createConsumer(topic);
producer.send(session.createTextMessage("testMessage"));
assertNotNull(topicConsumer.receive(1000));
assertNull(queueConsumer.receive(1000));
} finally {
connection.close();
}
}
@Test
public void testReleaseDisposition() throws Exception {
AmqpClient client = new AmqpClient(new URI(tcpAmqpConnectionUri), userName, password);

View File

@ -28,7 +28,6 @@ import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
import org.apache.activemq.artemis.api.core.ICoreMessage;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.RefCountMessage;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;

View File

@ -19,7 +19,6 @@ package org.apache.activemq.artemis.tests.integration.client;
import java.util.HashSet;
import java.util.Set;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage;