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 1813033ebb..7175579c03 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.") 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 fde05a72af..0aa5b3265a 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()); 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 9f9d87d734..fd535541f0 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: "", 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 b24dba8946..fcabc421b3 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: "", 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 16300e6150..4bf0b97eb2 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: "", 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 498f10ea73..5cd96fb3e0 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: "",