From 3fd0eea66704793927b42e88e46c3f08f27f372b Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Fri, 20 Aug 2021 12:56:22 -0500 Subject: [PATCH] ARTEMIS-3438 legacy updateQueue doesn't respect ringSize --- .../impl/ActiveMQServerControlImpl.java | 2 +- .../management/ActiveMQServerControlTest.java | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java index 145a23ad75..3e1a994573 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java @@ -1392,7 +1392,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - final Queue queue = server.updateQueue(name, routingType != null ? RoutingType.valueOf(routingType) : null, filter, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user); + final Queue queue = server.updateQueue(name, routingType != null ? RoutingType.valueOf(routingType) : null, filter, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, ringSize); if (queue == null) { if (AuditLogger.isResourceLoggingEnabled()) { AuditLogger.updateQueueFailure(name, routingType); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index 1e1057508f..24c753108b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -663,6 +663,37 @@ public class ActiveMQServerControlTest extends ManagementTestBase { serverControl.destroyQueue(name.toString()); } + @Test + public void testCreateAndLegacyUpdateQueueRingSize() throws Exception { + SimpleString address = RandomUtil.randomSimpleString(); + SimpleString name = RandomUtil.randomSimpleString(); + + ActiveMQServerControl serverControl = createManagementControl(); + + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(true).toJSON()); + serverControl.updateQueue(name.toString(), + RoutingType.ANYCAST.toString(), + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + 101L); + + QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); + Assert.assertEquals(address.toString(), queueControl.getAddress()); + Assert.assertEquals(name.toString(), queueControl.getName()); + Assert.assertEquals(101, queueControl.getRingSize()); + + serverControl.destroyQueue(name.toString()); + } + @Test public void testGetQueueCount() throws Exception { SimpleString address = RandomUtil.randomSimpleString();