Fix some tests race conditions

* Fix unused import in the `IntegrationRequestMappingHandlerMapping`
* Fix deprecations from Reactor
* Fix race condition in the `AbstractCorrelatingMessageHandlerTests`:
 the discard message is sent much earlier than group is removed from the store.
Iterate group count call until it pass or 10 seconds timeout
* Remove list size assert in the `FtpServerOutboundTests`: looks like
it is not updated properly even if we have an expected content in the collection
* Increase timeout to assert remote files removal in the `FtpRemoteFileTemplateTests`
This commit is contained in:
Artem Bilan
2020-09-12 11:58:57 -04:00
parent c36314d6ec
commit 5bac9bf66e
7 changed files with 8 additions and 8 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.integration.aggregator;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
@@ -524,7 +525,7 @@ public class AbstractCorrelatingMessageHandlerTests {
handler.start();
Message<?> receive = discardChannel.receive(10000);
assertThat(receive).isNotNull();
assertThat(groupStore.getMessageGroupCount()).isEqualTo(0);
await().until(groupStore::getMessageGroupCount, (count) -> count == 0);
verify(groupStore, atLeast(2)).expireMessageGroups(100);
taskScheduler.destroy();
}

View File

@@ -292,7 +292,7 @@ public class MessagingAnnotationsWithBeanAnnotationTests {
}
@Bean
@Router(inputChannel = "routerChannel", channelMappings = {"true=odd", "false=filter"}, suffix = "Channel")
@Router(inputChannel = "routerChannel", channelMappings = { "true=odd", "false=filter" }, suffix = "Channel")
public MessageSelector router() {
return new ExpressionEvaluatingSelector("payload % 2 == 0");
}
@@ -440,7 +440,7 @@ public class MessagingAnnotationsWithBeanAnnotationTests {
@ServiceActivator(inputChannel = "reactiveMessageHandlerChannel")
public ReactiveMessageHandler reactiveMessageHandlerService() {
return (message) -> {
messageMono.emitValue(message);
messageMono.tryEmitValue(message);
return Mono.empty();
};
}

View File

@@ -90,7 +90,7 @@ public class GatewayParserTests {
Sinks.One<Object> defaultMethodHandler = Sinks.one();
this.errorChannel.subscribe(message -> defaultMethodHandler.emitValue(message.getPayload()));
this.errorChannel.subscribe(message -> defaultMethodHandler.tryEmitValue(message.getPayload()));
String defaultMethodPayload = "defaultMethodPayload";
service.defaultMethodGateway(defaultMethodPayload);