activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [48/58] [abbrv] activemq-artemis git commit: More test fix. Enabled management in the wrapper class so some tests can use it to check some data.
Date Fri, 04 Mar 2016 22:43:32 GMT
More test fix.
Enabled management in the wrapper class so some tests can use
it to check some data.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/29a4ae42
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/29a4ae42
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/29a4ae42

Branch: refs/heads/refactor-openwire
Commit: 29a4ae42a5154b6508685398978a5da8fd5802fa
Parents: 4fe4830
Author: Howard Gao <howard.gao@gmail.com>
Authored: Mon Feb 22 21:03:39 2016 +0800
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri Mar 4 15:41:48 2016 -0500

----------------------------------------------------------------------
 .../apache/activemq/broker/BrokerService.java   |  1 -
 .../artemiswrapper/ArtemisBrokerWrapper.java    | 20 +++++---
 .../org/apache/activemq/JMSConsumerTest.java    | 52 +++++++++++++++-----
 .../JmsDurableQueueWildcardSendReceiveTest.java |  2 +-
 .../JmsQueueWildcardSendReceiveTest.java        |  2 +-
 .../org/apache/activemq/broker/BrokerTest.java  |  4 ++
 6 files changed, 59 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/29a4ae42/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
index 99de104..13d6b96 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
@@ -109,7 +109,6 @@ public class BrokerService implements Service {
    private PolicyMap destinationPolicy;
    private SystemUsage systemUsage;
 
-   private boolean isClustered = true;
    private final List<NetworkConnector> networkConnectors = new CopyOnWriteArrayList<NetworkConnector>();
 
    private TemporaryFolder tmpfolder;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/29a4ae42/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
index 1c8ce9b..be1713b 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
@@ -44,10 +44,14 @@ import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.region.policy.PolicyEntry;
 import org.apache.activemq.broker.region.policy.PolicyMap;
 
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
 public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
 
    protected final Map<String, SimpleString> testQueues = new HashMap<>();
    protected JMSServerManagerImpl jmsServer;
+   protected MBeanServer mbeanServer;
 
    public ArtemisBrokerWrapper(BrokerService brokerService, File temporaryFolder) {
       super(temporaryFolder);
@@ -57,10 +61,16 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
    @Override
    public void start() throws Exception {
       clearDataRecreateServerDirs();
+
+      mbeanServer = MBeanServerFactory.createMBeanServer();
+
       server = createServer(realStore, true);
+      server.setMBeanServer(mbeanServer);
+
       server.getConfiguration().getAcceptorConfigurations().clear();
 
       Configuration serverConfig = server.getConfiguration();
+      serverConfig.setJMXManagementEnabled(true);
 
       Map<String, AddressSettings> addressSettingsMap = serverConfig.getAddressesSettings();
 
@@ -155,11 +165,6 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
 
       server.start();
 
-/*
-         registerConnectionFactory();
-	      mbeanServer = MBeanServerFactory.createMBeanServer();
-*/
-
       ArtemisBrokerHelper.setBroker(this.bservice);
       stopped = false;
 
@@ -174,7 +179,6 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
       params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, bservice.KEYSTORE_PASSWORD);
       params.put(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME, bservice.storeType);
       if (bservice.SERVER_SIDE_TRUSTSTORE != null) {
-         params.put(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME, true);
          params.put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, bservice.SERVER_SIDE_TRUSTSTORE);
          params.put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, bservice.TRUSTSTORE_PASSWORD);
          params.put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, bservice.storeType);
@@ -279,4 +283,8 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
       }
       return count;
    }
+
+   public MBeanServer getMbeanServer() {
+      return this.mbeanServer;
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/29a4ae42/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 6bf47f6..6274890 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
@@ -35,11 +35,18 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
 import javax.management.ObjectName;
 
 import junit.framework.Test;
 
-import org.apache.activemq.broker.jmx.DestinationViewMBean;
+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.broker.artemiswrapper.ArtemisBrokerWrapper;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.slf4j.Logger;
@@ -855,7 +862,7 @@ public class JMSConsumerTest extends JmsTestSupport {
    }
 
    public void initCombosForTestAckOfExpired() {
-      addCombinationValues("destinationType", new Object[]{Byte.valueOf(ActiveMQDestination.QUEUE_TYPE),
Byte.valueOf(ActiveMQDestination.TOPIC_TYPE)});
+      addCombinationValues("destinationType", new Object[]{Byte.valueOf(ActiveMQDestination.QUEUE_TYPE)});
    }
 
    public void testAckOfExpired() throws Exception {
@@ -867,6 +874,7 @@ 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);
 
@@ -900,25 +908,43 @@ public class JMSConsumerTest extends JmsTestSupport {
       }
       assertEquals("consumer has expiredMessages", count, amqConsumer.getConsumerStats().getExpiredMessageCount().getCount());
 
-      DestinationViewMBean view = createView(destination);
+      DestinationControl view = createView(destination);
+
+      assertEquals("Wrong inFlightCount: " + view.getDeliveringCount(), 0, view.getDeliveringCount());
+      assertEquals("Wrong dispatch count: " + view.getMessagesAdded(), 8, view.getMessagesAdded());
+   }
 
