Author: davsclaus
Date: Wed Jul 16 21:52:28 2008
New Revision: 677501
URL: http://svn.apache.org/viewvc?rev=677501&view=rev
Log:
Unit test added inspired by user forum
Added:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/SendBodyToBeanDirectlyTest.java
(contents, props changed)
- copied, changed from r677191,
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInPipelineTest.java
Copied:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/SendBodyToBeanDirectlyTest.java
(from r677191,
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInPipelineTest.java)
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/SendBodyToBeanDirectlyTest.java?p2=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/SendBodyToBeanDirectlyTest.java&p1=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInPipelineTest.java&r1=677191&r2=677501&rev=677501&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInPipelineTest.java
(original)
+++
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/SendBodyToBeanDirectlyTest.java
Wed Jul 16 21:52:28 2008
@@ -23,28 +23,38 @@
import org.apache.camel.util.jndi.JndiContext;
/**
- * Unit test to demonstrate beans in pipelines.
+ * Unit test to demonstrate routes initiated by sending a body to bean.
*/
-public class BeanInPipelineTest extends ContextTestSupport {
+public class SendBodyToBeanDirectlyTest extends ContextTestSupport {
- public void testBeanInPipeline() throws Exception {
- Object response = template.requestBody("direct:start", "Start:");
- assertEquals("Start:onetwothree", response);
+ public void testSendBodyToBeanDirectly() throws Exception {
+ // note: the route chain is newever invoked as bean:one will only call
this bean
+ // and not do a route
+ Object response = template.sendBody("bean:one", "Start:");
+ assertEquals("Start:one", response);
+ }
+
+ public void testSendBodyToBeanIndirectly() throws Exception {
+ // note we must use pipeline in the route (check the builder)
+ Object response = template.sendBody("direct:start", "Start:");
+ assertEquals("Start:onetwo", response);
}
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("one", new MyBean("one"));
answer.bind("two", new MyBean("two"));
- answer.bind("three", new MyBean("three"));
return answer;
}
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("direct:start")
- .pipeline("bean:one", "bean:two", "seda:x", "direct:y",
"bean:three");
+ // this route will never happen
+ from("bean:one").to("bean:two");
+
+ // must use pipeline to force the route chains with beans to
beans
+ from("direct:start").pipeline("bean:one", "bean:two");
}
};
}
Propchange:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/SendBodyToBeanDirectlyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/SendBodyToBeanDirectlyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date