From d26ee1db4a3dcdda79ef42e2bf826a63d39e7e49 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 21 Aug 2019 10:22:37 -0400 Subject: [PATCH] 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` --- .../integration/amqp/dsl/AmqpTests.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl/AmqpTests.java b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl/AmqpTests.java index 18bd767984..3bc0590671 100644 --- a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl/AmqpTests.java +++ b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl/AmqpTests.java @@ -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");