INT-1953 refactored CORE and HTTP modules to make them compatible with Spring v3.1 while maintaining the target version of 3.0.*

This commit is contained in:
Oleg Zhurakousky
2011-06-24 15:20:04 -04:00
parent b60525a259
commit c00888f537
8 changed files with 47 additions and 9 deletions

View File

@@ -16,6 +16,7 @@
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;
@@ -278,6 +279,32 @@ public class MethodInvokingMessageGroupProcessorTests {
Object result = processor.processMessageGroup(messageGroupMock);
assertThat((Integer) ((Message<?>) result).getPayload(), is(7));
}
@Test
public void shouldFindFittingMethodForIteratorOfMessages() {
@SuppressWarnings("unused")
class UnannotatedAggregator {
public Iterator<?> and(Iterator<Message<?>> flags) {
return flags;
}
public void voidMethodShouldBeIgnored(List<Integer> flags) {
fail("this method should not be invoked");
}
public String methodAcceptingNoCollectionShouldBeIgnored(String irrelevant) {
fail("this method should not be invoked");
return null;
}
}
MessageGroupProcessor processor = new MethodInvokingMessageGroupProcessor(new UnannotatedAggregator());
when(messageGroupMock.getUnmarked()).thenReturn(messagesUpForProcessing);
Object result = processor.processMessageGroup(messageGroupMock);
assertTrue(((Message<?>)result).getPayload() instanceof Iterator<?>);
}
@Test(expected = IllegalArgumentException.class)
public void testTwoMethodsWithSameParameterTypesAmbiguous() {

View File

@@ -94,6 +94,7 @@ public class MessagePublishingAnnotationUsageTests {
@Publisher(channel="messagePublishingAnnotationUsageTestChannel")
public String argumentAsPayload(@Payload String fname, @Header String lname) {
System.out.println("###### INVOKING");
return fname + " " + lname;
}
}

View File

@@ -73,8 +73,8 @@ public class MethodAnnotationPublisherMetadataSourceTests {
Map<String, String> headerMap = source.getHeaderExpressions(method);
assertNotNull(headerMap);
assertEquals(2, headerMap.size());
assertEquals("#args['1']", headerMap.get("foo"));
assertEquals("#args['2']", headerMap.get("bar"));
assertEquals("#args[1]", headerMap.get("foo"));
assertEquals("#args[2]", headerMap.get("bar"));
}
@Test

View File

@@ -283,7 +283,7 @@ public class MethodInvokingMessageProcessorTests {
@Test
public void testProcessMessageBadExpression() throws Exception {
// TODO: should this be MessageHandlingException or NumberFormatException?
expected.expect(new ExceptionCauseMatcher(NumberFormatException.class));
expected.expect(new ExceptionCauseMatcher(Exception.class));
AnnotatedTestService service = new AnnotatedTestService();
Method method = service.getClass().getMethod("integerMethod", Integer.class);
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(service, method);