Search in sources :

Example 1 with QueueDeleteOkBody

use of org.apache.qpid.server.protocol.v0_8.transport.QueueDeleteOkBody in project qpid-broker-j by apache.

the class QueueTest method queueDelete.

@Test
@SpecificationTest(section = "1.7.2.9", description = "delete a queue")
public void queueDelete() throws Exception {
    getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
    getBrokerAdmin().putMessageOnQueue(BrokerAdmin.TEST_QUEUE_NAME, "message");
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction = transport.newInteraction();
        QueueDeleteOkBody response = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().deleteName(BrokerAdmin.TEST_QUEUE_NAME).delete().consumeResponse().getLatestResponse(QueueDeleteOkBody.class);
        assertThat(response.getMessageCount(), is(equalTo(1L)));
    }
}
Also used : QueueDeleteOkBody(org.apache.qpid.server.protocol.v0_8.transport.QueueDeleteOkBody) ChannelOpenOkBody(org.apache.qpid.server.protocol.v0_8.transport.ChannelOpenOkBody) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Example 2 with QueueDeleteOkBody

use of org.apache.qpid.server.protocol.v0_8.transport.QueueDeleteOkBody in project qpid-broker-j by apache.

the class QueueTest method queueDeleteDefaultQueue.

@Test
@SpecificationTest(section = "1.7.2.9", description = "The client MUST either specify a queue name or have previously declared a queue on the " + "same channel")
public void queueDeleteDefaultQueue() throws Exception {
    getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
    getBrokerAdmin().putMessageOnQueue(BrokerAdmin.TEST_QUEUE_NAME, "message");
    try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
        final Interaction interaction = transport.newInteraction();
        QueueDeleteOkBody deleteResponse = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().declareName(BrokerAdmin.TEST_QUEUE_NAME).declare().consumeResponse(QueueDeclareOkBody.class).queue().delete().consumeResponse().getLatestResponse(QueueDeleteOkBody.class);
        assertThat(deleteResponse.getMessageCount(), is(equalTo(1L)));
    }
}
Also used : QueueDeleteOkBody(org.apache.qpid.server.protocol.v0_8.transport.QueueDeleteOkBody) Test(org.junit.Test) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest) SpecificationTest(org.apache.qpid.tests.protocol.SpecificationTest)

Aggregations

QueueDeleteOkBody (org.apache.qpid.server.protocol.v0_8.transport.QueueDeleteOkBody)2 SpecificationTest (org.apache.qpid.tests.protocol.SpecificationTest)2 Test (org.junit.Test)2 ChannelOpenOkBody (org.apache.qpid.server.protocol.v0_8.transport.ChannelOpenOkBody)1