camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r957535 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/component/bean/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/language/bean/ camel-c...
Date Thu, 24 Jun 2010 12:53:47 GMT
Author: davsclaus
Date: Thu Jun 24 12:53:45 2010
New Revision: 957535

URL: http://svn.apache.org/viewvc?rev=957535&view=rev
Log:
CAMEL-2839: @RecipientList and @RoutingSlip now support async routing engine. CAMEL-2848: ProducerTemplate all methods now throw CamelExeuctionException to be consistent.

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean3Test.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean4Test.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBeanTest.java
      - copied, changed from r957424, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean2Test.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean3Test.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBeanTest.java
      - copied, changed from r957424, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipTest.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeExchangeException.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/OgnlHelper.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerTemplateTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanInvocationThrowsExceptionTest.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanInfoTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncProcessor.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncProcessor.java Thu Jun 24 12:53:45 2010
@@ -38,7 +38,7 @@ public interface AsyncProcessor extends 
      * @param callback the {@link AsyncCallback} will be invoked when the processing of the exchange is completed.
      *                 If the exchange is completed synchronously, then the callback is also invoked synchronously.
      *                 The callback should therefore be careful of starting recursive loop.
-     * @return <tt>true</tt> to continue execute synchronously, <tt>false</tt> to continue being executed asynchronously
+     * @return (doneSync) <tt>true</tt> to continue execute synchronously, <tt>false</tt> to continue being executed asynchronously
      */
     boolean process(Exchange exchange, AsyncCallback callback);
 }

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=957535&r1=957534&r2=957535&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 Thu Jun 24 12:53:45 2010
@@ -29,14 +29,14 @@ import org.apache.camel.spi.Synchronizat
  * et al) for working with Camel and sending {@link Message} instances in an
  * {@link Exchange} to an {@link Endpoint}.
  * <p/>
- * <b>All</b> methods throws {@link RuntimeCamelException} if processing of
- * the {@link Exchange} failed and an Exception occurred. The <tt>getCause</tt>
- * method on {@link RuntimeCamelException} returns the wrapper original caused
+ * <b>All</b> methods throws {@link CamelExecutionException} if processing of
+ * the {@link Exchange} failed and an {@link Exception} occurred. The <tt>getCause</tt>
+ * method on {@link CamelExecutionException} returns the wrapper original caused
  * exception.
  * <p/>
  * All the send<b>Body</b> methods will return the content according to this strategy
  * <ul>
- *   <li>throws {@link RuntimeCamelException} as stated above</li>
+ *   <li>throws {@link org.apache.camel.CamelExecutionException} as stated above</li>
  *   <li>The <tt>fault.body</tt> if there is a fault message set and its not <tt>null</tt></li>
  *   <li>Either <tt>IN</tt> or <tt>OUT</tt> body according to the message exchange pattern. If the pattern is
  *   Out capable then the <tt>OUT</tt> body is returned, otherwise <tt>IN</tt>.
@@ -85,8 +85,9 @@ public interface ProducerTemplate extend
      *
      * @param exchange the exchange to send
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(Exchange exchange);
+    Exchange send(Exchange exchange) throws CamelExecutionException;
 
     /**
      * Sends an exchange to the default endpoint using a supplied processor
@@ -97,8 +98,9 @@ public interface ProducerTemplate extend
      * @param processor the transformer used to populate the new exchange
      * {@link Processor} to populate the exchange
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(Processor processor);
+    Exchange send(Processor processor) throws CamelExecutionException;
 
     /**
      * Sends the body to the default endpoint
@@ -164,8 +166,9 @@ public interface ProducerTemplate extend
      * @param endpointUri the endpoint URI to send the exchange to
      * @param exchange    the exchange to send
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(String endpointUri, Exchange exchange);
+    Exchange send(String endpointUri, Exchange exchange) throws CamelExecutionException;
 
     /**
      * Sends an exchange to an endpoint using a supplied processor
@@ -177,8 +180,9 @@ public interface ProducerTemplate extend
      * @param processor   the transformer used to populate the new exchange
      * {@link Processor} to populate the exchange
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(String endpointUri, Processor processor);
+    Exchange send(String endpointUri, Processor processor) throws CamelExecutionException;
 
     /**
      * Sends an exchange to an endpoint using a supplied processor
@@ -192,8 +196,9 @@ public interface ProducerTemplate extend
      * @param processor   the transformer used to populate the new exchange
      * {@link Processor} to populate the exchange
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(String endpointUri, ExchangePattern pattern, Processor processor);
+    Exchange send(String endpointUri, ExchangePattern pattern, Processor processor) throws CamelExecutionException;
 
     /**
      * Sends the exchange to the given endpoint
@@ -204,8 +209,9 @@ public interface ProducerTemplate extend
      * @param endpoint the endpoint to send the exchange to
      * @param exchange the exchange to send
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(Endpoint endpoint, Exchange exchange);
+    Exchange send(Endpoint endpoint, Exchange exchange) throws CamelExecutionException;
 
     /**
      * Sends an exchange to an endpoint using a supplied processor
@@ -217,8 +223,9 @@ public interface ProducerTemplate extend
      * @param processor the transformer used to populate the new exchange
      * {@link Processor} to populate the exchange
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(Endpoint endpoint, Processor processor);
+    Exchange send(Endpoint endpoint, Processor processor) throws CamelExecutionException;
 
     /**
      * Sends an exchange to an endpoint using a supplied processor
@@ -232,8 +239,9 @@ public interface ProducerTemplate extend
      * @param processor the transformer used to populate the new exchange
      * {@link Processor} to populate the exchange
      * @return the returned exchange
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange send(Endpoint endpoint, ExchangePattern pattern, Processor processor);
+    Exchange send(Endpoint endpoint, ExchangePattern pattern, Processor processor) throws CamelExecutionException;
 
     /**
      * Send the body to an endpoint
@@ -495,8 +503,9 @@ public interface ProducerTemplate extend
      * @param endpoint  the Endpoint to send to
      * @param processor the processor which will populate the exchange before sending
      * @return the result (see class javadoc)
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange request(Endpoint endpoint, Processor processor);
+    Exchange request(Endpoint endpoint, Processor processor) throws CamelExecutionException;
 
     /**
      * Sends an exchange to an endpoint using a supplied processor
@@ -508,8 +517,9 @@ public interface ProducerTemplate extend
      * @param endpointUri the endpoint URI to send to
      * @param processor the processor which will populate the exchange before sending
      * @return the result (see class javadoc)
+     * @throws CamelExecutionException if the processing of the exchange failed
      */
