diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorParserTests-context.xml
index 6ed6b5c754..15a048a127 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorParserTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorParserTests-context.xml
@@ -1,19 +1,17 @@
-
+
@@ -40,96 +38,99 @@
-
+ input-channel="completelyDefinedAggregatorInput"
+ output-channel="outputChannel"
+ discard-channel="discardChannel"
+ ref="aggregatorBean"
+ release-strategy="releaseStrategy"
+ correlation-strategy="correlationStrategy"
+ send-timeout="86420000"
+ send-partial-result-on-expiry="true"
+ expire-groups-upon-completion="true"
+ expire-groups-upon-timeout="false"
+ empty-group-min-timeout="123"
+ group-timeout="456"
+ lock-registry="lockRegistry"
+ scheduler="scheduler"
+ message-store="store"
+ pop-sequence="false"
+ order="5"
+ expire-duration="10000"
+ expire-timeout="250">
+
-
+
+
+
+ input-channel="aggregatorWithExpressionsInput"
+ output-channel="aggregatorWithExpressionsOutput"
+ expression="?[payload.startsWith('1')].![payload]"
+ release-strategy-expression="#root.size()>2"
+ correlation-strategy-expression="headers['foo']"/>
+ ref="adderBean"
+ method="add"
+ input-channel="aggregatorWithReferenceAndMethodInput"
+ output-channel="outputChannel"/>
+ input-channel="aggregatorWithPojoReleaseStrategyInput"
+ output-channel="outputChannel"
+ ref="adderBean"
+ method="add"
+ release-strategy="pojoReleaseStrategy"
+ release-strategy-method="checkCompletenessAsList"/>
+ input-channel="aggregatorWithPojoReleaseStrategyInputAsCollection"
+ output-channel="outputChannel"
+ ref="adderBean"
+ method="add"
+ release-strategy="pojoReleaseStrategy"
+ release-strategy-method="checkCompletenessAsCollection"/>
+ input-channel="aggregatorWithExpressionsAndPojoAggregatorInput"
+ ref="aggregatorBean"
+ release-strategy-expression="size() == 2"
+ correlation-strategy-expression="headers['foo']"
+ empty-group-min-timeout="60000"/>
+ class="org.springframework.integration.config.TestAggregatorBean"/>
+ class="org.springframework.integration.aggregator.SimpleMessageGroupProcessor"/>
+ class="org.springframework.integration.config.AggregatorParserTests$MyMGP"/>
-
+
+ class="org.springframework.integration.config.TestReleaseStrategy"/>
-
+ class="org.springframework.integration.config.MaxValueReleaseStrategy">
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerParserTests-context.xml
index a6cf20ac4a..3bad3c9e88 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerParserTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerParserTests-context.xml
@@ -75,6 +75,7 @@
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml
index f91966bafd..6702c4d75a 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests-context.xml
@@ -49,6 +49,7 @@
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests-context.xml
index 946938031e..636ed22f95 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests-context.xml
@@ -24,10 +24,14 @@
default-request-channel="requestChannel"
proxy-default-methods="true"/>
+
+
+
+
+ default-reply-channel="receiveChannel"
+ default-reply-timeout="5000"/>
("foo"));
TestService service = (TestService) context.getBean("solicitResponse");
String result = service.solicitResponse();
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml
index 9bbe412238..8126b804c4 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/superParentApplicationContext.xml
@@ -7,6 +7,8 @@
https://www.springframework.org/schema/integration/spring-integration.xsd">
+ class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
+
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java
index 384c82ce5c..a86b101150 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.Lifecycle;
+import org.springframework.context.SmartLifecycle;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -586,6 +587,7 @@ public class IntegrationFlowTests {
@Bean(name = IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME)
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
+ threadPoolTaskScheduler.setPhase(SmartLifecycle.DEFAULT_PHASE / 2);
threadPoolTaskScheduler.setPoolSize(100);
return threadPoolTaskScheduler;
}
@@ -925,7 +927,9 @@ public class IntegrationFlowTests {
@Bean
public TaskScheduler dedicatedTaskScheduler() {
- return new ThreadPoolTaskScheduler();
+ ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
+ threadPoolTaskScheduler.setPhase(SmartLifecycle.DEFAULT_PHASE / 2);
+ return threadPoolTaskScheduler;
}
@Bean
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ExpressionEvaluatingMessageSourceIntegrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ExpressionEvaluatingMessageSourceIntegrationTests.java
index 35f5d4c5fc..d6806fd1c4 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ExpressionEvaluatingMessageSourceIntegrationTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ExpressionEvaluatingMessageSourceIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,6 +80,7 @@ public class ExpressionEvaluatingMessageSourceIntegrationTests {
for (int i = 0; i < 3; i++) {
messages.add(channel.receive(1000));
}
+ adapter.stop();
scheduler.destroy();
Message> message1 = messages.get(0);
assertThat(message1.getPayload()).isEqualTo("test-1");
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests-context.xml
index 4ca53e86c0..593993de63 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests-context.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/store/MessageStoreReaperTests-context.xml
@@ -1,9 +1,9 @@
@@ -23,7 +23,10 @@
-
+
+
+
@@ -35,21 +38,21 @@
-
+
-
+
+ discard-channel="discards"
+ message-store="messageStore3"/>
-
+
-
+
diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/FileWritingMessageHandlerTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/FileWritingMessageHandlerTests.java
index 3e7d376225..db825fb94a 100644
--- a/spring-integration-file/src/test/java/org/springframework/integration/file/FileWritingMessageHandlerTests.java
+++ b/spring-integration-file/src/test/java/org/springframework/integration/file/FileWritingMessageHandlerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -543,6 +543,7 @@ public class FileWritingMessageHandlerTests {
}
assertThat(flushes.get()).isGreaterThanOrEqualTo(2);
handler.stop();
+ taskScheduler.destroy();
}
@Test
@@ -586,6 +587,7 @@ public class FileWritingMessageHandlerTests {
verify(out).write(any(byte[].class), anyInt(), anyInt());
assertThat(closeWhileWriting.get()).isFalse();
handler.stop();
+ taskScheduler.destroy();
}
@Test
diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml
index 631a000ecc..6eb052a52d 100644
--- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml
+++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml
@@ -1,14 +1,13 @@
@@ -16,37 +15,37 @@
+ channel="input"
+ task-executor="exec"
+ file="/tmp/baz"
+ auto-startup="true"
+ phase="123"
+ error-channel="tailErrorChannel"/>
+ channel="input"
+ native-options="-F -n 6"
+ task-executor="exec"
+ task-scheduler="scheduler"
+ enable-status-reader="false"
+ file-delay="456"
+ file="/tmp/foo"
+ auto-startup="true"
+ delay="${empty}"
+ end="${empty}"
+ reopen="${empty}"
+ phase="123"/>
+ channel="input"
+ native-options="${empty}"
+ task-executor="exec"
+ file="/tmp/bar"
+ delay="${foo}"
+ file-delay="10000"
+ idle-event-interval="10000"
+ auto-startup="false"
+ phase="123"/>
@@ -56,20 +55,23 @@
+ channel="input"
+ task-executor="exec"
+ file="/tmp/qux"
+ delay="2000"
+ file-delay="10000"
+ end="false"
+ reopen="true"
+ auto-startup="false"
+ phase="123"/>
-
+
-
+
+
+
-
+
diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests.java
index b2da04b940..e942de017a 100644
--- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests.java
+++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ public class FileTailInboundChannelAdapterParserTests {
private TaskExecutor exec;
@Autowired
- private TaskScheduler sched;
+ private TaskScheduler scheduler;
@Autowired
private MessageChannel tailErrorChannel;
@@ -95,7 +95,7 @@ public class FileTailInboundChannelAdapterParserTests {
assertThat(normalizedName).isEqualTo("/tmp/foo");
assertThat(TestUtils.getPropertyValue(nativeAdapter, "command")).isEqualTo("tail -F -n 6 " + fileName);
assertThat(TestUtils.getPropertyValue(nativeAdapter, "taskExecutor")).isSameAs(exec);
- assertThat(TestUtils.getPropertyValue(nativeAdapter, "taskScheduler")).isSameAs(sched);
+ assertThat(TestUtils.getPropertyValue(nativeAdapter, "taskScheduler")).isSameAs(scheduler);
assertThat(TestUtils.getPropertyValue(nativeAdapter, "autoStartup", Boolean.class)).isTrue();
assertThat(TestUtils.getPropertyValue(nativeAdapter, "enableStatusReader", Boolean.class)).isFalse();
assertThat(TestUtils.getPropertyValue(nativeAdapter, "phase")).isEqualTo(123);
diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java
index d33ce7e928..fd031a8bd2 100644
--- a/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java
+++ b/spring-integration-file/src/test/java/org/springframework/integration/file/tail/FileTailingMessageProducerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -144,8 +144,7 @@ public class FileTailingMessageProducerTests {
if (event instanceof FileTailingIdleEvent) {
idleCountDownLatch.countDown();
}
- if (event instanceof FileTailingEvent) {
- FileTailingEvent fileTailingEvent = (FileTailingEvent) event;
+ if (event instanceof FileTailingEvent fileTailingEvent) {
if (fileTailingEvent.getMessage().contains("File not found")) {
fileExistCountDownLatch.countDown();
}
@@ -184,6 +183,7 @@ public class FileTailingMessageProducerTests {
assertThat(eventRaised).as("idle event did not emit").isTrue();
adapter.stop();
file.delete();
+ taskScheduler.destroy();
}
private void testGuts(FileTailingMessageProducerSupport adapter, String field) throws Exception {
diff --git a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyControlBusIntegrationTests-context.xml b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyControlBusIntegrationTests-context.xml
index 66ff2b4cc4..e920798e7f 100644
--- a/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyControlBusIntegrationTests-context.xml
+++ b/spring-integration-groovy/src/test/java/org/springframework/integration/groovy/GroovyControlBusIntegrationTests-context.xml
@@ -19,7 +19,10 @@
-
+
+
+
+ scheduler="scheduler" />
-
+
+
+
diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java
index 8f106d27bc..b4ec824301 100644
--- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java
+++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/config/ParserUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -236,7 +236,7 @@ public class ParserUnitTests {
TcpInboundGateway inGatewayClientMode;
@Autowired
- TaskScheduler sched;
+ TaskScheduler scheduler;
@Autowired
@Qualifier("tcpOutClientMode.handler")
@@ -624,7 +624,7 @@ public class ParserUnitTests {
assertThat(dfa.getPropertyValue("clientConnectionFactory")).isSameAs(cfC3);
assertThat(dfa.getPropertyValue("serverConnectionFactory")).isNull();
assertThat(dfa.getPropertyValue("isClientMode")).isEqualTo(Boolean.TRUE);
- assertThat(dfa.getPropertyValue("taskScheduler")).isSameAs(sched);
+ assertThat(dfa.getPropertyValue("taskScheduler")).isSameAs(scheduler);
assertThat(dfa.getPropertyValue("retryInterval")).isEqualTo(123000L);
}
@@ -634,7 +634,7 @@ public class ParserUnitTests {
assertThat(dfa.getPropertyValue("clientConnectionFactory")).isSameAs(cfC4);
assertThat(dfa.getPropertyValue("serverConnectionFactory")).isNull();
assertThat(dfa.getPropertyValue("isClientMode")).isEqualTo(Boolean.TRUE);
- assertThat(dfa.getPropertyValue("taskScheduler")).isSameAs(sched);
+ assertThat(dfa.getPropertyValue("taskScheduler")).isSameAs(scheduler);
assertThat(dfa.getPropertyValue("retryInterval")).isEqualTo(124000L);
}
@@ -644,7 +644,7 @@ public class ParserUnitTests {
assertThat(dfa.getPropertyValue("clientConnectionFactory")).isSameAs(cfC5);
assertThat(dfa.getPropertyValue("serverConnectionFactory")).isNull();
assertThat(dfa.getPropertyValue("isClientMode")).isEqualTo(Boolean.TRUE);
- assertThat(dfa.getPropertyValue("taskScheduler")).isSameAs(sched);
+ assertThat(dfa.getPropertyValue("taskScheduler")).isSameAs(scheduler);
assertThat(dfa.getPropertyValue("retryInterval")).isEqualTo(125000L);
}
diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpInboundGatewayTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpInboundGatewayTests.java
index 0b25cc4cdd..d242830720 100644
--- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpInboundGatewayTests.java
+++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpInboundGatewayTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -193,6 +193,7 @@ public class TcpInboundGatewayTests {
assertThat(done.get()).isTrue();
gateway.stop();
executorService.shutdown();
+ taskScheduler.destroy();
}
@Test
diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java
index 106fe3774a..6dd33f0f87 100644
--- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java
+++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpReceivingChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.core.serializer.DefaultDeserializer;
@@ -150,6 +150,7 @@ public class TcpReceivingChannelAdapterTests extends AbstractTcpChannelAdapterTe
latch2.countDown();
ccf.stop();
serverSocket.get().close();
+ taskScheduler.destroy();
}
@Test
diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java
index c553b7204c..92f18072f3 100644
--- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java
+++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/TcpSendingMessageHandlerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ import javax.net.SocketFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.BeanFactory;
@@ -217,11 +217,12 @@ public class TcpSendingMessageHandlerTests extends AbstractTcpChannelAdapterTest
adapter.stop();
ccf.stop();
serverSocket.get().close();
+ taskScheduler.destroy();
}
@Test
public void testNioCrLf() throws Exception {
- final AtomicReference serverSocket = new AtomicReference();
+ final AtomicReference serverSocket = new AtomicReference<>();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean done = new AtomicBoolean();
this.executor.execute(() -> {
diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/testIp-common-context.xml b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/testIp-common-context.xml
index 1fd1828d31..e7d3740517 100644
--- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/testIp-common-context.xml
+++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/testIp-common-context.xml
@@ -21,6 +21,7 @@
+
diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java
index 2760f47105..b5c0119000 100644
--- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java
+++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundGatewayTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -149,6 +149,7 @@ public class JmsOutboundGatewayTests extends ActiveMQMultiContextTests {
finally {
gateway.stop();
exec.shutdownNow();
+ taskScheduler.destroy();
}
}
diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/lifecycle-source.xml b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/lifecycle-source.xml
index f3e5f61444..5883f8564e 100644
--- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/lifecycle-source.xml
+++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/lifecycle-source.xml
@@ -1,52 +1,56 @@
+ http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml
index e2fd9b3469..cbbfcef799 100644
--- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml
+++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml
@@ -25,7 +25,10 @@
-
+
+
+
diff --git a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java
index 7e09afec50..adc3ad0d60 100644
--- a/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java
+++ b/spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2022 the original author or authors.
+ * Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,6 +69,8 @@ public class StompServerIntegrationTests {
private static final EmbeddedActiveMQ broker = new EmbeddedActiveMQ();
+ private static final ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
+
private static ReactorNettyTcpStompClient stompClient;
@BeforeAll
@@ -89,7 +91,6 @@ public class StompServerIntegrationTests {
stompClient = new ReactorNettyTcpStompClient("127.0.0.1", TransportConstants.DEFAULT_STOMP_PORT);
stompClient.setMessageConverter(new PassThruMessageConverter());
- ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.afterPropertiesSet();
stompClient.setTaskScheduler(taskScheduler);
stompClient.setReceiptTimeLimit(5000);
@@ -99,6 +100,7 @@ public class StompServerIntegrationTests {
public static void teardown() throws Exception {
stompClient.shutdown();
broker.stop();
+ taskScheduler.destroy();
}
@Test
diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java
index 5e86082e3a..9a2a09b3c4 100644
--- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java
+++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2022 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import org.apache.logging.log4j.core.config.LoggerConfig;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.SmartLifecycle;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.lang.Nullable;
@@ -61,6 +62,27 @@ public abstract class TestUtils {
private static final Log LOGGER = LogFactory.getLog(TestUtils.class);
+ /**
+ * Obtain a value for the property from the provide object
+ * and try to cast it to the provided type.
+ * Supports nested properties via period delimiter.
+ * @param root the object to obtain the property value
+ * @param propertyPath the property name to obtain a value.
+ * @param type the expected value type.
+ * @param the expected value type.
+ * Can be nested path defined by the period.
+ * @return the value of the property or null
+ * @see DirectFieldAccessor
+ */
+ @SuppressWarnings("unchecked")
+ public static T getPropertyValue(Object root, String propertyPath, Class type) {
+ Object value = getPropertyValue(root, propertyPath);
+ if (value != null) {
+ Assert.isAssignable(type, value.getClass());
+ }
+ return (T) value;
+ }
+
/**
* Obtain a value for the property from the provide object.
* Supports nested properties via period delimiter.
@@ -90,27 +112,6 @@ public abstract class TestUtils {
return value;
}
- /**
- * Obtain a value for the property from the provide object
- * and try to cast it to the provided type.
- * Supports nested properties via period delimiter.
- * @param root the object to obtain the property value
- * @param propertyPath the property name to obtain a value.
- * @param type the expected value type.
- * @param the expected value type.
- * Can be nested path defined by the period.
- * @return the value of the property or null
- * @see DirectFieldAccessor
- */
- @SuppressWarnings("unchecked")
- public static T getPropertyValue(Object root, String propertyPath, Class type) {
- Object value = getPropertyValue(root, propertyPath);
- if (value != null) {
- Assert.isAssignable(type, value.getClass());
- }
- return (T) value;
- }
-
/**
* Create a {@link TestApplicationContext} instance
* supplied with the basic Spring Integration infrastructure.
@@ -140,6 +141,7 @@ public abstract class TestUtils {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(poolSize);
scheduler.setRejectedExecutionHandler(new CallerRunsPolicy());
+ scheduler.setPhase(SmartLifecycle.DEFAULT_PHASE / 2);
scheduler.afterPropertiesSet();
return scheduler;
}
@@ -216,6 +218,7 @@ public abstract class TestUtils {
*/
public static Properties locateComponentInHistory(List history, String componentName,
int startingIndex) {
+
Assert.notNull(history, "'history' must not be null");
Assert.isTrue(StringUtils.hasText(componentName), "'componentName' must be provided");
Assert.isTrue(startingIndex < history.size(), "'startingIndex' can not be greater then size of history");