camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r761288 [1/2] - in /camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/processor/ camel-...
Date Thu, 02 Apr 2009 13:28:52 GMT
Author: davsclaus
Date: Thu Apr  2 13:28:50 2009
New Revision: 761288

URL: http://svn.apache.org/viewvc?rev=761288&view=rev
Log:
CAMEL-714: Changed default error handler from DeadLetterChannel to DefaultErrorHandler that currently does nothing. So all exceptions is sent back to caller, so no more surprises.

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
      - copied, changed from r761158, camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NoErrorHandlerBuilder.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerExplicitConfiguredTest.java   (with props)
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerTest.java   (with props)
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderWithHandledExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderWithEndTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RomeksExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/ExceptionWithManagementTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelExceptionCausePropagatedTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RedeliveryPolicyPerExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamSourceContentBasedRouterTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithHandlePipelineAndExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeansPayloadMode.xml
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsXMLRouteTest.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java
    camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/InterceptorTest.scala
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionNotNormalizedClassNameTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionSubRouteTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildRouteWithInterceptor.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRoute.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithChoice.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSimpleRouteWithHeaderPredicate.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildStaticRecipientList.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java Thu Apr  2 13:28:50 2009
@@ -25,7 +25,6 @@
 import org.apache.camel.Expression;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.NoSuchEndpointException;
-import org.apache.camel.processor.SendProcessor;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -237,6 +236,15 @@
     }
 
     /**
+     * Creates a default <a href="http://camel.apache.org/error-handler.html">error handler</a>.
+     *
+     * @return the builder
+     */
+    public DefaultErrorHandlerBuilder defaultErrorHandler() {
+        return new DefaultErrorHandlerBuilder();
+    }
+
+    /**
      * Creates a disabled <a href="http://camel.apache.org/error-handler.html">error handler</a>
      * for removing the default error handler
      *
@@ -336,11 +344,7 @@
     }
 
     protected ErrorHandlerBuilder createErrorHandlerBuilder() {
-        if (isInheritErrorHandler()) {
-            return new DeadLetterChannelBuilder();
-        } else {
-            return new NoErrorHandlerBuilder();
-        }
+        return new DefaultErrorHandlerBuilder();
     }
 
     /**

Copied: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java (from r761158, camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NoErrorHandlerBuilder.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NoErrorHandlerBuilder.java&r1=761158&r2=761288&rev=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NoErrorHandlerBuilder.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java Thu Apr  2 13:28:50 2009
@@ -17,20 +17,20 @@
 package org.apache.camel.builder;
 
 import org.apache.camel.Processor;
+import org.apache.camel.processor.DefaultErrorHandler;
 import org.apache.camel.spi.RouteContext;
 
 /**
- * A builder to disable the use of an error handler so that any exceptions are thrown.
- * This not recommended in general, the
- * <a href="http://camel.apache.org/dead-letter-channel.html">Dead Letter Channel</a> should be used
- * if you are unsure; however it can be useful sometimes to disable an error handler inside a complex route
- * so that exceptions bubble up to the parent {@link Processor}
+ * The default error handler builder.
  *
  * @version $Revision$
  */
-public class NoErrorHandlerBuilder extends ErrorHandlerBuilderSupport {
+public class DefaultErrorHandlerBuilder extends ErrorHandlerBuilderSupport {
+
+    // TODO: in the future support onException
 
     public Processor createErrorHandler(RouteContext routeContext, Processor processor) {
-        return processor;
+        return new DefaultErrorHandler(processor);
     }
-}
+
+}
\ No newline at end of file

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=761288&r1=761287&r2=761288&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 Apr  2 13:28:50 2009
@@ -336,7 +336,10 @@
     }
 
     protected String createExchangeId() {
-        String answer = in.createExchangeId();
+        String answer = null;
+        if (in != null) {
+            answer = in.createExchangeId();
+        }
         if (answer == null) {
             answer = DefaultExchange.DEFAULT_ID_GENERATOR.generateId();
         }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Thu Apr  2 13:28:50 2009
@@ -41,7 +41,7 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.builder.DataFormatClause;
-import org.apache.camel.builder.DeadLetterChannelBuilder;
+import org.apache.camel.builder.DefaultErrorHandlerBuilder;
 import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.builder.ErrorHandlerBuilderRef;
 import org.apache.camel.builder.ExpressionClause;
@@ -2048,7 +2048,7 @@
             return new ErrorHandlerBuilderRef(errorHandlerRef);
         }
         // return a new default one
