diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java index 71780e96a1..4dd95db42c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java @@ -1329,6 +1329,63 @@ public class QueueControlTest extends ManagementTestBase { session.deleteQueue(otherQueue); } + /** + * Moving message from another address to a single "child" queue of a multicast address + * + *
+ * + * + * + *
+ *
+ * + * + * + * + *
+ */ + @Test + public void testMoveMessageToFQQN() throws Exception { + SimpleString address = new SimpleString("ErrorQueue"); + SimpleString queue = new SimpleString("ErrorQueue"); + SimpleString otherAddress = new SimpleString("parent.addr.1"); + SimpleString otherQueue1 = new SimpleString("child.queue.1"); + SimpleString otherQueue2 = new SimpleString("child.queue.2"); + + session.createQueue(address, RoutingType.ANYCAST, queue, null, durable); + session.createQueue(otherAddress, RoutingType.MULTICAST, otherQueue1, null, durable); + session.createQueue(otherAddress, RoutingType.MULTICAST, otherQueue2, null, durable); + ClientProducer producer = session.createProducer(address); + + producer.send(session.createMessage(durable)); + producer.send(session.createMessage(durable)); + + QueueControl queueControl = createManagementControl(address, queue, RoutingType.ANYCAST); + QueueControl otherQueue1Control = createManagementControl(otherAddress, otherQueue1); + QueueControl otherQueue2Control = createManagementControl(otherAddress, otherQueue2); + assertMessageMetrics(queueControl, 2, durable); + assertMessageMetrics(otherQueue1Control, 0, durable); + assertMessageMetrics(otherQueue2Control, 0, durable); + + // the message IDs are set on the server + Map[] messages = queueControl.listMessages(null); + Assert.assertEquals(2, messages.length); + long messageID = (Long) messages[0].get("messageID"); + + boolean moved = queueControl.moveMessage(messageID, otherQueue1.toString()); + Assert.assertTrue(moved); + assertMessageMetrics(queueControl, 1, durable); + assertMessageMetrics(otherQueue1Control, 1, durable); + assertMessageMetrics(otherQueue2Control, 0, durable); + + consumeMessages(1, session, queue); + consumeMessages(1, session, otherQueue1); + + session.deleteQueue(queue); + session.deleteQueue(otherQueue1); + session.deleteQueue(otherQueue2); + } + @Test public void testMoveMessageToUnknownQueue() throws Exception { SimpleString address = RandomUtil.randomSimpleString();