You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by an...@apache.org on 2016/11/09 13:13:41 UTC
[5/6] activemq-artemis git commit: removal of all JMS control objects
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/SubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/SubscriptionInfo.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/SubscriptionInfo.java
deleted file mode 100644
index eee2667..0000000
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/SubscriptionInfo.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.api.jms.management;
-
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-
-import org.apache.activemq.artemis.api.core.JsonUtil;
-
-/**
- * Helper class to create Java Objects from the
- * JSON serialization returned by {@link TopicControl#listAllSubscriptionsAsJSON()} and related methods.
- */
-public class SubscriptionInfo {
-
- private final String queueName;
-
- private final String clientID;
-
- private final String name;
-
- private final boolean durable;
-
- private final String selector;
-
- private final int messageCount;
-
- private final int deliveringCount;
-
- // Static --------------------------------------------------------
-
- /**
- * Returns an array of SubscriptionInfo corresponding to the JSON serialization returned
- * by {@link TopicControl#listAllSubscriptionsAsJSON()} and related methods.
- */
- public static SubscriptionInfo[] from(final String jsonString) throws Exception {
- JsonArray array = JsonUtil.readJsonArray(jsonString);
- SubscriptionInfo[] infos = new SubscriptionInfo[array.size()];
- for (int i = 0; i < array.size(); i++) {
- JsonObject sub = array.getJsonObject(i);
- SubscriptionInfo info = new SubscriptionInfo(sub.getString("queueName"), sub.getString("clientID", null), sub.getString("name", null), sub.getBoolean("durable"), sub.getString("selector", null), sub.getInt("messageCount"), sub.getInt("deliveringCount"));
- infos[i] = info;
- }
-
- return infos;
- }
-
- // Constructors --------------------------------------------------
-
- private SubscriptionInfo(final String queueName,
- final String clientID,
- final String name,
- final boolean durable,
- final String selector,
- final int messageCount,
- final int deliveringCount) {
- this.queueName = queueName;
- this.clientID = clientID;
- this.name = name;
- this.durable = durable;
- this.selector = selector;
- this.messageCount = messageCount;
- this.deliveringCount = deliveringCount;
- }
-
- // Public --------------------------------------------------------
-
- /**
- * Returns the name of the ActiveMQ Artemis core queue corresponding to this subscription.
- */
- public String getQueueName() {
- return queueName;
- }
-
- /**
- * Returns the client ID of this subscription or {@code null}.
- */
- public String getClientID() {
- return clientID;
- }
-
- /**
- * Returns the name of this subscription.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns whether this subscription is durable.
- */
- public boolean isDurable() {
- return durable;
- }
-
- /**
- * Returns the JMS message selector associated to this subscription.
- */
- public String getSelector() {
- return selector;
- }
-
- /**
- * Returns the number of messages currently held by this subscription.
- */
- public int getMessageCount() {
- return messageCount;
- }
-
- /**
- * Returns the number of messages currently delivered to this subscription.
- */
- public int getDeliveringCount() {
- return deliveringCount;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/TopicControl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/TopicControl.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/TopicControl.java
deleted file mode 100644
index 7e643f1..0000000
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/TopicControl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.api.jms.management;
-
-import javax.management.MBeanOperationInfo;
-import java.util.Map;
-
-import org.apache.activemq.artemis.api.core.management.Attribute;
-import org.apache.activemq.artemis.api.core.management.Operation;
-import org.apache.activemq.artemis.api.core.management.Parameter;
-
-/**
- * A TopicControl is used to manage a JMS Topic.
- */
-public interface TopicControl extends DestinationControl {
-
- /**
- * Returns the number of (durable and non-durable) subscribers for this topic.
- */
- @Attribute(desc = "number of (durable and non-durable) subscribers for this topic")
- int getSubscriptionCount();
-
- /**
- * Returns the number of <em>durable</em> subscribers for this topic.
- */
- @Attribute(desc = "number of durable subscribers for this topic")
- int getDurableSubscriptionCount();
-
- /**
- * Returns the number of <em>non-durable</em> subscribers for this topic.
- */
- @Attribute(desc = "number of non-durable subscribers for this topic")
- int getNonDurableSubscriptionCount();
-
- /**
- * Returns the number of messages for all <em>durable</em> subscribers for this topic.
- */
- @Attribute(desc = "number of messages for all durable subscribers for this topic")
- int getDurableMessageCount();
-
- /**
- * Returns the number of messages for all <em>non-durable</em> subscribers for this topic.
- */
- @Attribute(desc = "number of messages for all non-durable subscribers for this topic")
- int getNonDurableMessageCount();
-
- /**
- * Returns the Registry bindings associated with this topic.
- */
- @Attribute(desc = "the list of Registry bindings associated with this topic")
- String[] getRegistryBindings();
-
- /**
- * Add the Registry binding to this destination
- */
- @Operation(desc = "Adds the queue to another Registry binding")
- void addBinding(@Parameter(name = "binding", desc = "the name of the binding for Registry") String binding) throws Exception;
-
- // Operations ----------------------------------------------------
-
- /**
- * Lists all the subscriptions for this topic (both durable and non-durable).
- */
- @Operation(desc = "List all subscriptions")
- Object[] listAllSubscriptions() throws Exception;
-
- /**
- * Lists all the subscriptions for this topic (both durable and non-durable) using JSON serialization.
- * <br>
- * Java objects can be recreated from JSON serialization using {@link SubscriptionInfo#from(String)}.
- */
- @Operation(desc = "List all subscriptions")
- String listAllSubscriptionsAsJSON() throws Exception;
-
- /**
- * Lists all the <em>durable</em> subscriptions for this topic.
- */
- @Operation(desc = "List only the durable subscriptions")
- Object[] listDurableSubscriptions() throws Exception;
-
- /**
- * Lists all the <em>durable</em> subscriptions using JSON serialization.
- * <br>
- * Java objects can be recreated from JSON serialization using {@link SubscriptionInfo#from(String)}.
- */
- @Operation(desc = "List only the durable subscriptions")
- String listDurableSubscriptionsAsJSON() throws Exception;
-
- /**
- * Lists all the <em>non-durable</em> subscriptions for this topic.
- */
- @Operation(desc = "List only the non durable subscriptions")
- Object[] listNonDurableSubscriptions() throws Exception;
-
- /**
- * Lists all the <em>non-durable</em> subscriptions using JSON serialization.
- * <br>
- * Java objects can be recreated from JSON serialization using {@link SubscriptionInfo#from(String)}.
- */
- @Operation(desc = "List only the non durable subscriptions")
- String listNonDurableSubscriptionsAsJSON() throws Exception;
-
- /**
- * Lists all the messages in this queue matching the specified queue representing the subscription.
- * <br>
- * 1 Map represents 1 message, keys are the message's properties and headers, values are the corresponding values.
- */
- @Operation(desc = "List all the message for the given subscription")
- Map<String, Object>[] listMessagesForSubscription(@Parameter(name = "queueName", desc = "the name of the queue representing a subscription") String queueName) throws Exception;
-
- /**
- * Lists all the messages in this queue matching the specified queue representing the subscription using JSON serialization.
- */
- @Operation(desc = "List all the message for the given subscription")
- String listMessagesForSubscriptionAsJSON(@Parameter(name = "queueName", desc = "the name of the queue representing a subscription") String queueName) throws Exception;
-
- /**
- * Counts the number of messages in the subscription specified by the specified client ID and subscription name. Only messages matching the filter will be counted.
- * <br>
- * Using {@code null} or an empty filter will count <em>all</em> messages from this queue.
- */
- @Operation(desc = "Count the number of messages matching the filter for the given subscription")
- int countMessagesForSubscription(@Parameter(name = "clientID", desc = "the client ID") String clientID,
- @Parameter(name = "subscriptionName", desc = "the name of the durable subscription") String subscriptionName,
- @Parameter(name = "filter", desc = "a JMS filter (can be empty)") String filter) throws Exception;
-
- /**
- * Drops the subscription specified by the specified client ID and subscription name.
- */
- @Operation(desc = "Drop a durable subscription", impact = MBeanOperationInfo.ACTION)
- void dropDurableSubscription(@Parameter(name = "clientID", desc = "the client ID") String clientID,
- @Parameter(name = "subscriptionName", desc = "the name of the durable subscription") String subscriptionName) throws Exception;
-
- /**
- * Drops all subscriptions.
- */
- @Operation(desc = "Drop all subscriptions from this topic", impact = MBeanOperationInfo.ACTION)
- void dropAllSubscriptions() throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
index e879dbf..97108d1 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
@@ -799,7 +799,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
@Override
public synchronized boolean destroyTopic(final String name, final boolean removeConsumers) throws Exception {
checkInitialised();
- AddressControl addressControl = (AddressControl) server.getManagementService().getResource(ResourceNames.CORE_ADDRESS + name);
+ AddressControl addressControl = (AddressControl) server.getManagementService().getResource(ResourceNames.ADDRESS + name);
if (addressControl != null) {
for (String queueName : addressControl.getQueueNames()) {
Binding binding = server.getPostOffice().getBinding(new SimpleString(queueName));
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/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 1fb564d..4f91317 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
@@ -565,6 +565,18 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
}
@Override
+ public void deleteAddress(String name) throws Exception {
+ checkStarted();
+
+ clearIO();
+ try {
+ server.removeAddressInfo(new SimpleString(name));
+ } finally {
+ blockOnIO();
+ }
+ }
+
+ @Override
public void deployQueue(final String address, final String name, final String filterString) throws Exception {
checkStarted();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
index c627e7e..1c53433 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
@@ -20,12 +20,15 @@ import javax.json.JsonArrayBuilder;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.management.AddressControl;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
+import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.core.paging.PagingManager;
import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.persistence.StorageManager;
@@ -39,6 +42,7 @@ import org.apache.activemq.artemis.core.security.SecurityAuth;
import org.apache.activemq.artemis.core.security.SecurityStore;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
+import org.apache.activemq.artemis.core.server.management.ManagementService;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.utils.Base64;
@@ -60,6 +64,8 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
private final SecurityStore securityStore;
+ private final ManagementService managementService;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -69,13 +75,15 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
final PagingManager pagingManager,
final StorageManager storageManager,
final HierarchicalRepository<Set<Role>> securityRepository,
- final SecurityStore securityStore)throws Exception {
+ final SecurityStore securityStore,
+ final ManagementService managementService)throws Exception {
super(AddressControl.class, storageManager);
this.addressInfo = addressInfo;
this.postOffice = postOffice;
this.pagingManager = pagingManager;
this.securityRepository = securityRepository;
this.securityStore = securityStore;
+ this.managementService = managementService;
}
// Public --------------------------------------------------------
@@ -228,26 +236,11 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
}
}
- /* @Override
- public String sendTextMessage(Map<String, String> headers,
- String body,
- String user,
- String password) throws Exception {
- boolean durable = false;
- if (headers.containsKey("JMSDeliveryMode")) {
- String jmsDeliveryMode = headers.remove("JMSDeliveryMode");
- if (jmsDeliveryMode != null && (jmsDeliveryMode.equals("2") || jmsDeliveryMode.equalsIgnoreCase("PERSISTENT"))) {
- durable = true;
- }
- }
- String userID = UUIDGenerator.getInstance().generateStringUUID();
- ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(56);
- buffer.writeNullableSimpleString(new SimpleString(body));
- byte[] bytes = new byte[buffer.readableBytes()];
- buffer.readBytes(bytes);
- coreQueueControl.sendMessage(headers, Message.TEXT_TYPE, Base64.encodeBytes(bytes), userID, durable, user, password);
- return userID;
- }*/
+ @Override
+ public long getMessageCount() {
+ return getMessageCount(DurabilityType.ALL);
+ }
+
@Override
public String sendMessage(final Map<String, String> headers,
@@ -303,5 +296,39 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
// Private -------------------------------------------------------
+ private int getMessageCount(final DurabilityType durability) {
+ List<QueueControl> queues = getQueues(durability);
+ int count = 0;
+ for (QueueControl queue : queues) {
+ count += queue.getMessageCount();
+ }
+ return count;
+ }
+
+ private List<QueueControl> getQueues(final DurabilityType durability) {
+ try {
+ List<QueueControl> matchingQueues = new ArrayList<>();
+ String[] queues = getQueueNames();
+ for (String queue : queues) {
+ QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue);
+
+ // Ignore the "special" subscription
+ if (coreQueueControl != null && !coreQueueControl.getName().equals(getAddress())) {
+ if (durability == DurabilityType.ALL || durability == DurabilityType.DURABLE && coreQueueControl.isDurable() ||
+ durability == DurabilityType.NON_DURABLE && !coreQueueControl.isDurable()) {
+ matchingQueues.add(coreQueueControl);
+ }
+ }
+ }
+ return matchingQueues;
+ } catch (Exception e) {
+ return Collections.emptyList();
+ }
+ }
+
// Inner classes -------------------------------------------------
+
+ private enum DurabilityType {
+ ALL, DURABLE, NON_DURABLE
+ }
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java
index 793a800..f16d863 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java
@@ -259,7 +259,7 @@ public class ClusterConnectionBridge extends BridgeImpl {
if (logger.isTraceEnabled()) {
logger.trace("Requesting sendQueueInfoToQueue through " + this, new Exception("trace"));
}
- ManagementHelper.putOperationInvocation(message, ResourceNames.CORE_SERVER, "sendQueueInfoToQueue", notifQueueName.toString(), flowRecord.getAddress());
+ ManagementHelper.putOperationInvocation(message, ResourceNames.BROKER, "sendQueueInfoToQueue", notifQueueName.toString(), flowRecord.getAddress());
try (ClientProducer prod = sessionConsumer.createProducer(managementAddress)) {
if (logger.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
index 2c28676..23cdcae 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
@@ -412,7 +412,7 @@ public class ScaleDownHandler {
Pair<byte[], Long> pair = list.get(i);
array[i] = new String(pair.getA());
}
- ManagementHelper.putOperationInvocation(message, ResourceNames.CORE_SERVER, "updateDuplicateIdCache", entry.getKey().toString(), array);
+ ManagementHelper.putOperationInvocation(message, ResourceNames.BROKER, "updateDuplicateIdCache", entry.getKey().toString(), array);
producer.send(message);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/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 6490b0f..a68d65b 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
@@ -198,7 +198,7 @@ public class ManagementServiceImpl implements ManagementService {
messagingServerControl = new ActiveMQServerControlImpl(postOffice, configuration, resourceManager, remotingService, messagingServer, messageCounterManager, storageManager1, broadcaster);
ObjectName objectName = objectNameBuilder.getActiveMQServerObjectName();
registerInJMX(objectName, messagingServerControl);
- registerInRegistry(ResourceNames.CORE_SERVER, messagingServerControl);
+ registerInRegistry(ResourceNames.BROKER, messagingServerControl);
return messagingServerControl;
}
@@ -207,13 +207,13 @@ public class ManagementServiceImpl implements ManagementService {
public synchronized void unregisterServer() throws Exception {
ObjectName objectName = objectNameBuilder.getActiveMQServerObjectName();
unregisterFromJMX(objectName);
- unregisterFromRegistry(ResourceNames.CORE_SERVER);
+ unregisterFromRegistry(ResourceNames.BROKER);
}
@Override
public void registerAddress(AddressInfo addressInfo) throws Exception {
ObjectName objectName = objectNameBuilder.getAddressObjectName(addressInfo.getName());
- AddressControlImpl addressControl = new AddressControlImpl(addressInfo, postOffice, pagingManager, storageManager, securityRepository, securityStore);
+ AddressControlImpl addressControl = new AddressControlImpl(addressInfo, postOffice, pagingManager, storageManager, securityRepository, securityStore, this);
registerInJMX(objectName, addressControl);
@@ -229,7 +229,7 @@ public class ManagementServiceImpl implements ManagementService {
ObjectName objectName = objectNameBuilder.getAddressObjectName(address);
unregisterFromJMX(objectName);
- unregisterFromRegistry(ResourceNames.CORE_ADDRESS + address);
+ unregisterFromRegistry(ResourceNames.ADDRESS + address);
}
@Override
public synchronized void registerQueue(final Queue queue,
@@ -263,7 +263,7 @@ public class ManagementServiceImpl implements ManagementService {
ObjectName objectName = objectNameBuilder.getDivertObjectName(divert.getUniqueName().toString(), config.getAddress());
DivertControl divertControl = new DivertControlImpl(divert, storageManager, config);
registerInJMX(objectName, divertControl);
- registerInRegistry(ResourceNames.CORE_DIVERT + config.getName(), divertControl);
+ registerInRegistry(ResourceNames.DIVERT + config.getName(), divertControl);
if (logger.isDebugEnabled()) {
logger.debug("registered divert " + objectName);
@@ -274,7 +274,7 @@ public class ManagementServiceImpl implements ManagementService {
public synchronized void unregisterDivert(final SimpleString name) throws Exception {
ObjectName objectName = objectNameBuilder.getDivertObjectName(name.toString(), null);
unregisterFromJMX(objectName);
- unregisterFromRegistry(ResourceNames.CORE_DIVERT + name);
+ unregisterFromRegistry(ResourceNames.DIVERT + name);
}
@Override
@@ -283,7 +283,7 @@ public class ManagementServiceImpl implements ManagementService {
ObjectName objectName = objectNameBuilder.getAcceptorObjectName(configuration.getName());
AcceptorControl control = new AcceptorControlImpl(acceptor, storageManager, configuration);
registerInJMX(objectName, control);
- registerInRegistry(ResourceNames.CORE_ACCEPTOR + configuration.getName(), control);
+ registerInRegistry(ResourceNames.ACCEPTOR + configuration.getName(), control);
}
@Override
@@ -291,14 +291,14 @@ public class ManagementServiceImpl implements ManagementService {
List<String> acceptors = new ArrayList<>();
synchronized (this) {
for (String resourceName : registry.keySet()) {
- if (resourceName.startsWith(ResourceNames.CORE_ACCEPTOR)) {
+ if (resourceName.startsWith(ResourceNames.ACCEPTOR)) {
acceptors.add(resourceName);
}
}
}
for (String acceptor : acceptors) {
- String name = acceptor.substring(ResourceNames.CORE_ACCEPTOR.length());
+ String name = acceptor.substring(ResourceNames.ACCEPTOR.length());
try {
unregisterAcceptor(name);
} catch (Exception e) {
@@ -310,7 +310,7 @@ public class ManagementServiceImpl implements ManagementService {
public synchronized void unregisterAcceptor(final String name) throws Exception {
ObjectName objectName = objectNameBuilder.getAcceptorObjectName(name);
unregisterFromJMX(objectName);
- unregisterFromRegistry(ResourceNames.CORE_ACCEPTOR + name);
+ unregisterFromRegistry(ResourceNames.ACCEPTOR + name);
}
@Override
@@ -320,14 +320,14 @@ public class ManagementServiceImpl implements ManagementService {
ObjectName objectName = objectNameBuilder.getBroadcastGroupObjectName(configuration.getName());
BroadcastGroupControl control = new BroadcastGroupControlImpl(broadcastGroup, storageManager, configuration);
registerInJMX(objectName, control);
- registerInRegistry(ResourceNames.CORE_BROADCAST_GROUP + configuration.getName(), control);
+ registerInRegistry(ResourceNames.BROADCAST_GROUP + configuration.getName(), control);
}
@Override
public synchronized void unregisterBroadcastGroup(final String name) throws Exception {
ObjectName objectName = objectNameBuilder.getBroadcastGroupObjectName(name);
unregisterFromJMX(objectName);
- unregisterFromRegistry(ResourceNames.CORE_BROADCAST_GROUP + name);
+ unregisterFromRegistry(ResourceNames.BROADCAST_GROUP + name);
}
@Override
@@ -337,14 +337,14 @@ public class ManagementServiceImpl implements ManagementService {
ObjectName objectName = objectNameBuilder.getBridgeObjectName(configuration.getName());
BridgeControl control = new BridgeControlImpl(bridge, storageManager, configuration);
registerInJMX(objectName, control);
- registerInRegistry(ResourceNames.CORE_BRIDGE + configuration.getName(), control);
+ registerInRegistry(ResourceNames.BRIDGE + configuration.getName(), control);
}
@Override
public synchronized void unregisterBridge(final String name) throws Exception {
ObjectName objectName = objectNameBuilder.getBridgeObjectName(name);
unregisterFromJMX(objectName);
- unregisterFromRegistry(ResourceNames.CORE_BRIDGE + name);
+ unregisterFromRegistry(ResourceNames.BRIDGE + name);
}
@Override
@@ -535,7 +535,7 @@ public class ManagementServiceImpl implements ManagementService {
List<String> unexpectedResourceNames = new ArrayList<>();
for (String name : resourceNames) {
// only addresses, queues, and diverts should still be registered
- if (!(name.startsWith(ResourceNames.CORE_ADDRESS) || name.startsWith(ResourceNames.CORE_QUEUE) || name.startsWith(ResourceNames.CORE_DIVERT))) {
+ if (!(name.startsWith(ResourceNames.ADDRESS) || name.startsWith(ResourceNames.CORE_QUEUE) || name.startsWith(ResourceNames.DIVERT))) {
unexpectedResourceNames.add(name);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java b/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
index 44be2f9..dfca508 100644
--- a/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
+++ b/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java
@@ -34,7 +34,8 @@ import javax.naming.InitialContext;
import java.util.HashMap;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
+import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
/**
* An example that shows how to manage ActiveMQ Artemis using JMX.
@@ -81,13 +82,13 @@ public class JMXExample {
// Step 11. Retrieve the MBeanServerConnection
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
- // Step 12. Create a JMSQueueControl proxy to manage the queue on the server
- JMSQueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, JMSQueueControl.class, false);
+ // Step 12. Create a QueueControl proxy to manage the queue on the server
+ QueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, QueueControl.class, false);
// Step 13. Display the number of messages in the queue
System.out.println(queueControl.getName() + " contains " + queueControl.getMessageCount() + " messages");
// Step 14. Remove the message sent at step #8
- System.out.println("message has been removed: " + queueControl.removeMessage(message.getJMSMessageID()));
+ System.out.println("message has been removed: " + queueControl.removeMessage(((ActiveMQTextMessage) message).getCoreMessage().getMessageID()));
// Step 15. Display the number of messages in the queue
System.out.println(queueControl.getName() + " contains " + queueControl.getMessageCount() + " messages");
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java b/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
index 5fc8245..f227343 100644
--- a/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
+++ b/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java
@@ -35,7 +35,7 @@ import java.util.HashMap;
import org.apache.activemq.artemis.api.core.management.MessageCounterInfo;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
/**
* An example showing how to use message counters to have information on a queue.
@@ -75,7 +75,7 @@ public class MessageCounterExample {
ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, Object>());
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
- JMSQueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, JMSQueueControl.class, false);
+ QueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mbsc, on, QueueControl.class, false);
// Step 8. List the message counters and convert them to MessageCounterInfo data structure.
String counters = queueControl.listMessageCounter();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
index 2cb755a..8ff33b9 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
@@ -27,9 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
-import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
import org.apache.activemq.artemis.core.server.JournalType;
@@ -195,15 +192,6 @@ public class OpenwireArtemisBaseTest {
return "tcp://" + localhostAddress + ":" + port + "?" + URISupport.createQueryString(params);
}
- public static JMSServerControl createJMSServerControl(final MBeanServer mbeanServer) throws Exception {
- return (JMSServerControl) createProxy(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), JMSServerControl.class, mbeanServer);
- }
-
- public static JMSQueueControl createJMSQueueControl(final String name,
- final MBeanServer mbeanServer) throws Exception {
- return (JMSQueueControl) createProxy(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(name), JMSQueueControl.class, mbeanServer);
- }
-
private static Object createProxy(final ObjectName objectName,
final Class mbeanInterface,
final MBeanServer mbeanServer) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
index f62052c..3845afd 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java
@@ -40,11 +40,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.Test;
+import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
-import org.apache.activemq.artemis.api.jms.management.DestinationControl;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
-import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
-import org.apache.activemq.artemis.api.jms.management.TopicControl;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
@@ -868,7 +866,6 @@ public class JMSConsumerTest extends JmsTestSupport {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
destination = (ActiveMQDestination) (destinationType == ActiveMQDestination.QUEUE_TYPE ? session.createQueue("test") : session.createTopic("test"));
- createManagedDestinationOnServer(destination);
MessageConsumer consumer = session.createConsumer(destination);
connection.setStatsEnabled(true);
@@ -902,42 +899,17 @@ public class JMSConsumerTest extends JmsTestSupport {
}
assertEquals("consumer has expiredMessages", count, amqConsumer.getConsumerStats().getExpiredMessageCount().getCount());
- DestinationControl view = createView(destination);
+ QueueControl view = createQueueControl(destination.getPhysicalName());
assertEquals("Wrong inFlightCount: " + view.getDeliveringCount(), 0, view.getDeliveringCount());
assertEquals("Wrong dispatch count: " + view.getMessagesAdded(), 8, view.getMessagesAdded());
}
- private void createManagedDestinationOnServer(ActiveMQDestination destination) throws Exception {
- String destName = destination.getPhysicalName();
+ private QueueControl createQueueControl(String destName) throws Exception {
ArtemisBrokerWrapper wrapper = (ArtemisBrokerWrapper) broker.getBroker();
MBeanServer beanServer = wrapper.getMbeanServer();
- ObjectName objName = ObjectNameBuilder.DEFAULT.getJMSServerObjectName();
- JMSServerControl serverControl = MBeanServerInvocationHandler.newProxyInstance(beanServer, objName, JMSServerControl.class, false);
- serverControl.createQueue(destName);
- }
-
- protected DestinationControl createView(ActiveMQDestination destination) throws Exception {
-
- String destName = destination.getPhysicalName();
- if (destination.isQueue()) {
- return createJMSQueueControl(destName);
- } else {
- return createJMSTopicControl(destName);
- }
- }
-
- private JMSQueueControl createJMSQueueControl(String destName) throws Exception {
- ArtemisBrokerWrapper wrapper = (ArtemisBrokerWrapper) broker.getBroker();
- MBeanServer beanServer = wrapper.getMbeanServer();
- ObjectName objName = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(destName);
- return MBeanServerInvocationHandler.newProxyInstance(beanServer, objName, JMSQueueControl.class, false);
- }
-
- private TopicControl createJMSTopicControl(String destName) throws Exception {
- ArtemisBrokerWrapper wrapper = (ArtemisBrokerWrapper) broker.getBroker();
- MBeanServer beanServer = wrapper.getMbeanServer();
- ObjectName objName = ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(destName);
- return MBeanServerInvocationHandler.newProxyInstance(beanServer, objName, TopicControl.class, false);
+ SimpleString address = new SimpleString(destName);
+ ObjectName objName = ObjectNameBuilder.DEFAULT.getQueueObjectName(address, address);
+ return MBeanServerInvocationHandler.newProxyInstance(beanServer, objName, QueueControl.class, false);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverBackupLeakTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverBackupLeakTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverBackupLeakTest.java
index 63e62eb..c87a640 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverBackupLeakTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverBackupLeakTest.java
@@ -23,7 +23,8 @@ import javax.jms.Session;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
+import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
+import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.management.ManagementService;
import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
@@ -112,7 +113,7 @@ public class FailoverBackupLeakTest extends OpenwireArtemisBaseTest {
private int getConnectionCount(EmbeddedJMS server) throws Exception {
ManagementService managementService = server.getActiveMQServer().getManagementService();
- JMSServerControl jmsControl = (JMSServerControl) managementService.getResource("jms.server");
+ ActiveMQServerControl jmsControl = (ActiveMQServerControl) managementService.getResource(ResourceNames.BROKER);
String[] ids = jmsControl.listConnectionIDs();
if (ids != null) {
return ids.length;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
index e9815f7..51306c1 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
@@ -39,9 +39,10 @@ import com.arjuna.ats.arjuna.coordinator.TxControl;
import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.management.AddressControl;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
+import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
@@ -485,7 +486,7 @@ public abstract class BridgeTestBase extends ActiveMQTestBase {
if (index == 1) {
managementService = server1.getManagementService();
}
- JMSQueueControl queueControl = (JMSQueueControl) managementService.getResource(queue.getQueueName());
+ QueueControl queueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue.getQueueName());
//server may be closed
if (queueControl != null) {
@@ -504,7 +505,7 @@ public abstract class BridgeTestBase extends ActiveMQTestBase {
if (index == 1) {
managementService = server1.getManagementService();
}
- AddressControl topicControl = (AddressControl) managementService.getResource("address." + topic.getTopicName());
+ AddressControl topicControl = (AddressControl) managementService.getResource(ResourceNames.ADDRESS + topic.getTopicName());
Assert.assertEquals(0, topicControl.getQueueNames().length);
}
@@ -514,7 +515,7 @@ public abstract class BridgeTestBase extends ActiveMQTestBase {
if (index == 1) {
managementService = server1.getManagementService();
}
- JMSQueueControl queueControl = (JMSQueueControl) managementService.getResource(queueName);
+ QueueControl queueControl = (QueueControl) managementService.getResource("queue." + queueName);
queueControl.removeMessages(null);
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java
index ad90f0a..6bceb7d 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java
@@ -39,7 +39,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import static org.apache.activemq.artemis.api.core.management.ResourceNames.CORE_ADDRESS;
+import static org.apache.activemq.artemis.api.core.management.ResourceNames.ADDRESS;
import static org.apache.activemq.artemis.api.core.management.ResourceNames.CORE_QUEUE;
public class AutoCreateJmsDestinationTest extends JMSTestBase {
@@ -73,7 +73,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase {
}
// make sure the JMX control was created for the address and queue
- assertNotNull(server.getManagementService().getResource(CORE_ADDRESS + QUEUE_NAME));
+ assertNotNull(server.getManagementService().getResource(ADDRESS + QUEUE_NAME));
assertNotNull(server.getManagementService().getResource(CORE_QUEUE + QUEUE_NAME));
connection.close();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSMessageCounterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSMessageCounterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSMessageCounterTest.java
index b3dd022..2f138b6 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSMessageCounterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSMessageCounterTest.java
@@ -23,7 +23,8 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
+import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Test;
@@ -53,7 +54,7 @@ public class JMSMessageCounterTest extends JMSTestBase {
conn.close();
- JMSQueueControl control = (JMSQueueControl) server.getManagementService().getResource(queue.getQueueName());
+ QueueControl control = (QueueControl) server.getManagementService().getResource(ResourceNames.CORE_QUEUE + queue.getQueueName());
assertNotNull(control);
System.out.println(control.listMessageCounterAsHTML());
@@ -62,7 +63,7 @@ public class JMSMessageCounterTest extends JMSTestBase {
restartServer();
- control = (JMSQueueControl) server.getManagementService().getResource(queue.getQueueName());
+ control = (QueueControl) server.getManagementService().getResource(ResourceNames.CORE_QUEUE + queue.getQueueName());
assertNotNull(control);
System.out.println(control.listMessageCounterAsHTML());
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java
index a77c4d1..0a35939 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java
@@ -25,7 +25,8 @@ import javax.jms.Queue;
import javax.jms.Session;
import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
+import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
@@ -47,7 +48,7 @@ public class MultipleProducersTest extends JMSTestBase {
public SimpleString queueOneName = new SimpleString("queueOne");
public SimpleString queueTwoName = new SimpleString("queueTwo");
- public JMSQueueControl control = null;
+ public QueueControl control = null;
public long queueOneMsgCount = 0;
public long queueTwoMsgCount = 0;
@@ -126,7 +127,7 @@ public class MultipleProducersTest extends JMSTestBase {
// after draining queueOne send 5 message to queueOne
queueTwoMsgCount = server.locateQueue(queueTwoName).getMessageCount();
- control = (JMSQueueControl) server.getManagementService().getResource(queueOne.getQueueName());
+ control = (QueueControl) server.getManagementService().getResource(ResourceNames.CORE_QUEUE + queueOne.getQueueName());
control.removeMessages(null);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredMessageCounterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredMessageCounterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredMessageCounterTest.java
index a8ad897..c12bad0 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredMessageCounterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredMessageCounterTest.java
@@ -174,7 +174,7 @@ public class ClusteredMessageCounterTest extends ClusterTestBase {
});
QueueControl control = (QueueControl) servers[1].getManagementService().getResource(ResourceNames.CORE_QUEUE + "queue0");
- ActiveMQServerControl serverControl = (ActiveMQServerControl) servers[1].getManagementService().getResource(ResourceNames.CORE_SERVER);
+ ActiveMQServerControl serverControl = (ActiveMQServerControl) servers[1].getManagementService().getResource(ResourceNames.BROKER);
serverControl.setMessageCounterSamplePeriod(300);
CountDownLatch resultLatch = new CountDownLatch(40);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
index 03e3d07..b5091dc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java
@@ -22,7 +22,8 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
-import org.apache.activemq.artemis.api.jms.management.TopicControl;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.api.core.management.AddressControl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
@@ -47,7 +48,7 @@ public class ExpiryMessageTest extends JMSTestBase {
@Test
public void testSendTopicNoSubscription() throws Exception {
Topic topic = createTopic("test-topic");
- TopicControl control = ManagementControlHelper.createTopicControl(topic, mbeanServer);
+ AddressControl control = ManagementControlHelper.createAddressControl(new SimpleString(topic.getTopicName()), mbeanServer);
Connection conn2 = cf.createConnection();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a6f1167d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java
deleted file mode 100644
index b5af25b..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.tests.integration.jms.server.management;
-
-import javax.management.Notification;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
-import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.api.jms.management.ConnectionFactoryControl;
-import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
-import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.ActiveMQServers;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
-import org.apache.activemq.artemis.jms.server.management.JMSNotificationType;
-import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
-import org.apache.activemq.artemis.tests.integration.management.ManagementTestBase;
-import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * A Connection Factory Control Test
- */
-public class ConnectionFactoryControlTest extends ManagementTestBase {
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private ActiveMQServer server;
-
- private JMSServerManagerImpl jmsServerManager;
-
- private InVMNamingContext ctx;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- @Test
- public void testCreateCF() throws Exception {
- JMSServerControl control = createJMSControl();
- control.createConnectionFactory("test", false, false, 0, "invm", "test");
-
- ConnectionFactoryControl controlCF = createCFControl("test");
-
- ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("test");
-
- Assert.assertFalse(cf.isCompressLargeMessage());
-
- controlCF.setCompressLargeMessages(true);
-
- cf = (ActiveMQConnectionFactory) ctx.lookup("test");
- Assert.assertTrue(cf.isCompressLargeMessage());
-
- server.stop();
-
- waitForServerToStop(server);
-
- startServer();
-
- cf = (ActiveMQConnectionFactory) ctx.lookup("test");
- Assert.assertTrue(cf.isCompressLargeMessage());
-
- }
-
- //make sure notifications are always received no matter whether
- //a CF is created via JMSServerControl or by JMSServerManager directly.
- @Test
- public void testCreateCFNotification() throws Exception {
- JMSUtil.JMXListener listener = new JMSUtil.JMXListener();
- this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), listener, null, null);
-
- List<String> connectors = new ArrayList<>();
- connectors.add("invm");
-
- this.jmsServerManager.createConnectionFactory("NewCF", false, JMSFactoryType.CF, connectors, "/NewConnectionFactory");
-
- Notification notif = listener.getNotification();
-
- Assert.assertEquals(JMSNotificationType.CONNECTION_FACTORY_CREATED.toString(), notif.getType());
- Assert.assertEquals("NewCF", notif.getMessage());
-
- this.jmsServerManager.destroyConnectionFactory("NewCF");
-
- notif = listener.getNotification();
- Assert.assertEquals(JMSNotificationType.CONNECTION_FACTORY_DESTROYED.toString(), notif.getType());
- Assert.assertEquals("NewCF", notif.getMessage());
-
- JMSServerControl control = createJMSControl();
-
- control.createConnectionFactory("test", false, false, 0, "invm", "test");
-
- notif = listener.getNotification();
- Assert.assertEquals(JMSNotificationType.CONNECTION_FACTORY_CREATED.toString(), notif.getType());
- Assert.assertEquals("test", notif.getMessage());
-
- control.destroyConnectionFactory("test");
-
- notif = listener.getNotification();
- Assert.assertEquals(JMSNotificationType.CONNECTION_FACTORY_DESTROYED.toString(), notif.getType());
- Assert.assertEquals("test", notif.getMessage());
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- startServer();
-
- }
-
- /**
- * @throws Exception
- */
- protected void startServer() throws Exception {
- Configuration config = createDefaultInVMConfig().addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY)).setJMXManagementEnabled(true);
- server = addServer(ActiveMQServers.newActiveMQServer(config, mbeanServer, true));
- server.start();
-
- jmsServerManager = new JMSServerManagerImpl(server);
- jmsServerManager.start();
-
- ctx = new InVMNamingContext();
-
- jmsServerManager.setRegistry(new JndiBindingRegistry(ctx));
- jmsServerManager.activated();
- }
-
- protected ConnectionFactoryControl createCFControl(String name) throws Exception {
- return ManagementControlHelper.createConnectionFactoryControl(name, mbeanServer);
- }
-
- protected JMSServerControl createJMSControl() throws Exception {
- return ManagementControlHelper.createJMSServerControl(mbeanServer);
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}