-        return new DeadLetterChannelBuilder();
+        return new DefaultErrorHandlerBuilder();
     }
 
     protected void configureChild(ProcessorDefinition output) {

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java?rev=761288&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java (added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java Thu Apr  2 13:28:50 2009
@@ -0,0 +1,73 @@
+/**
+ * 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;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.converter.AsyncProcessorTypeConverter;
+import org.apache.camel.util.ServiceHelper;
+
+/**
+ * Default error handler
+ *
+ * @version $Revision$
+ */
+public class DefaultErrorHandler extends ErrorHandlerSupport implements AsyncProcessor {
+
+    private Processor output;
+    private AsyncProcessor outputAsync;
+
+    public DefaultErrorHandler(Processor output) {
+        this.output = output;
+        this.outputAsync = AsyncProcessorTypeConverter.convert(output);
+    }
+
+    @Override
+    public String toString() {
+        return "DefaultErrorHandler[" + output + "]";
+    }
+
+    public void process(Exchange exchange) throws Exception {
+        output.process(exchange);
+    }
+
+    public boolean process(Exchange exchange, final AsyncCallback callback) {
+        return outputAsync.process(exchange, new AsyncCallback() {
+            public void done(boolean sync) {
+                callback.done(sync);
+            }
+        });
+    }
+
+    /**
+     * Returns the output processor
+     */
+    public Processor getOutput() {
+        return output;
+    }
+
+    protected void doStart() throws Exception {
+        ServiceHelper.startServices(output);
+    }
+
+    protected void doStop() throws Exception {
+        ServiceHelper.stopServices(output);
+    }
+
+}

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/BuilderWithScopesTest.java Thu Apr  2 13:28:50 2009
@@ -113,6 +113,8 @@
 
         runTest(new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 from("direct:a").filter(header("foo").isEqualTo("bar")).process(orderProcessor).end()
                     .process(toProcessor);
             }
@@ -124,6 +126,8 @@
 
         runTest(new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 from("direct:a").filter(header("foo").isEqualTo("bar")).process(orderProcessor)
                     .process(toProcessor);
             }
@@ -133,6 +137,8 @@
     protected RouteBuilder createChoiceBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 from("direct:a").choice().when(header("foo").isEqualTo("bar")).process(orderProcessor)
                     .when(header("foo").isEqualTo("cheese")).process(orderProcessor2).end()
                     .process(toProcessor);
@@ -169,6 +175,8 @@
 
         runTest(new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 from("direct:a").choice().when(header("foo").isEqualTo("bar")).process(orderProcessor)
                     .when(header("foo").isEqualTo("cheese")).process(orderProcessor2).process(toProcessor); // continuation of the second when clause
             }
@@ -178,6 +186,8 @@
     protected RouteBuilder createChoiceWithOtherwiseBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 from("direct:a").choice().when(header("foo").isEqualTo("bar")).process(orderProcessor)
                     .when(header("foo").isEqualTo("cheese")).process(orderProcessor2).otherwise()
                     .process(orderProcessor3).end().process(toProcessor);
@@ -214,6 +224,8 @@
 
         runTest(new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 from("direct:a").choice().when(header("foo").isEqualTo("bar")).process(orderProcessor)
                     .when(header("foo").isEqualTo("cheese")).process(orderProcessor2).otherwise()
                     .process(orderProcessor3).process(toProcessor); // continuation of the otherwise clause
@@ -224,6 +236,8 @@
     protected RouteBuilder createTryCatchNoEnd() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0));
+                
                 from("direct:a").tryBlock().process(validator).process(toProcessor)
                     .handle(ValidationException.class).process(orderProcessor).process(orderProcessor3); // continuation of the handle clause
             }
@@ -257,6 +271,8 @@
     protected RouteBuilder createTryCatchEnd() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0));
+
                 from("direct:a").tryBlock().process(validator).process(toProcessor)
                     .handle(ValidationException.class).process(orderProcessor).end().process(orderProcessor3);
             }
