You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/12/16 15:05:34 UTC
[2/3] activemq-artemis git commit: ARTEMIS-878 test fixes
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 <cl...@apache.org>
Authored: Fri Dec 16 09:26:54 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
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<ClientMessage>() {
@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());