camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r989532 - in /camel/trunk/components/camel-spring/src/test: java/org/apache/camel/spring/produce/ resources/org/apache/camel/spring/produce/
Date Thu, 26 Aug 2010 08:46:33 GMT
Author: ningjiang
Date: Thu Aug 26 08:46:32 2010
New Revision: 989532

URL: http://svn.apache.org/viewvc?rev=989532&view=rev
Log:
Updated the producer test according the user mail

Modified:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListener.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListenerService.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTest.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/MyCoolBeanTest-context.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateTest-context.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTest-context.xml

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListener.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListener.java?rev=989532&r1=989531&r2=989532&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListener.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListener.java
Thu Aug 26 08:46:32 2010
@@ -16,11 +16,18 @@
  */
 package org.apache.camel.spring.produce;
 
+import java.util.Map;
+
+import org.apache.camel.Body;
+import org.apache.camel.Headers;
+
 /**
  * @version $Revision$
  */
 public interface MyListener {
 
     String sayHello(String name);
+    
+    String greet(@Headers Map<String, Object>headers, @Body String name);
 
 }

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListenerService.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListenerService.java?rev=989532&r1=989531&r2=989532&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListenerService.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/MyListenerService.java
Thu Aug 26 08:46:32 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.spring.produce;
 
+import java.util.Map;
+
 import org.apache.camel.Consume;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -32,10 +34,14 @@ public class MyListenerService implement
     public MyListenerService() {
         LOG.debug("Instantiated service: " + this);
     }
-
-    @Consume(uri = "direct:myService")
+    
     public String sayHello(String name) {
         LOG.debug("Invoked sayHello with: " + name);
         return "Hello " + name;
     }
+
+    @Consume(uri = "direct:end")
+    public String greet(Map<String, Object> headers, String name) {
+        return headers.get("greeter") + name;
+    }
 }

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTest.java?rev=989532&r1=989531&r2=989532&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTest.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTest.java
Thu Aug 26 08:46:32 2010
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.spring.produce;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.camel.Produce;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
@@ -26,7 +29,7 @@ import org.springframework.test.context.
 @ContextConfiguration
 public class ProduceTest extends AbstractJUnit38SpringContextTests {
     
-    @Produce(uri = "direct:myService")
+    @Produce(uri = "direct:start")
     protected MyListener producer;
 
     public void testInvokeService() throws Exception {
@@ -34,4 +37,11 @@ public class ProduceTest extends Abstrac
         String actual = producer.sayHello("James");
         assertEquals("response", "Hello James", actual);
     }
+    
+    public void testInvokeServiceWithMessageHeader() throws Exception {
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("greeter", "Nihao ");
+        String response = producer.greet(headers, "Willem");
+        assertEquals("response is wrong", "Nihao Willem", response);
+    }
 }
\ No newline at end of file

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/MyCoolBeanTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/MyCoolBeanTest-context.xml?rev=989532&r1=989531&r2=989532&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/MyCoolBeanTest-context.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/MyCoolBeanTest-context.xml
Thu Aug 26 08:46:32 2010
@@ -24,7 +24,7 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-    <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"/>
+    <camelContext xmlns="http://camel.apache.org/schema/spring"/>
 
     <bean id="cool" class="org.apache.camel.spring.produce.MyCoolBean"/>
 

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateTest-context.xml?rev=989532&r1=989531&r2=989532&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateTest-context.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateTest-context.xml
Thu Aug 26 08:46:32 2010
@@ -25,7 +25,7 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
   	<template id="camelTemplate" />
   	<route>
   	   <from uri="direct:start"/>

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTest-context.xml?rev=989532&r1=989531&r2=989532&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTest-context.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTest-context.xml
Thu Aug 26 08:46:32 2010
@@ -29,6 +29,11 @@
   <context:component-scan base-package="org.apache.camel.spring.produce"/>
 
   <camelContext xmlns="http://camel.apache.org/schema/spring">
+     <route>
+  	   <from uri="direct:start"/>
+  	   <to uri="log:TraceMessage"/>
+  	   <to uri="direct:end"/>
+  	</route>
   </camelContext>
 
 </beans>



Mime
View raw message