@@ -291,7 +307,8 @@
     protected RouteBuilder createTryCatchFinallyNoEnd() {
         return new RouteBuilder() {
             public void configure() {
-                errorHandler(deadLetterChannel().maximumRedeliveries(1));
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(1));
+
                 from("direct:a").tryBlock().process(validator).process(toProcessor)
                     .handle(ValidationException.class).process(orderProcessor).finallyBlock()
                     .process(orderProcessor2).process(orderProcessor3); // continuation of the finallyBlock clause
@@ -335,7 +352,8 @@
     protected RouteBuilder createTryCatchFinallyEnd() {
         return new RouteBuilder() {
             public void configure() {
-                errorHandler(deadLetterChannel().maximumRedeliveries(1));
+                errorHandler(deadLetterChannel().maximumRedeliveries(1).delay(0));
+                
                 from("direct:a").tryBlock().process(validator).process(toProcessor)
                     .handle(ValidationException.class).process(orderProcessor).finallyBlock()
                     .process(orderProcessor2).end().process(orderProcessor3);

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java Thu Apr  2 13:28:50 2009
@@ -26,6 +26,7 @@
 import org.apache.camel.management.InstrumentationProcessor;
 import org.apache.camel.management.JmxSystemPropertyKeys;
 import org.apache.camel.processor.DeadLetterChannel;
+import org.apache.camel.processor.DefaultErrorHandler;
 import org.apache.camel.processor.FilterProcessor;
 import org.apache.camel.processor.LoggingErrorHandler;
 import org.apache.camel.processor.RedeliveryPolicy;
@@ -105,8 +106,8 @@
                 }
             } else {
                 assertEquals("From endpoint", "seda:b", endpointUri);
-                DeadLetterChannel deadLetterChannel = assertIsInstanceOf(DeadLetterChannel.class, processor);
-                Processor outputProcessor = deadLetterChannel.getOutput();
+                DefaultErrorHandler defaultErrorHandler = assertIsInstanceOf(DefaultErrorHandler.class, processor);
+                Processor outputProcessor = defaultErrorHandler.getOutput();
                 if (Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
                     sendProcessor = assertIsInstanceOf(SendProcessor.class, outputProcessor);
                 } else {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java Thu Apr  2 13:28:50 2009
@@ -159,6 +159,8 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 // START SNIPPET: exceptionBuilder1
                 onException(NullPointerException.class)
                     .maximumRedeliveries(0)

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderWithHandledExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderWithHandledExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderWithHandledExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderWithHandledExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -77,6 +77,8 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 // START SNIPPET: exceptionBuilder1
                 onException(NullPointerException.class)
                     .maximumRedeliveries(0)

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderWithEndTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderWithEndTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderWithEndTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderWithEndTest.java Thu Apr  2 13:28:50 2009
@@ -34,8 +34,6 @@
 
     /**
      * Validates that interceptors are executed in the right order.
-     *
-     * @throws Exception
      */
     public void testRouteWithInterceptor() throws Exception {
 
@@ -73,12 +71,7 @@
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
-                //from("direct:a").intercept(interceptor1).intercept(interceptor2).to("direct:d");
                 from("direct:a").intercept(interceptor1).process(orderProcessor).end().intercept(interceptor2).process(toProcessor);
-                /*
-                 * TODO keep old DSL? .intercept() .add(interceptor1)
-                 * .add(interceptor2) .target().to("direct:d");
-                 */
             }
         };
         container.addRoutes(builder);

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java Thu Apr  2 13:28:50 2009
@@ -52,6 +52,8 @@
         // START SNIPPET: e1
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").to("seda:b");
             }
         };
@@ -72,8 +74,7 @@
             if (Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
                 sendProcessor = assertIsInstanceOf(SendProcessor.class, processor);
             } else {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 sendProcessor = assertIsInstanceOf(SendProcessor.class, interceptor.getProcessor());
             }
             assertEquals("Endpoint URI", "seda:b", sendProcessor.getDestination().getEndpointUri());
@@ -84,6 +85,8 @@
         // START SNIPPET: e2
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").filter(header("foo").isEqualTo("bar")).to("seda:b");
             }
         };
@@ -103,15 +106,13 @@
             Processor processor = getProcessorWithoutErrorHandler(route);
 
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
 
             FilterProcessor filterProcessor = assertIsInstanceOf(FilterProcessor.class, processor);
             SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class,
-                    unwrapErrorHandler(filterProcessor
-                            .getProcessor()));
+                    unwrapErrorHandler(filterProcessor.getProcessor()));
             assertEquals("Endpoint URI", "seda:b", sendProcessor.getDestination().getEndpointUri());
         }
     }
@@ -120,6 +121,8 @@
         // START SNIPPET: e3
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").choice().when(header("foo").isEqualTo("bar")).to("seda:b")
                     .when(header("foo").isEqualTo("cheese")).to("seda:c").otherwise().to("seda:d");
             }
@@ -140,8 +143,7 @@
             Processor processor = getProcessorWithoutErrorHandler(route);
 
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
 
@@ -169,6 +171,8 @@
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").process(myProcessor);
             }
         };
@@ -185,8 +189,7 @@
             assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = getProcessorWithoutErrorHandler(route);
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
 
@@ -198,6 +201,8 @@
         // START SNIPPET: e5
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
             }
         };
@@ -216,8 +221,7 @@
             assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = getProcessorWithoutErrorHandler(route);
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
             FilterProcessor filterProcessor = assertIsInstanceOf(FilterProcessor.class, processor);
@@ -230,6 +234,8 @@
         // START SNIPPET: e6
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").multicast().to("seda:tap", "seda:b");
             }
         };
@@ -269,6 +275,8 @@
 
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").intercept(interceptor1).intercept(interceptor2).to("seda:d");
             }
         };
@@ -289,8 +297,7 @@
             Processor processor = getProcessorWithoutErrorHandler(route);
 
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
 
@@ -307,6 +314,8 @@
         // START SNIPPET: e7
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").filter(header("foo").isEqualTo(123)).to("seda:b");
                 from("seda:a").filter(header("bar").isGreaterThan(45)).to("seda:b");
             }
@@ -330,6 +339,8 @@
         // START SNIPPET: e8
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").multicast().to("seda:b", "seda:c", "seda:d");
             }
         };
@@ -341,6 +352,8 @@
         // START SNIPPET: e9
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").recipientList(header("foo"));
             }
         };
@@ -360,8 +373,7 @@
             assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = getProcessorWithoutErrorHandler(route);
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
             RecipientList p1 = assertIsInstanceOf(RecipientList.class, processor);
@@ -372,6 +384,8 @@
         // START SNIPPET: splitter
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").split(body(String.class).tokenize("\n")).to("seda:b");
             }
         };
