INT-1061 Upgraded to Spring 3.0.2

This commit is contained in:
Mark Fisher
2010-04-02 16:30:41 +00:00
parent baae9e1f36
commit 40385fb836
24 changed files with 188 additions and 171 deletions

View File

@@ -11,14 +11,14 @@
<classpathentry kind="var" path="SI_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/SI_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-sources-1.1.1.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/SI_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/SI_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.aop/3.0.1.RELEASE-A/org.springframework.aop-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.aop/3.0.1.RELEASE-A/org.springframework.aop-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.asm/3.0.1.RELEASE-A/org.springframework.asm-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.asm/3.0.1.RELEASE-A/org.springframework.asm-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.beans/3.0.1.RELEASE-A/org.springframework.beans-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.beans/3.0.1.RELEASE-A/org.springframework.beans-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.context/3.0.1.RELEASE-A/org.springframework.context-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.context/3.0.1.RELEASE-A/org.springframework.context-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.core/3.0.1.RELEASE-A/org.springframework.core-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.core/3.0.1.RELEASE-A/org.springframework.core-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.expression/3.0.1.RELEASE-A/org.springframework.expression-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.expression/3.0.1.RELEASE-A/org.springframework.expression-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.1.RELEASE-A/org.springframework.transaction-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.1.RELEASE-A/org.springframework.transaction-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.test/3.0.1.RELEASE-A/org.springframework.test-3.0.1.RELEASE-A.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.test/3.0.1.RELEASE-A/org.springframework.test-sources-3.0.1.RELEASE-A.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.aop/3.0.2.RELEASE/org.springframework.aop-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.aop/3.0.2.RELEASE/org.springframework.aop-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.asm/3.0.2.RELEASE/org.springframework.asm-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.asm/3.0.2.RELEASE/org.springframework.asm-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.beans/3.0.2.RELEASE/org.springframework.beans-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.beans/3.0.2.RELEASE/org.springframework.beans-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.context/3.0.2.RELEASE/org.springframework.context-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.context/3.0.2.RELEASE/org.springframework.context-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.core/3.0.2.RELEASE/org.springframework.core-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.core/3.0.2.RELEASE/org.springframework.core-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.expression/3.0.2.RELEASE/org.springframework.expression-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.expression/3.0.2.RELEASE/org.springframework.expression-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.2.RELEASE/org.springframework.transaction-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.2.RELEASE/org.springframework.transaction-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.springframework/org.springframework.test/3.0.2.RELEASE/org.springframework.test-3.0.2.RELEASE.jar" sourcepath="/SI_IVY_CACHE/org.springframework/org.springframework.test/3.0.2.RELEASE/org.springframework.test-sources-3.0.2.RELEASE.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.mockito/com.springsource.org.mockito/1.8.0/com.springsource.org.mockito-1.8.0.jar" sourcepath="/SI_IVY_CACHE/org.mockito/com.springsource.org.mockito/1.8.0/com.springsource.org.mockito-sources-1.8.0.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.objenesis/com.springsource.org.objenesis/1.0.0/com.springsource.org.objenesis-1.0.0.jar" sourcepath="/SI_IVY_CACHE/org.objenesis/com.springsource.org.objenesis/1.0.0/com.springsource.org.objenesis-sources-1.0.0.jar"/>
<classpathentry kind="var" path="SI_IVY_CACHE/org.codehaus.jackson/com.springsource.org.codehaus.jackson/1.4.2/com.springsource.org.codehaus.jackson-1.4.2.jar" sourcepath="/SI_IVY_CACHE/org.codehaus.jackson/com.springsource.org.codehaus.jackson/1.4.2/com.springsource.org.codehaus.jackson-sources-1.4.2.jar"/>

View File

