Search in sources :

Example 1 with ShowAddress

use of org.apache.activemq.artemis.cli.commands.address.ShowAddress 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());
}
Also used : PrintStream(java.io.PrintStream) ShowAddress(org.apache.activemq.artemis.cli.commands.address.ShowAddress) DivertConfiguration(org.apache.activemq.artemis.core.config.DivertConfiguration) 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 2 with ShowAddress

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

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

the class AddressCommandTest method testShowAddressDoesNotExist.

@Test
public void testShowAddressDoesNotExist() throws Exception {
    String address = "address";
    ShowAddress showAddress = new ShowAddress();
    showAddress.setName(address);
    showAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionFailure(showAddress, "Address Does Not Exist");
}
Also used : PrintStream(java.io.PrintStream) ShowAddress(org.apache.activemq.artemis.cli.commands.address.ShowAddress) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) 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 ShowAddress (org.apache.activemq.artemis.cli.commands.address.ShowAddress)3 Test (org.junit.Test)3 CreateAddress (org.apache.activemq.artemis.cli.commands.address.CreateAddress)1 DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)1 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)1