Skip to content

Commit 133287b

Browse files
committed
Move to Java 25
* Improve performance and stability of some recently failed tests
1 parent 72960e1 commit 133287b

File tree

7 files changed

+53
-75
lines changed

7 files changed

+53
-75
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ configure(javaProjects) { subproject ->
229229

230230
java {
231231
toolchain {
232-
languageVersion = JavaLanguageVersion.of(24)
232+
languageVersion = JavaLanguageVersion.of(25)
233233
}
234234
withJavadocJar()
235235
withSourcesJar()

spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/AbstractTxTimeoutMessageStoreTests.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ public void test() throws InterruptedException {
134134
public void testInt2993IdCacheConcurrency() throws InterruptedException, ExecutionException {
135135
final String groupId = "testInt2993Group";
136136
for (int i = 0; i < 100; i++) {
137-
this.jdbcChannelMessageStore.addMessageToGroup(groupId, new GenericMessage<String>("testInt2993Message"));
137+
this.jdbcChannelMessageStore.addMessageToGroup(groupId, new GenericMessage<>("testInt2993Message"));
138138
}
139139

140140
ExecutorService executorService = Executors.newCachedThreadPool();
141-
CompletionService<Boolean> completionService = new ExecutorCompletionService<Boolean>(executorService);
141+
CompletionService<Boolean> completionService = new ExecutorCompletionService<>(executorService);
142142

143143
final int concurrency = 5;
144144

@@ -156,12 +156,6 @@ public void testInt2993IdCacheConcurrency() throws InterruptedException, Executi
156156
log.error("IdCache race condition.", e1);
157157
return false;
158158
}
159-
try {
160-
Thread.sleep(10);
161-
}
162-
catch (InterruptedException e2) {
163-
log.error(e2);
164-
}
165159
if (message != null) {
166160
jdbcChannelMessageStore.removeFromIdCache(message.getHeaders().getId().toString());
167161
}

spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/MySqlTxTimeoutMessageStoreTests.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@
3333
@ContextConfiguration
3434
public class MySqlTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests implements MySqlContainerTest {
3535

36-
@Override
37-
@Test
38-
@Disabled("Fails sporadically")
39-
public void testInt3181ConcurrentPolling() throws InterruptedException {
40-
super.testInt3181ConcurrentPolling();
41-
}
42-
43-
@Override
44-
@Test
45-
@Disabled("Fails sporadically")
46-
public void testInt2993IdCacheConcurrency() throws InterruptedException, ExecutionException {
47-
super.testInt2993IdCacheConcurrency();
48-
}
36+
4937

5038
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans xmlns="http://www.springframework.org/schema/beans"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xmlns:util="http://www.springframework.org/schema/util"
5-
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
6-
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
75

86
<import resource="classpath:org/springframework/integration/jdbc/store/channel/DataSource-oracle-context.xml"/>
97

108
<import resource="classpath:org/springframework/integration/jdbc/store/channel/TxTimeoutMessageStoreTests-context.xml"/>
119

12-
<util:properties id="props">
13-
<prop key="concurrentPoll.fixedRate">2000</prop>
14-
<prop key="concurrentPoll.fixedDelay">1000</prop>
15-
</util:properties>
16-
1710
</beans>
1811

spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParserTests-context.xml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans xmlns="http://www.springframework.org/schema/beans"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xmlns:context="http://www.springframework.org/schema/context"
5-
xmlns:si="http://www.springframework.org/schema/integration"
6-
xmlns:jmx="http://www.springframework.org/schema/integration/jmx"
7-
xsi:schemaLocation="http://www.springframework.org/schema/beans
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:context="http://www.springframework.org/schema/context"
5+
xmlns:si="http://www.springframework.org/schema/integration"
6+
xmlns:jmx="http://www.springframework.org/schema/integration/jmx"
7+
xsi:schemaLocation="http://www.springframework.org/schema/beans
88
https://www.springframework.org/schema/beans/spring-beans.xsd
99
http://www.springframework.org/schema/context
1010
https://www.springframework.org/schema/context/spring-context.xsd
@@ -20,19 +20,19 @@
2020
<context:mbean-export server="mbeanServer"/>
2121

2222
<jmx:tree-polling-channel-adapter id="adapter-default"
23-
channel="channel1"
24-
auto-startup="false">
25-
<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
23+
channel="channel1"
24+
auto-startup="false">
25+
<si:poller max-messages-per-poll="1" fixed-delay="100"/>
2626
</jmx:tree-polling-channel-adapter>
2727

2828
<si:channel id="channel1">
2929
<si:queue/>
3030
</si:channel>
3131

3232
<jmx:tree-polling-channel-adapter id="adapter-inner"
33-
channel="channel2"
34-
auto-startup="false">
35-
<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
33+
channel="channel2"
34+
auto-startup="false">
35+
<si:poller max-messages-per-poll="1" fixed-delay="100"/>
3636
<bean class="org.springframework.integration.jmx.inbound.DefaultMBeanObjectConverter"/>
3737
</jmx:tree-polling-channel-adapter>
3838

@@ -41,22 +41,22 @@
4141
</si:channel>
4242

4343
<jmx:tree-polling-channel-adapter id="adapter-query-name"
44-
channel="channel3"
45-
auto-startup="false"
46-
query-name="java.lang:type=Runtime"
47-
query-expression="*:type=*">
48-
<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
44+
channel="channel3"
45+
auto-startup="false"
46+
query-name="java.lang:type=Runtime"
47+
query-expression="*:type=*">
48+
<si:poller max-messages-per-poll="1" fixed-delay="100"/>
4949
</jmx:tree-polling-channel-adapter>
5050

5151
<si:channel id="channel3">
5252
<si:queue/>
5353
</si:channel>
5454

5555
<jmx:tree-polling-channel-adapter id="adapter-query-name-bean"
56-
channel="channel4"
57-
auto-startup="false"
58-
query-name-ref="queryName">
59-
<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
56+
channel="channel4"
57+
auto-startup="false"
58+
query-name-ref="queryName">
59+
<si:poller max-messages-per-poll="1" fixed-delay="100"/>
6060
</jmx:tree-polling-channel-adapter>
6161

6262
<bean id="queryName" class="javax.management.ObjectName">
@@ -70,10 +70,10 @@
7070
</si:channel>
7171

7272
<jmx:tree-polling-channel-adapter id="adapter-query-expr-bean"
73-
channel="channel5"
74-
auto-startup="false"
75-
query-expression-ref="queryExp">
76-
<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
73+
channel="channel5"
74+
auto-startup="false"
75+
query-expression-ref="queryExp">
76+
<si:poller max-messages-per-poll="1" fixed-delay="100"/>
7777
</jmx:tree-polling-channel-adapter>
7878

7979
<bean id="queryExp" class="javax.management.ObjectName">
@@ -87,12 +87,12 @@
8787
</si:channel>
8888

8989
<jmx:tree-polling-channel-adapter id="adapter-converter"
90-
channel="channel6" converter="converter"
91-
auto-startup="false">
92-
<si:poller max-messages-per-poll="1" fixed-rate="5000"/>
90+
channel="channel6" converter="converter"
91+
auto-startup="false">
92+
<si:poller max-messages-per-poll="1" fixed-delay="100"/>
9393
</jmx:tree-polling-channel-adapter>
9494

95-
<bean id="converter" class="org.springframework.integration.jmx.inbound.DefaultMBeanObjectConverter" />
95+
<bean id="converter" class="org.springframework.integration.jmx.inbound.DefaultMBeanObjectConverter"/>
9696

9797
<si:channel id="channel6">
9898
<si:queue/>

spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParserTests.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ public void pollDefaultAdapter() {
109109
.extracting(Message::getPayload)
110110
.isInstanceOf(HashMap.class);
111111

112+
adapterDefault.stop();
113+
112114
@SuppressWarnings("unchecked")
113115
Map<String, Object> beans = (Map<String, Object>) result.getPayload();
114116

115117
// test for a couple of MBeans
116118
assertThat(beans).containsKeys("java.lang:type=OperatingSystem", "java.lang:type=Runtime");
117-
118-
adapterDefault.stop();
119119
}
120120

121121
@Test
@@ -128,13 +128,13 @@ public void pollInnerAdapter() {
128128
.extracting(Message::getPayload)
129129
.isInstanceOf(HashMap.class);
130130

131+
adapterInner.stop();
132+
131133
@SuppressWarnings("unchecked")
132134
Map<String, Object> beans = (Map<String, Object>) result.getPayload();
133135

134136
// test for a couple of MBeans
135137
assertThat(beans).containsKeys("java.lang:type=OperatingSystem", "java.lang:type=Runtime");
136-
137-
adapterInner.stop();
138138
}
139139

140140
@Test
@@ -153,15 +153,15 @@ public void pollQueryNameAdapter() throws Exception {
153153
.extracting(Message::getPayload)
154154
.isInstanceOf(HashMap.class);
155155

156+
adapterQueryName.stop();
157+
156158
@SuppressWarnings("unchecked")
157159
Map<String, Object> beans = (Map<String, Object>) result.getPayload();
158160

159161
// test for a couple of MBeans
160162
assertThat(beans)
161163
.containsKey("java.lang:type=Runtime")
162164
.doesNotContainKey("java.lang:type=OperatingSystem");
163-
164-
adapterQueryName.stop();
165165
}
166166

167167
@Test
@@ -174,15 +174,15 @@ public void pollQueryNameBeanAdapter() {
174174
.extracting(Message::getPayload)
175175
.isInstanceOf(HashMap.class);
176176

177+
adapterQueryNameBean.stop();
178+
177179
@SuppressWarnings("unchecked")
178180
Map<String, Object> beans = (Map<String, Object>) result.getPayload();
179181

180182
// test for a couple of MBeans
181183
assertThat(beans)
182184
.containsKey("java.lang:type=OperatingSystem")
183185
.doesNotContainKey("java.lang:type=Runtime");
184-
185-
adapterQueryNameBean.stop();
186186
}
187187

188188
@Test
@@ -195,15 +195,15 @@ public void pollQueryExprBeanAdapter() {
195195
.extracting(Message::getPayload)
196196
.isInstanceOf(HashMap.class);
197197

198+
adapterQueryExprBean.stop();
199+
198200
@SuppressWarnings("unchecked")
199201
Map<String, Object> beans = (Map<String, Object>) result.getPayload();
200202

201203
// test for a couple of MBeans
202204
assertThat(beans)
203205
.containsKey("java.lang:type=Runtime")
204206
.doesNotContainKey("java.lang:type=OperatingSystem");
205-
206-
adapterQueryExprBean.stop();
207207
}
208208

209209
@Test
@@ -216,13 +216,14 @@ public void pollConverterAdapter() {
216216
.extracting(Message::getPayload)
217217
.isInstanceOf(HashMap.class);
218218

219+
adapterConverter.stop();
220+
219221
@SuppressWarnings("unchecked")
220222
Map<String, Object> beans = (Map<String, Object>) result.getPayload();
221223

222224
// test for a couple of MBeans
223225
assertThat(beans).containsKeys("java.lang:type=OperatingSystem", "java.lang:type=Runtime");
224226

225-
adapterConverter.stop();
226227
assertThat(TestUtils.getPropertyValue(adapterConverter, "source.converter")).isSameAs(converter);
227228
}
228229

spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/ReactiveRedisStreamMessageProducerTests.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,13 @@ void testReadingPendingMessageWithNoAutoACK() {
221221

222222
stepVerifier.verify(Duration.ofSeconds(10));
223223

224-
await().until(() ->
225-
template.opsForStream()
226-
.pending(STREAM_KEY, consumerGroup)
227-
.block(Duration.ofMillis(100))
228-
.getTotalPendingMessages() == 1);
224+
await().untilAsserted(() ->
225+
assertThat(
226+
template.opsForStream()
227+
.pending(STREAM_KEY, consumerGroup)
228+
.block(Duration.ofMillis(100))
229+
.getTotalPendingMessages())
230+
.isEqualTo(1));
229231

230232
acknowledgmentReference.get().acknowledge();
231233

0 commit comments

Comments
 (0)