Search in sources :

Example 1 with DeleteQueue

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

the class QueueCommandTest method testAutoDeleteAddress.

@Test
public void testAutoDeleteAddress() 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());
    assertNotNull(server.getAddressInfo(queueName));
    server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
    DeleteQueue delete = new DeleteQueue();
    delete.setName(queueName.toString());
    delete.setRemoveConsumers(true);
    delete.setAutoDeleteAddress(true);
    delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionPassed(command);
    assertNull(server.getAddressInfo(queueName));
}
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 2 with DeleteQueue

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

the class QueueCommandTest method testDeleteQueueWithConsumersFails.

@Test
public void testDeleteQueueWithConsumersFails() 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.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionFailure(delete, "AMQ119025");
}
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 3 with DeleteQueue

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

the class QueueCommandTest method testDeleteCoreQueue.

@Test
public void testDeleteCoreQueue() 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());
    DeleteQueue delete = new DeleteQueue();
    delete.setName(queueName.toString());
    delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
    checkExecutionPassed(delete);
    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) CreateQueue(org.apache.activemq.artemis.cli.commands.queue.CreateQueue) ActionContext(org.apache.activemq.artemis.cli.commands.ActionContext) Test(org.junit.Test)

Example 4 with DeleteQueue

use of org.apache.activemq.artemis.cli.commands.queue.DeleteQueue 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 5 with DeleteQueue

use of org.apache.activemq.artemis.cli.commands.queue.DeleteQueue 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)

Aggregations

PrintStream (java.io.PrintStream)5 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)5 ActionContext (org.apache.activemq.artemis.cli.commands.ActionContext)5 DeleteQueue (org.apache.activemq.artemis.cli.commands.queue.DeleteQueue)5 Test (org.junit.Test)5 CreateQueue (org.apache.activemq.artemis.cli.commands.queue.CreateQueue)4