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
This commit is contained in:
Artem Bilan
2017-04-26 11:29:18 -04:00
parent 3c047c5076
commit 026484c382
16 changed files with 119 additions and 72 deletions

View File

@@ -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"));
}

View File

@@ -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);
}
}
}

View File

@@ -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 {

View File

@@ -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;
}
}
}

View File

@@ -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