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)));
}
}
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);
}
}
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)));
}
}
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);
}
}
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)));
}
}
Aggregations