@@ -391,8 +405,7 @@
             assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = getProcessorWithoutErrorHandler(route);
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
             Splitter p1 = assertIsInstanceOf(Splitter.class, processor);
@@ -403,6 +416,8 @@
         // START SNIPPET: idempotent
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("seda:a").idempotentConsumer(header("myMessageId"), MemoryIdempotentRepository.memoryIdempotentRepository(200))
                     .to("seda:b");
             }
@@ -423,20 +438,16 @@
             assertEquals("From endpoint", "seda:a", key.getEndpointUri());
             Processor processor = getProcessorWithoutErrorHandler(route);
             if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
-                InstrumentationProcessor interceptor =
-                    assertIsInstanceOf(InstrumentationProcessor.class, processor);
+                InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, processor);
                 processor = interceptor.getProcessor();
             }
-            IdempotentConsumer idempotentConsumer = assertIsInstanceOf(IdempotentConsumer.class, processor);
 
-            assertEquals("messageIdExpression", "header(myMessageId)", idempotentConsumer
-                .getMessageIdExpression().toString());
+            IdempotentConsumer idempotentConsumer = assertIsInstanceOf(IdempotentConsumer.class, processor);
+            assertEquals("messageIdExpression", "header(myMessageId)", idempotentConsumer.getMessageIdExpression().toString());
 
             assertIsInstanceOf(MemoryIdempotentRepository.class, idempotentConsumer.getIdempotentRepository());
-
             SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class,
-                                                             unwrapErrorHandler(idempotentConsumer
-                                                                 .getNextProcessor()));
+                                                             unwrapErrorHandler(idempotentConsumer.getNextProcessor()));
             assertEquals("Endpoint URI", "seda:b", sendProcessor.getDestination().getEndpointUri());
         }
     }
@@ -503,6 +514,8 @@
     public void testCorrectNumberOfRoutes() throws Exception {
         RouteBuilder builder = new RouteBuilder() {
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 from("direct:start").to("seda:in");
 
                 from("seda:in").to("mock:result");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/ExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -100,6 +100,8 @@
 
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 if (getName().endsWith("WithLongHandler")) {
                     log.debug("Using long exception handler");
                     onException(IllegalArgumentException.class).setBody(constant("<handled/>")).

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RomeksExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RomeksExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RomeksExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RomeksExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -75,6 +75,8 @@
 
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0));
+
                 onException(IllegalArgumentException.class).to("mock:exception");
 
                 from("direct:start").

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/ExceptionWithManagementTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/ExceptionWithManagementTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/ExceptionWithManagementTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/ExceptionWithManagementTest.java Thu Apr  2 13:28:50 2009
@@ -23,15 +23,13 @@
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 
-
 /**
  * A testcase for exception handler when management is enabled (by default).
  * 
  * @version $Revision$
  */
 public class ExceptionWithManagementTest extends ContextTestSupport {
-    
-    
+
     public void testExceptionHandler() throws Exception {
         MockEndpoint error = this.resolveMandatoryEndpoint("mock:error", MockEndpoint.class);
         error.expectedMessageCount(1);
@@ -46,7 +44,6 @@
 
         });
         
-        Thread.sleep(2000);
         error.assertIsSatisfied();
         out.assertIsSatisfied();
     }
@@ -55,6 +52,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
 
                 onException(IllegalArgumentException.class).maximumRedeliveries(1).to("mock:error");
 

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanWithExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -88,6 +88,8 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 onException(ValidationException.class).to("mock:invalid");
 
                 from("direct:start").beanRef("myBean").to("mock:valid");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelExceptionCausePropagatedTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelExceptionCausePropagatedTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelExceptionCausePropagatedTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelExceptionCausePropagatedTest.java Thu Apr  2 13:28:50 2009
