You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2008/03/04 15:22:41 UTC
svn commit: r633481 -
/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java
Author: jstrachan
Date: Tue Mar 4 06:22:35 2008
New Revision: 633481
URL: http://svn.apache.org/viewvc?rev=633481&view=rev
Log:
added a test case for https://issues.apache.org/activemq/browse/CAMEL-355
Added:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java
- copied, changed from r633398, activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInjectionTest.java
Copied: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java (from r633398, activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInjectionTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java?p2=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java&p1=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInjectionTest.java&r1=633398&r2=633481&rev=633481&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInjectionTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithMultipleParametersTest.java Tue Mar 4 06:22:35 2008
@@ -34,30 +34,22 @@
/**
* @version $Revision$
*/
-public class BeanWithHeadersAndBodyInjectionTest extends ContextTestSupport {
+public class BeanMethodWithMultipleParametersTest extends ContextTestSupport {
private static final transient Log LOG = LogFactory.getLog(BeanRouteTest.class);
protected MyBean myBean = new MyBean();
- public void testSendMessage() throws Exception {
- template.send("direct:in", new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.setProperty("p1", "abc");
- exchange.setProperty("p2", 123);
-
- Message in = exchange.getIn();
- in.setHeader("h1", "xyz");
- in.setHeader("h2", 456);
- in.setBody("TheBody");
- }
- });
+ public void testDummy() throws Exception {
+
+ }
- Map foo = myBean.headers;
- assertNotNull("myBean.foo", foo);
+ public void DISABLED_testSendMessage() throws Exception {
+ Object[] args = {"abc", 5, "def"};
- assertEquals("foo.h1", "xyz", foo.get("h1"));
- assertEquals("foo.h2", 456, foo.get("h2"));
+ template.sendBodyAndHeader("direct:in", args, BeanProcessor.METHOD_NAME, "myMethod");
- assertEquals("body", "TheBody", myBean.body);
+ assertEquals("bean.foo", "abc", myBean.foo);
+ assertEquals("bean.bar", 5, myBean.bar);
+ assertEquals("bean.x", "def", myBean.x);
}
@Override
@@ -76,21 +68,23 @@
}
public static class MyBean {
- public Map<String, Object> headers;
- public Object body;
+ public String foo;
+ public int bar;
+ public String x;
@Override
public String toString() {
- return "MyBean[foo: " + headers + " body: " + body + "]";
+ return "MyBean[foo: " + foo + " bar: " + bar + " x: " + x + "]";
}
- public void myMethod(@Headers Map<String, Object> headers,Object body) {
- this.headers = headers;
- this.body = body;
+ public void myMethod(String foo, int bar, String x) {
+ this.foo = foo;
+ this.bar = bar;
+ this.x = x;
LOG.info("myMethod() method called on " + this);
}
- public void anotherMethod(@Headers Map<String, Object> headers,Object body) {
+ public void anotherMethod(Object body) {
fail("Should not have called this method!");
}
}