changed MethodInvoking Soure and Targt to take a string via a a property methodName (fix for INT-272)
This commit is contained in:
@@ -49,7 +49,7 @@ public class MethodInvokingAdapterParser extends AbstractSingleBeanDefinitionPar
|
||||
throw new ConfigurationException("The 'method' attribute is required.");
|
||||
}
|
||||
builder.addPropertyReference("object", ref);
|
||||
builder.addPropertyValue("method", method);
|
||||
builder.addPropertyValue("methodName", method);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class SourceAnnotationPostProcessor extends AbstractAnnotationMethodPostP
|
||||
protected MessageSource<?> processMethod(Object bean, Method method, Annotation annotation) {
|
||||
MethodInvokingSource source = new MethodInvokingSource();
|
||||
source.setObject(bean);
|
||||
source.setMethod(method.getName());
|
||||
source.setMethodName(method.getName());
|
||||
return source;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MethodInvokingSource implements MessageSource<Object>, Initializing
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
public void setMethodName(String method) {
|
||||
Assert.notNull(method, "'method' must not be null");
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.integration.ConfigurationException;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<property name="object">
|
||||
<bean class="org.springframework.integration.handler.TestSource"/>
|
||||
</property>
|
||||
<property name="method" value="foo"/>
|
||||
<property name="methodName" value="foo"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg ref="channel"/>
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MethodInvokingSourceTests {
|
||||
public void testValidMethod() {
|
||||
MethodInvokingSource source = new MethodInvokingSource();
|
||||
source.setObject(new TestBean());
|
||||
source.setMethod("validMethod");
|
||||
source.setMethodName("validMethod");
|
||||
Message<?> result = source.receive();
|
||||
assertNotNull(result);
|
||||
assertNotNull(result.getPayload());
|
||||
@@ -45,7 +45,7 @@ public class MethodInvokingSourceTests {
|
||||
public void testNoMatchingMethodName() {
|
||||
MethodInvokingSource source = new MethodInvokingSource();
|
||||
source.setObject(new TestBean());
|
||||
source.setMethod("noMatchingMethod");
|
||||
source.setMethodName("noMatchingMethod");
|
||||
source.receive();
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class MethodInvokingSourceTests {
|
||||
public void testInvalidMethodWithArg() {
|
||||
MethodInvokingSource source = new MethodInvokingSource();
|
||||
source.setObject(new TestBean());
|
||||
source.setMethod("invalidMethodWithArg");
|
||||
source.setMethodName("invalidMethodWithArg");
|
||||
source.receive();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class MethodInvokingSourceTests {
|
||||
public void testInvalidMethodWithNoReturnValue() {
|
||||
MethodInvokingSource source = new MethodInvokingSource();
|
||||
source.setObject(new TestBean());
|
||||
source.setMethod("invalidMethodWithNoReturnValue");
|
||||
source.setMethodName("invalidMethodWithNoReturnValue");
|
||||
source.receive();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user