Fix sporadic AMQP test failure

https://build.spring.io/browse/INT-MASTER-1694

Use `receive(timeout)` on the AMQP channel and with 10 seconds interval
for the proper wait period instead of artificial short `do...while`
This commit is contained in:
Artem Bilan
2019-08-21 10:22:37 -04:00
parent 62d472f679
commit d26ee1db4a

View File

@@ -131,22 +131,11 @@ public class AmqpTests {
private PollableChannel amqpReplyChannel;
@Test
public void testAmqpOutboundFlow() throws Exception {
public void testAmqpOutboundFlow() {
this.amqpOutboundInput.send(MessageBuilder.withPayload("hello through the amqp")
.setHeader("routingKey", "si.dsl.test")
.build());
Message<?> receive = null;
int i = 0;
do {
receive = this.amqpReplyChannel.receive();
if (receive != null) {
break;
}
Thread.sleep(100);
i++;
}
while (i < 10);
Message<?> receive = this.amqpReplyChannel.receive(10000);
assertThat(receive).isNotNull();
assertThat(receive.getPayload()).isEqualTo("HELLO THROUGH THE AMQP");