Search in sources :

Example 1 with ExecutionException

use of org.apache.qpid.server.protocol.v0_10.transport.ExecutionException in project qpid-broker-j by apache.

the class ExchangeTest method exchangeDeleteInUseAsAlternate.

@Test
@SpecificationTest(section = "10.exchange.delete", description = "An exchange MUST NOT be deleted if it is in use as an alternate-exchange by a queue or by " + "another exchange.")
public void exchangeDeleteInUseAsAlternate() throws Exception {
    String exchangeName1 = "myexch1";
    String exchangeName2 = "myexch2";
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction = transport.newInteraction();
        ExecutionException response = interaction.openAnonymousConnection().channelId(1).attachSession(SESSION_NAME).exchange().declareExchange(exchangeName1).declareType(ExchangeDefaults.DIRECT_EXCHANGE_CLASS).declareId(0).declare().exchange().declareExchange(exchangeName2).declareAlternateExchange(exchangeName1).declareType(ExchangeDefaults.DIRECT_EXCHANGE_CLASS).declareId(1).declare().exchange().deleteExchange(exchangeName1).deleteId(2).delete().session().flushCompleted().flush().consumeResponse(SessionCommandPoint.class).consumeResponse().getLatestResponse(ExecutionException.class);
        assertThat(response.getErrorCode(), is(equalTo(ExecutionErrorCode.NOT_ALLOWED)));
    }
}
Also used : ExecutionException(org.apache.qpid.server.protocol.v0_10.transport.ExecutionException) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Example 2 with ExecutionException

use of org.apache.qpid.server.protocol.v0_10.transport.ExecutionException in project qpid-broker-j by apache.

the class QueueTest method queueDeclareRedeclareOfExclusivelyDeclaredQueue.

@Test
@SpecificationTest(section = "10.queue.declare", description = "If the server receives a declare, bind, consume or get request for a queue that has been" + "declared as exclusive by an existing client session, it MUST raise an exception.")
public void queueDeclareRedeclareOfExclusivelyDeclaredQueue() throws Exception {
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction = transport.newInteraction();
        interaction.openAnonymousConnection().channelId(1).attachSession(SESSION_NAME).queue().declareQueue(BrokerAdmin.TEST_QUEUE_NAME).declareId(0).declareExclusive(true).declare().session().flushCompleted().flush().consumeResponse(SessionCompleted.class);
        try (FrameTransport transport2 = new FrameTransport(_brokerAddress).connect()) {
            final Interaction interaction2 = transport2.newInteraction();
            ExecutionException response = interaction2.openAnonymousConnection().channelId(1).attachSession("test2".getBytes(UTF_8)).queue().declareQueue(BrokerAdmin.TEST_QUEUE_NAME).declareId(0).declareExclusive(true).declare().session().flushCompleted().flush().consumeResponse(SessionCommandPoint.class).consumeResponse().getLatestResponse(ExecutionException.class);
            assertThat(response.getErrorCode(), is(equalTo(ExecutionErrorCode.RESOURCE_LOCKED)));
        }
    }
    try (FrameTransport transport2 = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction2 = transport2.newInteraction();
        interaction2.openAnonymousConnection().channelId(1).attachSession("test2".getBytes(UTF_8)).queue().declareQueue(BrokerAdmin.TEST_QUEUE_NAME).declareId(0).declareExclusive(true).declare().session().flushCompleted().flush().consumeResponse(SessionCompleted.class);
    }
}
Also used : ExecutionException(org.apache.qpid.server.protocol.v0_10.transport.ExecutionException) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Example 3 with ExecutionException

use of org.apache.qpid.server.protocol.v0_10.transport.ExecutionException in project qpid-broker-j by apache.

the class QueueTest method queueDeleteQueueNotFound.

@Test
@SpecificationTest(section = "10.queue.delete", description = "The queue must exist. If the client attempts to delete a non-existing queue the server " + "MUST raise an exception.")
public void queueDeleteQueueNotFound() throws Exception {
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction = transport.newInteraction();
        ExecutionException response = interaction.openAnonymousConnection().channelId(1).attachSession(SESSION_NAME).queue().deleteQueue(BrokerAdmin.TEST_QUEUE_NAME).deleteId(0).delete().session().flushCompleted().flush().consumeResponse(SessionCommandPoint.class).consumeResponse().getLatestResponse(ExecutionException.class);
        assertThat(response.getErrorCode(), is(equalTo(ExecutionErrorCode.NOT_FOUND)));
    }
}
Also used : ExecutionException(org.apache.qpid.server.protocol.v0_10.transport.ExecutionException) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Example 4 with ExecutionException

