use of org.apache.activemq.artemis.cli.commands.ActionContext in project activemq-artemis by apache.
the class AddressCommandTest method testFailDeleteAddressWhenExistsQueues.
@Test
public void testFailDeleteAddressWhenExistsQueues() throws Exception {
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST));
server.addAddressInfo(addressInfo);
server.createQueue(addressSimpleString, RoutingType.MULTICAST, new SimpleString("queue1"), null, true, false);
final DeleteAddress deleteAddress = new DeleteAddress();
deleteAddress.setName(addressName);
deleteAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(deleteAddress, "Address " + addressName + " has bindings");
}
use of org.apache.activemq.artemis.cli.commands.ActionContext in project activemq-artemis by apache.
the class AddressCommandTest method testCreateAddress.
@Test
public void testCreateAddress() throws Exception {
String address = "address";
CreateAddress command = new CreateAddress();
command.setName(address);
command.setAnycast(true);
command.setMulticast(true);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
AddressInfo addressInfo = server.getAddressInfo(new SimpleString(address));
assertNotNull(addressInfo);
assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST));
assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST));
}
use of org.apache.activemq.artemis.cli.commands.ActionContext in project activemq-artemis by apache.
the class QueueCommandTest method testDeleteQueueWithConsumersFails.
@Test
public void testDeleteQueueWithConsumersFails() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(delete, "AMQ119025");
}
use of org.apache.activemq.artemis.cli.commands.ActionContext in project activemq-artemis by apache.
the class QueueCommandTest method testDeleteCoreQueue.
@Test
public void testDeleteCoreQueue() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(delete);
assertFalse(server.queueQuery(queueName).isExists());
}
use of org.apache.activemq.artemis.cli.commands.ActionContext in project activemq-artemis by apache.
the class QueueCommandTest method testUpdateCoreQueueCannotLowerMaxConsumers.
@Test
public void testUpdateCoreQueueCannotLowerMaxConsumers() throws Exception {
final String queueName = "updateQueue";
final SimpleString queueNameString = new SimpleString(queueName);
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final int oldMaxConsumers = 2;
final RoutingType oldRoutingType = RoutingType.MULTICAST;
final boolean oldPurgeOnNoConsumers = false;
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, oldRoutingType);
server.addAddressInfo(addressInfo);
server.createQueue(addressSimpleString, oldRoutingType, queueNameString, null, true, false, oldMaxConsumers, oldPurgeOnNoConsumers, false);
server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer());
server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer());
final int newMaxConsumers = 1;
final UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName);
updateQueue.setMaxConsumers(newMaxConsumers);
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateQueue, "AMQ119210");
final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString);
assertEquals("maxConsumers", oldMaxConsumers, queueQueryResult.getMaxConsumers());
}
Aggregations