Search in sources :

Example 1 with DeleteAddress

use of org.apache.activemq.artemis.cli.commands.address.DeleteAddress in project activemq-artemis by apache.

the class AddressCommandTest method testDeleteAddressDoesNotExistsShowsError.

@Test
public void testDeleteAddressDoesNotExistsShowsError() throws Exception {
    String address = "address";
    DeleteAddress deleteAddress = new DeleteAddress();
    deleteAddress.setName(address);
    deleteAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionFailure(deleteAddress, "Address Does Not Exist");
}
Also used : PrintStream(java.io.PrintStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) DeleteAddress(org.apache.activemq.artemis.cli.commands.address.DeleteAddress) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 2 with DeleteAddress

use of org.apache.activemq.artemis.cli.commands.address.DeleteAddress in project activemq-artemis by apache.

the class AddressCommandTest method testDeleteAddress.

@Test
public void testDeleteAddress() throws Exception {
    String address = "address";
    CreateAddress command = new CreateAddress();
    command.setName(address);
    command.execute(new ActionContext());
    assertNotNull(server.getAddressInfo(new SimpleString(address)));
    DeleteAddress deleteAddress = new DeleteAddress();
    deleteAddress.setName(address);
    deleteAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionPassed(deleteAddress);
    assertNull(server.getAddressInfo(new SimpleString(address)));
}
Also used : PrintStream(java.io.PrintStream) CreateAddress(org.apache.activemq.artemis.cli.commands.address.CreateAddress) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) DeleteAddress(org.apache.activemq.artemis.cli.commands.address.DeleteAddress) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 3 with DeleteAddress

use of org.apache.activemq.artemis.cli.commands.address.DeleteAddress 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");
}
Also used : PrintStream(java.io.PrintStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) DeleteAddress(org.apache.activemq.artemis.cli.commands.address.DeleteAddress) 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 DeleteAddress (org.apache.activemq.artemis.cli.commands.address.DeleteAddress)3 Test (org.junit.Test)3 CreateAddress (org.apache.activemq.artemis.cli.commands.address.CreateAddress)1 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)1