Fix address management to use JSON compatible types
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/806c688e Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/806c688e Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/806c688e Branch: refs/heads/ARTEMIS-780 Commit: 806c688e6ceacc7f2bdf1bba2318f14e79107c24 Parents: 842c5e5 Author: jbertram <[email protected]> Authored: Mon Nov 28 17:29:50 2016 -0600 Committer: jbertram <[email protected]> Committed: Mon Nov 28 17:29:50 2016 -0600 ---------------------------------------------------------------------- .../api/core/management/ActiveMQServerControl.java | 3 +-- .../core/management/impl/ActiveMQServerControlImpl.java | 11 ++++++++--- .../server/management/impl/ManagementServiceImpl.java | 3 ++- .../management/ActiveMQServerControlUsingCoreTest.java | 3 +-- .../apache/activemq/artemis/common/AbstractAdmin.java | 4 +--- 5 files changed, 13 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java index 43e7a4d..f002b5c 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java @@ -18,7 +18,6 @@ package org.apache.activemq.artemis.api.core.management; import javax.management.MBeanOperationInfo; import java.util.Map; -import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException; import org.apache.activemq.artemis.core.server.RoutingType; @@ -438,7 +437,7 @@ public interface ActiveMQServerControl { @Operation(desc = "delete an address", impact = MBeanOperationInfo.ACTION) void createAddress(@Parameter(name = "name", desc = "The name of the address") String name, - @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Set<RoutingType> routingTypes) throws Exception; + @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception; @Operation(desc = "delete an address", impact = MBeanOperationInfo.ACTION) void deleteAddress(@Parameter(name = "name", desc = "The name of the address") String name) throws Exception; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java ---------------------------------------------------------------------- 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 c237b70..c9214f3 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 @@ -36,6 +36,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Date; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -77,9 +78,9 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.ConnectorServiceFactory; import org.apache.activemq.artemis.core.server.Consumer; -import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.core.server.JournalType; import org.apache.activemq.artemis.core.server.Queue; +import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.core.server.ServerConsumer; import org.apache.activemq.artemis.core.server.ServerSession; import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; @@ -563,12 +564,16 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active @Override public void createAddress(@Parameter(name = "name", desc = "The name of the address") String name, - @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Set<RoutingType> routingTypes) throws Exception { + @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception { checkStarted(); clearIO(); try { - server.createAddressInfo(new AddressInfo(new SimpleString(name), routingTypes)); + Set<RoutingType> set = new HashSet<>(); + for (Object routingType : routingTypes) { + set.add(RoutingType.valueOf(routingType.toString())); + } + server.createAddressInfo(new AddressInfo(new SimpleString(name), set)); } finally { blockOnIO(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java index 61365c7..b736c42 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java @@ -719,7 +719,8 @@ public class ManagementServiceImpl implements ManagementService { paramTypes[i] == Long.TYPE && params[i].getClass() == Long.class || paramTypes[i] == Double.TYPE && params[i].getClass() == Double.class || paramTypes[i] == Integer.TYPE && params[i].getClass() == Integer.class || - paramTypes[i] == Boolean.TYPE && params[i].getClass() == Boolean.class) { + paramTypes[i] == Boolean.TYPE && params[i].getClass() == Boolean.class || + paramTypes[i] == Object[].class && params[i].getClass() == Object[].class) { // parameter match } else { match = false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java index 3dc5fb2..7508a37 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java @@ -17,7 +17,6 @@ package org.apache.activemq.artemis.tests.integration.management; import java.util.Map; -import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException; import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl; @@ -567,7 +566,7 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes @Override public void createAddress(@Parameter(name = "name", desc = "The name of the address") String name, - @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Set<RoutingType> routingTypes) throws Exception { + @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception { } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java ---------------------------------------------------------------------- diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java index bbe99fc..8ea7828 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java @@ -34,7 +34,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.management.ManagementHelper; import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; -import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; import org.objectweb.jtests.jms.admin.Admin; @@ -148,9 +147,8 @@ public class AbstractAdmin implements Admin { @Override public void createTopic(final String name) { - Boolean result; try { - invokeSyncOperation(ResourceNames.BROKER, "createAddress", name, (int) RoutingType.MULTICAST.getType(), false, -1); + invokeSyncOperation(ResourceNames.BROKER, "createAddress", name, new Object[]{"MULTICAST"}); } catch (Exception e) { throw new IllegalStateException(e); }
