Merge pull request #735 from sobychacko/INT-2526
* sobychacko-INT-2526: INT-2526 - Remove additional deprecations in Core INT-2526: Remove deprecations in Core after upgrade to Spring 3.1.1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.ReflectionUtils.MethodCallback;
|
||||
|
||||
@@ -30,6 +31,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Gunnar Hillert
|
||||
* @author Soby Chacko
|
||||
*
|
||||
*/
|
||||
abstract class AnnotationFinder {
|
||||
@@ -46,13 +48,12 @@ abstract class AnnotationFinder {
|
||||
return reference.get();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static Class<?> getTargetClass(Object targetObject) {
|
||||
Class<?> targetClass = targetObject.getClass();
|
||||
if (AopUtils.isAopProxy(targetObject)) {
|
||||
targetClass = AopUtils.getTargetClass(targetObject);
|
||||
}
|
||||
else if (AopUtils.isCglibProxyClass(targetClass)) {
|
||||
else if (ClassUtils.isCglibProxyClass(targetClass)) {
|
||||
Class<?> superClass = targetObject.getClass().getSuperclass();
|
||||
if (!Object.class.equals(superClass)) {
|
||||
targetClass = superClass;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2013 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,7 +19,7 @@ package org.springframework.integration.router;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.MessageDeliveryException;
|
||||
@@ -36,6 +36,7 @@ import org.springframework.jmx.export.annotation.ManagedResource;
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @author Soby Chacko
|
||||
*/
|
||||
@ManagedResource
|
||||
public abstract class AbstractMessageRouter extends AbstractMessageHandler {
|
||||
@@ -100,10 +101,9 @@ public abstract class AbstractMessageRouter extends AbstractMessageHandler {
|
||||
return this.messagingTemplate;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected ConversionService getRequiredConversionService() {
|
||||
if (this.getConversionService() == null) {
|
||||
this.setConversionService(ConversionServiceFactory.createDefaultConversionService());
|
||||
this.setConversionService(new DefaultConversionService());
|
||||
}
|
||||
return this.getConversionService();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -22,7 +22,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.DataBinder;
|
||||
@@ -36,6 +36,7 @@ import org.springframework.validation.DataBinder;
|
||||
* to types that represent the properties of the Object.
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MapToObjectTransformer extends AbstractPayloadTransformer<Map<?,?>, Object>{
|
||||
@@ -63,7 +64,6 @@ public class MapToObjectTransformer extends AbstractPayloadTransformer<Map<?,?>,
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.integration.transformer.AbstractPayloadTransformer#transformPayload(java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Object transformPayload(Map<?,?> payload) throws Exception {
|
||||
Object target = (this.targetClass != null)
|
||||
? BeanUtils.instantiate(this.targetClass)
|
||||
@@ -74,7 +74,7 @@ public class MapToObjectTransformer extends AbstractPayloadTransformer<Map<?,?>,
|
||||
conversionService = ((ConfigurableBeanFactory)this.getBeanFactory()).getConversionService();
|
||||
}
|
||||
if (conversionService == null){
|
||||
conversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
conversionService = new DefaultConversionService();
|
||||
}
|
||||
binder.setConversionService(conversionService);
|
||||
binder.bind(new MutablePropertyValues(payload));
|
||||
|
||||
@@ -25,13 +25,14 @@ import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.expression.TypeConverter;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
* @author Soby Chacko
|
||||
*/
|
||||
public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
|
||||
|
||||
@@ -43,11 +44,10 @@ public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware
|
||||
private volatile ConversionService conversionService;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public BeanFactoryTypeConverter() {
|
||||
synchronized (BeanFactoryTypeConverter.class) {
|
||||
if (defaultConversionService == null) {
|
||||
defaultConversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
defaultConversionService = new DefaultConversionService();
|
||||
}
|
||||
}
|
||||
this.conversionService = defaultConversionService;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -73,6 +73,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Dave Syer
|
||||
* @author Gunnar Hillert
|
||||
* @author Soby Chacko
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
@@ -356,13 +357,12 @@ public class MessagingMethodInvokerHelper<T> extends AbstractExpressionEvaluator
|
||||
return fallbackMethods;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private Class<?> getTargetClass(Object targetObject) {
|
||||
Class<?> targetClass = targetObject.getClass();
|
||||
if (AopUtils.isAopProxy(targetObject)) {
|
||||
targetClass = AopUtils.getTargetClass(targetObject);
|
||||
}
|
||||
else if (AopUtils.isCglibProxyClass(targetClass)) {
|
||||
else if (org.springframework.util.ClassUtils.isCglibProxyClass(targetClass)) {
|
||||
Class<?> superClass = targetObject.getClass().getSuperclass();
|
||||
if (!Object.class.equals(superClass)) {
|
||||
targetClass = superClass;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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,6 +16,13 @@
|
||||
|
||||
package org.springframework.integration.aggregator;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -30,7 +37,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.annotation.Aggregator;
|
||||
@@ -45,15 +52,6 @@ import org.springframework.integration.store.MessageGroup;
|
||||
import org.springframework.integration.store.SimpleMessageGroup;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class MethodInvokingMessageGroupProcessorTests {
|
||||
|
||||
@@ -227,7 +225,6 @@ public class MethodInvokingMessageGroupProcessorTests {
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void shouldFindSimpleAggregatorMethodWithIterator() throws Exception {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -242,7 +239,7 @@ public class MethodInvokingMessageGroupProcessorTests {
|
||||
}
|
||||
|
||||
MethodInvokingMessageGroupProcessor processor = new MethodInvokingMessageGroupProcessor(new SimpleAggregator());
|
||||
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
GenericConversionService conversionService = new DefaultConversionService();
|
||||
conversionService.addConverter(new Converter<ArrayList<?>, Iterator<?>>() {
|
||||
public Iterator<?> convert(ArrayList<?> source) {
|
||||
return source.iterator();
|
||||
@@ -359,7 +356,6 @@ public class MethodInvokingMessageGroupProcessorTests {
|
||||
@Test
|
||||
public void testHeaderParameters() throws Exception {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
class SingleAnnotationTestBean {
|
||||
@Aggregator
|
||||
public String method1(List<String> input, @Header("foo") String foo) {
|
||||
@@ -378,7 +374,6 @@ public class MethodInvokingMessageGroupProcessorTests {
|
||||
@Test
|
||||
public void testHeadersParameters() throws Exception {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
class SingleAnnotationTestBean {
|
||||
@Aggregator
|
||||
public String method1(List<String> input, @Headers Map<String, ?> map) {
|
||||
@@ -397,7 +392,6 @@ public class MethodInvokingMessageGroupProcessorTests {
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void multipleAnnotations() {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
class MultipleAnnotationTestBean {
|
||||
|
||||
@Aggregator
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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,6 +16,10 @@
|
||||
|
||||
package org.springframework.integration.channel;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -25,7 +29,7 @@ import org.springframework.context.support.ConversionServiceFactoryBean;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.MessageDeliveryException;
|
||||
@@ -34,12 +38,9 @@ import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.message.ErrorMessage;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.0
|
||||
*/
|
||||
public class DatatypeChannelTests {
|
||||
@@ -57,28 +58,25 @@ public class DatatypeChannelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void unsupportedTypeButConversionServiceSupports() {
|
||||
QueueChannel channel = createChannel(Integer.class);
|
||||
ConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
ConversionService conversionService = new DefaultConversionService();
|
||||
channel.setConversionService(conversionService);
|
||||
assertTrue(channel.send(new GenericMessage<String>("123")));
|
||||
}
|
||||
|
||||
@Test(expected = MessageDeliveryException.class)
|
||||
@SuppressWarnings("deprecation")
|
||||
public void unsupportedTypeAndConversionServiceDoesNotSupport() {
|
||||
QueueChannel channel = createChannel(Integer.class);
|
||||
ConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
ConversionService conversionService = new DefaultConversionService();
|
||||
channel.setConversionService(conversionService);
|
||||
assertTrue(channel.send(new GenericMessage<Boolean>(Boolean.TRUE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void unsupportedTypeButCustomConversionServiceSupports() {
|
||||
QueueChannel channel = createChannel(Integer.class);
|
||||
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
GenericConversionService conversionService = new DefaultConversionService();
|
||||
conversionService.addConverter(new Converter<Boolean, Integer>() {
|
||||
public Integer convert(Boolean source) {
|
||||
return source ? 1 : 0;
|
||||
@@ -111,7 +109,6 @@ public class DatatypeChannelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void conversionServiceReferenceOverridesDefault() {
|
||||
GenericApplicationContext context = new GenericApplicationContext();
|
||||
Converter<Boolean, Integer> defaultConverter = new Converter<Boolean, Integer>() {
|
||||
@@ -119,7 +116,7 @@ public class DatatypeChannelTests {
|
||||
return source ? 1 : 0;
|
||||
}
|
||||
};
|
||||
GenericConversionService customConversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
GenericConversionService customConversionService = new DefaultConversionService();
|
||||
customConversionService.addConverter(new Converter<Boolean, Integer>() {
|
||||
public Integer convert(Boolean source) {
|
||||
return source ? 99 : -99;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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,6 +16,9 @@
|
||||
|
||||
package org.springframework.integration.gateway;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
@@ -25,12 +28,11 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
@@ -43,12 +45,10 @@ import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
public class GatewayProxyFactoryBeanTests {
|
||||
|
||||
@@ -67,11 +67,10 @@ public class GatewayProxyFactoryBeanTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testRequestReplyWithAnonymousChannelConvertedTypeViaConversionService() throws Exception {
|
||||
QueueChannel requestChannel = new QueueChannel();
|
||||
startResponder(requestChannel);
|
||||
GenericConversionService cs = ConversionServiceFactory.createDefaultConversionService();
|
||||
GenericConversionService cs = new DefaultConversionService();
|
||||
Converter<String, byte[]> stringToByteConverter = new Converter<String, byte[]>() {
|
||||
public byte[] convert(String source) {
|
||||
return source.getBytes();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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,24 +16,23 @@
|
||||
|
||||
package org.springframework.integration.transformer;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
@@ -114,10 +113,9 @@ public class MapToObjectTransformerTests {
|
||||
assertEquals("1123 Main st", person.getAddress().getStreet());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private ConfigurableBeanFactory getBeanFactory(){
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
GenericConversionService conversionService = new DefaultConversionService();
|
||||
beanFactory.setConversionService(conversionService);
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user