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