use of org.apache.qpid.server.protocol.v0_10.transport.ExecutionException in project qpid-broker-j by apache.

the class QueueTest method queueDeclareAttemptedConsumeOfExclusivelyDeclaredQueue.

@Test
@SpecificationTest(section = "10.queue.declare", description = "If the server receives a declare, bind, consume or get request for a queue that has been" + "declared as exclusive by an existing client session, it MUST raise an exception.")
public void queueDeclareAttemptedConsumeOfExclusivelyDeclaredQueue() throws Exception {
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction = transport.newInteraction();
        interaction.openAnonymousConnection().channelId(1).attachSession(SESSION_NAME).queue().declareQueue(BrokerAdmin.TEST_QUEUE_NAME).declareId(0).declareExclusive(true).declare().session().flushCompleted().flush().consumeResponse(SessionCompleted.class);
        try (FrameTransport transport2 = new FrameTransport(_brokerAddress).connect()) {
            final Interaction interaction2 = transport2.newInteraction();
            ExecutionException response = interaction2.openAnonymousConnection().channelId(1).attachSession("test2".getBytes(UTF_8)).message().subscribeDestination("mysub").subscribeQueue(BrokerAdmin.TEST_QUEUE_NAME).subscribeId(0).subscribe().session().flushCompleted().flush().consumeResponse(SessionCommandPoint.class).consumeResponse().getLatestResponse(ExecutionException.class);
            assertThat(response.getErrorCode(), is(equalTo(ExecutionErrorCode.RESOURCE_LOCKED)));
        }
    }
    try (FrameTransport transport2 = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction2 = transport2.newInteraction();
        interaction2.openAnonymousConnection().channelId(1).attachSession("test2".getBytes(UTF_8)).message().subscribeDestination("mysub").subscribeQueue(BrokerAdmin.TEST_QUEUE_NAME).subscribeId(0).subscribe().session().flushCompleted().flush().consumeResponse(SessionCompleted.class);
    }
}
Also used : ExecutionException(org.apache.qpid.server.protocol.v0_10.transport.ExecutionException) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Example 5 with ExecutionException

use of org.apache.qpid.server.protocol.v0_10.transport.ExecutionException in project qpid-broker-j by apache.

the class QueueTest method queueDeclarePassiveQueueNotFound.

@Test
@SpecificationTest(section = "10.queue.declare", description = "[...] If the queue does not exist, the server treats this as a failure.")
public void queueDeclarePassiveQueueNotFound() throws Exception {
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction = transport.newInteraction();
        ExecutionException response = interaction.openAnonymousConnection().channelId(1).attachSession(SESSION_NAME).queue().declareQueue(BrokerAdmin.TEST_QUEUE_NAME).declarePassive(true).declareId(0).declare().session().flushCompleted().flush().consumeResponse(SessionCommandPoint.class).consumeResponse().getLatestResponse(ExecutionException.class);
        assertThat(response.getErrorCode(), is(equalTo(ExecutionErrorCode.NOT_FOUND)));
    }
}
Also used : ExecutionException(org.apache.qpid.server.protocol.v0_10.transport.ExecutionException) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Aggregations

ExecutionException (org.apache.qpid.server.protocol.v0_10.transport.ExecutionException)15 SpecificationTest (org.apache.qpid.tests.protocol.SpecificationTest)12 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)1 Subject (javax.security.auth.Subject)1 EventLogger (org.apache.qpid.server.logging.EventLogger)1 AmqpPort (org.apache.qpid.server.model.port.AmqpPort)1 Binary (org.apache.qpid.server.protocol.v0_10.transport.Binary)1 ExchangeDelete (org.apache.qpid.server.protocol.v0_10.transport.ExchangeDelete)1 ExecutionErrorCode (org.apache.qpid.server.protocol.v0_10.transport.ExecutionErrorCode)1 MessageTransfer (org.apache.qpid.server.protocol.v0_10.transport.MessageTransfer)1 Method (org.apache.qpid.server.protocol.v0_10.transport.Method)1 ArgumentMatcher (org.mockito.ArgumentMatcher)1