-      assertEquals("Wrong inFlightCount: " + view.getInFlightCount(), 0, view.getInFlightCount());
-      assertEquals("Wrong dispatch count: " + view.getDispatchCount(), 8, view.getDispatchCount());
-      assertEquals("Wrong dequeue count: " + view.getDequeueCount(), 8, view.getDequeueCount());
-      assertEquals("Wrong expired count: " + view.getExpiredCount(), 4, view.getExpiredCount());
+   private void createManagedDestinationOnServer(ActiveMQDestination destination) throws
Exception {
+      String destName = destination.getPhysicalName();
+      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 DestinationViewMBean createView(ActiveMQDestination destination) throws Exception
{
+   protected DestinationControl createView(ActiveMQDestination destination) throws Exception
{
 
-      String domain = "org.apache.activemq";
-      ObjectName name;
+      String destName = destination.getPhysicalName();
       if (destination.isQueue()) {
-         name = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=test");
+         return createJMSQueueControl(destName);
       }
       else {
-         name = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=test");
+         return createJMSTopicControl(destName);
       }
-      return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name,
DestinationViewMBean.class, true);
    }
 
+   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);
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/29a4ae42/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
index bf1535a..309fec9 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsDurableQueueWildcardSendReceiveTest.java
@@ -21,7 +21,7 @@ import javax.jms.DeliveryMode;
 import org.apache.activemq.test.JmsTopicSendReceiveTest;
 
 /**
- *
+ * https://issues.apache.org/jira/browse/ARTEMIS-189
  */
 public class JmsDurableQueueWildcardSendReceiveTest extends JmsTopicSendReceiveTest {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/29a4ae42/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
index 296a56e..9a6dcb1 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueWildcardSendReceiveTest.java
@@ -29,7 +29,7 @@ import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.test.JmsTopicSendReceiveTest;
 
 /**
- *
+ * https://issues.apache.org/jira/browse/ARTEMIS-189
  */
 public class JmsQueueWildcardSendReceiveTest extends JmsTopicSendReceiveTest {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/29a4ae42/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java
index 9f412a9..9458ae3 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java
@@ -102,6 +102,7 @@ public class BrokerTest extends BrokerTestSupport {
       addCombinationValues("deliveryMode", new Object[]{Integer.valueOf(DeliveryMode.NON_PERSISTENT),
Integer.valueOf(DeliveryMode.PERSISTENT)});
    }
 
+   //https://issues.apache.org/jira/browse/ARTEMIS-384
    public void testQueueBrowserWith2Consumers() throws Exception {
 
       ActiveMQDestination destination = new ActiveMQQueue("TEST");
@@ -684,6 +685,7 @@ public class BrokerTest extends BrokerTestSupport {
       addCombinationValues("durableConsumer", new Object[]{Boolean.TRUE, Boolean.FALSE});
    }
 
+   // https://issues.apache.org/jira/browse/ARTEMIS-402
    public void testTopicRetroactiveConsumerSeeMessagesBeforeCreation() throws Exception {
 
       ActiveMQDestination destination = new ActiveMQTopic("TEST");
@@ -1207,6 +1209,7 @@ public class BrokerTest extends BrokerTestSupport {
       addCombinationValues("deliveryMode", new Object[]{Integer.valueOf(DeliveryMode.NON_PERSISTENT),
Integer.valueOf(DeliveryMode.PERSISTENT)});
    }
 
+   // https://issues.apache.org/jira/browse/ARTEMIS-402
    public void testTopicNoLocal() throws Exception {
 
       ActiveMQDestination destination = new ActiveMQTopic("TEST");
@@ -1272,6 +1275,7 @@ public class BrokerTest extends BrokerTestSupport {
       addCombinationValues("deliveryMode", new Object[]{Integer.valueOf(DeliveryMode.NON_PERSISTENT),
Integer.valueOf(DeliveryMode.PERSISTENT)});
    }
 
+   //https://issues.apache.org/jira/browse/ARTEMIS-402
    public void testTopicDispatchIsBroadcast() throws Exception {
 
       ActiveMQDestination destination = new ActiveMQTopic("TEST");


Mime
View raw message