From 534dbee4477b3e1ad400e18dfba9541f8da1b5c8 Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Fri, 10 Jun 2016 09:50:59 -0400 Subject: [PATCH] NO-JIRA: Add test to show behavior of non-prefixed addresses that default to Queue. --- .../amqp/interop/AmqpSendReceiveTest.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpSendReceiveTest.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpSendReceiveTest.java index b9dda614a6..e48fef7b0f 100644 --- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpSendReceiveTest.java +++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpSendReceiveTest.java @@ -300,4 +300,70 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport { sender.close(); connection.close(); } + + @Test(timeout = 60000) + public void testSendMessageToQueueNoPrefixReceiveWithPrefix() throws Exception { + AmqpClient client = createAmqpClient(); + AmqpConnection connection = client.connect(); + AmqpSession session = connection.createSession(); + + AmqpSender sender = session.createSender(getTestName()); + AmqpMessage message = new AmqpMessage(); + + message.setText("Test-Message"); + + sender.send(message); + + QueueViewMBean queueView = getProxyToQueue(getTestName()); + assertEquals(1, queueView.getQueueSize()); + sender.close(); + + AmqpReceiver receiver = session.createReceiver("queue://" + getTestName()); + + assertEquals(1, queueView.getQueueSize()); + assertEquals(0, queueView.getDispatchCount()); + + receiver.flow(1); + AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS); + assertNotNull(received); + received.accept(); + receiver.close(); + + assertEquals(0, queueView.getQueueSize()); + + connection.close(); + } + + @Test(timeout = 60000) + public void testSendMessageToQueueWithPrefixReceiveWithNoPrefix() throws Exception { + AmqpClient client = createAmqpClient(); + AmqpConnection connection = client.connect(); + AmqpSession session = connection.createSession(); + + AmqpSender sender = session.createSender("queue://" + getTestName()); + AmqpMessage message = new AmqpMessage(); + + message.setText("Test-Message"); + + sender.send(message); + + QueueViewMBean queueView = getProxyToQueue(getTestName()); + assertEquals(1, queueView.getQueueSize()); + sender.close(); + + AmqpReceiver receiver = session.createReceiver(getTestName()); + + assertEquals(1, queueView.getQueueSize()); + assertEquals(0, queueView.getDispatchCount()); + + receiver.flow(1); + AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS); + assertNotNull(received); + received.accept(); + receiver.close(); + + assertEquals(0, queueView.getQueueSize()); + + connection.close(); + } }