Search in sources :

Example 21 with ActionContext

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

the class QueueCommandTest method testDeleteQueueDoesNotExist.

@Test
public void testDeleteQueueDoesNotExist() throws Exception {
    SimpleString queueName = new SimpleString("deleteQueue");
    DeleteQueue delete = new DeleteQueue();
    delete.setName(queueName.toString());
    delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionFailure(delete, "AMQ119017");
    assertFalse(server.queueQuery(queueName).isExists());
}
Also used : DeleteQueue(org.apache.activemq.artemis.cli.commands.queue.DeleteQueue) PrintStream(java.io.PrintStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 22 with ActionContext

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

the class QueueCommandTest method testUpdateCoreQueueDoesNotExist.

@Test
public void testUpdateCoreQueueDoesNotExist() throws Exception {
    SimpleString queueName = new SimpleString("updateQueue");
    UpdateQueue updateQueue = new UpdateQueue();
    updateQueue.setName(queueName.toString());
    updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionFailure(updateQueue, "AMQ119017: Queue " + queueName + " does not exist");
    assertFalse(server.queueQuery(queueName).isExists());
}
Also used : PrintStream(java.io.PrintStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) UpdateQueue(org.apache.activemq.artemis.cli.commands.queue.UpdateQueue) Test(org.junit.Test)

Example 23 with ActionContext

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

the class QueueCommandTest method testDeleteQueueWithConsumersFailsAndRemoveConsumersTrue.

@Test
public void testDeleteQueueWithConsumersFailsAndRemoveConsumersTrue() throws Exception {
    SimpleString queueName = new SimpleString("deleteQueue");
    CreateQueue command = new CreateQueue();
    command.setName(queueName.toString());
    command.setFilter("color='green'");
    command.setAutoCreateAddress(true);
    command.setMulticast(true);
    command.setAnycast(false);
    command.execute(new ActionContext());
    server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
    DeleteQueue delete = new DeleteQueue();
    delete.setName(queueName.toString());
    delete.setRemoveConsumers(true);
    delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionPassed(command);
}
Also used : DeleteQueue(org.apache.activemq.artemis.cli.commands.queue.DeleteQueue) PrintStream(java.io.PrintStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) CreateQueue(org.apache.activemq.artemis.cli.commands.queue.CreateQueue) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 24 with ActionContext

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

the class QueueCommandTest method testCreateCoreQueueAutoCreateAddressDefaultAddress.

@Test
public void testCreateCoreQueueAutoCreateAddressDefaultAddress() throws Exception {
    String queueName = UUID.randomUUID().toString();
    CreateQueue command = new CreateQueue();
    command.setName(queueName);
    command.setAutoCreateAddress(true);
    command.setMulticast(true);
    command.setAnycast(false);
    command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionPassed(command);
    assertNotNull(server.getAddressInfo(new SimpleString(queueName)));
    Queue queue = server.locateQueue(new SimpleString(queueName));
    assertEquals(-1, queue.getMaxConsumers());
    assertEquals(false, queue.isPurgeOnNoConsumers());
    assertTrue(server.queueQuery(new SimpleString(queueName)).isExists());
}
Also used : PrintStream(java.io.PrintStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) CreateQueue(org.apache.activemq.artemis.cli.commands.queue.CreateQueue) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) UpdateQueue(org.apache.activemq.artemis.cli.commands.queue.UpdateQueue) Queue(org.apache.activemq.artemis.core.server.Queue) DeleteQueue(org.apache.activemq.artemis.cli.commands.queue.DeleteQueue) CreateQueue(org.apache.activemq.artemis.cli.commands.queue.CreateQueue) Test(org.junit.Test)

Example 25 with ActionContext

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

the class QueueCommandTest method testCreateQueueAlreadyExists.

@Test
public void testCreateQueueAlreadyExists() throws Exception {
    String queueName = "queue2";
    String filerString = "color='green'";
    CreateQueue command = new CreateQueue();
    command.setName(queueName);
    command.setFilter("color='green'");
    command.setAutoCreateAddress(true);
    command.setMulticast(true);
    command.setAnycast(false);
    command.execute(new ActionContext());
    command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionFailure(command, "AMQ119019");
}
Also used : PrintStream(java.io.PrintStream) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) CreateQueue(org.apache.activemq.artemis.cli.commands.queue.CreateQueue) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Aggregations

ActionContext (org.apache.activemq.artemis.cli.commands.ActionContext)27 Test (org.junit.Test)27 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)26 PrintStream (java.io.PrintStream)25 CreateQueue (org.apache.activemq.artemis.cli.commands.queue.CreateQueue)9 AddressInfo (org.apache.activemq.artemis.core.server.impl.AddressInfo)9 DeleteQueue (org.apache.activemq.artemis.cli.commands.queue.DeleteQueue)8 UpdateQueue (org.apache.activemq.artemis.cli.commands.queue.UpdateQueue)7 CreateAddress (org.apache.activemq.artemis.cli.commands.address.CreateAddress)4 RoutingType (org.apache.activemq.artemis.api.core.RoutingType)3 DeleteAddress (org.apache.activemq.artemis.cli.commands.address.DeleteAddress)3 ShowAddress (org.apache.activemq.artemis.cli.commands.address.ShowAddress)3 UpdateAddress (org.apache.activemq.artemis.cli.commands.address.UpdateAddress)3 Queue (org.apache.activemq.artemis.core.server.Queue)3 QueueQueryResult (org.apache.activemq.artemis.core.server.QueueQueryResult)3 ParseArgumentsUnexpectedException (io.airlift.airline.ParseArgumentsUnexpectedException)1 File (java.io.File)1 InvalidOptionsError (org.apache.activemq.artemis.cli.commands.InvalidOptionsError)1 AddUser (org.apache.activemq.artemis.cli.commands.user.AddUser)1 ListUser (org.apache.activemq.artemis.cli.commands.user.ListUser)1