use of org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger in project qpid-broker-j by apache.
the class ResumeDeliveriesTest method resumeSendingLinkSingleUnsettledDelivery.
@Ignore("QPID-7845")
@Test
@SpecificationTest(section = "2.6.13", description = "When a suspended link having unsettled deliveries is resumed, the unsettled field from the" + " attach frame will carry the delivery-tags and delivery state of all deliveries" + " considered unsettled by the issuing link endpoint.")
public void resumeSendingLinkSingleUnsettledDelivery() throws Exception {
final String destination = BrokerAdmin.TEST_QUEUE_NAME;
final Binary deliveryTag = new Binary("testDeliveryTag".getBytes(StandardCharsets.UTF_8));
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final UnsignedInteger linkHandle1 = UnsignedInteger.ZERO;
final Interaction interaction = transport.newInteraction();
interaction.negotiateProtocol().consumeResponse().open().consumeResponse(Open.class).begin().consumeResponse(Begin.class);
// 1. attach with ReceiverSettleMode.SECOND
interaction.attachHandle(linkHandle1).attachRole(Role.SENDER).attachRcvSettleMode(ReceiverSettleMode.SECOND).attachTargetAddress(destination).attach().consumeResponse(Attach.class).consumeResponse(Flow.class);
// 2. send a unsettled delivery
final Disposition responseDisposition = interaction.transferHandle(linkHandle1).transferDeliveryId(UnsignedInteger.ZERO).transferDeliveryTag(deliveryTag).transferPayloadData(TEST_MESSAGE_CONTENT).transfer().consumeResponse().getLatestResponse(Disposition.class);
assertThat(responseDisposition.getRole(), is(Role.RECEIVER));
assertThat(responseDisposition.getSettled(), is(Boolean.FALSE));
final DeliveryState remoteDeliveryState = responseDisposition.getState();
// 3. detach the link
interaction.detach().consumeResponse(Detach.class);
// 4. resume the link
final UnsignedInteger linkHandle2 = UnsignedInteger.ONE;
final Attach responseAttach2 = interaction.attachHandle(linkHandle2).attachUnsettled(Collections.singletonMap(deliveryTag, null)).attach().consumeResponse().getLatestResponse(Attach.class);
// 5. assert content of unsettled map
assertThat(responseAttach2.getTarget(), is(notNullValue()));
final Map<Binary, DeliveryState> remoteUnsettled = responseAttach2.getUnsettled();
assertThat(remoteUnsettled, is(notNullValue()));
assertThat(remoteUnsettled.keySet(), is(equalTo(Collections.singleton(deliveryTag))));
assertThat(remoteUnsettled.get(deliveryTag).getClass(), typeCompatibleWith(remoteDeliveryState.getClass()));
assertThat(responseAttach2.getIncompleteUnsettled(), is(anyOf(nullValue(), equalTo(false))));
}
}
Aggregations