Async AMQP Tests: Purge ackChannel
Since acks may arrive after the timeout and therefore won't be delivered to the ackChannel, purge the channel to clear it instead of waiting for the acks, before stubbing the template.
This commit is contained in:
@@ -163,16 +163,12 @@ public class AsyncAmqpGatewayTests {
|
||||
});
|
||||
message = MessageBuilder.withPayload("bar").setErrorChannel(errorChannel).build();
|
||||
gateway.handleMessage(message);
|
||||
ack = ackChannel.receive(10000);
|
||||
assertNotNull(ack);
|
||||
assertNull(errorChannel.receive(100));
|
||||
|
||||
gateway.setRequiresReply(true);
|
||||
message = MessageBuilder.withPayload("baz").setErrorChannel(errorChannel).build();
|
||||
gateway.handleMessage(message);
|
||||
|
||||
ack = ackChannel.receive(10000);
|
||||
assertNotNull(ack);
|
||||
received = errorChannel.receive(10000);
|
||||
assertThat(received, instanceOf(ErrorMessage.class));
|
||||
ErrorMessage error = (ErrorMessage) received;
|
||||
@@ -208,6 +204,8 @@ public class AsyncAmqpGatewayTests {
|
||||
assertNotNull(returned);
|
||||
assertEquals("fiz", returned.getPayload());
|
||||
|
||||
ackChannel.purge(null);
|
||||
|
||||
// Simulate a nack - it's hard to get Rabbit to generate one
|
||||
// We must have consumed all the real acks by now, though, to prevent partial stubbing errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user