From cb4d2e046e66070bd5ba6b9e3c342144be6da5b4 Mon Sep 17 00:00:00 2001 From: jbertram Date: Thu, 11 Jun 2015 16:05:34 -0500 Subject: [PATCH] ARTEMIS-109 restore optional divert routing name --- .../core/config/DivertConfiguration.java | 9 ++++++++- .../management/ActiveMQServerControlTest.java | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java index b22239a50c..4f35477330 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java @@ -92,7 +92,14 @@ public class DivertConfiguration implements Serializable */ public DivertConfiguration setRoutingName(final String routingName) { - this.routingName = routingName; + if (routingName == null) + { + this.routingName = UUIDGenerator.getInstance().generateStringUUID(); + } + else + { + this.routingName = routingName; + } return this; } 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 6310458232..51c5c3ee68 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 @@ -657,6 +657,23 @@ public class ActiveMQServerControlTest extends ManagementTestBase } + @Test + public void testNullRouteNameOnDivert() throws Exception + { + String address = RandomUtil.randomString(); + String name = RandomUtil.randomString(); + String forwardingAddress = RandomUtil.randomString(); + + ActiveMQServerControl serverControl = createManagementControl(); + + checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name)); + assertEquals(0, serverControl.getDivertNames().length); + + serverControl.createDivert(name.toString(), null, address, forwardingAddress, true, null, null); + + checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name)); + } + @Test public void testCreateAndDestroyDivert() throws Exception {