Author: jstrachan
Date: Wed Oct  1 07:57:00 2008
New Revision: 700801

URL: http://svn.apache.org/viewvc?rev=700801&view=rev
Log:
added a @MessageDriven test case showing the use of the @RecipientList for 
CAMEL-953

Added:
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java
   (contents, props changed)
      - copied, changed from r700455, 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
   (contents, props changed)
      - copied, changed from r700455, 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/ExampleBean.java
    
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/bean/BeanWithRecipientListTest-context.xml
   (with props)

Copied: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java
 (from r700455, 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java)
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java?p2=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java&p1=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java&r1=700455&r2=700801&rev=700801&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java
 Wed Oct  1 07:57:00 2008
@@ -20,6 +20,8 @@
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import 
org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -28,29 +30,25 @@
  * @version $Revision$
  */
 @ContextConfiguration
-public class BeanRouteUsingSpringEndpointTest extends 
AbstractJUnit38SpringContextTests {
+public class BeanWithRecipientListTest extends 
AbstractJUnit38SpringContextTests {
     @Autowired
     protected ProducerTemplate template;
-    @Resource
-    protected Endpoint helloEndpoint;
-    @Resource
-    protected Endpoint goodbyeEndpoint;
+    @EndpointInject(uri = "mock:a")
+    protected MockEndpoint a;
+    @EndpointInject(uri = "mock:b")
+    protected MockEndpoint b;
 
     protected String body = "James";
 
-    public void testSayHello() throws Exception {
-        assertNotNull(helloEndpoint);
-        assertNotNull(goodbyeEndpoint);
+    public void testSendBody() throws Exception {
+        a.expectedBodiesReceived(body);
+        b.expectedBodiesReceived(body);
 
-        Object value = template.sendBody(helloEndpoint, body);
+        template.sendBody("direct:start", body);
 
-        assertEquals("Returned value", "Hello James!", value);
-    }
-
-    public void testSayGoodbye() throws Exception {
-        Object value = template.sendBody(goodbyeEndpoint, body);
+        MockEndpoint.assertIsSatisfied(a, b);
 
-        assertEquals("Returned value", "Bye James!", value);
+        System.out.println(a.getReceivedExchanges());
     }
 
-}
+}
\ No newline at end of file

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanWithRecipientListTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
 (from r700455, 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/ExampleBean.java)
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java?p2=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java&p1=activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/ExampleBean.java&r1=700455&r2=700801&rev=700801&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/ExampleBean.java
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
 Wed Oct  1 07:57:00 2008
@@ -16,23 +16,21 @@
  */
 package org.apache.camel.component.bean;
 
+import org.apache.camel.RecipientList;
+import org.apache.camel.MessageDriven;
+
 /**
- * An example POJO with no annotations or interfaces to test out the POJO
- * Camel binding
+ * An example POJO which has a method [EMAIL PROTECTED] #route) which can be 
used as a
+ * Dynamic Recipient List
  *
  * @version $Revision$
  */
-public class ExampleBean {
-
-    public String sayHello(String name) {
-        return "Hello " + name + "!";
-    }
-
-    public String sayGoodbye(String name) {
-        return "Bye " + name + "!";       
-    }
+public class RouterBean {
 
-    public long timesTwo(int value) {
-        return value * 2;
+    @MessageDriven(uri = "direct:start")
+    @RecipientList
+    public String[] route(String body) {
+        System.out.println("RouteBean called with body: " + body);
+        return new String[]{"mock:a", "mock:b"};
     }
 }
\ No newline at end of file

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/bean/BeanWithRecipientListTest-context.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/bean/BeanWithRecipientListTest-context.xml?rev=700801&view=auto
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/bean/BeanWithRecipientListTest-context.xml
 (added)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/bean/BeanWithRecipientListTest-context.xml
 Wed Oct  1 07:57:00 2008
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://activemq.apache.org/camel/schema/spring 
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>
+    <template id="camelTemplate"/>
+  </camelContext>
+
+
+  <bean id="myBean" class="org.apache.camel.component.bean.RouterBean"/>
+
+</beans>

Propchange: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/bean/BeanWithRecipientListTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to