camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r906068 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/processor/BatchProcessor.java test/java/org/apache/camel/processor/aggregator/AggregatorBeanThrowExceptionTest.java
Date Wed, 03 Feb 2010 14:34:44 GMT
Author: davsclaus
Date: Wed Feb  3 14:34:43 2010
New Revision: 906068

URL: http://svn.apache.org/viewvc?rev=906068&view=rev
Log:
CAMEL-2443: BatchProcessor now logs unhandled exceptions so you see these in the logs.

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorBeanThrowExceptionTest.java
      - copied, changed from r906038, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorTimerAndTracerTest.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java?rev=906068&r1=906067&r2=906068&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java Wed
Feb  3 14:34:43 2010
@@ -196,6 +196,9 @@
      */
     protected void processExchange(Exchange exchange) throws Exception {
         processor.process(exchange);
+        if (exchange.getException() != null) {
+            getExceptionHandler().handleException("Error processing Exchange: " + exchange,
exchange.getException());
+        }
     }
 
     protected void doStart() throws Exception {

Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorBeanThrowExceptionTest.java
(from r906038, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorTimerAndTracerTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorBeanThrowExceptionTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorBeanThrowExceptionTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorTimerAndTracerTest.java&r1=906038&r2=906068&rev=906068&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorTimerAndTracerTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregatorBeanThrowExceptionTest.java
Wed Feb  3 14:34:43 2010
@@ -18,35 +18,27 @@
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
 
 /**
  * Unit test with timer, splitter, aggregator and tracer.
  */
-public class AggregatorTimerAndTracerTest extends ContextTestSupport {
+public class AggregatorBeanThrowExceptionTest extends ContextTestSupport {
 
-    public void testAggregatorTimerAndTracer() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedBodiesReceived("c");
-
-        assertMockEndpointsSatisfied();
+    public void testAggregatorToBeanThrowException() throws Exception {
+        template.sendBodyAndHeader("direct:start", "Hello World", "id", "A");
+        Thread.sleep(2000);
     }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                getContext().setTracing(true);
-                
-                from("seda:splitted").
-                    aggregate(header("id")).
-                    to("mock:foo").
-                    to("mock:result");
 
-                from("timer://kickoff?period=9999910000").
-                    setHeader("id").constant("foo").setBody().constant("a b c").
-                    split(body().tokenize(" ")).to("seda:splitted");
+                from("direct:start").
+                    aggregate(header("id")).
+                        bean(AggregatorBeanThrowExceptionTest.class, "fooDoesNotExistMethod").
+                        to("log:foo");
             }
         };
     }
-}
+}
\ No newline at end of file



Mime
View raw message