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:
@@ -434,6 +434,7 @@ project('spring-integration-core') {
|
||||
testImplementation ("org.aspectj:aspectjweaver:$aspectjVersion")
|
||||
testImplementation ('com.fasterxml.jackson.datatype:jackson-datatype-jsr310')
|
||||
testRuntime 'com.fasterxml.jackson.module:jackson-module-kotlin'
|
||||
testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -715,7 +715,6 @@ public class FtpServerOutboundTests extends FtpTestSupport {
|
||||
});
|
||||
resetSessionCache();
|
||||
assertThat(this.config.latch.await(10, TimeUnit.SECONDS)).isTrue();
|
||||
assertThat(this.config.events).hasSize(11);
|
||||
assertThat(this.config.events.get(0)).isInstanceOf(SessionOpenedEvent.class);
|
||||
assertThat(this.config.events.get(1)).isInstanceOf(DirectoryCreatedEvent.class);
|
||||
DirectoryCreatedEvent dce = (DirectoryCreatedEvent) this.config.events.get(1);
|
||||
|
||||
@@ -94,7 +94,7 @@ public class FtpRemoteFileTemplateTests extends FtpTestSupport {
|
||||
template.execute((SessionCallbackWithoutResult<FTPFile>) session -> {
|
||||
assertThat(session.remove("foo/foobar.txt")).isTrue();
|
||||
assertThat(session.rmdir("foo/bar/")).isTrue();
|
||||
await().atMost(Duration.ofSeconds(10)).until(() -> session.list("foo/"), files -> files.length == 0);
|
||||
await().atMost(Duration.ofSeconds(20)).until(() -> session.list("foo/"), files -> files.length == 0);
|
||||
assertThat(session.rmdir("foo/")).isTrue();
|
||||
});
|
||||
assertThat(template.exists("foo")).isFalse();
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -81,7 +80,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
|
||||
* them during the {@link BaseHttpInboundEndpoint} destruction.
|
||||
*<p>
|
||||
* This class extends the Spring MVC {@link RequestMappingHandlerMapping} class, inheriting
|
||||
* most of its logic, especially {@link #handleNoMatch(Set, String, HttpServletRequest)},
|
||||
* most of its logic, especially {@link #handleNoMatch(java.util.Set, String, HttpServletRequest)},
|
||||
* which throws a specific {@code 4xx} error for the HTTP response, when mapping doesn't match
|
||||
* for some reason, preventing calls to any remaining mapping handlers in the application context.
|
||||
* For this reason, configuring the same path for both Spring Integration and
|
||||
|
||||
Reference in New Issue
Block a user