[1/2] activemq-artemis git commit: This closes #2439

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/2] activemq-artemis git commit: This closes #2439

nigrofranz
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8e4bc4813 -> f75da3c85


This closes #2439


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

Branch: refs/heads/master
Commit: f75da3c851391980b89b83eac01e57f73054147e
Parents: 8e4bc48 3c595f1
Author: Francesco Nigro <[hidden email]>
Authored: Thu Dec 6 16:45:35 2018 +0100
Committer: Francesco Nigro <[hidden email]>
Committed: Thu Dec 6 16:45:35 2018 +0100

----------------------------------------------------------------------
 .../core/management/ActiveMQServerControl.java  |  6 ++++++
 .../impl/ActiveMQServerControlImpl.java         | 18 ++++++++++++++++
 .../management/ActiveMQServerControlTest.java   | 22 ++++++++++++++++++++
 .../ActiveMQServerControlUsingCoreTest.java     | 11 ++++++++++
 4 files changed, 57 insertions(+)
----------------------------------------------------------------------


Reply | Threaded
Open this post in threaded view
|

[2/2] activemq-artemis git commit: ARTEMIS-2179 mgmnt method to get cluster-cxn names

nigrofranz
ARTEMIS-2179 mgmnt method to get cluster-cxn names


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

Branch: refs/heads/master
Commit: 3c595f18d5dbd439f7230c53619160a01af8d183
Parents: 8e4bc48
Author: Justin Bertram <[hidden email]>
Authored: Tue Nov 20 18:53:01 2018 -0600
Committer: Francesco Nigro <[hidden email]>
Committed: Thu Dec 6 16:45:35 2018 +0100

----------------------------------------------------------------------
 .../core/management/ActiveMQServerControl.java  |  6 ++++++
 .../impl/ActiveMQServerControlImpl.java         | 18 ++++++++++++++++
 .../management/ActiveMQServerControlTest.java   | 22 ++++++++++++++++++++
 .../ActiveMQServerControlUsingCoreTest.java     | 11 ++++++++++
 4 files changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3c595f18/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
index 62a422f..06819b2 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
@@ -1335,5 +1335,11 @@ public interface ActiveMQServerControl {
     */
    @Operation(desc = "Names of the queues created on this server with the given routing-type (i.e. ANYCAST or MULTICAST)", impact = MBeanOperationInfo.INFO)
    String[] getQueueNames(@Parameter(name = "routingType", desc = "The routing type, MULTICAST or ANYCAST") String routingType);
+
+   /**
+    * Returns the names of the cluster-connections deployed on this server.
+    */
+   @Operation(desc = "Names of the cluster-connections deployed on this server", impact = MBeanOperationInfo.INFO)
+   String[] getClusterConnectionNames();
 }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3c595f18/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 716a733..96f352e 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
@@ -951,6 +951,24 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
    }
 
    @Override
+   public String[] getClusterConnectionNames() {
+      checkStarted();
+
+      clearIO();
+      try {
+         List<String> names = new ArrayList<>();
+         for (ClusterConnection clusterConnection : server.getClusterManager().getClusterConnections()) {
+            names.add(clusterConnection.getName().toString());
+         }
+
+         String[] result = new String[names.size()];
+         return names.toArray(result);
+      } finally {
+         blockOnIO();
+      }
+   }
+
+   @Override
    public String getUptime() {
       checkStarted();
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3c595f18/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
index 931e6c3..0e40041 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
@@ -55,6 +55,7 @@ import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
 import org.apache.activemq.artemis.api.jms.JMSFactoryType;
 import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
 import org.apache.activemq.artemis.core.client.impl.ClientSessionImpl;
+import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
 import org.apache.activemq.artemis.core.messagecounter.impl.MessageCounterManagerImpl;
@@ -464,6 +465,27 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
    }
 
    @Test
+   public void testGetClusterConnectionNames() throws Exception {
+      String clusterConnection1 = RandomUtil.randomString();
+      String clusterConnection2 = RandomUtil.randomString();
+
+      ActiveMQServerControl serverControl = createManagementControl();
+
+      Assert.assertFalse(ActiveMQServerControlTest.contains(clusterConnection1, serverControl.getClusterConnectionNames()));
+      Assert.assertFalse(ActiveMQServerControlTest.contains(clusterConnection2, serverControl.getClusterConnectionNames()));
+
+      server.stop();
+      server
+         .getConfiguration()
+         .addClusterConfiguration(new ClusterConnectionConfiguration().setName(clusterConnection1).setConnectorName(connectorConfig.getName()))
+         .addClusterConfiguration(new ClusterConnectionConfiguration().setName(clusterConnection2).setConnectorName(connectorConfig.getName()));
+      server.start();
+
+      Assert.assertTrue(ActiveMQServerControlTest.contains(clusterConnection1, serverControl.getClusterConnectionNames()));
+      Assert.assertTrue(ActiveMQServerControlTest.contains(clusterConnection2, serverControl.getClusterConnectionNames()));
+   }
+
+   @Test
    public void testGetAddressNames() throws Exception {
       SimpleString address = RandomUtil.randomSimpleString();
       SimpleString name = RandomUtil.randomSimpleString();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3c595f18/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 a20da2b..716b5d0 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
@@ -325,6 +325,17 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
          }
 
          @Override
+         public String[] getClusterConnectionNames() {
+            try {
+               return (String[]) proxy.invokeOperation(String.class, "getClusterConnectionNames");
+            } catch (Exception e) {
+               e.printStackTrace();
+            }
+
+            return null;
+         }
+
+         @Override
          public String getUptime() {
             return null;
          }