-    Exchange request(String endpointUri, Processor processor);
+    Exchange request(String endpointUri, Processor processor) throws CamelExecutionException;
 
     /**
      * Sends the body to the default endpoint and returns the result content

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeExchangeException.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeExchangeException.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeExchangeException.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/RuntimeExchangeException.java Thu Jun 24 12:53:45 2010
@@ -37,6 +37,8 @@ public class RuntimeExchangeException ex
 
     /**
      * Returns the exchange which caused the exception
+     * <p/>
+     * Can be <tt>null</tt>
      */
     public Exchange getExchange() {
         return exchange;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java Thu Jun 24 12:53:45 2010
@@ -18,12 +18,16 @@ package org.apache.camel.component.bean;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.apache.commons.logging.Log;
@@ -35,7 +39,7 @@ import org.apache.commons.logging.LogFac
  *
  * @version $Revision$
  */
-public class BeanProcessor extends ServiceSupport implements Processor {
+public class BeanProcessor extends ServiceSupport implements AsyncProcessor {
     private static final transient Log LOG = LogFactory.getLog(BeanProcessor.class);
 
     private boolean multiParameterArray;
@@ -67,6 +71,10 @@ public class BeanProcessor extends Servi
     }
 
     public void process(Exchange exchange) throws Exception {
+        AsyncProcessorHelper.process(this, exchange);
+    }
+
+    public boolean process(Exchange exchange, AsyncCallback callback) {
         // do we have an explicit method name we always should invoke
         boolean isExplicitMethod = ObjectHelper.isNotEmpty(method);
 
@@ -80,8 +88,13 @@ public class BeanProcessor extends Servi
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Using a custom adapter as bean invocation: " + processor);
             }
-            processor.process(exchange);
-            return;
+            try {
+                processor.process(exchange);
+            } catch (Throwable e) {
+                exchange.setException(e);
+            }
+            callback.done(true);
+            return true;
         }
 
         Message in = exchange.getIn();
@@ -105,7 +118,8 @@ public class BeanProcessor extends Servi
                 beanInvoke.invoke(bean, exchange);
                 // propagate headers
                 exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
-                return;
+                callback.done(true);
+                return true;
             }
         }
 
@@ -124,7 +138,13 @@ public class BeanProcessor extends Servi
                 prevMethod = in.getHeader(Exchange.BEAN_METHOD_NAME, String.class);
                 in.setHeader(Exchange.BEAN_METHOD_NAME, method);
             }
-            invocation = beanInfo.createInvocation(bean, exchange);
+            try {
+                invocation = beanInfo.createInvocation(bean, exchange);
+            } catch (Throwable e) {
+                exchange.setException(e);
+                callback.done(true);
+                return true;
+            }
         }
         if (invocation == null) {
             throw new IllegalStateException("No method invocation could be created, no matching method could be found on: " + bean);
@@ -135,17 +155,29 @@ public class BeanProcessor extends Servi
 
         Object value = null;
         try {
-            value = invocation.proceed();
-        } catch (InvocationTargetException e) {
-            // lets unwrap the exception
-            Throwable throwable = e.getCause();
-            if (throwable instanceof Exception) {
-                Exception exception = (Exception)throwable;
-                throw exception;
-            } else {
-                Error error = (Error)throwable;
-                throw error;
+            AtomicBoolean sync = new AtomicBoolean(true);
+            value = invocation.proceed(callback, sync);
+            if (!sync.get()) {
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Processing exchangeId: " + exchange.getExchangeId() + " is continued being processed asynchronously");
+                }
+                // the remainder of the routing slip will be completed async
+                // so we break out now, then the callback will be invoked which then continue routing from where we left here
+                return false;
+            }
+
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Processing exchangeId: " + exchange.getExchangeId() + " is continued being processed synchronously");
             }
+        } catch (InvocationTargetException e) {
+            // lets unwrap the exception when its an invocation target exception
+            exchange.setException(e.getCause());
+            callback.done(true);
+            return true;
+        } catch (Throwable e) {
+            exchange.setException(e);
+            callback.done(true);
+            return true;
         } finally {
             if (isExplicitMethod) {
                 in.setHeader(Exchange.BEAN_METHOD_NAME, prevMethod);
@@ -170,6 +202,9 @@ public class BeanProcessor extends Servi
                 exchange.getIn().setBody(value);
             }
         }
+
+        callback.done(true);
+        return true;
     }
 
     protected Processor getProcessor() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java Thu Jun 24 12:53:45 2010
@@ -25,7 +25,9 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
+import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.camel.AsyncCallback;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -155,7 +157,7 @@ public class MethodInfo {
                 return arguments;
             }
 
