Search in sources :

Example 1 with UpdateAddress

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");
}
Also used : PrintStream(java.io.PrintStream) UpdateAddress(org.apache.activemq.artemis.cli.commands.address.UpdateAddress) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 2 with UpdateAddress

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());
}
Also used : PrintStream(java.io.PrintStream) UpdateAddress(org.apache.activemq.artemis.cli.commands.address.UpdateAddress) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) AddressInfo(org.apache.activemq.artemis.core.server.impl.AddressInfo) Test(org.junit.Test)

Example 3 with UpdateAddress

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);
}
Also used : PrintStream(java.io.PrintStream) UpdateAddress(org.apache.activemq.artemis.cli.commands.address.UpdateAddress) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) AddressInfo(org.apache.activemq.artemis.core.server.impl.AddressInfo) Test(org.junit.Test)

Aggregations

PrintStream (java.io.PrintStream)3 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)3 ActionContext (org.apache.activemq.artemis.cli.commands.ActionContext)3 UpdateAddress (org.apache.activemq.artemis.cli.commands.address.UpdateAddress)3 Test (org.junit.Test)3 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)2