use of org.apache.activemq.artemis.cli.commands.address.UpdateAddress in project activemq-artemis by apache.
the class AddressCommandTest method testFailUpdateAddressDoesNotExist.
@Test
public void testFailUpdateAddressDoesNotExist() throws Exception {
final String addressName = "address";
final UpdateAddress updateAddress = new UpdateAddress();
updateAddress.setName(addressName);
updateAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateAddress, "Address Does Not Exist");
}
use of org.apache.activemq.artemis.cli.commands.address.UpdateAddress in project activemq-artemis by apache.
the class AddressCommandTest method testUpdateAddressRoutingTypes.
@Test
public void testUpdateAddressRoutingTypes() throws Exception {
final String addressName = "address";
final SimpleString address = new SimpleString(addressName);
server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST));
final UpdateAddress updateAddress = new UpdateAddress();
updateAddress.setName(addressName);
updateAddress.setAnycast(true);
updateAddress.setMulticast(true);
updateAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(updateAddress);
final AddressInfo addressInfo = server.getAddressInfo(address);
assertNotNull(addressInfo);
assertEquals(EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST), addressInfo.getRoutingTypes());
}
use of org.apache.activemq.artemis.cli.commands.address.UpdateAddress in project activemq-artemis by apache.
the class AddressCommandTest method testFailUpdateAddressRoutingTypesWhenExistsQueues.
@Test
public void testFailUpdateAddressRoutingTypesWhenExistsQueues() 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 UpdateAddress updateAddress = new UpdateAddress();
updateAddress.setName(addressName);
updateAddress.setAnycast(true);
updateAddress.setMulticast(false);
updateAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
final String expectedErrorMessage = MessageFormat.format("Can''t remove routing type {0}, queues exists for address: {1}. Please delete queues before removing this routing type.", RoutingType.MULTICAST, addressName);
checkExecutionFailure(updateAddress, expectedErrorMessage);
}
Aggregations