Author: davsclaus
Date: Thu Oct  2 10:14:51 2008
New Revision: 701192

URL: http://svn.apache.org/viewvc?rev=701192&view=rev
Log:
CAMEL-958: Fixed wrong multicast example. Polished code. Added some more xpath 
tests based on user forum.

Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchEndpointException.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java
    
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchEndpointException.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchEndpointException.java?rev=701192&r1=701191&r2=701192&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchEndpointException.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/NoSuchEndpointException.java
 Thu Oct  2 10:14:51 2008
@@ -30,7 +30,7 @@
 
     public NoSuchEndpointException(String uri) {
         super("No endpoint could be found for: " + uri
-              + ", please check the class path for the uri relates camel 
component module.");
+              + ", please check your classpath contains the needed camel 
component jar.");
 
         this.uri = uri;
     }

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java?rev=701192&r1=701191&r2=701192&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java
 Thu Oct  2 10:14:51 2008
@@ -103,7 +103,6 @@
      * @return a predicate which evaluates to true if the given value 
expression
      *         is contained within this expression value
      */
-
     public Predicate<E> contains(Object value) {
         Expression<E> right = asExpression(value);
         return onNewPredicate(PredicateBuilder.contains(expression, right));
@@ -117,7 +116,6 @@
      * @return a predicate which evaluates to true if the expression matches 
the
      *         regex
      */
-
     public Predicate<E> regex(String regex) {
         return onNewPredicate(PredicateBuilder.regex(expression, regex));
     }
@@ -138,7 +136,6 @@
      * Tokenizes the string conversion of this expression using the given
      * regular expression
      */
-
     public ValueBuilder<E> regexTokenize(String regex) {
         Expression<E> newExp = ExpressionBuilder.regexTokenize(expression, 
regex);
         return new ValueBuilder<E>(newExp);
@@ -148,7 +145,6 @@
      * Replaces all occurrencies of the regular expression with the given
      * replacement
      */
-
     public ValueBuilder<E> regexReplaceAll(String regex, String replacement) {
         Expression<E> newExp = ExpressionBuilder.regexReplaceAll(expression, 
regex, replacement);
         return new ValueBuilder<E>(newExp);
@@ -158,7 +154,6 @@
      * Replaces all occurrencies of the regular expression with the given
      * replacement
      */
-
     public ValueBuilder<E> regexReplaceAll(String regex, Expression<E> 
replacement) {
         Expression<E> newExp = ExpressionBuilder.regexReplaceAll(expression, 
regex, replacement);
         return new ValueBuilder<E>(newExp);
@@ -171,7 +166,6 @@
      * @param type the type to convert the value to
      * @return the current builder
      */
-
     public ValueBuilder<E> convertTo(Class type) {
         Expression<E> newExp = ExpressionBuilder.convertTo(expression, type);
         return new ValueBuilder<E>(newExp);
@@ -182,7 +176,6 @@
      * 
      * @return the current builder
      */
-
     public ValueBuilder<E> convertToString() {
         return convertTo(String.class);
     }
@@ -193,7 +186,6 @@
      * @param value the value or expression to append
      * @return the current builder
      */
-
     public ValueBuilder<E> append(Object value) {
         return new ValueBuilder<E>(ExpressionBuilder.append(expression, 
asExpression(value)));
     }

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java?rev=701192&r1=701191&r2=701192&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
 Thu Oct  2 10:14:51 2008
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.processor;
 
-
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -27,11 +25,11 @@
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.converter.ObjectConverter;
 import org.apache.camel.impl.ProducerCache;
 import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
 import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.ObjectHelper;
 import static org.apache.camel.util.ObjectHelper.notNull;
 
 /**
@@ -63,13 +61,9 @@
 
     /**
      * Sends the given exchange to the recipient list
-     *
-     * @param exchange
-     * @param receipientList
-     * @throws Exception
      */
     public void sendToRecipientList(Exchange exchange, Object receipientList) 
throws Exception {
-        Iterator iter = ObjectConverter.iterator(receipientList);
+        Iterator iter = ObjectHelper.createIterator(receipientList);
         List<Processor> processors = new ArrayList<Processor>();
         while (iter.hasNext()) {
             Object recipient = iter.next();

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?rev=701192&r1=701191&r2=701192&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
 Thu Oct  2 10:14:51 2008
@@ -337,7 +337,7 @@
         // START SNIPPET: e8
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                from("seda:a").to("seda:b", "seda:c", "seda:d");
+                from("seda:a").multicast().to("seda:b", "seda:c", "seda:d");
             }
         };
         // END SNIPPET: e8

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java?rev=701192&r1=701191&r2=701192&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathTest.java
 Thu Oct  2 10:14:51 2008
@@ -26,6 +26,7 @@
  * @version $Revision$
  */
 public class XPathTest extends LanguageTestSupport {
+
     public void testExpressions() throws Exception {
         assertExpression("in:body()", "<hello id='m123'>world!</hello>");
         assertExpression("in:header('foo')", "abc");
@@ -38,6 +39,12 @@
         assertPredicate("$foo = 'bar'", false);
     }
 
+    public void testNormalXPathExpression() throws Exception {
+        assertExpression("hello", "world!");
+        assertExpression("hello/text()", "world!");
+        assertExpression("hello/@id", "m123");
+    }
+
     protected String getLanguageName() {
         return "xpath";
     }

Modified: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml?rev=701192&r1=701191&r2=701192&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml
 Thu Oct  2 10:14:51 2008
@@ -29,9 +29,11 @@
   <camelContext id="camel" 
xmlns="http://activemq.apache.org/camel/schema/spring";>
     <route>
       <from uri="seda:a"/>
-      <to uri="seda:b"/>
-      <to uri="seda:c"/>
-      <to uri="seda:d"/>
+      <multicast>
+        <to uri="seda:b"/>
+        <to uri="seda:c"/>
+        <to uri="seda:d"/>
+      </multicast>
     </route>
   </camelContext>
   <!-- END SNIPPET: example -->


Reply via email to