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.
@@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageDeliveryException;
@@ -194,7 +194,7 @@ public abstract class AbstractMessageRouter extends AbstractMessageHandler {
protected ConversionService getRequiredConversionService() {
if (this.getConversionService() == null) {
this.setConversionService(new DefaultConversionService());
this.setConversionService(ConversionServiceFactory.createDefaultConversionService());
}
return this.getConversionService();
}

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.
@@ -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.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.validation.DataBinder;
@@ -73,7 +73,7 @@ public class MapToObjectTransformer extends AbstractPayloadTransformer<Map<?,?>,
conversionService = ((ConfigurableBeanFactory)this.getBeanFactory()).getConversionService();
}
if (conversionService == null){
conversionService = new DefaultConversionService();
conversionService = ConversionServiceFactory.createDefaultConversionService();
}
binder.setConversionService(conversionService);
binder.bind(new MutablePropertyValues(payload));

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.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.DefaultConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.expression.TypeConverter;
/**
@@ -45,7 +45,7 @@ public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware
public BeanFactoryTypeConverter() {
synchronized (BeanFactoryTypeConverter.class) {
if (defaultConversionService == null) {
defaultConversionService = new DefaultConversionService();
defaultConversionService = ConversionServiceFactory.createDefaultConversionService();
}
}
this.conversionService = defaultConversionService;

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

View File

@@ -29,7 +29,7 @@ import org.junit.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
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.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -460,7 +460,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
public void validateCustomHeadersWithNonStringValuesAndDefaultConverterOnly() throws Exception{
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
mapper.setOutboundHeaderNames(new String[] {"customHeader*"});
ConversionService cs = new DefaultConversionService();
ConversionService cs = ConversionServiceFactory.createDefaultConversionService();
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
beanFactory.registerSingleton("integrationConversionService", cs);
mapper.setBeanFactory(beanFactory);
@@ -481,7 +481,7 @@ public class DefaultHttpHeaderMapperFromMessageInboundTests {
public void validateCustomHeadersWithNonStringValuesAndDefaultConverterWithCustomConverter() throws Exception{
DefaultHttpHeaderMapper mapper = new DefaultHttpHeaderMapper();
mapper.setOutboundHeaderNames(new String[] {"customHeader*"});
GenericConversionService cs = new DefaultConversionService();
GenericConversionService cs = ConversionServiceFactory.createDefaultConversionService();
cs.addConverter(new TestClassConverter());
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
beanFactory.registerSingleton("integrationConversionService", cs);