camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r638334 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/model/ProcessorType.java test/java/org/apache/camel/processor/SetHeaderUsingDslExpressionsTest.java
Date Tue, 18 Mar 2008 11:45:56 GMT
Author: jstrachan
Date: Tue Mar 18 04:45:55 2008
New Revision: 638334

URL: http://svn.apache.org/viewvc?rev=638334&view=rev
Log:
add helper method from("...").setHeader("name", "value") which is a tiny bit easier to figure
out than setHeader("name").constant("value")

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetHeaderUsingDslExpressionsTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?rev=638334&r1=638333&r2=638334&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
Tue Mar 18 04:45:55 2008
@@ -988,6 +988,13 @@
     }
 
     /**
+     * Adds a processor which sets the header on the IN message to the given value
+     */
+    public Type setHeader(String name, String value) {
+        return (Type) setHeader(name).constant(value);
+    }
+
+    /**
      * Adds a processor which sets the header on the OUT message
      */
     public ExpressionClause<ProcessorType<Type>> setOutHeader(String name) {
@@ -1004,6 +1011,13 @@
     }
 
     /**
+     * Adds a processor which sets the header on the OUT message
+     */
+    public Type setOutHeader(String name, String value) {
+        return (Type) setOutHeader(name).constant(value);
+    }
+
+    /**
      * Adds a processor which sets the header on the FAULT message
      */
     public Type setFaultHeader(String name, Expression expression) {
@@ -1016,6 +1030,7 @@
     public Type setProperty(String name, Expression expression) {
         return process(ProcessorBuilder.setProperty(name, expression));
     }
+
 
     /**
      * Adds a processor which sets the exchange property

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetHeaderUsingDslExpressionsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetHeaderUsingDslExpressionsTest.java?rev=638334&r1=638333&r2=638334&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetHeaderUsingDslExpressionsTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetHeaderUsingDslExpressionsTest.java
Tue Mar 18 04:45:55 2008
@@ -43,6 +43,20 @@
         assertMockEndpointsSatisifed();
     }
 
+    public void testUseConstantParameter() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            public void configure() throws Exception {
+                from("direct:start").
+                        setHeader("foo", "ABC").
+                        to("mock:result");
+            }
+        });
+
+        template.sendBodyAndHeader("direct:start", body, "bar", "ABC");
+
+        assertMockEndpointsSatisifed();
+    }
+
     public void testUseExpression() throws Exception {
         context.addRoutes(new RouteBuilder() {
             public void configure() throws Exception {



Mime
View raw message