diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/AnnotationFinder.java b/spring-integration-core/src/main/java/org/springframework/integration/config/AnnotationFinder.java index e3e3a8514f..1caefbdbe1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/AnnotationFinder.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/AnnotationFinder.java @@ -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; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMessageRouter.java b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMessageRouter.java index ba90f0e984..9be804808d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMessageRouter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMessageRouter.java @@ -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(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java index a6074cdb7e..a3d5f2268f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java @@ -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, Object>{ @@ -63,7 +64,6 @@ public class MapToObjectTransformer extends AbstractPayloadTransformer, * (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, conversionService = ((ConfigurableBeanFactory)this.getBeanFactory()).getConversionService(); } if (conversionService == null){ - conversionService = ConversionServiceFactory.createDefaultConversionService(); + conversionService = new DefaultConversionService(); } binder.setConversionService(conversionService); binder.bind(new MutablePropertyValues(payload)); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java b/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java index ebe5ed8399..69eb44b0f4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/BeanFactoryTypeConverter.java @@ -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; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java b/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java index 22ea6ca674..af98e99626 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/MessagingMethodInvokerHelper.java @@ -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 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; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java index 6c4eb87bec..5755655081 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/MethodInvokingMessageGroupProcessorTests.java @@ -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, 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 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 input, @Headers Map map) { @@ -397,7 +392,6 @@ public class MethodInvokingMessageGroupProcessorTests { @Test(expected = IllegalArgumentException.class) public void multipleAnnotations() { - @SuppressWarnings("unused") class MultipleAnnotationTestBean { @Aggregator diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java index 0307e50a38..58c539e12f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/DatatypeChannelTests.java @@ -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("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.TRUE))); } @Test - @SuppressWarnings("deprecation") public void unsupportedTypeButCustomConversionServiceSupports() { QueueChannel channel = createChannel(Integer.class); - GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService(); + GenericConversionService conversionService = new DefaultConversionService(); conversionService.addConverter(new Converter() { 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 defaultConverter = new Converter() { @@ -119,7 +116,7 @@ public class DatatypeChannelTests { return source ? 1 : 0; } }; - GenericConversionService customConversionService = ConversionServiceFactory.createDefaultConversionService(); + GenericConversionService customConversionService = new DefaultConversionService(); customConversionService.addConverter(new Converter() { public Integer convert(Boolean source) { return source ? 99 : -99; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java index f23f9602ce..a6469785b2 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java @@ -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 stringToByteConverter = new Converter() { public byte[] convert(String source) { return source.getBytes(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java index f2a3e1dcbb..b7b5148803 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java @@ -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; }