camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r739348 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/ main/java/org/apache/camel/builder/ test/java/org/apache/camel/ test/java/org/apache/camel/processor/
Date Fri, 30 Jan 2009 17:40:57 GMT
Author: janstey
Date: Fri Jan 30 17:40:57 2009
New Revision: 739348

URL: http://svn.apache.org/viewvc?rev=739348&view=rev
Log:
CAMEL-1299 - add ValueBuilder support for exchange properties

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithStringDelimitedPropertyTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java?rev=739348&r1=739347&r2=739348&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java Fri Jan 30
17:40:57 2009
@@ -73,8 +73,8 @@
      * Sends the body to the default endpoint with a specified header and header
      * value
      *
-     * @param body        the payload to send
-     * @param header      the header name
+     * @param body the payload to send
+     * @param header the header name
      * @param headerValue the header value
      * @return the result (see class javadoc)
      */

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java?rev=739348&r1=739347&r2=739348&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java Fri Jan 30
17:40:57 2009
@@ -77,6 +77,14 @@
     }
 
     /**
+     * Returns a predicate and value builder for properties on an exchange
+     */
+    public static ValueBuilder property(String name) {
+        Expression expression = ExpressionBuilder.propertyExpression(name);
+        return new ValueBuilder(expression);
+    }    
+    
+    /**
      * Returns a predicate and value builder for the inbound body on an exchange
      */
     public static ValueBuilder body() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java?rev=739348&r1=739347&r2=739348&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java Fri
Jan 30 17:40:57 2009
@@ -63,6 +63,13 @@
     }
 
     /**
+     * Returns a value builder for the given property
+     */
+    public ValueBuilder property(String name) {
+        return Builder.property(name);
+    }   
+    
+    /**
      * Returns a predicate and value builder for the inbound body on an exchange
      */
     public ValueBuilder body() {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java?rev=739348&r1=739347&r2=739348&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java Fri Jan 30 17:40:57
2009
@@ -51,6 +51,13 @@
     }
 
     /**
+     * Returns a value builder for the given property
+     */
+    public ValueBuilder property(String name) {
+        return Builder.property(name);
+    }    
+    
+    /**
      * Returns a predicate and value builder for the inbound body on an exchange
      */
     public ValueBuilder body() {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithStringDelimitedPropertyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithStringDelimitedPropertyTest.java?rev=739348&r1=739347&r2=739348&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithStringDelimitedPropertyTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithStringDelimitedPropertyTest.java
Fri Jan 30 17:40:57 2009
@@ -19,36 +19,43 @@
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import static org.apache.camel.language.property.PropertyLanguage.property;
 
 /**
  * @version $Revision: 736555 $
  */
 public class RecipientListWithStringDelimitedPropertyTest extends ContextTestSupport {
 
+    private static final String BODY = "answer";
+    private static final String PROPERTY_NAME = "myProperty";
+    private static final String PROPERTY_VALUE = "mock:x, mock:y, mock:z";
+
     public void testSendingAMessageUsingMulticastReceivesItsOwnExchange() throws Exception
{
         MockEndpoint x = getMockEndpoint("mock:x");
         MockEndpoint y = getMockEndpoint("mock:y");
         MockEndpoint z = getMockEndpoint("mock:z");
 
-        x.expectedBodiesReceived("answer");
-        y.expectedBodiesReceived("answer");
-        z.expectedBodiesReceived("answer");
-
+        x.expectedBodiesReceived(BODY);
+        y.expectedBodiesReceived(BODY);
+        z.expectedBodiesReceived(BODY);
+        
+        x.message(0).property(PROPERTY_NAME).isEqualTo(PROPERTY_VALUE);
+        y.message(0).property(PROPERTY_NAME).isEqualTo(PROPERTY_VALUE);
+        z.message(0).property(PROPERTY_NAME).isEqualTo(PROPERTY_VALUE);      
+        
         sendBody();
 
         assertMockEndpointsSatisfied();
     }
 
     protected void sendBody() {
-        template.sendBodyAndProperty("direct:a", "answer", "myProperty", "mock:x, mock:y,
mock:z");
+        template.sendBodyAndProperty("direct:a", BODY, PROPERTY_NAME, PROPERTY_VALUE);
     }
 
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
                 // START SNIPPET: example
-                from("direct:a").recipientList(property("myProperty"));
+                from("direct:a").recipientList(property(PROPERTY_NAME));
                 // END SNIPPET: example
             }
         };



Mime
View raw message