use of org.apache.qpid.server.protocol.v0_8.transport.ExchangeBoundOkBody in project qpid-broker-j by apache.
the class ExchangeTest method exchangeDelete.
@Test
@SpecificationTest(section = "1.6.2.3", description = "This method deletes an exchange. When an exchange is deleted all queue bindings on the " + "exchange are cancelled.")
public void exchangeDelete() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
interaction.negotiateOpen().channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().declareName(TEST_EXCHANGE).declare().consumeResponse().getLatestResponse(ExchangeDeclareOkBody.class);
ExchangeBoundOkBody boundResponse = interaction.exchange().boundExchangeName(TEST_EXCHANGE).bound().consumeResponse().getLatestResponse(ExchangeBoundOkBody.class);
assertThat(boundResponse.getReplyCode(), is(equalTo(ExchangeBoundOkBody.NO_BINDINGS)));
interaction.exchange().deleteExchangeName(TEST_EXCHANGE).delete().consumeResponse(ExchangeDeleteOkBody.class);
ExchangeBoundOkBody boundResponse2 = interaction.exchange().boundExchangeName(TEST_EXCHANGE).bound().consumeResponse().getLatestResponse(ExchangeBoundOkBody.class);
assertThat(boundResponse2.getReplyCode(), is(equalTo(ExchangeBoundOkBody.EXCHANGE_NOT_FOUND)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ExchangeBoundOkBody in project qpid-broker-j by apache.
the class ExchangeTest method exchangeDeclareDurable.
@Test
@SpecificationTest(section = "1.6.2.1", description = "If [durable is] set when creating a new exchange, the exchange will be marked as durable. " + "Durable exchanges remain active when a server restarts. Non-durable exchanges (transient " + "exchanges) are purged if/when a server restarts.")
public void exchangeDeclareDurable() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
interaction.negotiateOpen().channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().declareDurable(true).declareName(TEST_EXCHANGE).declare().consumeResponse(ExchangeDeclareOkBody.class);
}
assumeThat(getBrokerAdmin().supportsRestart(), Matchers.is(true));
getBrokerAdmin().restart();
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
ExchangeBoundOkBody response = interaction.negotiateOpen().channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().boundExchangeName(TEST_EXCHANGE).bound().consumeResponse().getLatestResponse(ExchangeBoundOkBody.class);
assertThat(response.getReplyCode(), is(equalTo(ExchangeBoundOkBody.NO_BINDINGS)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ExchangeBoundOkBody in project qpid-broker-j by apache.
the class QueueTest method queueBindDefaultQueue.
@Test
@SpecificationTest(section = "1.7.2.3", description = "The client MUST either specify a queue name or have previously declared a queue on the same channel")
public void queueBindDefaultQueue() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
String testExchange = "testExchange";
final Interaction interaction = transport.newInteraction();
interaction.negotiateOpen().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().declareName(BrokerAdmin.TEST_QUEUE_NAME).declare().consumeResponse(QueueDeclareOkBody.class).exchange().declareName(testExchange).declare().consumeResponse(ExchangeDeclareOkBody.class).queue().bindName(testExchange).bind().consumeResponse(QueueBindOkBody.class);
ExchangeBoundOkBody response = interaction.exchange().boundExchangeName(testExchange).boundQueue(BrokerAdmin.TEST_QUEUE_NAME).bound().consumeResponse().getLatestResponse(ExchangeBoundOkBody.class);
assertThat(response.getReplyCode(), is(equalTo(ExchangeBoundOkBody.OK)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ExchangeBoundOkBody in project qpid-broker-j by apache.
the class QueueTest method queueBindDurableQueueToTransientExchange.
@Test
@SpecificationTest(section = "1.7.2.3", description = "The server MUST allow a durable queue to bind to a transient exchange.")
public void queueBindDurableQueueToTransientExchange() throws Exception {
String testExchange = "testExchange";
String testRoutingKey = "rk1";
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
interaction.negotiateOpen().channel().open().consumeResponse(ChannelOpenOkBody.class).queue().declareName(BrokerAdmin.TEST_QUEUE_NAME).declareDurable(true).declare().consumeResponse(QueueDeclareOkBody.class).exchange().declareName(testExchange).declareDurable(false).declare().consumeResponse(ExchangeDeclareOkBody.class).queue().bindName(testExchange).bindQueueName(BrokerAdmin.TEST_QUEUE_NAME).bindRoutingKey(testRoutingKey).bind().consumeResponse(QueueBindOkBody.class);
ExchangeBoundOkBody response = interaction.exchange().boundExchangeName(testExchange).boundQueue(BrokerAdmin.TEST_QUEUE_NAME).boundRoutingKey(testRoutingKey).bound().consumeResponse().getLatestResponse(ExchangeBoundOkBody.class);
assertThat(response.getReplyCode(), is(equalTo(ExchangeBoundOkBody.OK)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport.ExchangeBoundOkBody in project qpid-broker-j by apache.
the class QueueTest method queueBindIgnoreDuplicates.
@Test
@SpecificationTest(section = "1.7.2.3", description = "A server MUST allow ignore duplicate bindings")
public void queueBindIgnoreDuplicates() throws Exception {
getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
String testExchange = "testExchange";
interaction.negotiateOpen().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().bindName(testExchange).bindQueueName(BrokerAdmin.TEST_QUEUE_NAME).bindRoutingKey("rk1").bind().consumeResponse(QueueBindOkBody.class);
ExchangeBoundOkBody response = interaction.exchange().boundExchangeName(testExchange).bound().consumeResponse().getLatestResponse(ExchangeBoundOkBody.class);
assertThat(response.getReplyCode(), is(equalTo(ExchangeBoundOkBody.OK)));
interaction.queue().unbindName(testExchange).unbindQueueName(BrokerAdmin.TEST_QUEUE_NAME).unbindRoutingKey("rk1").unbind().consumeResponse(QueueUnbindOkBody.class);
response = interaction.exchange().boundExchangeName(testExchange).bound().consumeResponse().getLatestResponse(ExchangeBoundOkBody.class);
assertThat(response.getReplyCode(), is(equalTo(ExchangeBoundOkBody.NO_BINDINGS)));
}
}
Aggregations