Skip to content

Commit 026484c

Browse files
committed
Compatibility with the latest dependencies
* Upgrade to Gradle 3.5, SS-5.0, Hibernate-5.2.10, Mockito-2.7.22, Pah-1.1.1 And some other minor upgrades * Fix deprecations for Mockito compatibility * Fix `ServletWebSocketHandlerRegistry` deprecations * Fix SD-Mongo deprecations * Tweak JMX tests to avoid dangling threads after tests exist * Increase timeouts in some polling tests
1 parent 3c047c5 commit 026484c

File tree

16 files changed

+119
-72
lines changed

16 files changed

+119
-72
lines changed

build.gradle

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,28 @@ subprojects { subproject ->
8787
}
8888

8989
ext {
90-
activeMqVersion = '5.14.3'
90+
activeMqVersion = '5.14.5'
9191
aspectjVersion = '1.8.9'
9292
apacheSshdVersion = '1.4.0'
93-
boonVersion = '0.33'
93+
boonVersion = '0.34'
9494
chronicleVersion = '3.5.3'
9595
commonsDbcpVersion = '1.4'
9696
commonsIoVersion = '2.4'
97-
commonsNetVersion = '3.4'
97+
commonsNetVersion = '3.5'
9898
curatorVersion = '2.11.1'
99-
derbyVersion = '10.11.1.1'
100-
eclipseLinkVersion = '2.5.2'
99+
derbyVersion = '10.13.1.1'
100+
eclipseLinkVersion = '2.6.4'
101101
ftpServerVersion = '1.0.6'
102102
groovyVersion = '2.4.6'
103-
guavaVersion = '19.0'
103+
guavaVersion = '20.0'
104104
hamcrestVersion = '1.3'
105-
hazelcastVersion = '3.6.1'
106-
hibernateVersion = '5.2.5.Final'
107-
hsqldbVersion = '2.3.3'
108-
h2Version = '1.4.180'
105+
hazelcastVersion = '3.8'
106+
hibernateVersion = '5.2.10.Final'
107+
hsqldbVersion = '2.4.0'
108+
h2Version = '1.4.194'
109109
jackson2Version = '2.9.0.pr2'
110110
javaxActivationVersion = '1.1.1'
111-
javaxMailVersion = '1.5.6'
111+
javaxMailVersion = '1.6.0-rc1'
112112
jedisVersion = '2.9.0'
113113
jmsApiVersion = '2.0.1'
114114
jpa21ApiVersion = '1.0.0.Final'
@@ -120,27 +120,27 @@ subprojects { subproject ->
120120
jythonVersion = '2.5.3'
121121
kryoShadedVersion = '3.0.3'
122122
log4jVersion = '1.2.17'
123-
mockitoVersion = '2.5.4'
124-
mysqlVersion = '5.1.34'
125-
pahoMqttClientVersion = '1.0.2'
123+
mockitoVersion = '2.7.22'
124+
mysqlVersion = '5.1.41'
125+
pahoMqttClientVersion = '1.1.1'
126126
postgresVersion = '9.1-901-1.jdbc4'
127127
reactorNettyVersion = '0.6.3.BUILD-SNAPSHOT'
128128
reactorVersion = '3.1.0.BUILD-SNAPSHOT'
129-
romeToolsVersion = '1.7.0'
129+
romeToolsVersion = '1.7.2'
130130
servletApiVersion = '3.1.0'
131-
slf4jVersion = "1.7.21"
132-
smackVersion = '4.1.7'
131+
slf4jVersion = "1.7.25"
132+
smackVersion = '4.1.9'
133133
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.0.0.BUILD-SNAPSHOT'
134134
springDataJpaVersion = '2.0.0.BUILD-SNAPSHOT'
135135
springDataMongoVersion = '2.0.0.BUILD-SNAPSHOT'
136136
springDataRedisVersion = '2.0.0.BUILD-SNAPSHOT'
137137
springGemfireVersion = '2.0.0.BUILD-SNAPSHOT'
138-
springSecurityVersion = '4.2.2.RELEASE'
138+
springSecurityVersion = '5.0.0.BUILD-SNAPSHOT'
139139
springSocialTwitterVersion = '2.0.0.M1'
140140
springRetryVersion = '1.2.0.RELEASE'
141141
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.0.0.BUILD-SNAPSHOT'
142142
springWsVersion = '2.4.0.RELEASE'
143-
tomcatVersion = "8.5.9"
143+
tomcatVersion = "8.5.14"
144144
xmlUnitVersion = '1.6'
145145
xstreamVersion = '1.4.7'
146146
}

gradle/wrapper/gradle-wrapper.jar

575 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Jan 05 11:36:34 EST 2017
1+
#Wed Apr 26 10:11:04 EDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpOutboundChannelAdapterParserTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import static org.mockito.ArgumentMatchers.anyString;
2828
import static org.mockito.ArgumentMatchers.isNull;
2929
import static org.mockito.Mockito.doAnswer;
30+
import static org.mockito.Mockito.doNothing;
3031
import static org.mockito.Mockito.doThrow;
3132
import static org.mockito.Mockito.mock;
3233
import static org.mockito.Mockito.never;
@@ -312,7 +313,7 @@ public void testInt3430FailForNotLazyConnect() {
312313
AmqpOutboundEndpoint handler = new AmqpOutboundEndpoint(amqpTemplate);
313314
Log logger = spy(TestUtils.getPropertyValue(handler, "logger", Log.class));
314315
new DirectFieldAccessor(handler).setPropertyValue("logger", logger);
315-
doAnswer(new DoesNothing()).when(logger).error("Failed to eagerly establish the connection.", toBeThrown);
316+
doNothing().when(logger).error("Failed to eagerly establish the connection.", toBeThrown);
316317
ApplicationContext context = mock(ApplicationContext.class);
317318
handler.setApplicationContext(context);
318319
handler.setBeanFactory(context);

spring-integration-core/src/test/java/org/springframework/integration/config/xml/GatewayParserTests.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void testOneWay() {
8585
TestService service = (TestService) context.getBean("oneWay");
8686
service.oneWay("foo");
8787
PollableChannel channel = (PollableChannel) context.getBean("requestChannel");
88-
Message<?> result = channel.receive(1000);
88+
Message<?> result = channel.receive(10000);
8989
assertEquals("foo", result.getPayload());
9090
}
9191

@@ -94,7 +94,7 @@ public void testOneWayOverride() {
9494
TestService service = (TestService) context.getBean("methodOverride");
9595
service.oneWay("foo");
9696
PollableChannel channel = (PollableChannel) context.getBean("otherRequestChannel");
97-
Message<?> result = channel.receive(1000);
97+
Message<?> result = channel.receive(10000);
9898
assertEquals("fiz", result.getPayload());
9999
assertEquals("bar", result.getHeaders().get("foo"));
100100
assertEquals("qux", result.getHeaders().get("baz"));
@@ -133,7 +133,7 @@ public void testAsyncGateway() throws Exception {
133133
this.startResponder(requestChannel, replyChannel);
134134
TestService service = context.getBean("async", TestService.class);
135135
Future<Message<?>> result = service.async("foo");
136-
Message<?> reply = result.get(1, TimeUnit.SECONDS);
136+
Message<?> reply = result.get(10, TimeUnit.SECONDS);
137137
assertEquals("foo", reply.getPayload());
138138
assertEquals("testExecutor", reply.getHeaders().get("executor"));
139139
assertNotNull(TestUtils.getPropertyValue(context.getBean("&async"), "asyncExecutor"));
@@ -146,7 +146,7 @@ public void testAsyncDisabledGateway() throws Exception {
146146
this.startResponder(requestChannel, replyChannel);
147147
TestService service = context.getBean("asyncOff", TestService.class);
148148
Future<Message<?>> result = service.async("futureSync");
149-
Message<?> reply = result.get(1, TimeUnit.SECONDS);
149+
Message<?> reply = result.get(10, TimeUnit.SECONDS);
150150
assertEquals("futureSync", reply.getPayload());
151151
Object serviceBean = context.getBean("&asyncOff");
152152
assertNull(TestUtils.getPropertyValue(serviceBean, "asyncExecutor"));
@@ -220,7 +220,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
220220
this.startResponder(requestChannel, replyChannel);
221221
TestService service = context.getBean("completableNoAsync", TestService.class);
222222
CompletableFuture<String> result = service.completable("flowCompletable");
223-
String reply = result.get(1, TimeUnit.SECONDS);
223+
String reply = result.get(10, TimeUnit.SECONDS);
224224
assertEquals("SYNC_COMPLETABLE", reply);
225225
assertEquals(Thread.currentThread(), thread.get());
226226
assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor"));
@@ -243,7 +243,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
243243
this.startResponder(requestChannel, replyChannel);
244244
TestService service = context.getBean("completableNoAsync", TestService.class);
245245
MyCompletableFuture result = service.customCompletable("flowCustomCompletable");
246-
String reply = result.get(1, TimeUnit.SECONDS);
246+
String reply = result.get(10, TimeUnit.SECONDS);
247247
assertEquals("SYNC_CUSTOM_COMPLETABLE", reply);
248248
assertEquals(Thread.currentThread(), thread.get());
249249
assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor"));
@@ -270,7 +270,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
270270
this.startResponder(requestChannel, replyChannel);
271271
TestService service = context.getBean("customCompletableAttemptAsync", TestService.class);
272272
MyCompletableFuture result = service.customCompletable("flowCustomCompletable");
273-
String reply = result.get(1, TimeUnit.SECONDS);
273+
String reply = result.get(10, TimeUnit.SECONDS);
274274
assertEquals("SYNC_CUSTOM_COMPLETABLE", reply);
275275
assertEquals(Thread.currentThread(), thread.get());
276276
assertNotNull(TestUtils.getPropertyValue(gateway, "asyncExecutor"));
@@ -296,7 +296,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
296296
this.startResponder(requestChannel, replyChannel);
297297
TestService service = context.getBean("asyncCompletable", TestService.class);
298298
CompletableFuture<Message<?>> result = service.completableReturnsMessage("foo");
299-
Message<?> reply = result.get(1, TimeUnit.SECONDS);
299+
Message<?> reply = result.get(10, TimeUnit.SECONDS);
300300
assertEquals("foo", reply.getPayload());
301301
assertThat(thread.get().getName(), startsWith("testExec-"));
302302
assertNotNull(TestUtils.getPropertyValue(context.getBean("&asyncCompletable"), "asyncExecutor"));
@@ -319,7 +319,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
319319
this.startResponder(requestChannel, replyChannel);
320320
TestService service = context.getBean("completableNoAsync", TestService.class);
321321
CompletableFuture<Message<?>> result = service.completableReturnsMessage("flowCompletableM");
322-
Message<?> reply = result.get(1, TimeUnit.SECONDS);
322+
Message<?> reply = result.get(10, TimeUnit.SECONDS);
323323
assertEquals("flowCompletableM", reply.getPayload());
324324
assertEquals(Thread.currentThread(), thread.get());
325325
assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor"));
@@ -342,7 +342,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
342342
this.startResponder(requestChannel, replyChannel);
343343
TestService service = context.getBean("completableNoAsync", TestService.class);
344344
MyCompletableMessageFuture result = service.customCompletableReturnsMessage("flowCustomCompletableM");
345-
Message<?> reply = result.get(1, TimeUnit.SECONDS);
345+
Message<?> reply = result.get(10, TimeUnit.SECONDS);
346346
assertEquals("flowCustomCompletableM", reply.getPayload());
347347
assertEquals(Thread.currentThread(), thread.get());
348348
assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor"));

spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import static org.junit.Assert.fail;
3030
import static org.mockito.ArgumentMatchers.any;
3131
import static org.mockito.ArgumentMatchers.anyString;
32-
import static org.mockito.Mockito.doAnswer;
32+
import static org.mockito.Mockito.doNothing;
3333
import static org.mockito.Mockito.doThrow;
3434
import static org.mockito.Mockito.mock;
3535
import static org.mockito.Mockito.spy;
@@ -53,7 +53,6 @@
5353
import org.junit.Test;
5454
import org.mockito.ArgumentCaptor;
5555
import org.mockito.Mockito;
56-
import org.mockito.internal.stubbing.answers.DoesNothing;
5756

5857
import org.springframework.beans.DirectFieldAccessor;
5958
import org.springframework.context.ApplicationEvent;
@@ -67,7 +66,6 @@
6766
import org.springframework.integration.test.util.TestUtils;
6867
import org.springframework.messaging.Message;
6968
import org.springframework.messaging.MessageChannel;
70-
import org.springframework.messaging.MessageHandler;
7169
import org.springframework.messaging.MessageHandlingException;
7270
import org.springframework.messaging.MessagingException;
7371
import org.springframework.messaging.support.GenericMessage;
@@ -76,6 +74,8 @@
7674

7775
/**
7876
* @author Gary Russell
77+
* @author Artyem Bilan
78+
*
7979
* @since 3.0
8080
*
8181
*/
@@ -112,7 +112,8 @@ public void publishEvent(Object event) {
112112
conn.send(new GenericMessage<String>("bar"));
113113
fail("Expected exception");
114114
}
115-
catch (Exception e) { }
115+
catch (Exception e) {
116+
}
116117
assertTrue(theEvent.size() > 0);
117118
assertNotNull(theEvent.get(0));
118119
assertTrue(theEvent.get(0) instanceof TcpConnectionExceptionEvent);
@@ -150,6 +151,7 @@ public void testOutboundChannelAdapterNoConnectionEvents() {
150151
@Override
151152
public void run() {
152153
}
154+
153155
};
154156
final AtomicReference<ApplicationEvent> theEvent = new AtomicReference<ApplicationEvent>();
155157
scf.setApplicationEventPublisher(new ApplicationEventPublisher() {
@@ -206,13 +208,7 @@ public void publishEvent(ApplicationEvent event) {
206208
});
207209
gw.setConnectionFactory(scf);
208210
DirectChannel requestChannel = new DirectChannel();
209-
requestChannel.subscribe(new MessageHandler() {
210-
211-
@Override
212-
public void handleMessage(Message<?> message) throws MessagingException {
213-
((MessageChannel) message.getHeaders().getReplyChannel()).send(message);
214-
}
215-
});
211+
requestChannel.subscribe(message -> ((MessageChannel) message.getHeaders().getReplyChannel()).send(message));
216212
gw.setRequestChannel(requestChannel);
217213
gw.start();
218214
Message<String> message = MessageBuilder.withPayload("foo")
@@ -229,6 +225,7 @@ public void handleMessage(Message<?> message) throws MessagingException {
229225
public void testOutboundGatewayNoConnectionEvents() {
230226
TcpOutboundGateway gw = new TcpOutboundGateway();
231227
AbstractClientConnectionFactory ccf = new AbstractClientConnectionFactory("localhost", 0) {
228+
232229
};
233230
final AtomicReference<ApplicationEvent> theEvent = new AtomicReference<ApplicationEvent>();
234231
ccf.setApplicationEventPublisher(new ApplicationEventPublisher() {
@@ -296,7 +293,7 @@ public void publishEvent(Object event) {
296293
factory.setBeanName("sf");
297294
factory.registerListener(message -> false);
298295
Log logger = spy(TestUtils.getPropertyValue(factory, "logger", Log.class));
299-
doAnswer(new DoesNothing()).when(logger).error(anyString(), any(Throwable.class));
296+
doNothing().when(logger).error(anyString(), any(Throwable.class));
300297
new DirectFieldAccessor(factory).setPropertyValue("logger", logger);
301298

302299
factory.start();

spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import static org.junit.Assert.assertThat;
2222
import static org.mockito.ArgumentMatchers.any;
2323
import static org.mockito.ArgumentMatchers.anyString;
24-
import static org.mockito.Mockito.doAnswer;
24+
import static org.mockito.Mockito.doNothing;
2525
import static org.mockito.Mockito.mock;
2626
import static org.mockito.Mockito.spy;
2727

@@ -31,7 +31,6 @@
3131

3232
import org.apache.commons.logging.Log;
3333
import org.junit.Test;
34-
import org.mockito.internal.stubbing.answers.DoesNothing;
3534

3635
import org.springframework.beans.DirectFieldAccessor;
3736
import org.springframework.beans.factory.BeanFactory;
@@ -74,7 +73,7 @@ public void testBadConversion() throws Exception {
7473
final QueueChannel requestChannel = new QueueChannel();
7574
ChannelPublishingJmsMessageListener listener = new ChannelPublishingJmsMessageListener();
7675
Log logger = spy(TestUtils.getPropertyValue(listener, "logger", Log.class));
77-
doAnswer(new DoesNothing()).when(logger).error(anyString(), any(Throwable.class));
76+
doNothing().when(logger).error(anyString(), any(Throwable.class));
7877
new DirectFieldAccessor(listener).setPropertyValue("logger", logger);
7978
listener.setRequestChannel(requestChannel);
8079
QueueChannel errorChannel = new QueueChannel();

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2015 the original author or authors.
2+
* Copyright 2013-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@
4545
/**
4646
* @author Stuart Williams
4747
* @author Gary Russell
48+
* @author Artem Bilan
4849
*
4950
*/
5051
@ContextConfiguration
@@ -140,7 +141,7 @@ public void pollInnerAdapter() throws Exception {
140141
assertTrue(beans.containsKey("java.lang:type=OperatingSystem"));
141142
assertTrue(beans.containsKey("java.lang:type=Runtime"));
142143

143-
adapterDefault.stop();
144+
adapterInner.stop();
144145
}
145146

146147
@Test
@@ -165,7 +166,7 @@ public void pollQueryNameAdapter() throws Exception {
165166
assertFalse(beans.containsKey("java.lang:type=OperatingSystem"));
166167
assertTrue(beans.containsKey("java.lang:type=Runtime"));
167168

168-
adapterDefault.stop();
169+
adapterQueryName.stop();
169170
}
170171

171172
@Test
@@ -184,7 +185,7 @@ public void pollQueryNameBeanAdapter() throws Exception {
184185
assertTrue(beans.containsKey("java.lang:type=OperatingSystem"));
185186
assertFalse(beans.containsKey("java.lang:type=Runtime"));
186187

187-
adapterDefault.stop();
188+
adapterQueryNameBean.stop();
188189
}
189190

190191
@Test
@@ -203,7 +204,7 @@ public void pollQueryExprBeanAdapter() throws Exception {
203204
assertFalse(beans.containsKey("java.lang:type=OperatingSystem"));
204205
assertTrue(beans.containsKey("java.lang:type=Runtime"));
205206

206-
adapterDefault.stop();
207+
adapterQueryExprBean.stop();
207208
}
208209

209210
@Test
@@ -222,7 +223,7 @@ public void pollConverterAdapter() throws Exception {
222223
assertTrue(beans.containsKey("java.lang:type=OperatingSystem"));
223224
assertTrue(beans.containsKey("java.lang:type=Runtime"));
224225

225-
adapterDefault.stop();
226+
adapterConverter.stop();
226227
assertSame(converter, TestUtils.getPropertyValue(adapterConverter, "source.converter"));
227228
}
228229

spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageChannelsMonitorIntegrationTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2016 the original author or authors.
2+
* Copyright 2009-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -218,6 +218,7 @@ private ClassPathXmlApplicationContext createContext(String config, String chann
218218
}
219219

220220
public static class Service {
221+
221222
private int counter;
222223

223224
private volatile CountDownLatch latch;
@@ -241,10 +242,12 @@ public int getCounter() {
241242

242243
@Aspect
243244
public static class TestChannelInterceptor {
245+
244246
@Before("execution(* *..MessageChannel+.send(*)) && args(input)")
245247
public void around(Message<?> input) {
246248
logger.debug("Handling: " + input);
247249
}
250+
248251
}
249252

250253
}

0 commit comments

Comments
 (0)