activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/2] activemq-artemis git commit: NO-JIRA added unit test to exercise ActiveMQServerControl.listQueues()
Date Wed, 06 Sep 2017 13:55:30 GMT
NO-JIRA added unit test to exercise ActiveMQServerControl.listQueues()


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

Branch: refs/heads/master
Commit: 26389c472d81628a36961b02d0352c16d3a7f6e1
Parents: f8ccb6d
Author: Pat Fox <pat.g.fox@gmail.com>
Authored: Fri Sep 1 16:52:56 2017 +0200
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Sep 6 09:54:29 2017 -0400

----------------------------------------------------------------------
 .../management/ActiveMQServerControlTest.java   | 60 ++++++++++++++++++++
 .../ActiveMQServerControlUsingCoreTest.java     | 11 ++--
 2 files changed, 65 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/26389c47/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 526a5ae..34928bc 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
@@ -1435,6 +1435,66 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
    }
 
    @Test
+   public void testListQueues() throws Exception {
+      SimpleString queueName1 = new SimpleString("my_queue_one");
+      SimpleString queueName2 = new SimpleString("my_queue_two");
+      SimpleString queueName3 = new SimpleString("other_queue_three");
+
+      ActiveMQServerControl serverControl = createManagementControl();
+
+      server.addAddressInfo(new AddressInfo(queueName1, RoutingType.ANYCAST));
+      server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, false, false);
+
+      server.addAddressInfo(new AddressInfo(queueName2, RoutingType.ANYCAST));
+      server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, false, false);
+
+      server.addAddressInfo(new AddressInfo(queueName3, RoutingType.ANYCAST));
+      server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, false, false);
+
+      //test with filter that matches 2 queues
+      HashMap<String, Object> optionMap = new HashMap<>();
+      optionMap.put("field", "name");
+      optionMap.put("operation", "CONTAINS");
+      optionMap.put("value", "my_queue");
+      JsonObject optionjsonObject = JsonUtil.toJsonObject(optionMap);
+      String optionString = optionjsonObject.toString();
+
+      String queuesAsJsonString = serverControl.listQueues(optionString, 1, 50);
+
+      JsonObject queuesAsJsonObject = JsonUtil.readJsonObject(queuesAsJsonString);
+      JsonArray array = (JsonArray) queuesAsJsonObject.get("data");
+
+      Assert.assertEquals("number of queues returned from query", 2, array.size());
+      Assert.assertTrue(array.getJsonObject(0).getString("name").contains("my_queue"));
+      Assert.assertTrue(array.getJsonObject(1).getString("name").contains("my_queue"));
+
+      //test with an empty filter
+      optionMap = new HashMap<>();
+      optionMap.put("field", "");
+      optionMap.put("operation", "");
+      optionMap.put("value", "");
+      optionjsonObject = JsonUtil.toJsonObject(optionMap);
+      optionString = optionjsonObject.toString();
+
+      queuesAsJsonString = serverControl.listQueues(optionString, 1, 50);
+
+      queuesAsJsonObject = JsonUtil.readJsonObject(queuesAsJsonString);
+      array = (JsonArray) queuesAsJsonObject.get("data");
+
+      // at least 3 queues or more
+      Assert.assertTrue("number of queues returned from query", 3 <= array.size());
+
+      //test with small page size
+      queuesAsJsonString = serverControl.listQueues(optionString, 1, 1);
+
+      queuesAsJsonObject = JsonUtil.readJsonObject(queuesAsJsonString);
+      array = (JsonArray) queuesAsJsonObject.get("data");
+
+      Assert.assertEquals("number of queues returned from query", 1, array.size());
+
+   }
+
+   @Test
    public void testConnectorServiceManagement() throws Exception {
       ActiveMQServerControl managementControl = createManagementControl();
       managementControl.createConnectorService("myconn", FakeConnectorServiceFactory.class.getCanonicalName(),
new HashMap<String, Object>());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/26389c47/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 9408fdb..8910b1c 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
@@ -916,36 +916,35 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
          public String listSessions(@Parameter(name = "Filter String") String filter,
                                     @Parameter(name = "Page Number") int page,
                                     @Parameter(name = "Page Size") int pageSize) throws Exception
{
-            return null;
+            return (String) proxy.invokeOperation("listSessions", filter, page, pageSize);
          }
 
          @Override
          public String listConsumers(@Parameter(name = "Options") String options,
                                      @Parameter(name = "Page Number") int page,
                                      @Parameter(name = "Page Size") int pageSize) throws
Exception {
-            return null;
+            return (String) proxy.invokeOperation("listConsumers", options, page, pageSize);
          }
 
-
          @Override
          public String listProducers(@Parameter(name = "Options") String options,
                                      @Parameter(name = "Page Number") int page,
                                      @Parameter(name = "Page Size") int pageSize) throws
Exception {
-            return null;
+            return (String) proxy.invokeOperation("listProducers", options, page, pageSize);
          }
 
          @Override
          public String listAddresses(@Parameter(name = "Options") String options,
                                      @Parameter(name = "Page Number") int page,
                                      @Parameter(name = "Page Size") int pageSize) throws
Exception {
-            return null;
+            return (String) proxy.invokeOperation("listAddresses", options, page, pageSize);
          }
 
          @Override
          public String listQueues(@Parameter(name = "Options") String options,
                                   @Parameter(name = "Page Number") int page,
                                   @Parameter(name = "Page Size") int pageSize) throws Exception
{
-            return null;
+            return (String) proxy.invokeOperation("listQueues", options, page, pageSize);
          }
       };
    }


Mime
View raw message