-            public Object proceed() throws Exception {
+            public Object proceed(AsyncCallback callback, AtomicBoolean doneSync) throws Exception {
                 if (LOG.isTraceEnabled()) {
                     LOG.trace(">>>> invoking: " + method + " on bean: " + pojo + " with arguments: " + asString(arguments) + " for exchange: " + exchange);
                 }
@@ -165,7 +167,9 @@ public class MethodInfo {
                     if (!recipientList.isStarted()) {
                         ServiceHelper.startService(recipientList);
                     }
-                    recipientList.sendToRecipientList(exchange, result);
+                    boolean sync = recipientList.sendToRecipientList(exchange, result, callback);
+                    // must remember the done sync returned from the recipient list
+                    doneSync.set(sync);
                     // we don't want to return the list of endpoints
                     // return Void to indicate to BeanProcessor that there is no reply
                     return Void.TYPE;
@@ -174,7 +178,9 @@ public class MethodInfo {
                     if (!routingSlip.isStarted()) {
                         ServiceHelper.startService(routingSlip);
                     }
-                    routingSlip.doRoutingSlip(exchange, result);
+                    boolean sync = routingSlip.doRoutingSlip(exchange, result, callback);
+                    // must remember the done sync returned from the routing slip
+                    doneSync.set(sync);
                     return Void.TYPE;
                 }
                 return result;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInvocation.java Thu Jun 24 12:53:45 2010
@@ -18,6 +18,9 @@ package org.apache.camel.component.bean;
 
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.camel.AsyncCallback;
 
 /**
  * Information used by Camel to perform method invocation.
@@ -30,7 +33,7 @@ public interface MethodInvocation {
 
     Object[] getArguments();
 
-    Object proceed() throws Exception;
+    Object proceed(AsyncCallback callback, AtomicBoolean doneSync) throws Exception;
 
     Object getThis();
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java Thu Jun 24 12:53:45 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.impl;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java Thu Jun 24 12:53:45 2010
@@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -118,18 +119,18 @@ public class DefaultProducerTemplate ext
         return extractResultBody(result, pattern);
     }
 
-    public void sendBody(Endpoint endpoint, Object body) {
+    public void sendBody(Endpoint endpoint, Object body) throws CamelExecutionException {
         Exchange result = send(endpoint, createSetBodyProcessor(body));
         // must invoke extract result body in case of exception to be rethrown
         extractResultBody(result);
     }
 
-    public void sendBody(String endpointUri, Object body) {
+    public void sendBody(String endpointUri, Object body) throws CamelExecutionException {
         Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
         sendBody(endpoint, body);
     }
 
-    public Object sendBody(String endpointUri, ExchangePattern pattern, Object body) {
+    public Object sendBody(String endpointUri, ExchangePattern pattern, Object body) throws CamelExecutionException {
         Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
         Object result = sendBody(endpoint, pattern, body);
         if (pattern.isOutCapable()) {
@@ -140,18 +141,18 @@ public class DefaultProducerTemplate ext
         }
     }
 
-    public void sendBodyAndHeader(String endpointUri, final Object body, final String header, final Object headerValue) {
+    public void sendBodyAndHeader(String endpointUri, final Object body, final String header, final Object headerValue) throws CamelExecutionException {
         sendBodyAndHeader(resolveMandatoryEndpoint(endpointUri), body, header, headerValue);
     }
 
-    public void sendBodyAndHeader(Endpoint endpoint, final Object body, final String header, final Object headerValue) {
+    public void sendBodyAndHeader(Endpoint endpoint, final Object body, final String header, final Object headerValue) throws CamelExecutionException {
         Exchange result = send(endpoint, createBodyAndHeaderProcessor(body, header, headerValue));
         // must invoke extract result body in case of exception to be rethrown
         extractResultBody(result);
     }
 
     public Object sendBodyAndHeader(Endpoint endpoint, ExchangePattern pattern, final Object body,
-                                    final String header, final Object headerValue) {
+                                    final String header, final Object headerValue) throws CamelExecutionException {
         Exchange exchange = send(endpoint, pattern, createBodyAndHeaderProcessor(body, header, headerValue));
         Object result = extractResultBody(exchange, pattern);
         if (pattern.isOutCapable()) {
@@ -163,7 +164,7 @@ public class DefaultProducerTemplate ext
     }
 
     public Object sendBodyAndHeader(String endpoint, ExchangePattern pattern, final Object body,
-                                    final String header, final Object headerValue) {
+                                    final String header, final Object headerValue) throws CamelExecutionException {
         Exchange exchange = send(endpoint, pattern, createBodyAndHeaderProcessor(body, header, headerValue));
         Object result = extractResultBody(exchange, pattern);
         if (pattern.isOutCapable()) {
@@ -175,19 +176,19 @@ public class DefaultProducerTemplate ext
     }
 
     public void sendBodyAndProperty(String endpointUri, final Object body,
-                                      final String property, final Object propertyValue) {
+                                      final String property, final Object propertyValue) throws CamelExecutionException {
         sendBodyAndProperty(resolveMandatoryEndpoint(endpointUri), body, property, propertyValue);
     }    
     
     public void sendBodyAndProperty(Endpoint endpoint, final Object body,
-                                      final String property, final Object propertyValue) {
+                                      final String property, final Object propertyValue) throws CamelExecutionException {
         Exchange result = send(endpoint, createBodyAndPropertyProcessor(body, property, propertyValue));
         // must invoke extract result body in case of exception to be rethrown
         extractResultBody(result);
     }
     
     public Object sendBodyAndProperty(Endpoint endpoint, ExchangePattern pattern, final Object body,
-                                      final String property, final Object propertyValue) {
+                                      final String property, final Object propertyValue) throws CamelExecutionException {
         Exchange exchange = send(endpoint, pattern, createBodyAndPropertyProcessor(body, property, propertyValue));
         Object result = extractResultBody(exchange, pattern);
         if (pattern.isOutCapable()) {
@@ -199,7 +200,7 @@ public class DefaultProducerTemplate ext
     }
 
     public Object sendBodyAndProperty(String endpoint, ExchangePattern pattern, final Object body,
-                                      final String property, final Object propertyValue) {
+                                      final String property, final Object propertyValue) throws CamelExecutionException {
         Exchange exchange = send(endpoint, pattern, createBodyAndPropertyProcessor(body, property, propertyValue));
         Object result = extractResultBody(exchange, pattern);
         if (pattern.isOutCapable()) {
@@ -210,11 +211,11 @@ public class DefaultProducerTemplate ext
         }
     }
     
-    public void sendBodyAndHeaders(String endpointUri, final Object body, final Map<String, Object> headers) {
+    public void sendBodyAndHeaders(String endpointUri, final Object body, final Map<String, Object> headers) throws CamelExecutionException {
         sendBodyAndHeaders(resolveMandatoryEndpoint(endpointUri), body, headers);
     }
 
-    public void sendBodyAndHeaders(Endpoint endpoint, final Object body, final Map<String, Object> headers) {
+    public void sendBodyAndHeaders(Endpoint endpoint, final Object body, final Map<String, Object> headers) throws CamelExecutionException {
         Exchange result = send(endpoint, new Processor() {
             public void process(Exchange exchange) {
                 Message in = exchange.getIn();
@@ -228,11 +229,11 @@ public class DefaultProducerTemplate ext
         extractResultBody(result);
     }
 
-    public Object sendBodyAndHeaders(String endpointUri, ExchangePattern pattern, Object body, Map<String, Object> headers) {
+    public Object sendBodyAndHeaders(String endpointUri, ExchangePattern pattern, Object body, Map<String, Object> headers) throws CamelExecutionException {
         return sendBodyAndHeaders(resolveMandatoryEndpoint(endpointUri), pattern, body, headers);
     }
 
-    public Object sendBodyAndHeaders(Endpoint endpoint, ExchangePattern pattern, final Object body, final Map<String, Object> headers) {
+    public Object sendBodyAndHeaders(Endpoint endpoint, ExchangePattern pattern, final Object body, final Map<String, Object> headers) throws CamelExecutionException {
         Exchange exchange = send(endpoint, pattern, new Processor() {
             public void process(Exchange exchange) throws Exception {
                 Message in = exchange.getIn();
@@ -258,31 +259,31 @@ public class DefaultProducerTemplate ext
         return send(endpoint, ExchangePattern.InOut, processor);
     }
 
-    public Object requestBody(Object body) {
+    public Object requestBody(Object body) throws CamelExecutionException {
         return sendBody(getMandatoryDefaultEndpoint(), ExchangePattern.InOut, body);
     }
 
-    public Object requestBody(Endpoint endpoint, Object body) {
+    public Object requestBody(Endpoint endpoint, Object body) throws CamelExecutionException {
         return sendBody(endpoint, ExchangePattern.InOut, body);
     }
 
-    public Object requestBodyAndHeader(Object body, String header, Object headerValue) {
+    public Object requestBodyAndHeader(Object body, String header, Object headerValue) throws CamelExecutionException {
         return sendBodyAndHeader(getMandatoryDefaultEndpoint(), ExchangePattern.InOut, body, header, headerValue);
     }
 
-    public Object requestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue) {
+    public Object requestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue) throws CamelExecutionException {
         return sendBodyAndHeader(endpoint, ExchangePattern.InOut, body, header, headerValue);
     }
 
-    public Exchange request(String endpoint, Processor processor) {
+    public Exchange request(String endpoint, Processor processor) throws CamelExecutionException {
         return send(endpoint, ExchangePattern.InOut, processor);
     }
 
-    public Object requestBody(String endpoint, Object body) {
+    public Object requestBody(String endpoint, Object body) throws CamelExecutionException {
         return sendBody(endpoint, ExchangePattern.InOut, body);
     }
 
-    public Object requestBodyAndHeader(String endpoint, Object body, String header, Object headerValue) {
+    public Object requestBodyAndHeader(String endpoint, Object body, String header, Object headerValue) throws CamelExecutionException {
         return sendBodyAndHeader(endpoint, ExchangePattern.InOut, body, header, headerValue);
     }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java Thu Jun 24 12:53:45 2010
@@ -41,7 +41,7 @@ import org.apache.camel.util.StopWatch;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
+import static org.apache.camel.util.ObjectHelper.wrapCamelExecutionException;
 
 /**
  * Cache containing created {@link Producer}.
@@ -121,8 +121,12 @@ public class ProducerCache extends Servi
     public void send(Endpoint endpoint, Exchange exchange) {
         try {
             sendExchange(endpoint, null, null, exchange);
+            // ensure that CamelExecutionException is always thrown
+            if (exchange.getException() != null) {
+                throw wrapCamelExecutionException(exchange, exchange.getException());
+            }
         } catch (Exception e) {
-            throw wrapRuntimeCamelException(e);
+            throw wrapCamelExecutionException(exchange, e);
         }
     }
 
@@ -153,7 +157,7 @@ public class ProducerCache extends Servi
         try {
             return sendExchange(endpoint, null, processor, null);
         } catch (Exception e) {
-            throw wrapRuntimeCamelException(e);
+            throw wrapCamelExecutionException(null, e);
         }
     }
 
@@ -171,7 +175,7 @@ public class ProducerCache extends Servi
         try {
             return sendExchange(endpoint, pattern, processor, null);
         } catch (Exception e) {
-            throw wrapRuntimeCamelException(e);
+            throw wrapCamelExecutionException(null, e);
         }
     }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java Thu Jun 24 12:53:45 2010
@@ -66,7 +66,7 @@ public class BeanExpression implements E
         } else {
             holder = new ConstantBeanHolder(bean, exchange.getContext());
         }
-        
+
         // invoking the bean can either be the easy way or using OGNL
 
         // validate OGNL
@@ -135,6 +135,11 @@ public class BeanExpression implements E
                 resultExchange.setPattern(ExchangePattern.InOut);
                 processor.process(resultExchange);
                 result = resultExchange.getOut().getBody();
+
+                // propagate exceptions
+                if (resultExchange.getException() != null) {
+                    exchange.setException(resultExchange.getException());
+                }
             } catch (Exception e) {
                 throw new RuntimeBeanExpressionException(exchange, beanName, methodName, e);
             }
@@ -179,8 +184,8 @@ public class BeanExpression implements E
             for (String methodName : methods) {
                 BeanHolder holder = new ConstantBeanHolder(beanToCall, exchange.getContext());
 
-                // support the elvis operator
-                boolean elvis = OgnlHelper.isElvis(methodName);
+                // support the null safe operator
+                boolean nullSafe = OgnlHelper.isNullSafeOperator(methodName);
 
                 // keep up with how far are we doing
                 ognlPath += methodName;
@@ -200,16 +205,22 @@ public class BeanExpression implements E
                 if (methodName != null) {
                     InvokeProcessor invoke = new InvokeProcessor(holder, methodName);
                     invoke.process(resultExchange);
+
+                    // check for exception and rethrow if we failed
+                    if (resultExchange.getException() != null) {
+                        throw new RuntimeBeanExpressionException(exchange, beanName, methodName, resultExchange.getException());
+                    }
+
                     result = invoke.getResult();
                 }
 
                 // if there was a key then we need to lookup using the key
                 if (key != null) {
-                    result = lookupResult(resultExchange, key, result, elvis, ognlPath, holder.getBean());
+                    result = lookupResult(resultExchange, key, result, nullSafe, ognlPath, holder.getBean());
                 }
 
-                // check elvis for null results
-                if (result == null && elvis) {
+                // check null safe for null results
+                if (result == null && nullSafe) {
                     return;
                 }
 
@@ -218,7 +229,7 @@ public class BeanExpression implements E
             }
         }
 
-        private Object lookupResult(Exchange exchange, String key, Object result, boolean elvis, String ognlPath, Object bean) {
+        private Object lookupResult(Exchange exchange, String key, Object result, boolean nullSafe, String ognlPath, Object bean) {
             // trim key
             key = key.trim();
 
@@ -252,7 +263,7 @@ public class BeanExpression implements E
                     if (num != null && num >= 0 && list.size() > num - 1) {
                         return list.get(num);
                     }
-                    if (!elvis) {
+                    if (!nullSafe) {
                         // not elvis then its mandatory so thrown out of bounds exception
                         throw new IndexOutOfBoundsException("Index: " + num + ", Size: " + list.size()
                                 + " out of bounds with List from bean: " + bean + "using OGNL path [" + ognlPath + "]");
@@ -260,11 +271,11 @@ public class BeanExpression implements E
                 }
             }
 
-            if (!elvis) {
+            if (!nullSafe) {
                 throw new IndexOutOfBoundsException("Key: " + key + " not found in bean: " + bean + " of type: "
                         + ObjectHelper.classCanonicalName(bean) + " using OGNL path [" + ognlPath + "]");
             } else {
-                // elvis so we can return null
+                // null safe so we can return null
                 return null;
             }
         }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java Thu Jun 24 12:53:45 2010
@@ -16,11 +16,7 @@
  */
 package org.apache.camel.processor;
 
-import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
 import java.util.concurrent.ExecutorService;
 
 import org.apache.camel.AsyncCallback;
@@ -106,16 +102,6 @@ public class RecipientList extends Servi
         return sendToRecipientList(exchange, recipientList, callback);
     }
 
-    public boolean sendToRecipientList(Exchange exchange, Object routingSlip) {
-        // this method is invoked from @RecipientList so we bridge with an empty callback
-        // TODO: Have @RecipientList support async out of the box
-        return sendToRecipientList(exchange, routingSlip, new AsyncCallback() {
-            public void done(boolean doneSync) {
-                // noop
-            }
-        });
-    }
-
     /**
      * Sends the given exchange to the recipient list
      */

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java Thu Jun 24 12:53:45 2010
@@ -89,7 +89,7 @@ public interface ExecutorServiceStrategy
     /**
      * Sets the thread name pattern used for creating the full thread name.
      * <p/>
-     * The default pattern is: <tt>Camel Thread ${counter} - ${suffix}</tt>
+     * The default pattern is: <tt>Camel Thread ${counter} - ${name}</tt>
      * </br>
      * Where <tt>${counter}</tt> is a unique incrementing counter.
      * And <tt>${name}</tt> is the thread name.

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java Thu Jun 24 12:53:45 2010
@@ -55,7 +55,7 @@ public final class ExchangeHelper {
      * Extracts the Exchange.BINDING of the given type or null if not present
      *
      * @param exchange the message exchange
-     * @param type the expected binding type
+     * @param type     the expected binding type
      * @return the binding object of the given type or null if it could not be found or converted
      */
     public static <T> T getBinding(Exchange exchange, Class<T> type) {
@@ -66,17 +66,16 @@ public final class ExchangeHelper {
      * Attempts to resolve the endpoint for the given value
      *
      * @param exchange the message exchange being processed
-     * @param value the value which can be an {@link Endpoint} or an object
-     *                which provides a String representation of an endpoint via
-     *                {@link #toString()}
-     *
+     * @param value    the value which can be an {@link Endpoint} or an object
+     *                 which provides a String representation of an endpoint via
+     *                 {@link #toString()}
      * @return the endpoint
      * @throws NoSuchEndpointException if the endpoint cannot be resolved
      */
     public static Endpoint resolveEndpoint(Exchange exchange, Object value) throws NoSuchEndpointException {
         Endpoint endpoint;
         if (value instanceof Endpoint) {
-            endpoint = (Endpoint)value;
+            endpoint = (Endpoint) value;
         } else {
             String uri = value.toString().trim();
             endpoint = CamelContextHelper.getMandatoryEndpoint(exchange.getContext(), uri);
@@ -192,7 +191,7 @@ public final class ExchangeHelper {
         // --------------------------------------------------------------------
         //  TODO: merge logic with that of copyResultsPreservePattern()
         // --------------------------------------------------------------------
-        
+
         if (result != source) {
             result.setException(source.getException());
             if (source.hasOut()) {
@@ -223,8 +222,8 @@ public final class ExchangeHelper {
 
     /**
      * Copies the <code>source</code> exchange to <code>target</code> exchange
-     * preserving the {@link ExchangePattern} of <code>target</code>.  
-     * 
+     * preserving the {@link ExchangePattern} of <code>target</code>.
+     *
      * @param source source exchange.
      * @param result target exchange.
      */
@@ -233,7 +232,7 @@ public final class ExchangeHelper {
         // --------------------------------------------------------------------
         //  TODO: merge logic with that of copyResults()
         // --------------------------------------------------------------------
-        
+
         if (source == result) {
             // no need to copy
             return;
@@ -241,7 +240,7 @@ public final class ExchangeHelper {
 
         // copy in message
         result.getIn().copyFrom(source.getIn());
-    
+
         // copy out message
         if (source.hasOut()) {
             // exchange pattern sensitive
@@ -251,7 +250,7 @@ public final class ExchangeHelper {
 
         // copy exception
         result.setException(source.getException());
-        
+
         // copy properties
         if (source.hasProperties()) {
             result.getProperties().putAll(source.getProperties());
@@ -261,7 +260,7 @@ public final class ExchangeHelper {
     /**
      * Returns the message where to write results in an
      * exchange-pattern-sensitive way.
-     * 
+     *
      * @param exchange message exchange.
      * @return result message.
      */
@@ -278,7 +277,7 @@ public final class ExchangeHelper {
      *
      * @param exchange the exchange to interrogate
      * @return true if the exchange is defined as an {@link ExchangePattern} which supports
-     * OUT messages
+     *         OUT messages
      */
     public static boolean isOutCapable(Exchange exchange) {
         ExchangePattern pattern = exchange.getPattern();
@@ -332,7 +331,7 @@ public final class ExchangeHelper {
      * Returns the MIME content type on the input message or null if one is not defined
      */
     public static String getContentType(Exchange exchange) {
-        return MessageHelper.getContentType(exchange.getIn());        
+        return MessageHelper.getContentType(exchange.getIn());
     }
 
     /**
@@ -398,8 +397,8 @@ public final class ExchangeHelper {
      * This implementation will copy the OUT body to the IN body so when you do
      * aggregation the body is <b>only</b> in the IN body to avoid confusing end users.
      *
-     * @param oldExchange  the old exchange
-     * @param newExchange  the new exchange
+     * @param oldExchange the old exchange
+     * @param newExchange the new exchange
      */
     public static void prepareAggregation(Exchange oldExchange, Exchange newExchange) {
         // move body/header from OUT to IN
@@ -438,10 +437,10 @@ public final class ExchangeHelper {
      * If the exchange pattern is provided it will try to honor it and retrieve the body
      * from either IN or OUT according to the pattern.
      *
-     * @param exchange   the exchange
-     * @param pattern    exchange pattern if given, can be <tt>null</tt>
+     * @param exchange the exchange
+     * @param pattern  exchange pattern if given, can be <tt>null</tt>
      * @return the result body, can be <tt>null</tt>.
-     * @throws CamelExecutionException if the processing of the exchange failed
+     * @throws CamelExecutionException is thrown if the processing of the exchange failed
      */
     public static Object extractResultBody(Exchange exchange, ExchangePattern pattern) {
         Object answer = null;
@@ -478,7 +477,7 @@ public final class ExchangeHelper {
     /**
      * Tests whether the exchange has a fault message set and that its not null.
      *
-     * @param exchange  the exchange
+     * @param exchange the exchange
      * @return <tt>true</tt> if fault message exists
      */
     public static boolean hasFaultMessage(Exchange exchange) {
@@ -491,10 +490,10 @@ public final class ExchangeHelper {
      * Will wait until the future task is complete.
      *
      * @param context the camel context
-     * @param future the future handle
-     * @param type the expected body response type
+     * @param future  the future handle
+     * @param type    the expected body response type
      * @return the result body, can be <tt>null</tt>.
-     * @throws CamelExecutionException if the processing of the exchange failed
+     * @throws CamelExecutionException is thrown if the processing of the exchange failed
      */
     public static <T> T extractFutureBody(CamelContext context, Future<Object> future, Class<T> type) {
         try {
@@ -518,13 +517,14 @@ public final class ExchangeHelper {
      * Will wait for the future task to complete, but waiting at most the timeout value.
      *
      * @param context the camel context
-     * @param future the future handle
+     * @param future  the future handle
      * @param timeout timeout value
      * @param unit    timeout unit
-     * @param type the expected body response type
+     * @param type    the expected body response type
      * @return the result body, can be <tt>null</tt>.
-     * @throws CamelExecutionException if the processing of the exchange failed
-     * @throws java.util.concurrent.TimeoutException is thrown if a timeout triggered
+     * @throws CamelExecutionException is thrown if the processing of the exchange failed
+     * @throws java.util.concurrent.TimeoutException
+     *                                 is thrown if a timeout triggered
      */
     public static <T> T extractFutureBody(CamelContext context, Future<Object> future, long timeout, TimeUnit unit, Class<T> type) throws TimeoutException {
         try {
@@ -534,7 +534,8 @@ public final class ExchangeHelper {
                 return doExtractFutureBody(context, future.get(), type);
             }
         } catch (InterruptedException e) {
-            throw ObjectHelper.wrapRuntimeCamelException(e);
+            // execution failed due interruption so rethrow the cause
+            throw ObjectHelper.wrapCamelExecutionException(null, e);
         } catch (ExecutionException e) {
             // execution failed due to an exception so rethrow the cause
             throw ObjectHelper.wrapCamelExecutionException(null, e.getCause());
@@ -566,9 +567,9 @@ public final class ExchangeHelper {
      * <p/>
      * All fields is optional so you can pass in only an exception, or just a message etc. or any combination.
      *
-     * @param message the message
+     * @param message  the message
      * @param exchange the exchange
-     * @param cause the caused exception
+     * @param cause    the caused exception
      * @return an error message (without stacktrace from exception)
      */
     public static String createExceptionMessage(String message, Exchange exchange, Throwable cause) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/OgnlHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/OgnlHelper.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/OgnlHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/OgnlHelper.java Thu Jun 24 12:53:45 2010
@@ -90,7 +90,7 @@ public final class OgnlHelper {
      * @param ognlExpression the Camel OGNL expression
      * @return <tt>true</tt> if the elvis operator is used, otherwise <tt>false</tt>.
      */
-    public static boolean isElvis(String ognlExpression) {
+    public static boolean isNullSafeOperator(String ognlExpression) {
         if (ObjectHelper.isEmpty(ognlExpression)) {
             return false;
         }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerTemplateTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerTemplateTest.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerTemplateTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultConsumerTemplateTest.java Thu Jun 24 12:53:45 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.impl;
 
+import org.apache.camel.CamelExecutionException;
 import org.apache.camel.ConsumerTemplate;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Endpoint;
@@ -272,7 +273,12 @@ public class DefaultConsumerTemplateTest
     public void testReceiveException() throws Exception {
         Exchange exchange = new DefaultExchange(context);
         exchange.setException(new IllegalArgumentException("Damn"));
-        template.send("seda:foo", exchange);
+        try {
+            template.send("seda:foo", exchange);
+            fail("Should have thrown an exception");
+        } catch (CamelExecutionException e) {
+            // ignore
+        }
 
         try {
             consumer.receiveBody("seda:foo", String.class);

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java Thu Jun 24 12:53:45 2010
@@ -271,9 +271,8 @@ public class SimpleTest extends Language
     
     public void testExceptionOGNLSimple() throws Exception {
         exchange.getIn().setHeader(Exchange.AUTHENTICATION_FAILURE_POLICY_ID, "myPolicy");
-        Exception exception = new CamelAuthorizationException("The camel authorization exception", exchange);
-        exchange.setException(exception);
-        
+        exchange.setProperty(Exchange.EXCEPTION_CAUGHT, new CamelAuthorizationException("The camel authorization exception", exchange));
+
         assertExpression("${exception.getPolicyId}", "myPolicy");
     }
 
@@ -513,7 +512,7 @@ public class SimpleTest extends Language
         }
     }
 
-    public void testBodyOGNLOrderListOutOfBoundsWithElvis() throws Exception {
+    public void testBodyOGNLOrderListOutOfBoundsWithNullSafe() throws Exception {
         List<OrderLine> lines = new ArrayList<OrderLine>();
         lines.add(new OrderLine(123, "Camel in Action"));
         lines.add(new OrderLine(456, "ActiveMQ in Action"));
@@ -524,7 +523,7 @@ public class SimpleTest extends Language
         assertExpression("${in.body?.getLines[3].getId}", null);
     }
 
-    public void testBodyOGNLOrderListOutOfBoundsWithElvisShorthand() throws Exception {
+    public void testBodyOGNLOrderListOutOfBoundsWithNullSafeShorthand() throws Exception {
         List<OrderLine> lines = new ArrayList<OrderLine>();
         lines.add(new OrderLine(123, "Camel in Action"));
         lines.add(new OrderLine(456, "ActiveMQ in Action"));
@@ -535,7 +534,7 @@ public class SimpleTest extends Language
         assertExpression("${in.body?.lines[3].id}", null);
     }
 
-    public void testBodyOGNLOrderListNoMethodNameWithElvis() throws Exception {
+    public void testBodyOGNLOrderListNoMethodNameWithNullSafe() throws Exception {
         List<OrderLine> lines = new ArrayList<OrderLine>();
         lines.add(new OrderLine(123, "Camel in Action"));
         lines.add(new OrderLine(456, "ActiveMQ in Action"));
@@ -552,7 +551,7 @@ public class SimpleTest extends Language
         }
     }
 
-    public void testBodyOGNLOrderListNoMethodNameWithElvisShorthand() throws Exception {
+    public void testBodyOGNLOrderListNoMethodNameWithNullSafeShorthand() throws Exception {
         List<OrderLine> lines = new ArrayList<OrderLine>();
         lines.add(new OrderLine(123, "Camel in Action"));
         lines.add(new OrderLine(456, "ActiveMQ in Action"));

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanInvocationThrowsExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanInvocationThrowsExceptionTest.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanInvocationThrowsExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanInvocationThrowsExceptionTest.java Thu Jun 24 12:53:45 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.processor;
 
+import org.apache.camel.CamelExecutionException;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -36,11 +37,17 @@ public class BeanInvocationThrowsExcepti
         // must create an exchange to get the result as an exchange where we can get the caused exception
         Exchange exchange = getMandatoryEndpoint("direct:input").createExchange(ExchangePattern.InOut);
         exchange.getIn().setBody("Hello Paris");
-        Exchange result = template.send("direct:input", exchange);
 
-        assertTrue("Should be failed", result.isFailed());
-        assertTrue("Should be IllegalArgumentException", result.getException() instanceof IllegalArgumentException);
-        assertEquals("Forced exception", result.getException().getMessage());
+        try {
+            template.send("direct:input", exchange);
+            fail("Should have thrown exception");
+        } catch (CamelExecutionException e) {
+            assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
+        }
+
+        assertTrue("Should be failed", exchange.isFailed());
+        assertTrue("Should be IllegalArgumentException", exchange.getException() instanceof IllegalArgumentException);
+        assertEquals("Forced exception", exchange.getException().getMessage());
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean3Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean3Test.java?rev=957535&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean3Test.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean3Test.java Thu Jun 24 12:53:45 2010
@@ -0,0 +1,91 @@
+/**
+ * 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.
+ */
+package org.apache.camel.processor.async;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RecipientList;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version $Revision$
+ */
+public class AsyncEndpointRecipientListBean3Test extends ContextTestSupport {
+
+    private static String beforeThreadName;
+    private static String afterThreadName;
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myBean", new MyRecipientBean());
+        return jndi;
+    }
+
+    public void testAsyncEndpoint() throws Exception {
+        getMockEndpoint("mock:before").expectedBodiesReceived("Hello Camel");
+        getMockEndpoint("mock:after").expectedBodiesReceived("Bye Camel");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel");
+
+        String reply = template.requestBody("direct:start", "Hello Camel", String.class);
+        assertEquals("Bye Camel", reply);
+
+        assertFalse("Should use different threads", beforeThreadName.equalsIgnoreCase(afterThreadName));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.addComponent("async", new MyAsyncComponent());
+
+                from("direct:start")
+                        .to("mock:before")
+                        .to("log:before")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                beforeThreadName = Thread.currentThread().getName();
+                            }
+                        })
+                        .beanRef("myBean");
+
+                from("direct:foo")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                afterThreadName = Thread.currentThread().getName();
+                                exchange.getOut().setBody("Bye Camel");
+                            }
+                        })
+                        .to("log:after")
+                        .to("mock:after")
+                        .to("mock:result");
+            }
+        };
+    }
+
+    public static class MyRecipientBean {
+
+        @RecipientList
+        public String doSomething() {
+            return "async:Hi Camel,direct:foo";
+        }
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean3Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean3Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean4Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean4Test.java?rev=957535&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean4Test.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean4Test.java Thu Jun 24 12:53:45 2010
@@ -0,0 +1,91 @@
+/**
+ * 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.
+ */
+package org.apache.camel.processor.async;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RecipientList;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version $Revision$
+ */
+public class AsyncEndpointRecipientListBean4Test extends ContextTestSupport {
+
+    private static String beforeThreadName;
+    private static String afterThreadName;
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myBean", new MyRecipientBean());
+        return jndi;
+    }
+
+    public void testAsyncEndpoint() throws Exception {
+        getMockEndpoint("mock:before").expectedBodiesReceived("Hello Camel");
+        getMockEndpoint("mock:after").expectedBodiesReceived("Bye Camel");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel");
+
+        String reply = template.requestBody("direct:start", "Hello Camel", String.class);
+        assertEquals("Bye Camel", reply);
+
+        assertFalse("Should use different threads", beforeThreadName.equalsIgnoreCase(afterThreadName));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.addComponent("async", new MyAsyncComponent());
+
+                from("direct:start")
+                        .to("mock:before")
+                        .to("log:before")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                beforeThreadName = Thread.currentThread().getName();
+                            }
+                        })
+                        .beanRef("myBean");
+
+                from("direct:foo")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                afterThreadName = Thread.currentThread().getName();
+                                exchange.getOut().setBody("Bye Camel");
+                            }
+                        })
+                        .to("log:after")
+                        .to("mock:after")
+                        .to("mock:result");
+            }
+        };
+    }
+
+    public static class MyRecipientBean {
+
+        @RecipientList
+        public String doSomething() {
+            return "async:Hi Camel,async:Hi World,direct:foo";
+        }
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean4Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBean4Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBeanTest.java (from r957424, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBeanTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBeanTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListTest.java&r1=957424&r2=957535&rev=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRecipientListBeanTest.java Thu Jun 24 12:53:45 2010
@@ -19,16 +19,25 @@ package org.apache.camel.processor.async
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.RecipientList;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
 
 /**
  * @version $Revision$
  */
-public class AsyncEndpointRecipientListTest extends ContextTestSupport {
+public class AsyncEndpointRecipientListBeanTest extends ContextTestSupport {
 
     private static String beforeThreadName;
     private static String afterThreadName;
 
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myBean", new MyRecipientBean());
+        return jndi;
+    }
+
     public void testAsyncEndpoint() throws Exception {
         getMockEndpoint("mock:before").expectedBodiesReceived("Hello Camel");
         getMockEndpoint("mock:after").expectedBodiesReceived("Bye Camel");
@@ -55,7 +64,7 @@ public class AsyncEndpointRecipientListT
                                 beforeThreadName = Thread.currentThread().getName();
                             }
                         })
-                        .recipientList(constant("async:Bye Camel"))
+                        .beanRef("myBean")
                         .process(new Processor() {
                             public void process(Exchange exchange) throws Exception {
                                 afterThreadName = Thread.currentThread().getName();
@@ -68,4 +77,12 @@ public class AsyncEndpointRecipientListT
         };
     }
 
+    public static class MyRecipientBean {
+
+        @RecipientList
+        public String doSomething() {
+            return "async:Bye Camel";
+        }
+    }
+
 }
\ No newline at end of file

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean2Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean2Test.java?rev=957535&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean2Test.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean2Test.java Thu Jun 24 12:53:45 2010
@@ -0,0 +1,63 @@
+/**
+ * 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.
+ */
+package org.apache.camel.processor.async;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.RoutingSlip;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version $Revision$
+ */
+public class AsyncEndpointRoutingSlipBean2Test extends ContextTestSupport {
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myBean", new MyRoutingSlipBean());
+        return jndi;
+    }
+
+    public void testAsyncEndpoint() throws Exception {
+        String reply = template.requestBody("direct:start", "Hello Camel", String.class);
+        assertEquals("Bye World", reply);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.addComponent("async", new MyAsyncComponent());
+
+                from("direct:start")
+                        .beanRef("myBean");
+            }
+        };
+    }
+
+    public static class MyRoutingSlipBean {
+
+        @RoutingSlip
+        public String doSomething() {
+            return "async:Bye Camel,async:Bye World";
+        }
+    }
+
+
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean2Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean3Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean3Test.java?rev=957535&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean3Test.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean3Test.java Thu Jun 24 12:53:45 2010
@@ -0,0 +1,96 @@
+/**
+ * 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.
+ */
+package org.apache.camel.processor.async;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RoutingSlip;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version $Revision$
+ */
+public class AsyncEndpointRoutingSlipBean3Test extends ContextTestSupport {
+
+    private static String beforeThreadName;
+    private static String afterThreadName;
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myBean", new MyRoutingSlipBean());
+        return jndi;
+    }
+
+    public void testAsyncEndpoint() throws Exception {
+        getMockEndpoint("mock:before").expectedBodiesReceived("Hello Camel");
+        getMockEndpoint("mock:after").expectedBodiesReceived("Bye Camel");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel");
+
+        String reply = template.requestBody("direct:start", "Hello Camel", String.class);
+        assertEquals("Bye Camel", reply);
+
+        assertMockEndpointsSatisfied();
+
+        assertFalse("Should use different threads", beforeThreadName.equalsIgnoreCase(afterThreadName));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.addComponent("async", new MyAsyncComponent());
+
+                from("direct:start")
+                        .to("mock:before")
+                        .to("log:before")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                beforeThreadName = Thread.currentThread().getName();
+                            }
+                        })
+                        .beanRef("myBean");
+
+                from("direct:foo")
+                        .process(new Processor() {
+                            public void process(Exchange exchange) throws Exception {
+                                afterThreadName = Thread.currentThread().getName();
+                                String body = exchange.getIn().getBody(String.class);
+                                assertEquals("Hi World", body);
+                                exchange.getOut().setBody("Bye Camel");
+                            }
+                        })
+                        .to("log:after")
+                        .to("mock:after")
+                        .to("mock:result");
+            }
+        };
+    }
+
+    public static class MyRoutingSlipBean {
+
+        @RoutingSlip
+        public String doSomething() {
+            return "async:Hi World,direct:foo";
+        }
+    }
+
+
+}
\ No newline at end of file

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean3Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBean3Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBeanTest.java (from r957424, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBeanTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBeanTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipTest.java&r1=957424&r2=957535&rev=957535&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointRoutingSlipBeanTest.java Thu Jun 24 12:53:45 2010
@@ -17,12 +17,21 @@
 package org.apache.camel.processor.async;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.RoutingSlip;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
 
 /**
  * @version $Revision$
  */
-public class AsyncEndpointRoutingSlipTest extends ContextTestSupport {
+public class AsyncEndpointRoutingSlipBeanTest extends ContextTestSupport {
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("myBean", new MyRoutingSlipBean());
+        return jndi;
+    }
 
     public void testAsyncEndpoint() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel");
@@ -41,9 +50,18 @@ public class AsyncEndpointRoutingSlipTes
                 context.addComponent("async", new MyAsyncComponent());
 
                 from("direct:start")
-                        .routingSlip(constant("async:Bye Camel,mock:result"));
+                        .beanRef("myBean");
             }
         };
     }
 
+    public static class MyRoutingSlipBean {
+
+        @RoutingSlip
+        public String doSomething() {
+            return "async:Bye Camel,mock:result";
+        }
+    }
+
+
 }
\ No newline at end of file

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanInfoTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanInfoTest.java?rev=957535&r1=957534&r2=957535&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanInfoTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanInfoTest.java Thu Jun 24 12:53:45 2010
@@ -16,8 +16,10 @@
  */
 package org.apache.camel.spring.bind;
 
-import junit.framework.TestCase;
+import java.util.concurrent.atomic.AtomicBoolean;
 
+import junit.framework.TestCase;
+import org.apache.camel.AsyncCallback;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.bean.BeanInfo;
 import org.apache.camel.component.bean.BeanProcessor;
@@ -25,36 +27,36 @@ import org.apache.camel.component.bean.D
 import org.apache.camel.component.bean.MethodInvocation;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultExchange;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * @version $Revision$
  */
 public class BeanInfoTest extends TestCase {
-    private static final Log LOG = LogFactory.getLog(BeanInfoTest.class);
     protected DefaultCamelContext camelContext = new DefaultCamelContext();
     protected Exchange exchange = new DefaultExchange(camelContext);
     protected DefaultParameterMappingStrategy strategy = new DefaultParameterMappingStrategy();
     protected ExampleBean bean = new ExampleBean();
     protected BeanInfo info;
 
-
-
     public void testFindsSingleMethodMatchingBody() throws Throwable {
         MethodInvocation invocation = info.createInvocation(bean, exchange);
         assertNotNull("Should have found a method invocation!", invocation);
 
-        Object value = invocation.proceed();
+        AtomicBoolean sync = new AtomicBoolean(true);
+        Object value = invocation.proceed(new AsyncCallback() {
+            public void done(boolean doneSync) {
+                // nnop
+            }
+        }, sync);
 
-        LOG.info("Value: " + value);
+        assertEquals(true, sync.get());
+        assertEquals("Hello James!", value);
     }
 
     public void testBeanProcessor() throws Exception {
         BeanProcessor processor = new BeanProcessor(bean, info);
         processor.process(exchange);
-
-        LOG.info("Exchange is: " + exchange);
+        assertEquals("Hello James!", exchange.getIn().getBody());
     }
 
     protected void setUp() throws Exception {



Mime
View raw message