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: ARTEMIS-1436 update CLI StatQueue and console to allow greater_than/less_than comparison
Date Tue, 26 Sep 2017 19:17:56 GMT
ARTEMIS-1436 update CLI StatQueue and console to allow greater_than/less_than comparison


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

Branch: refs/heads/master
Commit: 0d57c3973ae93fe2daf2b7fcdbf679d0cb25e4b4
Parents: 0e655f9
Author: Pat Fox <pat.g.fox@gmail.com>
Authored: Tue Sep 19 16:45:07 2017 +0200
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Sep 26 15:17:48 2017 -0400

----------------------------------------------------------------------
 .../artemis/cli/commands/queue/StatQueue.java   |  4 +-
 .../apache/activemq/cli/test/ArtemisTest.java   | 39 +++++++++++++++++++-
 .../src/main/webapp/plugin/js/addresses.js      |  4 +-
 .../src/main/webapp/plugin/js/connections.js    |  4 +-
 .../src/main/webapp/plugin/js/queues.js         |  4 +-
 .../src/main/webapp/plugin/js/sessions.js       |  4 +-
 6 files changed, 52 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0d57c397/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
index 1813033..7175579 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/StatQueue.java
@@ -51,7 +51,7 @@ public class StatQueue extends AbstractAction {
    }
 
    public enum OPERATION {
-      CONTAINS, EQUALS
+      CONTAINS, EQUALS, GREATER_THAN, LESS_THAN
    }
 
    @Option(name = "--queueName", description = "display queue stats for queue(s) with names
containing this string.")
@@ -60,7 +60,7 @@ public class StatQueue extends AbstractAction {
    @Option(name = "--field", description = "field to use in filter. Possible values NAME,
ADDRESS, MESSAGE_COUNT, MESSAGES_ADDED, DELIVERING_COUNT, MESSAGES_ACKED.")
    private String fieldName;
 
-   @Option(name = "--operation", description = "operation to use in filter. Possible values
CONTAINS, EQUALS.")
+   @Option(name = "--operation", description = "operation to use in filter. Possible values
CONTAINS, EQUALS, GREATER_THAN, LESS_THAN.")
    private String operationName;
 
    @Option(name = "--value", description = "value to use in the filter.")

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0d57c397/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
index fde05a7..0aa5b32 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
@@ -761,6 +761,43 @@ public class ArtemisTest extends CliTestBase {
          // Header line + 0 queues
          Assert.assertEquals("rows returned filtering by MESSAGES_ADDED", 1, lines.size());
 
+         //check  queues with greater_than 19 MESSAGE_ADDED  displayed
+         context = new TestActionContext();
+         statQueue = new StatQueue();
+         statQueue.setUser("admin");
+         statQueue.setPassword("admin");
+         statQueue.setFieldName("MESSAGES_ADDED");
+         statQueue.setOperationName("GREATER_THAN");
+         statQueue.setValue("19");
+         statQueue.execute(context);
+         lines = getOutputLines(context, false);
+
+         // Header line + 1 queues
+         Assert.assertEquals("rows returned filtering by MESSAGES_ADDED", 2, lines.size());
+         String[] columns = lines.get(1).split("\\|");
+         Assert.assertEquals("queue name filtered by MESSAGES_ADDED GREATER_THAN ", "Test20",
columns[2].trim());
+
+         //check queues with less_than 2 MESSAGE_ADDED displayed
+         context = new TestActionContext();
+         statQueue = new StatQueue();
+         statQueue.setUser("admin");
+         statQueue.setPassword("admin");
+         statQueue.setFieldName("MESSAGES_ADDED");
+         statQueue.setOperationName("LESS_THAN");
+         statQueue.setValue("2");
+         statQueue.execute(context);
+         lines = getOutputLines(context, false);
+
+         // Header line + "at least" 2 queues
+         Assert.assertTrue("rows returned filtering by MESSAGES_ADDED LESS_THAN", 2 <=
lines.size());
+
+         //walk the result returned and the specific destinations are not part of the output
+         for (String line : lines) {
+            columns = line.split("\\|");
+            Assert.assertNotEquals("ensure Test20 is not part of returned result", "Test20",
columns[2].trim());
+            Assert.assertNotEquals("ensure Test1 is not part of returned result", "Test1",
columns[2].trim());
+         }
+
          //check all queues containing address "Test1" are displayed using Filter field DELIVERING_COUNT
          context = new TestActionContext();
          statQueue = new StatQueue();
@@ -771,7 +808,7 @@ public class ArtemisTest extends CliTestBase {
          statQueue.setValue("10");
          statQueue.execute(context);
          lines = getOutputLines(context, false);
-         String[] columns = lines.get(1).split("\\|");
+         columns = lines.get(1).split("\\|");
          // Header line + 1 queues
          Assert.assertEquals("rows returned filtering by DELIVERING_COUNT", 2, lines.size());
          Assert.assertEquals("queue name filtered by DELIVERING_COUNT ", "Test1", columns[2].trim());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0d57c397/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/addresses.js
----------------------------------------------------------------------
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/addresses.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/addresses.js
index 9f9d87d..fd53554 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/addresses.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/addresses.js
@@ -66,7 +66,9 @@ var ARTEMIS = (function(ARTEMIS) {
             ],
             operationOptions: [
                 {id: 'EQUALS', name: 'Equals'},
-                {id: 'CONTAINS', name: 'Contains'}
+                {id: 'CONTAINS', name: 'Contains'},
+                {id: 'GREATER_THAN', name: 'Greater Than'},
+                {id: 'LESS_THAN', name: 'Less Than'}
             ],
             values: {
                 field: "",

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0d57c397/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js
----------------------------------------------------------------------
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js
index b24dba8..fcabc42 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js
@@ -85,7 +85,9 @@ var ARTEMIS = (function(ARTEMIS) {
             ],
             operationOptions: [
                 {id: 'EQUALS', name: 'Equals'},
-                {id: 'CONTAINS', name: 'Contains'}
+                {id: 'CONTAINS', name: 'Contains'},
+                {id: 'GREATER_THAN', name: 'Greater Than'},
+                {id: 'LESS_THAN', name: 'Less Than'}
             ],
             values: {
                 field: "",

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0d57c397/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js
----------------------------------------------------------------------
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js
index 16300e6..4bf0b97 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js
@@ -169,7 +169,9 @@ var ARTEMIS = (function(ARTEMIS) {
             ],
             operationOptions: [
                 {id: 'EQUALS', name: 'Equals'},
-                {id: 'CONTAINS', name: 'Contains'}
+                {id: 'CONTAINS', name: 'Contains'},
+                {id: 'GREATER_THAN', name: 'Greater Than'},
+                {id: 'LESS_THAN', name: 'Less Than'}
             ],
             values: {
                 field: "",

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0d57c397/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js
----------------------------------------------------------------------
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js
index 498f10e..5cd96fb 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js
@@ -77,7 +77,9 @@ var ARTEMIS = (function(ARTEMIS) {
             ],
             operationOptions: [
                 {id: 'EQUALS', name: 'Equals'},
-                {id: 'CONTAINS', name: 'Contains'}
+                {id: 'CONTAINS', name: 'Contains'},
+                {id: 'GREATER_THAN', name: 'Greater Than'},
+                {id: 'LESS_THAN', name: 'Less Than'}
             ],
             values: {
                 field: "",


Mime
View raw message