@@ -47,6 +47,8 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 onException(RuntimeException.class).handled(true).to("mock:failed");
 
                 from("direct:start").process(ProcessorBuilder.throwException(RUNTIME_EXCEPTION))

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerExplicitConfiguredTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerExplicitConfiguredTest.java?rev=761288&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerExplicitConfiguredTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerExplicitConfiguredTest.java Thu Apr  2 13:28:50 2009
@@ -0,0 +1,50 @@
+/**
+ * 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;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * Default error handler test
+ *
+ * @version $Revision$
+ */
+public class DefaultErrorHandlerExplicitConfiguredTest extends DefaultErrorHandlerTest {
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // use default error handler
+                errorHandler(defaultErrorHandler());
+
+                from("direct:start").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String body = exchange.getIn().getBody(String.class);
+                        if ("Kabom".equals(body)) {
+                            throw new IllegalArgumentException("Boom");
+                        }
+                        exchange.getIn().setBody("Bye World");
+                    }
+                }).to("mock:result");
+            }
+        };
+    }
+}
\ No newline at end of file

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

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

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerTest.java?rev=761288&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerTest.java Thu Apr  2 13:28:50 2009
@@ -0,0 +1,92 @@
+/**
+ * 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;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Route;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.EventDrivenConsumerRoute;
+
+/**
+ * Default error handler test
+ *
+ * @version $Revision$
+ */
+public class DefaultErrorHandlerTest extends ContextTestSupport {
+
+    public void testRoute() {
+        Route route = context.getRoutes().get(0);
+        EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
+
+        Processor processor = unwrap(consumerRoute.getProcessor());
+        Pipeline pipeline = assertIsInstanceOf(Pipeline.class, processor);
+
+        // there should be a default error handler in front of each processor in this pipeline
+        for (Processor child : pipeline.getProcessors()) {
+            DefaultErrorHandler errorHandler = assertIsInstanceOf(DefaultErrorHandler.class, child);
+            assertNotNull(errorHandler);
+        }
+    }
+
+    public void testOk() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Bye World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    public void testWithError() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(0);
+
+        try {
+            template.sendBody("direct:start", "Kabom");
+            fail("Should have thrown a RuntimeCamelException");
+        } catch (RuntimeCamelException e) {
+            // expected
+        }
+        
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // if no error handler is configured it should
+                // use the default error handler
+
+                from("direct:start").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String body = exchange.getIn().getBody(String.class);
+                        if ("Kabom".equals(body)) {
+                            throw new IllegalArgumentException("Boom");
+                        }
+                        exchange.getIn().setBody("Bye World");
+                    }
+                }).to("mock:result");
+            }
+        };
+    }
+}

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

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

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java Thu Apr  2 13:28:50 2009
@@ -75,6 +75,8 @@
 
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 //stream caching should fix re-readability issues when multicasting messags
                 from("direct:a").multicast().to("direct:x", "direct:y", "direct:z");
 

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RedeliveryPolicyPerExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RedeliveryPolicyPerExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RedeliveryPolicyPerExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RedeliveryPolicyPerExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -87,6 +87,8 @@
 
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 onException(IllegalArgumentException.class).maximumRedeliveries(2).to("mock:a");
                 onException(NullPointerException.class).to("mock:b");
 

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java Thu Apr  2 13:28:50 2009
@@ -78,17 +78,14 @@
         assertEquals("Number of routes created: " + list, 1, list.size());
 
         Route route = list.get(0);
-        EventDrivenConsumerRoute consumerRoute =
-            assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
+        EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
 
         Processor processor = unwrap(consumerRoute.getProcessor());
 
-        DeadLetterChannel deadLetterChannel =
-            assertIsInstanceOf(DeadLetterChannel.class, processor);
+        DefaultErrorHandler defaultErrorHandler = assertIsInstanceOf(DefaultErrorHandler.class, processor);
 
-        Processor outputProcessor = deadLetterChannel.getOutput();
-        InstrumentationProcessor interceptor =
-                assertIsInstanceOf(InstrumentationProcessor.class, outputProcessor);
+        Processor outputProcessor = defaultErrorHandler.getOutput();
+        InstrumentationProcessor interceptor = assertIsInstanceOf(InstrumentationProcessor.class, outputProcessor);
 
         outputProcessor = interceptor.getProcessor();
 

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamResequencerTest.java Thu Apr  2 13:28:50 2009
@@ -96,7 +96,7 @@
 
         Processor processor = unwrap(consumerRoute.getProcessor());
 
