From 026484c382fb2e810424a9db6adbc6e5d8c00567 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 26 Apr 2017 11:29:18 -0400 Subject: [PATCH] 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 --- build.gradle | 38 +++++++++--------- gradle/wrapper/gradle-wrapper.jar | Bin 54208 -> 54783 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- ...AmqpOutboundChannelAdapterParserTests.java | 3 +- .../config/xml/GatewayParserTests.java | 20 ++++----- .../tcp/connection/ConnectionEventTests.java | 21 +++++----- ...nnelPublishingJmsMessageListenerTests.java | 5 +-- ...nTreePollingChannelAdapterParserTests.java | 13 +++--- ...essageChannelsMonitorIntegrationTests.java | 5 ++- .../monitor/MessageMetricsAdviceTests.java | 19 +++++++-- ...ssageSourceMonitoringIntegrationTests.java | 15 ++++++- .../monitor/MessageSourceTests.java | 4 +- .../integration/mail/MailReceiverTests.java | 7 ++-- ...stractConfigurableMongoDbMessageStore.java | 4 +- .../mongodb/store/MongoDbMessageStore.java | 5 ++- ...etIntegrationConfigurationInitializer.java | 28 +++++++++++-- 16 files changed, 119 insertions(+), 72 deletions(-) diff --git a/build.gradle b/build.gradle index 3a82ea5756..ac9427649d 100644 --- a/build.gradle +++ b/build.gradle @@ -87,28 +87,28 @@ subprojects { subproject -> } ext { - activeMqVersion = '5.14.3' + activeMqVersion = '5.14.5' aspectjVersion = '1.8.9' apacheSshdVersion = '1.4.0' - boonVersion = '0.33' + boonVersion = '0.34' chronicleVersion = '3.5.3' commonsDbcpVersion = '1.4' commonsIoVersion = '2.4' - commonsNetVersion = '3.4' + commonsNetVersion = '3.5' curatorVersion = '2.11.1' - derbyVersion = '10.11.1.1' - eclipseLinkVersion = '2.5.2' + derbyVersion = '10.13.1.1' + eclipseLinkVersion = '2.6.4' ftpServerVersion = '1.0.6' groovyVersion = '2.4.6' - guavaVersion = '19.0' + guavaVersion = '20.0' hamcrestVersion = '1.3' - hazelcastVersion = '3.6.1' - hibernateVersion = '5.2.5.Final' - hsqldbVersion = '2.3.3' - h2Version = '1.4.180' + hazelcastVersion = '3.8' + hibernateVersion = '5.2.10.Final' + hsqldbVersion = '2.4.0' + h2Version = '1.4.194' jackson2Version = '2.9.0.pr2' javaxActivationVersion = '1.1.1' - javaxMailVersion = '1.5.6' + javaxMailVersion = '1.6.0-rc1' jedisVersion = '2.9.0' jmsApiVersion = '2.0.1' jpa21ApiVersion = '1.0.0.Final' @@ -120,27 +120,27 @@ subprojects { subproject -> jythonVersion = '2.5.3' kryoShadedVersion = '3.0.3' log4jVersion = '1.2.17' - mockitoVersion = '2.5.4' - mysqlVersion = '5.1.34' - pahoMqttClientVersion = '1.0.2' + mockitoVersion = '2.7.22' + mysqlVersion = '5.1.41' + pahoMqttClientVersion = '1.1.1' postgresVersion = '9.1-901-1.jdbc4' reactorNettyVersion = '0.6.3.BUILD-SNAPSHOT' reactorVersion = '3.1.0.BUILD-SNAPSHOT' - romeToolsVersion = '1.7.0' + romeToolsVersion = '1.7.2' servletApiVersion = '3.1.0' - slf4jVersion = "1.7.21" - smackVersion = '4.1.7' + slf4jVersion = "1.7.25" + smackVersion = '4.1.9' springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.0.0.BUILD-SNAPSHOT' springDataJpaVersion = '2.0.0.BUILD-SNAPSHOT' springDataMongoVersion = '2.0.0.BUILD-SNAPSHOT' springDataRedisVersion = '2.0.0.BUILD-SNAPSHOT' springGemfireVersion = '2.0.0.BUILD-SNAPSHOT' - springSecurityVersion = '4.2.2.RELEASE' + springSecurityVersion = '5.0.0.BUILD-SNAPSHOT' springSocialTwitterVersion = '2.0.0.M1' springRetryVersion = '1.2.0.RELEASE' springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.0.0.BUILD-SNAPSHOT' springWsVersion = '2.4.0.RELEASE' - tomcatVersion = "8.5.9" + tomcatVersion = "8.5.14" xmlUnitVersion = '1.6' xstreamVersion = '1.4.7' } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index dcea6d091adaa12aeaaee5f0397f3cf8bc9d052b..80454fc9618222f920ed64c428bb67cde8dfe510 100644 GIT binary patch delta 6636 zcmZ8m2RxPk_rI>l$liPJl@*!E%DBQsglk2Ka4EA~e32FLWUmmi%9feEcgQBn$c{vb z|I@wq|Lg1fdA*+3bMATGXMD~%pYyz)bDQ&V&x&wK^>uJBP(vUD1P};B1rkfj0}?6_ zPr?@8Sb0;L%>=4wO^~Ve!=VbDQViB6S~+(#_mkBHPtu*nt>dCmes0`fKLTBDm=UMYB)owEy)IP*BwA+{4Gmo?0W=g8ljG2SAW^TOz;Y4#_#jjJV1G^a*j$-Tj<4$fh%yQo7muLSOsQaXrbUqsu*x;t^gv`8f{wz{ z`MJByC?zsd^vb$zg{aH8x)GiELu9IGwKmR-RGB4Jjg#$D$c28DuCm6{7x8*Cj)A+c zR}qM{fuoA*Wxjmjh3^->YIf-{Gcbj9uzppRQ*yVsc8O^0d%fOt4Ku1$+kW%@x@O>X z(_S0u>BUag2$Bqj#j$9OK>gnIwm%4~M)>IPJZxz7-$)%xth4M*g}W6|Gr( zHI?^LdX4DqIf1_9_2^^7X!57>mM?@eI((LzFOl;ecNOH*S+(C=EDf*B9C^40u}YTyaTuPhbD6+gZ_P@NyP0Cm4R9hIrOoQgZcb z^p;ml49Q9^@7#7<&x;c7`zD+mFpkg!fKrf9ev2=?Ve{vghD%4yUj+ORqH(olFFl6$ z9-xNG45fINb9-Nr#+E1n)s6EE@?<*rz7mp(A{2&?s$&jilWWDzrx9I^qw=TExB8DN zqAYRXzg;v0Il5zFBM$Itrau>YN;X~78JVPFKq)PM2&tCV+`=LH;xHjr5#h5m33umv z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ar0k=9O zIEgTCE5s!8Un_!WFmEN7FzvA-9+(#N?@0zo?iBg&O$He4l)$boK!X&(frm&j9Pmd< zb6ajSf&!rUAb6o!NapLcq7F zvG$UWd^m1THw28wbjG~^s3^&6!UTYjt^k8yk?Dz?a1js>gv7c7Q>F;|C0SF{b z3Ibij%6hLflJ*GT;NtD1Z)JyayOCOI2!~70VfOm7c7#9 z1kgjBCGXeGj34;(UN#SmFA?eaN?Yo@@vULp3=!aTKOM6n;$S&!=?O=J3?*fIu= zh9TecpH zD1aON6ga!zAOvjdh~>T?6vm1Q8=6PvVZ@d(jpv*wlM9x(>P7J2?!+lEd$c+4*9~} zj)~+sq5f2?P*%%@x z0Q-!)4FUZj2>5O>RycWx2kZRrmIHyL&Sh}F3`;ceV>ykECG*o+y&%Rc(tFIw7CuJ~ zuEdgc(x^`t2{%`R5eRsy8f!n@(`U)_K>Y|#sJ5-#H4!6JggF?}=Y)Fd{&PS?(*L*O z%a<=~%VPFd5#uCu&Y`&x>2*ms1T<3)tk result = channel.receive(1000); + Message result = channel.receive(10000); assertEquals("foo", result.getPayload()); } @@ -94,7 +94,7 @@ public class GatewayParserTests { TestService service = (TestService) context.getBean("methodOverride"); service.oneWay("foo"); PollableChannel channel = (PollableChannel) context.getBean("otherRequestChannel"); - Message result = channel.receive(1000); + Message result = channel.receive(10000); assertEquals("fiz", result.getPayload()); assertEquals("bar", result.getHeaders().get("foo")); assertEquals("qux", result.getHeaders().get("baz")); @@ -133,7 +133,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("async", TestService.class); Future> result = service.async("foo"); - Message reply = result.get(1, TimeUnit.SECONDS); + Message reply = result.get(10, TimeUnit.SECONDS); assertEquals("foo", reply.getPayload()); assertEquals("testExecutor", reply.getHeaders().get("executor")); assertNotNull(TestUtils.getPropertyValue(context.getBean("&async"), "asyncExecutor")); @@ -146,7 +146,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("asyncOff", TestService.class); Future> result = service.async("futureSync"); - Message reply = result.get(1, TimeUnit.SECONDS); + Message reply = result.get(10, TimeUnit.SECONDS); assertEquals("futureSync", reply.getPayload()); Object serviceBean = context.getBean("&asyncOff"); assertNull(TestUtils.getPropertyValue(serviceBean, "asyncExecutor")); @@ -220,7 +220,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("completableNoAsync", TestService.class); CompletableFuture result = service.completable("flowCompletable"); - String reply = result.get(1, TimeUnit.SECONDS); + String reply = result.get(10, TimeUnit.SECONDS); assertEquals("SYNC_COMPLETABLE", reply); assertEquals(Thread.currentThread(), thread.get()); assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor")); @@ -243,7 +243,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("completableNoAsync", TestService.class); MyCompletableFuture result = service.customCompletable("flowCustomCompletable"); - String reply = result.get(1, TimeUnit.SECONDS); + String reply = result.get(10, TimeUnit.SECONDS); assertEquals("SYNC_CUSTOM_COMPLETABLE", reply); assertEquals(Thread.currentThread(), thread.get()); assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor")); @@ -270,7 +270,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("customCompletableAttemptAsync", TestService.class); MyCompletableFuture result = service.customCompletable("flowCustomCompletable"); - String reply = result.get(1, TimeUnit.SECONDS); + String reply = result.get(10, TimeUnit.SECONDS); assertEquals("SYNC_CUSTOM_COMPLETABLE", reply); assertEquals(Thread.currentThread(), thread.get()); assertNotNull(TestUtils.getPropertyValue(gateway, "asyncExecutor")); @@ -296,7 +296,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("asyncCompletable", TestService.class); CompletableFuture> result = service.completableReturnsMessage("foo"); - Message reply = result.get(1, TimeUnit.SECONDS); + Message reply = result.get(10, TimeUnit.SECONDS); assertEquals("foo", reply.getPayload()); assertThat(thread.get().getName(), startsWith("testExec-")); assertNotNull(TestUtils.getPropertyValue(context.getBean("&asyncCompletable"), "asyncExecutor")); @@ -319,7 +319,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("completableNoAsync", TestService.class); CompletableFuture> result = service.completableReturnsMessage("flowCompletableM"); - Message reply = result.get(1, TimeUnit.SECONDS); + Message reply = result.get(10, TimeUnit.SECONDS); assertEquals("flowCompletableM", reply.getPayload()); assertEquals(Thread.currentThread(), thread.get()); assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor")); @@ -342,7 +342,7 @@ public class GatewayParserTests { this.startResponder(requestChannel, replyChannel); TestService service = context.getBean("completableNoAsync", TestService.class); MyCompletableMessageFuture result = service.customCompletableReturnsMessage("flowCustomCompletableM"); - Message reply = result.get(1, TimeUnit.SECONDS); + Message reply = result.get(10, TimeUnit.SECONDS); assertEquals("flowCustomCompletableM", reply.getPayload()); assertEquals(Thread.currentThread(), thread.get()); assertNull(TestUtils.getPropertyValue(context.getBean("&completableNoAsync"), "asyncExecutor")); diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java index 3664f231af..e0699b9a70 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionEventTests.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -53,7 +53,6 @@ import org.hamcrest.Matchers; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; -import org.mockito.internal.stubbing.answers.DoesNothing; import org.springframework.beans.DirectFieldAccessor; import org.springframework.context.ApplicationEvent; @@ -67,7 +66,6 @@ import org.springframework.integration.ip.tcp.TcpSendingMessageHandler; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; -import org.springframework.messaging.MessageHandler; import org.springframework.messaging.MessageHandlingException; import org.springframework.messaging.MessagingException; import org.springframework.messaging.support.GenericMessage; @@ -76,6 +74,8 @@ import org.springframework.util.SocketUtils; /** * @author Gary Russell + * @author Artyem Bilan + * * @since 3.0 * */ @@ -112,7 +112,8 @@ public class ConnectionEventTests { conn.send(new GenericMessage("bar")); fail("Expected exception"); } - catch (Exception e) { } + catch (Exception e) { + } assertTrue(theEvent.size() > 0); assertNotNull(theEvent.get(0)); assertTrue(theEvent.get(0) instanceof TcpConnectionExceptionEvent); @@ -150,6 +151,7 @@ public class ConnectionEventTests { @Override public void run() { } + }; final AtomicReference theEvent = new AtomicReference(); scf.setApplicationEventPublisher(new ApplicationEventPublisher() { @@ -206,13 +208,7 @@ public class ConnectionEventTests { }); gw.setConnectionFactory(scf); DirectChannel requestChannel = new DirectChannel(); - requestChannel.subscribe(new MessageHandler() { - - @Override - public void handleMessage(Message message) throws MessagingException { - ((MessageChannel) message.getHeaders().getReplyChannel()).send(message); - } - }); + requestChannel.subscribe(message -> ((MessageChannel) message.getHeaders().getReplyChannel()).send(message)); gw.setRequestChannel(requestChannel); gw.start(); Message message = MessageBuilder.withPayload("foo") @@ -229,6 +225,7 @@ public class ConnectionEventTests { public void testOutboundGatewayNoConnectionEvents() { TcpOutboundGateway gw = new TcpOutboundGateway(); AbstractClientConnectionFactory ccf = new AbstractClientConnectionFactory("localhost", 0) { + }; final AtomicReference theEvent = new AtomicReference(); ccf.setApplicationEventPublisher(new ApplicationEventPublisher() { @@ -296,7 +293,7 @@ public class ConnectionEventTests { factory.setBeanName("sf"); factory.registerListener(message -> false); Log logger = spy(TestUtils.getPropertyValue(factory, "logger", Log.class)); - doAnswer(new DoesNothing()).when(logger).error(anyString(), any(Throwable.class)); + doNothing().when(logger).error(anyString(), any(Throwable.class)); new DirectFieldAccessor(factory).setPropertyValue("logger", logger); factory.start(); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java index 3a4cd3bd7f..b78a7ce4f1 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListenerTests.java @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -31,7 +31,6 @@ import javax.jms.Session; import org.apache.commons.logging.Log; import org.junit.Test; -import org.mockito.internal.stubbing.answers.DoesNothing; import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.BeanFactory; @@ -74,7 +73,7 @@ public class ChannelPublishingJmsMessageListenerTests { final QueueChannel requestChannel = new QueueChannel(); ChannelPublishingJmsMessageListener listener = new ChannelPublishingJmsMessageListener(); Log logger = spy(TestUtils.getPropertyValue(listener, "logger", Log.class)); - doAnswer(new DoesNothing()).when(logger).error(anyString(), any(Throwable.class)); + doNothing().when(logger).error(anyString(), any(Throwable.class)); new DirectFieldAccessor(listener).setPropertyValue("logger", logger); listener.setRequestChannel(requestChannel); QueueChannel errorChannel = new QueueChannel(); diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParserTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParserTests.java index bda149aeb4..ff88c8963a 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParserTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-2017 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. @@ -45,6 +45,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author Stuart Williams * @author Gary Russell + * @author Artem Bilan * */ @ContextConfiguration @@ -140,7 +141,7 @@ public class MBeanTreePollingChannelAdapterParserTests { assertTrue(beans.containsKey("java.lang:type=OperatingSystem")); assertTrue(beans.containsKey("java.lang:type=Runtime")); - adapterDefault.stop(); + adapterInner.stop(); } @Test @@ -165,7 +166,7 @@ public class MBeanTreePollingChannelAdapterParserTests { assertFalse(beans.containsKey("java.lang:type=OperatingSystem")); assertTrue(beans.containsKey("java.lang:type=Runtime")); - adapterDefault.stop(); + adapterQueryName.stop(); } @Test @@ -184,7 +185,7 @@ public class MBeanTreePollingChannelAdapterParserTests { assertTrue(beans.containsKey("java.lang:type=OperatingSystem")); assertFalse(beans.containsKey("java.lang:type=Runtime")); - adapterDefault.stop(); + adapterQueryNameBean.stop(); } @Test @@ -203,7 +204,7 @@ public class MBeanTreePollingChannelAdapterParserTests { assertFalse(beans.containsKey("java.lang:type=OperatingSystem")); assertTrue(beans.containsKey("java.lang:type=Runtime")); - adapterDefault.stop(); + adapterQueryExprBean.stop(); } @Test @@ -222,7 +223,7 @@ public class MBeanTreePollingChannelAdapterParserTests { assertTrue(beans.containsKey("java.lang:type=OperatingSystem")); assertTrue(beans.containsKey("java.lang:type=Runtime")); - adapterDefault.stop(); + adapterConverter.stop(); assertSame(converter, TestUtils.getPropertyValue(adapterConverter, "source.converter")); } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageChannelsMonitorIntegrationTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageChannelsMonitorIntegrationTests.java index d156c1de85..17849255f1 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageChannelsMonitorIntegrationTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageChannelsMonitorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2016 the original author or authors. + * Copyright 2009-2017 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. @@ -218,6 +218,7 @@ public class MessageChannelsMonitorIntegrationTests { } public static class Service { + private int counter; private volatile CountDownLatch latch; @@ -241,10 +242,12 @@ public class MessageChannelsMonitorIntegrationTests { @Aspect public static class TestChannelInterceptor { + @Before("execution(* *..MessageChannel+.send(*)) && args(input)") public void around(Message input) { logger.debug("Handling: " + input); } + } } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageMetricsAdviceTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageMetricsAdviceTests.java index a69a9ed3a3..6b91cc63bb 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageMetricsAdviceTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageMetricsAdviceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 the original author or authors. + * Copyright 2011-2017 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. @@ -18,6 +18,7 @@ package org.springframework.integration.monitor; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; +import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -39,10 +40,13 @@ import org.springframework.util.ClassUtils; * @author Dave Syer * @author Gary Russell * @author Artem Bilan + * * @since 2.0.4 */ public class MessageMetricsAdviceTests { + private GenericApplicationContext applicationContext; + private ConfigurableListableBeanFactory beanFactory; private IntegrationMBeanExporter mBeanExporter; @@ -53,11 +57,11 @@ public class MessageMetricsAdviceTests { @Before public void setUp() throws Exception { - GenericApplicationContext applicationContext = TestUtils.createTestApplicationContext(); - this.beanFactory = applicationContext.getBeanFactory(); + this.applicationContext = TestUtils.createTestApplicationContext(); + this.beanFactory = this.applicationContext.getBeanFactory(); this.channel = new NullChannel(); this.mBeanExporter = new IntegrationMBeanExporter(); - this.mBeanExporter.setApplicationContext(applicationContext); + this.mBeanExporter.setApplicationContext(this.applicationContext); this.mBeanExporter.setBeanFactory(this.beanFactory); this.mBeanExporter.setBeanClassLoader(ClassUtils.getDefaultClassLoader()); this.mBeanExporter.afterPropertiesSet(); @@ -65,6 +69,13 @@ public class MessageMetricsAdviceTests { applicationContext.refresh(); } + @After + public void tearDown() throws Exception { + if (this.applicationContext != null) { + this.applicationContext.close(); + } + } + @Test public void exportAdvisedHandler() throws Exception { diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java index bed1e8e376..f501aac663 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceMonitoringIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2016 the original author or authors. + * Copyright 2009-2017 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. @@ -19,10 +19,16 @@ package org.springframework.integration.monitor; import static org.junit.Assert.assertTrue; import org.junit.Test; + import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.messaging.PollableChannel; +/** + * @author Dave Syer + * @author Gary Russell + * @author Artem Bilan + */ public class MessageSourceMonitoringIntegrationTests { private PollableChannel channel; @@ -74,17 +80,21 @@ public class MessageSourceMonitoringIntegrationTests { private ClassPathXmlApplicationContext createContext(String config, String channelName) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config, getClass()); - context.getAutowireCapableBeanFactory().autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false); + context.getAutowireCapableBeanFactory() + .autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false); channel = context.getBean(channelName, PollableChannel.class); return context; } public interface Service { + String execute() throws Exception; + int getCounter(); } public static class SimpleService implements Service { + private int counter; public String execute() throws Exception { @@ -96,6 +106,7 @@ public class MessageSourceMonitoringIntegrationTests { public int getCounter() { return counter; } + } } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceTests.java index 3c3acda4fe..5271468c35 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceTests.java +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/MessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 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,6 +39,7 @@ import org.springframework.integration.jmx.config.EnableIntegrationMBeanExport; import org.springframework.integration.scheduling.PollerMetadata; import org.springframework.jmx.support.MBeanServerFactoryBean; import org.springframework.messaging.PollableChannel; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; /** @@ -47,6 +48,7 @@ import org.springframework.test.context.junit4.SpringRunner; * */ @RunWith(SpringRunner.class) +@DirtiesContext public class MessageSourceTests { @Autowired diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java index 85cffd90d6..9832169abc 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceiverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2017 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. @@ -16,7 +16,7 @@ package org.springframework.integration.mail; -import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -34,7 +34,6 @@ import javax.mail.Store; import javax.mail.URLName; import org.junit.Test; -import org.mockito.internal.stubbing.answers.DoesNothing; import org.springframework.beans.DirectFieldAccessor; @@ -66,7 +65,7 @@ public class MailReceiverTests { when(folder.exists()).thenReturn(true); when(folder.isOpen()).thenReturn(false); doReturn(folder).when(store).getFolder((URLName) null); - doAnswer(new DoesNothing()).when(store).connect(); + doNothing().when(store).connect(); receiver.openFolder(); receiver.openFolder(); verify(store, times(2)).connect(); diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java index 5af8249791..1cb3571e9a 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java @@ -36,9 +36,9 @@ import org.springframework.data.mongodb.MongoDbFactory; import org.springframework.data.mongodb.core.FindAndModifyOptions; import org.springframework.data.mongodb.core.IndexOperations; import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.data.mongodb.core.convert.CustomConversions; import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver; import org.springframework.data.mongodb.core.convert.MappingMongoConverter; +import org.springframework.data.mongodb.core.convert.MongoCustomConversions; import org.springframework.data.mongodb.core.index.Index; import org.springframework.data.mongodb.core.mapping.MongoMappingContext; import org.springframework.data.mongodb.core.query.Criteria; @@ -134,7 +134,7 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe List customConverters = new ArrayList(); customConverters.add(new MessageToBinaryConverter()); customConverters.add(new BinaryToMessageConverter()); - this.mappingMongoConverter.setCustomConversions(new CustomConversions(customConverters)); + this.mappingMongoConverter.setCustomConversions(new MongoCustomConversions(customConverters)); this.mappingMongoConverter.afterPropertiesSet(); } this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mappingMongoConverter); diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java index 25e21a09e3..75f1c13836 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java @@ -51,9 +51,9 @@ import org.springframework.data.mongodb.core.BulkOperations; import org.springframework.data.mongodb.core.FindAndModifyOptions; import org.springframework.data.mongodb.core.IndexOperations; import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.data.mongodb.core.convert.CustomConversions; import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver; import org.springframework.data.mongodb.core.convert.MappingMongoConverter; +import org.springframework.data.mongodb.core.convert.MongoCustomConversions; import org.springframework.data.mongodb.core.index.Index; import org.springframework.data.mongodb.core.mapping.MongoMappingContext; import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity; @@ -94,6 +94,7 @@ import com.mongodb.DBObject; * @author Jodie StJohn * @author Gary Russell * @author Artem Bilan + * * @since 2.1 */ public class MongoDbMessageStore extends AbstractMessageGroupStore @@ -506,7 +507,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore customConverters.add(new DocumentToErrorMessageConverter()); customConverters.add(new DocumentToAdviceMessageConverter()); customConverters.add(new ThrowableToBytesConverter()); - this.setCustomConversions(new CustomConversions(customConverters)); + this.setCustomConversions(new MongoCustomConversions(customConverters)); super.afterPropertiesSet(); } diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java index 0a1a2afe3d..6f9672683a 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2017 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. @@ -31,6 +31,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.integration.config.IntegrationConfigurationInitializer; +import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.util.ClassUtils; import org.springframework.web.servlet.HandlerMapping; @@ -44,6 +45,7 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer; * * @author Artem Bilan * @author Gary Russell + * * @since 4.1 */ public class WebSocketIntegrationConfigurationInitializer implements IntegrationConfigurationInitializer { @@ -111,12 +113,15 @@ public class WebSocketIntegrationConfigurationInitializer implements Integration private static class WebSocketHandlerMappingFactoryBean extends AbstractFactoryBean implements ApplicationContextAware { - private ServletWebSocketHandlerRegistry registry; + private final IntegrationServletWebSocketHandlerRegistry registry = + new IntegrationServletWebSocketHandlerRegistry(); + + private ThreadPoolTaskScheduler sockJsTaskScheduler; private ApplicationContext applicationContext; public void setSockJsTaskScheduler(ThreadPoolTaskScheduler sockJsTaskScheduler) { - this.registry = new ServletWebSocketHandlerRegistry(sockJsTaskScheduler); + this.sockJsTaskScheduler = sockJsTaskScheduler; } @Override @@ -131,6 +136,9 @@ public class WebSocketIntegrationConfigurationInitializer implements Integration for (WebSocketConfigurer configurer : webSocketConfigurers) { configurer.registerWebSocketHandlers(this.registry); } + if (this.registry.requiresTaskScheduler()) { + this.registry.setTaskScheduler(this.sockJsTaskScheduler); + } AbstractHandlerMapping handlerMapping = this.registry.getHandlerMapping(); handlerMapping.setApplicationContext(this.applicationContext); return handlerMapping; @@ -143,4 +151,18 @@ public class WebSocketIntegrationConfigurationInitializer implements Integration } + private static class IntegrationServletWebSocketHandlerRegistry extends ServletWebSocketHandlerRegistry { + + @Override + public boolean requiresTaskScheduler() { + return super.requiresTaskScheduler(); + } + + @Override + public void setTaskScheduler(TaskScheduler scheduler) { + super.setTaskScheduler(scheduler); + } + + } + }