activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [02/50] [abbrv] activemq-artemis git commit: ARTEMIS-876 Remove JMS JMX Objects and add new Address JMX objects
Date Fri, 09 Dec 2016 19:48:46 GMT
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0189f156/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java
b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java
index f309c16..3fae952 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java
@@ -228,27 +228,6 @@ public abstract class ActiveMQServerTestCase {
       queue4 = (Queue) ic.lookup("/queue/Queue4");
    }
 
-   protected void undeployAdministeredObjects() throws Exception {
-      removeAllMessages("Topic1", false);
-      removeAllMessages("Topic2", false);
-      removeAllMessages("Topic3", false);
-      removeAllMessages("Queue1", true);
-      removeAllMessages("Queue2", true);
-      removeAllMessages("Queue3", true);
-      removeAllMessages("Queue4", true);
-
-      destroyTopic("Topic1");
-      destroyTopic("Topic2");
-      destroyTopic("Topic3");
-      destroyQueue("Queue1");
-      destroyQueue("Queue2");
-      destroyQueue("Queue3");
-      destroyQueue("Queue4");
-
-      undeployConnectionFactory("ConnectionFactory");
-      undeployConnectionFactory("CF_TOPIC");
-      undeployConnectionFactory("CF_XA_TRUE");
-   }
 
    @AfterClass
    public static final void tearDownAllServers() {
@@ -362,7 +341,7 @@ public abstract class ActiveMQServerTestCase {
    }
 
    protected void removeAllMessages(final String destName, final boolean isQueue) throws
Exception {
-      ActiveMQServerTestCase.servers.get(0).removeAllMessages(destName, isQueue);
+      ActiveMQServerTestCase.servers.get(0).removeAllMessages(destName);
    }
 
    protected boolean assertRemainingMessages(final int expected) throws Exception {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0189f156/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..64f6626 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,12 +28,14 @@ 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.core.management.ResourceNames;
 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;
 import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
@@ -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();
@@ -338,25 +340,19 @@ 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);
-         queue.removeMessages(null);
-      } else {
-         TopicControl topic = (TopicControl) getActiveMQServer().getManagementService().getResource(destination);
-         topic.removeMessages(null);
-      }
+   public void removeAllMessages(final String queueName) throws Exception {
+      QueueControl queue = (QueueControl) getActiveMQServer().getManagementService().getResource(ResourceNames.QUEUE
+ queueName);
+      queue.removeMessages(null);
    }
 
    @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/0189f156/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java
b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java
index 1180726..7d21289 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/Server.java
@@ -174,7 +174,7 @@ public interface Server extends Remote {
 
    InitialContext getInitialContext() throws Exception;
 
-   void removeAllMessages(String destination, boolean isQueue) throws Exception;
+   void removeAllMessages(String destination) throws Exception;
 
    Long getMessageCountForQueue(String queueName) throws Exception;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0189f156/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..f76c5b5 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,8 +34,8 @@ 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 +120,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.BROKER, "createQueue", name, name);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }
@@ -131,8 +130,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.BROKER, "destroyQueue", name);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }
@@ -152,8 +150,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.BROKER, "createAddress", name, (int)AddressInfo.RoutingType.MULTICAST.getType(),
false, -1);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }
@@ -163,8 +160,7 @@ public class AbstractAdmin implements Admin {
    public void deleteTopic(final String name) {
       Boolean result;
       try {
-         result = (Boolean) invokeSyncOperation(ResourceNames.JMS_SERVER, "destroyTopic",
name);
-         Assert.assertEquals(true, result.booleanValue());
+         invokeSyncOperation(ResourceNames.BROKER, "deleteAddress", name);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0189f156/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..df0c4a2 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
@@ -21,7 +21,6 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import java.util.Hashtable;
 
-import org.apache.activemq.artemis.api.core.management.ResourceNames;
 import org.apache.activemq.artemis.common.AbstractAdmin;
 import org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory;
 
@@ -57,20 +56,10 @@ 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");
 
    }
 
-   private void createConnection(final String name, final int cfType) {
-      try {
-         invokeSyncOperation(ResourceNames.JMS_SERVER, "createConnectionFactory", name, false,
false, cfType, "netty", name);
-      } catch (Exception e) {
-         throw new IllegalStateException(e);
-      }
-
-   }
-
    @Override
    public Context createContext() throws NamingException {
       return new InitialContext(jndiProps);
@@ -84,7 +73,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,18 +84,12 @@ 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");
    }
 
    @Override
    public void deleteConnectionFactory(final String name) {
-      try {
-         invokeSyncOperation(ResourceNames.JMS_SERVER, "destroyConnectionFactory", name);
-         jndiProps.remove("connectionFactory." + name);
-      } catch (Exception e) {
-         throw new IllegalStateException(e);
-      }
+      jndiProps.remove("connectionFactory." + name);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0189f156/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
----------------------------------------------------------------------
diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
index 34bbdb2..6aefd52 100644
--- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
+++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
@@ -44,11 +44,12 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
+import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 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.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.InVMAcceptorFactory;
@@ -468,8 +469,8 @@ public class JMSBridgeImplTest extends ActiveMQTestBase {
       }
 
       sourceConn.close();
-
-      JMSQueueControl jmsQueueControl = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(JMSBridgeImplTest.SOURCE), JMSQueueControl.class,
false);
+      SimpleString add = new SimpleString(JMSBridgeImplTest.SOURCE);
+      QueueControl jmsQueueControl = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
ObjectNameBuilder.DEFAULT.getQueueObjectName(add, add), QueueControl.class, false);
       assertNotEquals(jmsQueueControl.getDeliveringCount(), numMessages);
 
       bridge.stop();


Mime
View raw message