@@ -47,7 +47,7 @@ public abstract class AbstractMessageProcessor implements MessageProcessor {
try {
return expression.getValue(this.evaluationContext, message);
}
catch (EvaluationException e) {
catch (Exception e) {
throw new MessageHandlingException(message, "Expression evaluation failed.", e);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 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.
@@ -44,76 +44,92 @@ public class MethodInvokingMessageProcessorTests {
@Test
public void testHandlerInheritanceMethodImplInSuper() {
class A{
public Message<String> myMethod(final Message<String> msg){
class A {
@SuppressWarnings("unused")
public Message<String> myMethod(final Message<String> msg) {
return MessageBuilder.fromMessage(msg).setHeader("A", "A").build();
}
}
class B extends A{}
class C extends B{}
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(
new B(), "myMethod");
Message message = (Message) processor.processMessage(new StringMessage(""));
class B extends A {}
@SuppressWarnings("unused")
class C extends B {}
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new B(), "myMethod");
Message<?> message = (Message<?>) processor.processMessage(new StringMessage(""));
assertEquals("A", message.getHeaders().get("A"));
}
@Test
public void testHandlerInheritanceMethodImplInLatestSuper() {
class A{
public Message<String> myMethod(Message<String> msg){
class A {
@SuppressWarnings("unused")
public Message<String> myMethod(Message<String> msg) {
return MessageBuilder.fromMessage(msg).setHeader("A", "A").build();
}
}
class B extends A{
public Message<String> myMethod(Message<String> msg){
class B extends A {
public Message<String> myMethod(Message<String> msg) {
return MessageBuilder.fromMessage(msg).setHeader("B", "B").build();
}
}
class C extends B{}
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(
new B(), "myMethod");
Message message = (Message) processor.processMessage(new StringMessage(""));
@SuppressWarnings("unused")
class C extends B {}
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new B(), "myMethod");
Message<?> message = (Message<?>) processor.processMessage(new StringMessage(""));
assertEquals("B", message.getHeaders().get("B"));
}
public void testHandlerInheritanceMethodImplInSubClass() {
class A{
public Message<String> myMethod(Message<String> msg){
class A {
@SuppressWarnings("unused")
public Message<String> myMethod(Message<String> msg) {
return MessageBuilder.fromMessage(msg).setHeader("A", "A").build();
}
}
class B extends A{
public Message<String> myMethod(Message<String> msg){
class B extends A {
public Message<String> myMethod(Message<String> msg) {
return MessageBuilder.fromMessage(msg).setHeader("B", "B").build();
}
}
class C extends B{
public Message<String> myMethod(Message<String> msg){
class C extends B {
public Message<String> myMethod(Message<String> msg) {
return MessageBuilder.fromMessage(msg).setHeader("C", "C").build();
}
}
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(
new C(), "myMethod");
Message message = (Message) processor.processMessage(new StringMessage(""));
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new C(), "myMethod");
Message<?> message = (Message<?>) processor.processMessage(new StringMessage(""));
assertEquals("C", message.getHeaders().get("C"));
}
public void testHandlerInheritanceMethodImplInSubClassAndSuper() {
class A{
class A {
@SuppressWarnings("unused")
public Message<String> myMethod(Message<String> msg){
return MessageBuilder.fromMessage(msg).setHeader("A", "A").build();
}
}
class B extends A{}
class C extends B{
public Message<String> myMethod(Message<String> msg){
class B extends A {}
class C extends B {
public Message<String> myMethod(Message<String> msg) {
return MessageBuilder.fromMessage(msg).setHeader("C", "C").build();
}
}
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(
new C(), "myMethod");
Message message = (Message) processor.processMessage(new StringMessage(""));
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new C(), "myMethod");
Message<?> message = (Message<?>) processor.processMessage(new StringMessage(""));
assertEquals("C", message.getHeaders().get("C"));
}
@Test
public void payloadAsMethodParameterAndObjectAsReturnValue() {
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(
@@ -185,10 +201,11 @@ public class MethodInvokingMessageProcessorTests {
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(new TestBean(), "testVoidReturningMethods", true);
assertEquals(12, processor.processMessage(MessageBuilder.withPayload(12).build()));
try {
processor.processMessage(MessageBuilder.withPayload("Something").build());
processor.processMessage(MessageBuilder.withPayload("not_a_number").build());
fail();
}
catch(MessageHandlingException ex) {
// the only void method expects a number
exception = ex;
}
assertNotNull(exception);