ARTEMIS-1436 update CLI StatQueue and console to allow greater_than/less_than comparison

This commit is contained in:
Pat Fox 2017-09-19 16:45:07 +02:00 committed by Clebert Suconic
parent 0e655f9a8e
commit 0d57c3973a
6 changed files with 52 additions and 7 deletions

View File

@ -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.")

View File

@ -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());

View File

@ -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: "",

View File

@ -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: "",

View File

@ -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: "",

View File

@ -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: "",