Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7014B200BEE for ; Fri, 16 Dec 2016 16:05:35 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 6ED45160B24; Fri, 16 Dec 2016 15:05:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9741C160AF6 for ; Fri, 16 Dec 2016 16:05:34 +0100 (CET) Received: (qmail 49817 invoked by uid 500); 16 Dec 2016 15:05:33 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 49804 invoked by uid 99); 16 Dec 2016 15:05:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Dec 2016 15:05:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A09F6DFA1F; Fri, 16 Dec 2016 15:05:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: martyntaylor@apache.org To: commits@activemq.apache.org Date: Fri, 16 Dec 2016 15:05:34 -0000 Message-Id: <594791004995474da47431c875dd6783@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/3] activemq-artemis git commit: ARTEMIS-878 test fixes archived-at: Fri, 16 Dec 2016 15:05:35 -0000 ARTEMIS-878 test fixes Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e1577e23 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e1577e23 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e1577e23 Branch: refs/heads/master Commit: e1577e230a472bf6bdbade7cbcbc0c5da56aedff Parents: 03cc566 Author: Clebert Suconic Authored: Fri Dec 16 09:26:54 2016 -0500 Committer: Clebert Suconic Committed: Fri Dec 16 09:37:46 2016 -0500 ---------------------------------------------------------------------- .../artemis/cli/commands/queue/CreateQueue.java | 2 +- .../cli/commands/queue/QueueAbstract.java | 7 ++++-- .../artemis/cli/commands/queue/UpdateQueue.java | 2 +- .../tests/integration/cli/QueueCommandTest.java | 23 ++++++++++---------- 4 files changed, 18 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e1577e23/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java index a76b3c6..93c8e78 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java @@ -37,7 +37,7 @@ public class CreateQueue extends QueueAbstract { @Override public void setUpInvocation(ClientMessage message) throws Exception { String address = getAddress(); - ManagementHelper.putOperationInvocation(message, "broker", "createQueue", address, getRoutingType(), getName(), getFilter(), isDurable(), getMaxConsumers(), treatNoConsumers(true), isAutoCreateAddress()); + ManagementHelper.putOperationInvocation(message, "broker", "createQueue", address, getRoutingType(), getName(), getFilter(), isDurable(), getMaxConsumers(-1), treatNoConsumers(true), isAutoCreateAddress()); } @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e1577e23/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java index beeb179..1e0da90 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java @@ -41,7 +41,7 @@ public class QueueAbstract extends AbstractAction { private boolean keepOnNoConsumers = false; @Option(name = "--max-consumers", description = "Maximum number of consumers allowed on this queue at any one time (default no limit)") - private int maxConsumers = -1; + private Integer maxConsumers; @Option(name = "--auto-create-ddress", description = "Auto create the address (if it doesn't exist) with default values") private Boolean autoCreateAddress = false; @@ -89,7 +89,10 @@ public class QueueAbstract extends AbstractAction { return this; } - public int getMaxConsumers() { + public Integer getMaxConsumers(Integer defaultValue) { + if (maxConsumers == null) { + return defaultValue; + } return maxConsumers; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e1577e23/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java index b134269..cb4d89f 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java @@ -36,7 +36,7 @@ public class UpdateQueue extends QueueAbstract { performCoreManagement(new ManagementCallback() { @Override public void setUpInvocation(ClientMessage message) throws Exception { - ManagementHelper.putOperationInvocation(message, "broker", "updateQueue", getName(), getRoutingType(), getMaxConsumers(), isDeleteOnNoConsumers()); + ManagementHelper.putOperationInvocation(message, "broker", "updateQueue", getName(), getRoutingType(), getMaxConsumers(null), isDeleteOnNoConsumers()); } @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e1577e23/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java ---------------------------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java index d578154..ed9f147 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java @@ -59,7 +59,7 @@ public class QueueCommandTest extends JMSTestBase { command.setMulticast(true); command.setAnycast(false); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); - checkExecutionFailure(command, "AMQ119203: Address Does Not Exist:"); + checkExecutionFailure(command, "AMQ119203"); assertFalse(server.queueQuery(new SimpleString(queueName)).isExists()); } @@ -137,7 +137,7 @@ public class QueueCommandTest extends JMSTestBase { command.setAnycast(false); command.execute(new ActionContext()); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); - checkExecutionFailure(command, "AMQ119019: Queue already exists " + queueName); + checkExecutionFailure(command, "AMQ119019"); } @Test @@ -167,7 +167,7 @@ public class QueueCommandTest extends JMSTestBase { DeleteQueue delete = new DeleteQueue(); delete.setName(queueName.toString()); delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); - checkExecutionFailure(delete, "AMQ119017: Queue " + queueName + " does not exist"); + checkExecutionFailure(delete, "AMQ119017"); assertFalse(server.queueQuery(queueName).isExists()); } @@ -189,7 +189,7 @@ public class QueueCommandTest extends JMSTestBase { DeleteQueue delete = new DeleteQueue(); delete.setName(queueName.toString()); delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); - checkExecutionFailure(delete, "AMQ119025: Cannot delete queue " + queueName + " on binding deleteQueue"); + checkExecutionFailure(delete, "AMQ119025"); } @Test @@ -257,8 +257,8 @@ public class QueueCommandTest extends JMSTestBase { final UpdateQueue updateQueue = new UpdateQueue(); updateQueue.setName(queueName); updateQueue.setDeleteOnNoConsumers(newDeleteOnNoConsumers); - updateQueue.setMulticast(newRoutingType.equals(RoutingType.MULTICAST)); - updateQueue.setAnycast(newRoutingType.equals(RoutingType.ANYCAST)); + updateQueue.setAnycast(true); + updateQueue.setMulticast(false); updateQueue.setMaxConsumers(newMaxConsumers); updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); @@ -287,12 +287,12 @@ public class QueueCommandTest extends JMSTestBase { final RoutingType newRoutingType = RoutingType.ANYCAST; final UpdateQueue updateQueue = new UpdateQueue(); updateQueue.setName(queueName); - updateQueue.setMulticast(newRoutingType.equals(RoutingType.MULTICAST)); - updateQueue.setAnycast(newRoutingType.equals(RoutingType.ANYCAST)); + updateQueue.setAnycast(true); + updateQueue.setMulticast(false); + updateQueue.setMaxConsumers(-1); updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); - final String expectedErrorMessage = MessageFormat.format("Can''t update queue {0} with routing type: {1}, Supported routing types for address: {2} are {3}", queueName, newRoutingType, addressName, supportedRoutingTypes); - checkExecutionFailure(updateQueue, expectedErrorMessage); + checkExecutionFailure(updateQueue, "AMQ119211"); final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString); assertEquals("maxConsumers", oldMaxConsumers, queueQueryResult.getMaxConsumers()); @@ -322,8 +322,7 @@ public class QueueCommandTest extends JMSTestBase { updateQueue.setMaxConsumers(newMaxConsumers); updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); - final String expectedErrorMessage = MessageFormat.format("Can''t update queue {0} with maxConsumers: {1}. Current consumers are {2}.", queueName, newMaxConsumers, 2); - checkExecutionFailure(updateQueue, expectedErrorMessage); + checkExecutionFailure(updateQueue, "AMQ119210"); final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString); assertEquals("maxConsumers", oldMaxConsumers, queueQueryResult.getMaxConsumers());