camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r679298 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/CamelContext.java main/java/org/apache/camel/builder/BuilderSupport.java test/java/org/apache/camel/builder/ErrorHandlerTest.java
Date Thu, 24 Jul 2008 08:20:53 GMT
Author: ningjiang
Date: Thu Jul 24 01:20:52 2008
New Revision: 679298

URL: http://svn.apache.org/viewvc?rev=679298&view=rev
Log:
Reenable the tests in ErrorHandlerTest

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java?rev=679298&r1=679297&r2=679298&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java Thu Jul
24 01:20:52 2008
@@ -20,6 +20,7 @@
 import java.util.List;
 import java.util.concurrent.Callable;
 
+import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.model.RouteType;
 import org.apache.camel.spi.ExchangeConverter;
 import org.apache.camel.spi.Injector;
@@ -203,4 +204,14 @@
     <E extends Exchange> ProducerTemplate<E> createProducerTemplate();
 
     void addInterceptStrategy(InterceptStrategy interceptStrategy);
+
+    /**
+     * Gets the default error handler builder which is inherited by the routes
+     */
+    public ErrorHandlerBuilder getErrorHandlerBuilder();
+
+    /**
+     * Sets the default error handler builder which is inherited by the routes
+     */
+    public void setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder);
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java?rev=679298&r1=679297&r2=679298&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
Thu Jul 24 01:20:52 2008
@@ -247,7 +247,11 @@
 
     protected ErrorHandlerBuilder createErrorHandlerBuilder() {
         if (isInheritErrorHandler()) {
-            return new DeadLetterChannelBuilder();
+            ErrorHandlerBuilder errorHandler= context.getErrorHandlerBuilder();
+            if (errorHandler == null) {
+                errorHandler = new DeadLetterChannelBuilder();
+            }
+            return errorHandler;
         } else {
             return new NoErrorHandlerBuilder();
         }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java?rev=679298&r1=679297&r2=679298&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
Thu Jul 24 01:20:52 2008
@@ -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.DelegateAsyncProcessor;
 import org.apache.camel.processor.FilterProcessor;
 import org.apache.camel.processor.LoggingErrorHandler;
 import org.apache.camel.processor.RedeliveryPolicy;
@@ -36,8 +37,8 @@
  */
 public class ErrorHandlerTest extends TestSupport {
 
-    // TODO get the test fixed
-    public void xtestOverloadingTheDefaultErrorHandler() throws Exception {
+
+    public void testOverloadingTheDefaultErrorHandler() throws Exception {
         // START SNIPPET: e1
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -55,9 +56,10 @@
 
             EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class,
route);
             Processor processor = consumerRoute.getProcessor();
-
+            processor = unwrap(processor);
             LoggingErrorHandler loggingProcessor = assertIsInstanceOf(LoggingErrorHandler.class,
processor);
-            SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, loggingProcessor.getOutput());
+            processor = unwrap(loggingProcessor.getOutput());
+            SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, processor);
             log.debug("Found sendProcessor: " + sendProcessor);
         }
     }
@@ -134,8 +136,8 @@
         }
     }
 
-    // TODO Fix the test
-    public void xtestConfigureDeadLetterChannelWithCustomRedeliveryPolicy() throws Exception
{
+
+    public void testConfigureDeadLetterChannelWithCustomRedeliveryPolicy() throws Exception
{
         // START SNIPPET: e4
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
@@ -153,6 +155,7 @@
 
             EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class,
route);
             Processor processor = consumerRoute.getProcessor();
+            processor = unwrap(processor);
 
             DeadLetterChannel deadLetterChannel = assertIsInstanceOf(DeadLetterChannel.class,
processor);
 
@@ -184,14 +187,14 @@
 
             LoggingErrorHandler loggingProcessor = assertIsInstanceOf(LoggingErrorHandler.class,
processor);
 
-            if (Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {   
+            if (Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
                 processor = loggingProcessor.getOutput();
             } else {
                 InstrumentationProcessor interceptor =
                     assertIsInstanceOf(InstrumentationProcessor.class, loggingProcessor.getOutput());
                 processor = interceptor.getProcessor();
             }
-            
+
             FilterProcessor filterProcessor = assertIsInstanceOf(FilterProcessor.class, processor);
             SendProcessor sendProcessor = assertIsInstanceOf(SendProcessor.class, filterProcessor.getProcessor());
 



Mime
View raw message