use of org.apache.activemq.artemis.cli.commands.ActionContext in project activemq-artemis by apache.
the class AddressCommandTest method testCreateAddressAlreadyExistsShowsError.
@Test
public void testCreateAddressAlreadyExistsShowsError() throws Exception {
String address = "address";
CreateAddress command = new CreateAddress();
command.setName(address);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
assertNotNull(server.getAddressInfo(new SimpleString(address)));
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(command, "Address already exists");
}
use of org.apache.activemq.artemis.cli.commands.ActionContext 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");
}
use of org.apache.activemq.artemis.cli.commands.ActionContext 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)));
}
use of org.apache.activemq.artemis.cli.commands.ActionContext in project activemq-artemis by apache.
the class AddressCommandTest method testShowAddressBindings.
@Test
public void testShowAddressBindings() throws Exception {
// Create bindings
SimpleString address = new SimpleString("address");
server.addAddressInfo(new AddressInfo(address, RoutingType.MULTICAST));
server.createQueue(address, RoutingType.MULTICAST, new SimpleString("queue1"), null, true, false);
server.createQueue(address, RoutingType.MULTICAST, new SimpleString("queue2"), null, true, false);
server.createQueue(address, RoutingType.MULTICAST, new SimpleString("queue3"), null, true, false);
DivertConfiguration divertConfiguration = new DivertConfiguration();
divertConfiguration.setName(address.toString());
divertConfiguration.setAddress(address.toString());
server.deployDivert(divertConfiguration);
ShowAddress showAddress = new ShowAddress();
showAddress.setName(address.toString());
showAddress.setBindings(true);
showAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
System.out.println(output.toString());
}
use of org.apache.activemq.artemis.cli.commands.ActionContext 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");
}
Aggregations