use of org.apache.qpid.server.protocol.v0_8.transport.ChannelCloseBody in project qpid-broker-j by apache.
the class ExchangeTest method exchangeDeleteAmqDisallowed.
@Test
@SpecificationTest(section = "1.6.2.3", description = "The server MUST, in each virtual host, pre-declare an exchange instance for each standard " + "exchange type that it implements.")
public void exchangeDeleteAmqDisallowed() throws Exception {
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
ChannelCloseBody response = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().deleteExchangeName(ExchangeDefaults.DIRECT_EXCHANGE_NAME).delete().consumeResponse().getLatestResponse(ChannelCloseBody.class);
assertThat(response.getReplyCode(), is(equalTo(ErrorCodes.NOT_ALLOWED)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ChannelCloseBody in project qpid-broker-j by apache.
the class QueueTest method queueUnbindUnknownRoutingKey.
@Test
@SpecificationTest(section = "1.7.2.5", description = "If a unbind fails, the server MUST raise a connection " + "exception")
public void queueUnbindUnknownRoutingKey() throws Exception {
getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
String testExchange = "testExchange";
ChannelCloseBody response = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().declareName(testExchange).declare().consumeResponse(ExchangeDeclareOkBody.class).queue().bindName(testExchange).bindQueueName(BrokerAdmin.TEST_QUEUE_NAME).bindRoutingKey("rk1").bind().consumeResponse(QueueBindOkBody.class).queue().unbindName(testExchange).unbindQueueName(BrokerAdmin.TEST_QUEUE_NAME).unbindRoutingKey("rk2").unbind().consumeResponse().getLatestResponse(ChannelCloseBody.class);
assertThat(response.getReplyCode(), is(equalTo(ErrorCodes.NOT_FOUND)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ChannelCloseBody in project qpid-broker-j by apache.
the class QueueTest method queuePurgeQueueNotFound.
@Test
@SpecificationTest(section = "1.7.2.7", description = "The client MUST NOT attempt to purge a queue that does not exist.")
public void queuePurgeQueueNotFound() throws Exception {
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
ChannelCloseBody response = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().purgeName(BrokerAdmin.TEST_QUEUE_NAME).purge().consumeResponse().getLatestResponse(ChannelCloseBody.class);
assertThat(response.getReplyCode(), is(equalTo(ErrorCodes.NOT_FOUND)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ChannelCloseBody in project qpid-broker-j by apache.
the class QueueTest method queueDeleteQueueNotFound.
@Test
@SpecificationTest(section = "1.7.2.9", description = "The client MUST NOT attempt to delete a queue that does not exist.")
public void queueDeleteQueueNotFound() throws Exception {
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
ChannelCloseBody response = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().deleteName(BrokerAdmin.TEST_QUEUE_NAME).delete().consumeResponse().getLatestResponse(ChannelCloseBody.class);
assertThat(response.getReplyCode(), is(equalTo(ErrorCodes.NOT_FOUND)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ChannelCloseBody in project qpid-broker-j by apache.
the class QueueTest method queueDeclareAutoDelete.
@Test
@SpecificationTest(section = "1.7.2.1", description = "If [auto-delete] set, the queue is deleted when all consumers have finished using it. The " + "last consumer can be cancelled either explicitly or because its channel is closed. " + "If there was no consumer ever on the queue, it won't be deleted.")
public void queueDeclareAutoDelete() throws Exception {
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
QueueDeclareOkBody response = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().declareAutoDelete(true).declareName(BrokerAdmin.TEST_QUEUE_NAME).declare().consumeResponse().getLatestResponse(QueueDeclareOkBody.class);
assertThat(response.getQueue(), is(equalTo(AMQShortString.valueOf(BrokerAdmin.TEST_QUEUE_NAME))));
}
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
QueueDeclareOkBody response = interaction.openAnonymousConnection().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().declarePassive(true).declareName(BrokerAdmin.TEST_QUEUE_NAME).declare().consumeResponse().getLatestResponse(QueueDeclareOkBody.class);
assertThat(response.getQueue(), is(equalTo(AMQShortString.valueOf(BrokerAdmin.TEST_QUEUE_NAME))));
final String consumerTag = "lastConsumer";
interaction.basic().consumeConsumerTag(consumerTag).consumeQueue(BrokerAdmin.TEST_QUEUE_NAME).consume().consumeResponse(BasicConsumeOkBody.class).basic().consumeCancelTag(consumerTag).cancel().consumeResponse().getLatestResponse(BasicCancelOkBody.class);
ChannelCloseBody closeResponse = interaction.queue().declarePassive(true).declareName(BrokerAdmin.TEST_QUEUE_NAME).declare().consumeResponse().getLatestResponse(ChannelCloseBody.class);
assertThat(closeResponse.getReplyCode(), is(equalTo(ErrorCodes.NOT_FOUND)));
}
}
Aggregations