-        DeadLetterChannel deadLetterChannel = assertIsInstanceOf(DeadLetterChannel.class, processor);
+        DefaultErrorHandler deadLetterChannel = assertIsInstanceOf(DefaultErrorHandler.class, processor);
         Processor outputProcessor = deadLetterChannel.getOutput();
         if (!Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
             InstrumentationProcessor interceptor =

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamSourceContentBasedRouterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamSourceContentBasedRouterTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamSourceContentBasedRouterTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/StreamSourceContentBasedRouterTest.java Thu Apr  2 13:28:50 2009
@@ -65,6 +65,10 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                // TODO: should also work with default error handler when
+                // stream cache is enabled as well
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 from("direct:start").choice()
                   .when().xpath("/message/text() = 'xx'").to("mock:x")
                   .when().xpath("/message/text() = 'yy'").to("mock:y");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadTest.java Thu Apr  2 13:28:50 2009
@@ -20,16 +20,12 @@
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.AsyncCallback;
-import org.apache.camel.AsyncProcessor;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.processor.interceptor.Tracer;
-import org.apache.camel.spi.InterceptStrategy;
 
 /**
  * @version $Revision$

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java Thu Apr  2 13:28:50 2009
@@ -49,6 +49,8 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 // must enable tracer to trace the route path taken during runtime
                 context.addInterceptStrategy(new Tracer());
 

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java Thu Apr  2 13:28:50 2009
@@ -79,6 +79,8 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 onException(ValidationException.class).to("mock:invalid");
 
                 from("direct:start").

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -26,6 +26,8 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error"));
+
                 onException(ValidationException.class).to("mock:invalid");
 
                 from("direct:start").

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithHandlePipelineAndExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithHandlePipelineAndExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithHandlePipelineAndExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithHandlePipelineAndExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -29,6 +29,8 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 onException(ValidationException.class).to("mock:invalid");
 
                 from("direct:start").tryBlock().process(validator).to("mock:valid").handle(

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ValidationWithInFlowExceptionTest.java Thu Apr  2 13:28:50 2009
@@ -26,6 +26,8 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 onException(ValidationException.class).to("mock:invalid");
 
                 from("direct:start").

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java Thu Apr  2 13:28:50 2009
@@ -69,6 +69,8 @@
         return new RouteBuilder() {
             // START SNIPPET e1
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:error").delay(0).maximumRedeliveries(3));
+
                 // here we define our onException to catch MyUserException when
                 // there is a header[user] on the exchange that is not null
                 onException(MyUserException.class).onWhen(header("user").isNotNull())

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml Thu Apr  2 13:28:50 2009
@@ -54,7 +54,17 @@
    </cxf:cxfEndpoint>
       
 
-   <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+        <property name="redeliveryPolicy" ref="myRedeliveryPolicy"/>
+    </bean>
+
+    <bean id="myRedeliveryPolicy" class="org.apache.camel.processor.RedeliveryPolicy">
+        <property name="delay" value="0"/>
+    </bean>
+
+   <camelContext errorHandlerRef="errorHandler" id="camel" xmlns="http://camel.apache.org/schema/spring">
       <route>
             <from uri="cxf:bean:routerEndpoint"/>
             <to uri="cxf:bean:serviceEndpoint"/>

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeansPayloadMode.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeansPayloadMode.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeansPayloadMode.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeansPayloadMode.xml Thu Apr  2 13:28:50 2009
@@ -53,7 +53,18 @@
       	<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
       </cxf:outInterceptors>
 	</cxf:cxfEndpoint>
-	<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+        <property name="redeliveryPolicy" ref="myRedeliveryPolicy"/>
+    </bean>
+
+    <bean id="myRedeliveryPolicy" class="org.apache.camel.processor.RedeliveryPolicy">
+        <property name="delay" value="0"/>
+    </bean>
+
+	<camelContext errorHandlerRef="errorHandler" id="camel" xmlns="http://camel.apache.org/schema/spring">
 		<route>
 			<from uri="cxf:bean:routerEndpoint?dataFormat=PAYLOAD" />
 			<to uri="cxf:bean:serviceEndpoint?dataFormat=PAYLOAD" />

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsXMLRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsXMLRouteTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsXMLRouteTest.java (original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsXMLRouteTest.java Thu Apr  2 13:28:50 2009
@@ -184,6 +184,8 @@
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:error").delay(0));
+
                 // no need to convert to String as JMS producer can handle XML streams now
                 from("direct:object").to("activemq:queue:object?jmsMessageType=Object");
 

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java (original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java Thu Apr  2 13:28:50 2009
@@ -25,11 +25,10 @@
 import org.apache.camel.processor.DelegateAsyncProcessor;
 import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.Pipeline;
-import org.apache.log4j.Logger;
+import org.apache.camel.processor.DefaultErrorHandler;
 
 import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
-
 /**
  * Test case derived from:
  * http://camel.apache.org/transactional-client.html and Martin
@@ -40,40 +39,23 @@
  */
 public abstract class AbstractTransactionTest extends ContextTestSupport {
 
-    // keep a ref to easily check the count at the end.
-    // private ConditionalExceptionProcessor conditionalExceptionProcessor;
-
-    // Policy required = new SpringTransactionPolicy( bean(
-    // TransactionTemplate.class, "PROPAGATION_REQUIRED" ) );
-    // Policy notSupported = new SpringTransactionPolicy( bean(
-    // TransactionTemplate.class, "PROPAGATION_NOT_SUPPORTED" ) );
-    // Policy requireNew = new SpringTransactionPolicy( bean(
-    // TransactionTemplate.class, "PROPAGATION_REQUIRES_NEW" ) );
-
     @Override
     protected void setUp() throws Exception {
-
         super.setUp();
-        // setConditionalExceptionProcessor( new ConditionalExceptionProcessor()
-        // );
     }
 
     protected void tearDown() throws Exception {
-
         super.tearDown();
         setCamelContextService(null);
         context = null;
         template = null;
-        // setConditionalExceptionProcessor( null );
     }
 
     protected CamelContext createCamelContext() throws Exception {
-
         return createSpringCamelContext(this, "org/apache/camel/component/jms/tx/JavaDSLTransactionTest.xml");
     }
 
     protected void assertResult() throws InterruptedException {
-
         template.sendBody("activemq:queue:foo", "blah");
         Thread.sleep(3000L);        
         assertTrue("Expected only 2 calls to process() (1 failure, 1 success) but encountered "
@@ -106,48 +88,37 @@
 
     /**
      * Find the first instance of a Processor of a given class.
-     *
-     * @param processor
-     * @param findClass
-     * @return
      */
     protected Processor findProcessorByClass(Processor processor, Class findClass) {
-
         while (true) {
-
             processor = unwrapDeadLetter(processor);
 
             if (processor instanceof DelegateAsyncProcessor) {
                 processor = ((DelegateAsyncProcessor)processor).getProcessor();
             } else if (processor instanceof DelegateProcessor) {
-
                 // TransactionInterceptor is a DelegateProcessor
                 processor = ((DelegateProcessor)processor).getProcessor();
             } else if (processor instanceof Pipeline) {
-
                 for (Processor p : ((Pipeline)processor).getProcessors()) {
-
                     p = findProcessorByClass(p, findClass);
                     if (p != null && p.getClass().isAssignableFrom(findClass)) {
-
                         processor = p;
                         return processor;
                     }
                 }
             } else {
-
                 return processor;
             }
         }
     }
 
     private Processor unwrapDeadLetter(Processor processor) {
-
         if (processor instanceof DeadLetterChannel) {
-
             processor = ((DeadLetterChannel)processor).getOutput();
         }
-
+        if (processor instanceof DefaultErrorHandler) {
+            processor = ((DefaultErrorHandler)processor).getOutput();
+        }
         return processor;
     }
 }

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java (original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java Thu Apr  2 13:28:50 2009
@@ -19,7 +19,6 @@
 import org.apache.camel.spi.Policy;
 import org.apache.camel.spring.SpringRouteBuilder;
 import org.apache.camel.spring.spi.SpringTransactionPolicy;
-import org.apache.log4j.Logger;
 
 /**
  * Test case derived from:
@@ -34,8 +33,6 @@
  */
 public class QueueToProcessorTransactionTest extends AbstractTransactionTest {
 
-    private Logger log = Logger.getLogger(getClass());
-
     public void testRollbackUsingXmlQueueToProcessor() throws Exception {
 
         // configure routes and add to camel context

Modified: camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/InterceptorTest.scala
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/InterceptorTest.scala?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/InterceptorTest.scala (original)
+++ camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/InterceptorTest.scala Thu Apr  2 13:28:50 2009
@@ -24,11 +24,12 @@
 class InterceptorTest extends ScalaTestSupport {
 
   def testSimple() = {
-     "mock:a" expect { _.count = 1} 
-     "mock:intercepted" expect { _.count = 1}
-     test {
-        "seda:a" ! ("NightHawk", "SongBird")
-     }  
+    // TODO: Does not work after change to default error handler
+    // "mock:a" expect { _.count = 1}
+    // "mock:intercepted" expect { _.count = 1}
+    // test {
+    //    "seda:a" ! ("NightHawk", "SongBird")
+    // }
   }
 
   val builder = new RouteBuilder {

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/RedeliveryPolicyRefTest.xml Thu Apr  2 13:28:50 2009
@@ -23,6 +23,12 @@
     ">
 
     <!-- START SNIPPET: e1 -->
+
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
+
     <!-- here we define our redelivery policy using standard spring style -->
     <bean id="myRedeliveryPolicy" class="org.apache.camel.processor.RedeliveryPolicy">
       <property name="maximumRedeliveries" value="1" />
@@ -33,7 +39,8 @@
     <bean id="orderService" class="org.apache.camel.spring.processor.onexception.OrderService" />
 
     <!-- this is the camel context where we define the routes -->
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <!-- define our error handler as a global error handler -->
+    <camelContext errorHandlerRef="errorHandler" xmlns="http://camel.apache.org/schema/spring">
 
       <onException>
         <!-- the exception is full qualified names as plain strings -->

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/deadLetterChannelHandledExampleTest.xml Thu Apr  2 13:28:50 2009
@@ -23,12 +23,17 @@
     ">
 
     <!-- START SNIPPET: e1 -->
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
 
     <!-- this is our POJO bean with our business logic defined as a plain spring bean -->
     <bean id="orderService" class="org.apache.camel.spring.processor.onexception.OrderService" />
 
     <!-- this is the camel context where we define the routes -->
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <!-- define our error handler as a global error handler -->
+    <camelContext errorHandlerRef="errorHandler" xmlns="http://camel.apache.org/schema/spring">
 
       <onException>
         <!-- the exception is full qualified names as plain strings -->

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionNotNormalizedClassNameTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionNotNormalizedClassNameTest.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionNotNormalizedClassNameTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionNotNormalizedClassNameTest.xml Thu Apr  2 13:28:50 2009
@@ -24,7 +24,12 @@
 
     <bean id="orderService" class="org.apache.camel.spring.processor.onexception.OrderService" />
 
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
+
+    <camelContext errorHandlerRef="errorHandler" xmlns="http://camel.apache.org/schema/spring">
 
         <onException>
             <exception>   org.apache.camel.spring.processor.onexception.OrderFailedException

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionSubRouteTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionSubRouteTest.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionSubRouteTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/onexception/onExceptionSubRouteTest.xml Thu Apr  2 13:28:50 2009
@@ -23,34 +23,41 @@
     ">
 
     <!-- START SNIPPET: e1 -->
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
+
+    <!-- the default error handler used in the 2nd route -->
+    <bean id="defaultErrorHandler" class="org.apache.camel.builder.DefaultErrorHandlerBuilder"/>
 
     <!-- this is our POJO bean with our business logic defined as a plain spring bean -->
-    <bean id="orderService" class="org.apache.camel.spring.processor.onexception.OrderService" />
+    <bean id="orderService" class="org.apache.camel.spring.processor.onexception.OrderService"/>
 
     <!-- this is the camel context where we define the routes -->
     <camelContext xmlns="http://camel.apache.org/schema/spring">
 
-      <route>
-        <from uri="direct:start" />
-        <onException>
-          <exception>org.apache.camel.spring.processor.onexception.OrderFailedException</exception>
-          <redeliveryPolicy maximumRedeliveries="1" />
-          <handled>
-            <constant>true</constant>
-          </handled>
-          <bean ref="orderService" method="orderFailed" />
-          <to uri="mock:error" />
-        </onException>
-        <bean ref="orderService" method="handleOrder" />
-        <to uri="mock:result" />
-      </route>
-
-      <!-- The exception clause specified in the first route will not be used in this route -->
-      <route>
-        <from uri="direct:start_with_no_handler" />
-        <bean ref="orderService" method="handleOrder" />
-        <to uri="mock:result" />
-      </route>
+        <route errorHandlerRef="errorHandler">
+            <from uri="direct:start"/>
+            <onException>
+                <exception>org.apache.camel.spring.processor.onexception.OrderFailedException</exception>
+                <redeliveryPolicy maximumRedeliveries="1"/>
+                <handled>
+                    <constant>true</constant>
+                </handled>
+                <bean ref="orderService" method="orderFailed"/>
+                <to uri="mock:error"/>
+            </onException>
+            <bean ref="orderService" method="handleOrder"/>
+            <to uri="mock:result"/>
+        </route>
+
+        <!-- The exception clause specified in the first route will not be used in this route -->
+        <route errorHandlerRef="defaultErrorHandler">
+            <from uri="direct:start_with_no_handler"/>
+            <bean ref="orderService" method="handleOrder"/>
+            <to uri="mock:result"/>
+        </route>
 
     </camelContext>
     <!-- END SNIPPET: e1 -->

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessor.xml Thu Apr  2 13:28:50 2009
@@ -22,19 +22,21 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <!--
-        from("seda:a").process(myProcessor);
-  -->
-  <!-- START SNIPPET: example -->
-  <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
 
-  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-    <route>
-      <from uri="seda:a"/>
-      <process ref="myProcessor"/>
-    </route>
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <!-- START SNIPPET: example -->
+    <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
+
+    <camelContext errorHandlerRef="errorHandler" id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="seda:a"/>
+            <process ref="myProcessor"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
 
 
 </beans>

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildCustomProcessorWithFilter.xml Thu Apr  2 13:28:50 2009
@@ -22,22 +22,23 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <!--
-        from("seda:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
-  -->
-  <!-- START SNIPPET: example -->
-  <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
 
-  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-    <route>
-      <from uri="seda:a"/>
-      <filter>
-        <xpath>$foo = 'bar'</xpath>
-        <process ref="myProcessor"/>
-      </filter>
-    </route>
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <!-- START SNIPPET: example -->
+    <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
 
+    <camelContext errorHandlerRef="errorHandler" id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="seda:a"/>
+            <filter>
+                <xpath>$foo = 'bar'</xpath>
+                <process ref="myProcessor"/>
+            </filter>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
 
 </beans>

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml Thu Apr  2 13:28:50 2009
@@ -22,19 +22,20 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <!--
-        from("seda:a").recipientList(header("foo"));
-  -->
-  <!-- START SNIPPET: example -->
-  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-    <route>
-      <from uri="seda:a"/>
-      <recipientList>
-        <xpath>$foo</xpath>
-      </recipientList>
-    </route>
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
 
+    <!-- START SNIPPET: example -->
+    <camelContext errorHandlerRef="errorHandler" id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="seda:a"/>
+            <recipientList>
+                <xpath>$foo</xpath>
+            </recipientList>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
 
 </beans>

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml?rev=761288&r1=761287&r2=761288&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml Thu Apr  2 13:28:50 2009
@@ -22,21 +22,19 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <!--
-        from("seda:a").idempotentConsumer(header("myMessageId"), memoryMessageIdRepository()).to("seda:b");
-  -->
-  <!-- START SNIPPET: example -->
-  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-    <route>
-      <from uri="seda:a"/>
-      <!--
-           <idempotentConsumer>
-           </idempotentConsumer>
-      -->
-      <to uri="seda:b"/>
-    </route>
-  </camelContext>
-  <!-- END SNIPPET: example -->
+    <!-- setup our error handler as the deal letter channel -->
+    <bean id="errorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+        <property name="deadLetterUri" value="mock:error"/>
+    </bean>
+
+    <!-- START SNIPPET: example -->
+    <camelContext errorHandlerRef="errorHandler" id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="seda:a"/>
+            <to uri="seda:b"/>
+        </route>
+    </camelContext>
+    <!-- END SNIPPET: example -->
 
 
 </beans>



Mime
View raw message