INT-2689 - SI builds without warnings (Except Spring Integration HTTP)

* Ensure that no deprecation warnings occur
* Spring Integration builds with all tests successfully for Spring 3.1.2.RELEASE and 3.0.7.RELEASE (Except Spring Integration HTTP)

For reference see: https://jira.springsource.org/browse/INT-2689

INT-2694 - Fix Http Test Failures with Spring 3.0

As part of INT-2689, fix Http Test Failures in the Spring Integration Http Module when using Spring 3.0.7.RELEASE
For reference see: https://jira.springsource.org/browse/INT-2694
This commit is contained in:
Gunnar Hillert
2012-07-30 15:34:47 -04:00
committed by Oleg Zhurakousky
parent 19c53ed9e9
commit 57bc67b8fb
27 changed files with 283 additions and 168 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -225,7 +225,9 @@ public class MethodInvokingMessageGroupProcessorTests {
assertThat((Integer) ((Message<?>) result).getPayload(), is(7));
}
@Test
@SuppressWarnings("deprecation")
public void shouldFindSimpleAggregatorMethodWithIterator() throws Exception {
@SuppressWarnings("unused")
@@ -280,7 +282,7 @@ public class MethodInvokingMessageGroupProcessorTests {
Object result = processor.processMessageGroup(messageGroupMock);
assertThat((Integer) ((Message<?>) result).getPayload(), is(7));
}
@Test
public void shouldFindFittingMethodForIteratorOfMessages() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -57,6 +57,7 @@ public class DatatypeChannelTests {
}
@Test
@SuppressWarnings("deprecation")
public void unsupportedTypeButConversionServiceSupports() {
QueueChannel channel = createChannel(Integer.class);
ConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
@@ -65,6 +66,7 @@ public class DatatypeChannelTests {
}
@Test(expected = MessageDeliveryException.class)
@SuppressWarnings("deprecation")
public void unsupportedTypeAndConversionServiceDoesNotSupport() {
QueueChannel channel = createChannel(Integer.class);
ConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
@@ -73,6 +75,7 @@ public class DatatypeChannelTests {
}
@Test
@SuppressWarnings("deprecation")
public void unsupportedTypeButCustomConversionServiceSupports() {
QueueChannel channel = createChannel(Integer.class);
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
@@ -104,10 +107,11 @@ public class DatatypeChannelTests {
context.registerBeanDefinition("testChannel", channelBuilder.getBeanDefinition());
QueueChannel channel = context.getBean("testChannel", QueueChannel.class);
assertTrue(channel.send(new GenericMessage<Boolean>(Boolean.TRUE)));
assertEquals(new Integer(1), channel.receive().getPayload());
assertEquals(new Integer(1), channel.receive().getPayload());
}
@Test
@SuppressWarnings("deprecation")
public void conversionServiceReferenceOverridesDefault() {
GenericApplicationContext context = new GenericApplicationContext();
Converter<Boolean, Integer> defaultConverter = new Converter<Boolean, Integer>() {
@@ -131,7 +135,7 @@ public class DatatypeChannelTests {
context.registerBeanDefinition("testChannel", channelBuilder.getBeanDefinition());
QueueChannel channel = context.getBean("testChannel", QueueChannel.class);
assertTrue(channel.send(new GenericMessage<Boolean>(Boolean.TRUE)));
assertEquals(new Integer(99), channel.receive().getPayload());
assertEquals(new Integer(99), channel.receive().getPayload());
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -65,8 +65,9 @@ public class GatewayProxyFactoryBeanTests {
String result = service.requestReply("foo");
assertEquals("foobar", result);
}
@Test
@SuppressWarnings("deprecation")
public void testRequestReplyWithAnonymousChannelConvertedTypeViaConversionService() throws Exception {
QueueChannel requestChannel = new QueueChannel();
startResponder(requestChannel);
@@ -75,13 +76,13 @@ public class GatewayProxyFactoryBeanTests {
public byte[] convert(String source) {
return source.getBytes();
}
};
};
stringToByteConverter = Mockito.spy(stringToByteConverter);
cs.addConverter(stringToByteConverter);
GatewayProxyFactoryBean proxyFactory = new GatewayProxyFactoryBean();
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerSingleton(IntegrationContextUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME, cs);
proxyFactory.setBeanFactory(bf);
proxyFactory.setDefaultRequestChannel(requestChannel);
proxyFactory.setServiceInterface(TestService.class);
@@ -334,7 +335,7 @@ public class GatewayProxyFactoryBeanTests {
// MessageHistoryEvent event1 = historyIterator.next();
// MessageHistoryEvent event2 = historyIterator.next();
// MessageHistoryEvent event3 = historyIterator.next();
//
//
// //assertEquals("echo", event1.getAttribute("method", String.class));
// assertEquals("gateway", event1.getType());
// assertEquals("testGateway", event1.getName());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -36,12 +36,14 @@ import static junit.framework.Assert.assertNull;
/**
* @author Oleg Zhurakousky
* @author Gunnar Hillert
*
* @since 2.0
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public class MapToObjectTransformerTests {
@Test
public void testMapToObjectTransformation(){
Map map = new HashMap();
@@ -50,9 +52,9 @@ public class MapToObjectTransformerTests {
Address address = new Address();
address.setStreet("1123 Main st");
map.put("address", address);
Message message = MessageBuilder.withPayload(map).build();
MapToObjectTransformer transformer = new MapToObjectTransformer(Person.class);
transformer.setBeanFactory(this.getBeanFactory());
Message newMessage = transformer.transform(message);
@@ -64,7 +66,7 @@ public class MapToObjectTransformerTests {
assertNotNull(person.getAddress());
assertEquals("1123 Main st", person.getAddress().getStreet());
}
@Test
public void testMapToObjectTransformationWithPrototype(){
Map map = new HashMap();
@@ -73,7 +75,7 @@ public class MapToObjectTransformerTests {
Address address = new Address();
address.setStreet("1123 Main st");
map.put("address", address);
Message message = MessageBuilder.withPayload(map).build();
StaticApplicationContext ac = new StaticApplicationContext();
ac.registerPrototype("person", Person.class);
@@ -95,14 +97,14 @@ public class MapToObjectTransformerTests {
map.put("fname", "Justin");
map.put("lname", "Case");
map.put("address", "1123 Main st");
Message message = MessageBuilder.withPayload(map).build();
MapToObjectTransformer transformer = new MapToObjectTransformer(Person.class);
ConfigurableBeanFactory beanFactory = this.getBeanFactory();
((GenericConversionService)beanFactory.getConversionService()).addConverter(new StringToAddressConverter());
transformer.setBeanFactory(beanFactory);
Message newMessage = transformer.transform(message);
Person person = (Person) newMessage.getPayload();
assertNotNull(person);
@@ -111,7 +113,8 @@ public class MapToObjectTransformerTests {
assertNotNull(person.getAddress());
assertEquals("1123 Main st", person.getAddress().getStreet());
}
@SuppressWarnings("deprecation")
private ConfigurableBeanFactory getBeanFactory(){
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
@@ -129,7 +132,7 @@ public class MapToObjectTransformerTests {
}
public void setSsn(String ssn) {
this.ssn = ssn;
}
}
public String getFname() {
return fname;
}
@@ -149,7 +152,7 @@ public class MapToObjectTransformerTests {
this.address = address;
}
}
public static class Address {
private String street;
@@ -161,7 +164,7 @@ public class MapToObjectTransformerTests {
this.street = street;
}
}
public class StringToAddressConverter implements Converter<String, Address>{
public Address convert(String source) {
Address address = new Address();