activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andytay...@apache.org
Subject [1/3] activemq-artemis git commit: remove JMS JMX Objects and add new Address JMX objects
Date Mon, 07 Nov 2016 12:37:55 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/ARTEMIS-780 dc9c07878 -> 3858b1cfc


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/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 5cc55c3..52800a8 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
@@ -99,6 +99,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
          }
 
          @Override
+         public void createAddress(@Parameter(name = "name", desc = "The name of the address")
String name, @Parameter(name = "routingType", desc = "the routing type of the address either
0 for multicast or 1 for anycast") int routingType, @Parameter(name = "defaultDeleteOnNoConsumers",
desc = "Whether or not a queue with this address is deleted when it has no consumers") boolean
defaultDeleteOnNoConsumers, @Parameter(name = "defaultMaxConsumers", desc = "The maximim number
of consumer a queue with this address can have") int defaultMaxConsumers) throws Exception
{
+            proxy.invokeOperation("createAddress", name, routingType, defaultDeleteOnNoConsumers,
defaultMaxConsumers);
+         }
+
+         @Override
          public void createQueue(final String address,
                                  final String name,
                                  final String filter,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java
index 7311727..109e008 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java
@@ -45,9 +45,9 @@ public class DivertControlTest extends ManagementTestBase {
 
    @Test
    public void testAttributes() throws Exception {
-      checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(divertConfig.getName()));
+      checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(divertConfig.getName(),
divertConfig.getAddress()));
 
-      DivertControl divertControl = createManagementControl(divertConfig.getName());
+      DivertControl divertControl = createDivertManagementControl(divertConfig.getName(),
divertConfig.getAddress());
 
       Assert.assertEquals(divertConfig.getFilterString(), divertControl.getFilter());
 
@@ -86,7 +86,7 @@ public class DivertControlTest extends ManagementTestBase {
       server.start();
    }
 
-   protected DivertControl createManagementControl(final String name) throws Exception {
-      return ManagementControlHelper.createDivertControl(name, mbeanServer);
+   protected DivertControl createDivertManagementControl(final String name, final String
address) throws Exception {
+      return ManagementControlHelper.createDivertControl(name, address, mbeanServer);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java
index cf92cf1..ecf4142 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlUsingCoreTest.java
@@ -32,7 +32,7 @@ public class DivertControlUsingCoreTest extends DivertControlTest {
    // DivertControlTest overrides --------------------------------
 
    @Override
-   protected DivertControl createManagementControl(final String name) throws Exception {
+   protected DivertControl createDivertManagementControl(final String name, final String
address) throws Exception {
       return new DivertControl() {
          private final CoreMessagingProxy proxy = new CoreMessagingProxy(addServerLocator(createInVMNonHALocator()),
ResourceNames.CORE_DIVERT + name);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java
index a41c908..641d97c 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementControlHelper.java
@@ -59,8 +59,8 @@ public class ManagementControlHelper {
       return (BridgeControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getBridgeObjectName(name),
BridgeControl.class, mbeanServer);
    }
 
-   public static DivertControl createDivertControl(final String name, final MBeanServer mbeanServer)
throws Exception {
-      return (DivertControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getDivertObjectName(name),
DivertControl.class, mbeanServer);
+   public static DivertControl createDivertControl(final String name, String address, final
MBeanServer mbeanServer) throws Exception {
+      return (DivertControl) ManagementControlHelper.createProxy(ObjectNameBuilder.DEFAULT.getDivertObjectName(name,
address), DivertControl.class, mbeanServer);
    }
 
    public static ClusterConnectionControl createClusterConnectionControl(final String name,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
index ce95046..2004ee8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementServiceImplTest.java
@@ -27,6 +27,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.ServerMessage;
+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.impl.ManagementServiceImpl;
 import org.apache.activemq.artemis.tests.integration.server.FakeStorageManager;
@@ -134,7 +135,7 @@ public class ManagementServiceImplTest extends ActiveMQTestBase {
       managementService.setStorageManager(new NullStorageManager());
 
       SimpleString address = RandomUtil.randomSimpleString();
-      managementService.registerAddress(address);
+      managementService.registerAddress(new AddressInfo(address));
       Queue queue = new FakeQueue(RandomUtil.randomSimpleString());
       managementService.registerQueue(queue, RandomUtil.randomSimpleString(), new FakeStorageManager());
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java
----------------------------------------------------------------------
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 fa84c16..235b1f8 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
@@ -2108,7 +2108,7 @@ public class QueueControlTest extends ManagementTestBase {
 
       QueueControl queueControl = createManagementControl(address, queue);
 
-      queueControl.sendMessage(new HashMap<String, String>(), Message.TEXT_TYPE, Base64.encodeBytes("theBody".getBytes()),
"myID", true, "myUser", "myPassword");
+      queueControl.sendMessage(new HashMap<String, String>(), Message.TEXT_TYPE, Base64.encodeBytes("theBody".getBytes()),
true, "myUser", "myPassword");
 
       Assert.assertEquals(1, getMessageCount(queueControl));
 
@@ -2133,7 +2133,7 @@ public class QueueControlTest extends ManagementTestBase {
 
       QueueControl queueControl = createManagementControl(address, queue);
 
-      queueControl.sendMessage(new HashMap<String, String>(), Message.TEXT_TYPE, null,
"myID", true, "myUser", "myPassword");
+      queueControl.sendMessage(new HashMap<String, String>(), Message.TEXT_TYPE, null,
true, "myUser", "myPassword");
 
       Assert.assertEquals(1, getMessageCount(queueControl));
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
index 9b901fc..4dd418b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
@@ -316,11 +316,10 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
          public String sendMessage(Map<String, String> headers,
                                    int type,
                                    String body,
-                                   String userID,
                                    boolean durable,
                                    String user,
                                    String password) throws Exception {
-            return (String) proxy.invokeOperation("sendMessage", headers, type, body, userID,
durable, user, password);
+            return (String) proxy.invokeOperation("sendMessage", headers, type, body, durable,
user, password);
          }
 
          public void setDeadLetterAddress(final String deadLetterAddress) throws Exception
{
@@ -352,6 +351,17 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
          }
 
          @Override
+         public CompositeData[] browse() throws Exception {
+            Map map = (Map) proxy.invokeOperation("browse");
+            CompositeData[] compositeDatas = (CompositeData[]) map.get(CompositeData.class.getName());
+            if (compositeDatas == null) {
+               compositeDatas = new CompositeData[0];
+            }
+            return compositeDatas;
+         }
+
+
+         @Override
          public CompositeData[] browse(String filter) throws Exception {
             Map map = (Map) proxy.invokeOperation("browse", filter);
             CompositeData[] compositeDatas = (CompositeData[]) map.get(CompositeData.class.getName());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
index 0fe7b47..9f15229 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java
@@ -28,11 +28,13 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+import org.apache.activemq.artemis.api.core.management.AddressControl;
 import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
+import org.apache.activemq.artemis.api.core.management.QueueControl;
 import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
 import org.apache.activemq.artemis.api.jms.management.TopicControl;
 import org.apache.activemq.artemis.core.config.FileDeploymentManager;
 import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
@@ -328,7 +330,7 @@ public class LocalTestServer implements Server, Runnable {
 
    @Override
    public Long getMessageCountForQueue(final String queueName) throws Exception {
-      JMSQueueControl queue = (JMSQueueControl) getActiveMQServer().getManagementService().getResource(queueName);
+      QueueControl queue = (QueueControl) getActiveMQServer().getManagementService().getResource("queue."
+ queueName);
       if (queue != null) {
          queue.flushExecutor();
          return queue.getMessageCount();
@@ -340,7 +342,7 @@ public class LocalTestServer implements Server, Runnable {
    @Override
    public void removeAllMessages(final String destination, final boolean isQueue) throws
Exception {
       if (isQueue) {
-         JMSQueueControl queue = (JMSQueueControl) getActiveMQServer().getManagementService().getResource(destination);
+         QueueControl queue = (QueueControl) getActiveMQServer().getManagementService().getResource("queue."
+ destination);
          queue.removeMessages(null);
       } else {
          TopicControl topic = (TopicControl) getActiveMQServer().getManagementService().getResource(destination);
@@ -350,13 +352,12 @@ public class LocalTestServer implements Server, Runnable {
 
    @Override
    public List<String> listAllSubscribersForTopic(final String s) throws Exception
{
-      ObjectName objectName = ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(s);
-      TopicControl topic = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
objectName, TopicControl.class, false);
-      Object[] subInfos = topic.listAllSubscriptions();
+      ObjectName objectName = ObjectNameBuilder.DEFAULT.getAddressObjectName(new SimpleString(s));
+      AddressControl topic = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
objectName, AddressControl.class, false);
+      Object[] subInfos = topic.getQueueNames();
       List<String> subs = new ArrayList<>();
       for (Object o : subInfos) {
-         Object[] data = (Object[]) o;
-         subs.add((String) data[2]);
+         subs.add( ((String) o).split("\\.")[1]);
       }
       return subs;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/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 63ae052..7d9d24a 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,6 +34,7 @@ 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.impl.AddressInfo;
 import org.apache.activemq.artemis.tests.util.SpawnedVMSupport;
 import org.junit.Assert;
 import org.objectweb.jtests.jms.admin.Admin;
@@ -120,8 +121,7 @@ public class AbstractAdmin implements Admin {
    public void createQueue(final String name) {
       Boolean result;
       try {
-         result = (Boolean) invokeSyncOperation(ResourceNames.JMS_SERVER, "createQueue",
name, name);
-         Assert.assertEquals(true, result.booleanValue());
+         invokeSyncOperation(ResourceNames.CORE_SERVER, "createQueue", name, name);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }
@@ -131,8 +131,7 @@ public class AbstractAdmin implements Admin {
    public void deleteQueue(final String name) {
       Boolean result;
       try {
-         result = (Boolean) invokeSyncOperation(ResourceNames.JMS_SERVER, "destroyQueue",
name);
-         Assert.assertEquals(true, result.booleanValue());
+         invokeSyncOperation(ResourceNames.CORE_SERVER, "destroyQueue", name);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }
@@ -152,8 +151,7 @@ public class AbstractAdmin implements Admin {
    public void createTopic(final String name) {
       Boolean result;
       try {
-         result = (Boolean) invokeSyncOperation(ResourceNames.JMS_SERVER, "createTopic",
name, name);
-         Assert.assertEquals(true, result.booleanValue());
+         invokeSyncOperation(ResourceNames.CORE_SERVER, "createAddress", name, (int)AddressInfo.RoutingType.MULTICAST.getType(),
false, -1);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java
b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java
index 910f141..321bdca 100644
--- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java
+++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQCoreAdmin.java
@@ -57,7 +57,6 @@ public class ActiveMQCoreAdmin extends AbstractAdmin {
 
    @Override
    public void createConnectionFactory(final String name) {
-      createConnection(name, 0);
       jndiProps.put("connectionFactory." + name, "tcp://127.0.0.1:61616?type=CF");
 
    }
@@ -84,7 +83,6 @@ public class ActiveMQCoreAdmin extends AbstractAdmin {
 
    @Override
    public void createQueueConnectionFactory(final String name) {
-      createConnection(name, 1);
       jndiProps.put("connectionFactory." + name, "tcp://127.0.0.1:61616?type=QUEUE_CF");
    }
 
@@ -96,7 +94,6 @@ public class ActiveMQCoreAdmin extends AbstractAdmin {
 
    @Override
    public void createTopicConnectionFactory(final String name) {
-      createConnection(name, 2);
       jndiProps.put("connectionFactory." + name, "tcp://127.0.0.1:61616?type=TOPIC_CF");
    }
 


Mime
View raw message