reverting use of new DefaultConversionService()

new DefaultConversionService() -> ConversionServiceFactory.createDefaultConversionService();
This commit is contained in:
Mark Fisher
2011-08-19 15:40:30 -04:00
parent 1786634b7e
commit fa502a735b
8 changed files with 29 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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.
@@ -30,7 +30,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.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.integration.Message;
import org.springframework.integration.annotation.Aggregator;
@@ -240,7 +240,7 @@ public class MethodInvokingMessageGroupProcessorTests {
}
MethodInvokingMessageGroupProcessor processor = new MethodInvokingMessageGroupProcessor(new SimpleAggregator());
GenericConversionService conversionService = new DefaultConversionService();
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
conversionService.addConverter(new Converter<ArrayList<?>, Iterator<?>>() {
public Iterator<?> convert(ArrayList<?> source) {
return source.iterator();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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.
@@ -25,7 +25,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.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageDeliveryException;
@@ -59,7 +59,7 @@ public class DatatypeChannelTests {
@Test
public void unsupportedTypeButConversionServiceSupports() {
QueueChannel channel = createChannel(Integer.class);
ConversionService conversionService = new DefaultConversionService();
ConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
channel.setConversionService(conversionService);
assertTrue(channel.send(new GenericMessage<String>("123")));
}
@@ -67,7 +67,7 @@ public class DatatypeChannelTests {
@Test(expected = MessageDeliveryException.class)
public void unsupportedTypeAndConversionServiceDoesNotSupport() {
QueueChannel channel = createChannel(Integer.class);
ConversionService conversionService = new DefaultConversionService();
ConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
channel.setConversionService(conversionService);
assertTrue(channel.send(new GenericMessage<Boolean>(Boolean.TRUE)));
}
@@ -75,7 +75,7 @@ public class DatatypeChannelTests {
@Test
public void unsupportedTypeButCustomConversionServiceSupports() {
QueueChannel channel = createChannel(Integer.class);
GenericConversionService conversionService = new DefaultConversionService();
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
conversionService.addConverter(new Converter<Boolean, Integer>() {
public Integer convert(Boolean source) {
return source ? 1 : 0;
@@ -115,7 +115,7 @@ public class DatatypeChannelTests {
return source ? 1 : 0;
}
};
GenericConversionService customConversionService = new DefaultConversionService();
GenericConversionService customConversionService = ConversionServiceFactory.createDefaultConversionService();
customConversionService.addConverter(new Converter<Boolean, Integer>() {
public Integer convert(Boolean source) {
return source ? 99 : -99;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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.
@@ -25,11 +25,12 @@ 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.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
@@ -69,7 +70,7 @@ public class GatewayProxyFactoryBeanTests {
public void testRequestReplyWithAnonymousChannelConvertedTypeViaConversionService() throws Exception {
QueueChannel requestChannel = new QueueChannel();
startResponder(requestChannel);
GenericConversionService cs = new DefaultConversionService();
GenericConversionService cs = ConversionServiceFactory.createDefaultConversionService();
Converter<String, byte[]> stringToByteConverter = new Converter<String, byte[]>() {
public byte[] convert(String source) {
return source.getBytes();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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.
@@ -20,11 +20,12 @@ 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.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.integration.Message;
import org.springframework.integration.support.MessageBuilder;
@@ -113,7 +114,7 @@ public class MapToObjectTransformerTests {
private ConfigurableBeanFactory getBeanFactory(){
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
GenericConversionService conversionService = new DefaultConversionService();
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
beanFactory.setConversionService(conversionService);
return beanFactory;
}