Search in sources :

Example 1 with CreateAddress

use of org.apache.activemq.artemis.cli.commands.address.CreateAddress 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");
}
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) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 2 with CreateAddress

use of org.apache.activemq.artemis.cli.commands.address.CreateAddress 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 CreateAddress

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

the class AddressCommandTest method testShowAddress.

@Test
public void testShowAddress() throws Exception {
    String address = "address";
    CreateAddress command = new CreateAddress();
    command.setName(address);
    command.execute(new ActionContext());
    assertNotNull(server.getAddressInfo(new SimpleString(address)));
    ShowAddress showAddress = new ShowAddress();
    showAddress.setName(address);
    showAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    System.out.println(output.toString());
}
Also used : PrintStream(java.io.PrintStream) ShowAddress(org.apache.activemq.artemis.cli.commands.address.ShowAddress) 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) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 4 with CreateAddress

use of org.apache.activemq.artemis.cli.commands.address.CreateAddress 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));
}
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) 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)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 ActionContext (org.apache.activemq.artemis.cli.commands.ActionContext)4 CreateAddress (org.apache.activemq.artemis.cli.commands.address.CreateAddress)4 Test (org.junit.Test)4 DeleteAddress (org.apache.activemq.artemis.cli.commands.address.DeleteAddress)1 ShowAddress (org.apache.activemq.artemis.cli.commands.address.ShowAddress)1 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)1