Skip to content

Commit d26ee1d

Browse files
committed
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`
1 parent 62d472f commit d26ee1d

File tree

1 file changed

+2
-13
lines changed
  • spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl

1 file changed

+2
-13
lines changed

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl/AmqpTests.java

+2-13
Original file line numberDiff line numberDiff line change
@@ -131,22 +131,11 @@ public void testAmqpInboundGatewayFlow() {
131131
private PollableChannel amqpReplyChannel;
132132

133133
@Test
134-
public void testAmqpOutboundFlow() throws Exception {
134+
public void testAmqpOutboundFlow() {
135135
this.amqpOutboundInput.send(MessageBuilder.withPayload("hello through the amqp")
136136
.setHeader("routingKey", "si.dsl.test")
137137
.build());
138-
Message<?> receive = null;
139-
int i = 0;
140-
do {
141-
receive = this.amqpReplyChannel.receive();
142-
if (receive != null) {
143-
break;
144-
}
145-
Thread.sleep(100);
146-
i++;
147-
}
148-
while (i < 10);
149-
138+
Message<?> receive = this.amqpReplyChannel.receive(10000);
150139
assertThat(receive).isNotNull();
151140
assertThat(receive.getPayload()).isEqualTo("HELLO THROUGH THE AMQP");
152141

0 commit comments

Comments
 (0)