camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r836346 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/ main/java/org/apache/camel/model/ main/java/org/apache/camel/processor/ main/java/org/apache/camel/processor/interceptor/ test/java/org/apache/camel/issues/ test/jav...
Date Sun, 15 Nov 2009 10:14:27 GMT
Author: davsclaus
Date: Sun Nov 15 10:14:27 2009
New Revision: 836346

URL: http://svn.apache.org/viewvc?rev=836346&view=rev
Log:
CAMEL-2172, CAMEL-2173: Improved tracer to output try catch finally onException and aggregate.
Also made the code in TraceInterceptor a bit easier to understand and maintain.

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java   (contents,
props changed)
      - copied, changed from r836224, camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java
      - copied, changed from r836224, camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.java   (with
props)
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TryCatchWithSplitIssueTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerOnExceptionTraceTest.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/aggregator/AggregatorTimerAndTracerTest.java

Copied: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java
(from r836224, camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java&r1=836224&r2=836346&rev=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/AggregateRouteNode.java Sun
Nov 15 10:14:27 2009
@@ -19,19 +19,18 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.RouteNode;
+import org.apache.camel.model.AggregateDefinition;
 import org.apache.camel.model.ProcessorDefinition;
 
 /**
- * A default implementation of the {@link org.apache.camel.RouteNode}
- *
  * @version $Revision$
  */
-public class OnCompletionRouteNode implements RouteNode {
+public class AggregateRouteNode implements RouteNode {
 
-    private final Exchange exchange;
+    private AggregateDefinition aggregateDefinition;
 
-    public OnCompletionRouteNode(Exchange exchange) {
-        this.exchange = exchange;
+    public AggregateRouteNode(AggregateDefinition aggregateDefinition) {
+        this.aggregateDefinition = aggregateDefinition;
     }
 
     public Processor getProcessor() {
@@ -43,7 +42,8 @@
     }
 
     public String getLabel(Exchange exchange) {
-        return "OnCompletion[" + exchange.getProperty(Exchange.CORRELATION_ID) + "]";
+        String expressionString = (aggregateDefinition.getExpression() != null) ? aggregateDefinition.getExpression().getLabel()
: "";
+        return "aggregate[" + expressionString + "]";
     }
 
     public boolean isAbstract() {
@@ -52,6 +52,6 @@
 
     @Override
     public String toString() {
-        return "OnCompletionRouteNode";
+        return "AggregateRouteNode";
     }
 }
\ No newline at end of file

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

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

Copied: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java (from
r836224, camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java&r1=836224&r2=836346&rev=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoCatchRouteNode.java Sun Nov
15 10:14:27 2009
@@ -19,19 +19,15 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.RouteNode;
+import org.apache.camel.model.CatchDefinition;
 import org.apache.camel.model.ProcessorDefinition;
 
 /**
- * A default implementation of the {@link org.apache.camel.RouteNode}
- *
  * @version $Revision$
  */
-public class OnExceptionRouteNode implements RouteNode {
+public class DoCatchRouteNode implements RouteNode {
 
-    private final Exchange exchange;
-
-    public OnExceptionRouteNode(Exchange exchange) {
-        this.exchange = exchange;
+    public DoCatchRouteNode() {
     }
 
     public Processor getProcessor() {
@@ -43,7 +39,7 @@
     }
 
     public String getLabel(Exchange exchange) {
-        return "OnException[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName()
+ "]";
+        return "doCatch[" + exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getClass().getSimpleName()
+ "]";
     }
 
     public boolean isAbstract() {
@@ -52,6 +48,6 @@
 
     @Override
     public String toString() {
-        return "OnExceptionRouteNode";
+        return "DoCatchRouteNode";
     }
 }
\ No newline at end of file

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.java?rev=836346&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.java (added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DoFinallyRouteNode.java Sun
Nov 15 10:14:27 2009
@@ -0,0 +1,52 @@
+/**
+ * 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.impl;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.RouteNode;
+import org.apache.camel.model.ProcessorDefinition;
+
+/**
+ * @version $Revision$
+ */
+public class DoFinallyRouteNode implements RouteNode {
+
+    public DoFinallyRouteNode() {
+    }
+
+    public Processor getProcessor() {
+        return null;
+    }
+
+    public ProcessorDefinition<?> getProcessorDefinition() {
+        return null;
+    }
+
+    public String getLabel(Exchange exchange) {
+        return "doFinally";
+    }
+
+    public boolean isAbstract() {
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "DoFinallyRouteNode";
+    }
+}
\ No newline at end of file

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

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

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java?rev=836346&r1=836345&r2=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnCompletionRouteNode.java
Sun Nov 15 10:14:27 2009
@@ -22,16 +22,11 @@
 import org.apache.camel.model.ProcessorDefinition;
 
 /**
- * A default implementation of the {@link org.apache.camel.RouteNode}
- *
  * @version $Revision$
  */
 public class OnCompletionRouteNode implements RouteNode {
 
-    private final Exchange exchange;
-
-    public OnCompletionRouteNode(Exchange exchange) {
-        this.exchange = exchange;
+    public OnCompletionRouteNode() {
     }
 
     public Processor getProcessor() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java?rev=836346&r1=836345&r2=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/OnExceptionRouteNode.java Sun
Nov 15 10:14:27 2009
@@ -22,16 +22,11 @@
 import org.apache.camel.model.ProcessorDefinition;
 
 /**
- * A default implementation of the {@link org.apache.camel.RouteNode}
- *
  * @version $Revision$
  */
 public class OnExceptionRouteNode implements RouteNode {
 
-    private final Exchange exchange;
-
-    public OnExceptionRouteNode(Exchange exchange) {
-        this.exchange = exchange;
+    public OnExceptionRouteNode() {
     }
 
     public Processor getProcessor() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java?rev=836346&r1=836345&r2=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
Sun Nov 15 10:14:27 2009
@@ -23,7 +23,7 @@
 /**
  * Helper class for ProcessorDefinition and the other model classes.
  */
-final class ProcessorDefinitionHelper {
+public final class ProcessorDefinitionHelper {
 
     private ProcessorDefinitionHelper() {
     }
@@ -58,6 +58,29 @@
         return found.iterator().next();
     }
 
+    /**
+     * Is the given child the first in the outputs from the parent?
+     *
+     * @param parentType the type the parent must be
+     * @param node the node
+     * @return <tt>true</tt> if first child, <tt>false</tt> otherwise
+     */
+    public static boolean isFirstChildOfType(Class parentType, ProcessorDefinition node)
{
+        if (node == null || node.getParent() == null) {
+            return false;
+        }
+
+        if (node.getParent().getOutputs().isEmpty()) {
+            return false;
+        }
+
+        if (!(node.getParent().getClass().equals(parentType))) {
+            return false;
+        }
+
+        return node.getParent().getOutputs().get(0).equals(node);
+    }
+
     @SuppressWarnings("unchecked")
     private static void doFindType(List<ProcessorDefinition> outputs, Class<?>
type, List found) {
         if (outputs == null || outputs.isEmpty()) {
@@ -97,4 +120,5 @@
         }
     }
 
+
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java?rev=836346&r1=836345&r2=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java Sun
Nov 15 10:14:27 2009
@@ -52,7 +52,7 @@
     }
 
     public String getTraceLabel() {
-        return "try";
+        return "doTry";
     }
 
     public void process(Exchange exchange) throws Exception {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java?rev=836346&r1=836345&r2=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
Sun Nov 15 10:14:27 2009
@@ -26,12 +26,19 @@
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.impl.DefaultRouteNode;
+import org.apache.camel.impl.DoCatchRouteNode;
+import org.apache.camel.impl.DoFinallyRouteNode;
+import org.apache.camel.impl.AggregateRouteNode;
 import org.apache.camel.impl.OnCompletionRouteNode;
+import org.apache.camel.impl.OnExceptionRouteNode;
+import org.apache.camel.model.AggregateDefinition;
+import org.apache.camel.model.CatchDefinition;
+import org.apache.camel.model.FinallyDefinition;
 import org.apache.camel.model.InterceptDefinition;
 import org.apache.camel.model.OnCompletionDefinition;
 import org.apache.camel.model.OnExceptionDefinition;
 import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.model.TryDefinition;
+import org.apache.camel.model.ProcessorDefinitionHelper;
 import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.Logger;
 import org.apache.camel.spi.ExchangeFormatter;
@@ -110,18 +117,32 @@
                 if (exchange.getUnitOfWork() != null) {
                     TracedRouteNodes traced = exchange.getUnitOfWork().getTracedRouteNodes();
 
-                    if (node instanceof OnCompletionDefinition || node instanceof OnExceptionDefinition
|| node instanceof TryDefinition) {
+                    if (node instanceof OnCompletionDefinition || node instanceof OnExceptionDefinition)
{
                         // skip any of these as its just a marker definition
                         trace = false;
-                    } else if (exchange.getProperty(Exchange.ON_COMPLETION) != null) {
+                    } else if (ProcessorDefinitionHelper.isFirstChildOfType(OnCompletionDefinition.class,
node)) {
                         // special for on completion tracing
                         traceOnCompletion(traced, exchange);
+                    } else if (ProcessorDefinitionHelper.isFirstChildOfType(OnExceptionDefinition.class,
node)) {
+                        // special for on exception
+                        traceOnException(traced, exchange);
+                    } else if (ProcessorDefinitionHelper.isFirstChildOfType(CatchDefinition.class,
node)) {
+                        // special for do catch
+                        traceDoCatch(traced, exchange);
+                    } else if (ProcessorDefinitionHelper.isFirstChildOfType(FinallyDefinition.class,
node)) {
+                        // special for do finally
+                        traceDoFinally(traced, exchange);
+                    } else if (ProcessorDefinitionHelper.isFirstChildOfType(AggregateDefinition.class,
node)) {
+                        // special for aggregate
+                        traceAggregate(traced, exchange);
                     } else {
                         // regular so just add it
                         traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
                     }
                 } else {
-                    LOG.trace("Cannot trace as this Exchange does not have an UnitOfWork:
" + exchange);
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace("Cannot trace as this Exchange does not have an UnitOfWork:
" + exchange);
+                    }
                 }
             }
 
@@ -154,17 +175,42 @@
     }
 
     private void traceOnCompletion(TracedRouteNodes traced, Exchange exchange) {
-        // if ON_COMPLETION is not null then we are actually doing the onCompletion routing
-        // add the onCompletion and then the processor that is invoked next
-        if (!(traced.getSecondLastNode() instanceof OnCompletionRouteNode)) {
-            // only and on completion once when we start the on completion routing
-            traced.addTraced(new OnCompletionRouteNode(exchange));
-            // add the next processor as well
-            traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
-        } else {
-            // regular during on completion so add it
-            traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
-        }
+        traced.addTraced(new OnCompletionRouteNode());
+        // do not log and trace as onCompletion should be a new event on its own
+        // add the next step as well so we have onCompletion -> new step
+        traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
+    }
+
+    private void traceOnException(TracedRouteNodes traced, Exchange exchange) throws Exception
{
+        traced.addTraced(new DefaultRouteNode(traced.getLastNode().getProcessorDefinition(),
traced.getLastNode().getProcessor()));
+        traced.addTraced(new OnExceptionRouteNode());
+        // log and trace so we have the from -> onException event as well
+        logExchange(exchange);
+        traceExchange(exchange);
+        traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
+    }
+
+    private void traceDoCatch(TracedRouteNodes traced, Exchange exchange) throws Exception
{
+        traced.addTraced(new DefaultRouteNode(traced.getLastNode().getProcessorDefinition(),
traced.getLastNode().getProcessor()));
+        traced.addTraced(new DoCatchRouteNode());
+        // log and trace so we have the from -> doCatch event as well
+        logExchange(exchange);
+        traceExchange(exchange);
+        traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
+    }
+
+    private void traceDoFinally(TracedRouteNodes traced, Exchange exchange) throws Exception
{
+        traced.addTraced(new DefaultRouteNode(traced.getLastNode().getProcessorDefinition(),
traced.getLastNode().getProcessor()));
+        traced.addTraced(new DoFinallyRouteNode());
+        // log and trace so we have the from -> doFinally event as well
+        logExchange(exchange);
+        traceExchange(exchange);
+        traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
+    }
+
+    private void traceAggregate(TracedRouteNodes traced, Exchange exchange) {
+        traced.addTraced(new AggregateRouteNode((AggregateDefinition) node.getParent()));
+        traced.addTraced(new DefaultRouteNode(node, super.getProcessor()));
     }
 
     protected void traceIntercept(InterceptDefinition intercept, TracedRouteNodes traced,
Exchange exchange) throws Exception {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TryCatchWithSplitIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TryCatchWithSplitIssueTest.java?rev=836346&r1=836345&r2=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TryCatchWithSplitIssueTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TryCatchWithSplitIssueTest.java
Sun Nov 15 10:14:27 2009
@@ -41,6 +41,17 @@
         assertMockEndpointsSatisfied();
     }
 
+    public void testSplitOnlyWithErrorIsHandled() throws Exception {
+        MockEndpoint error = getMockEndpoint("mock:error");
+        error.expectedBodiesReceived("James");
+        error.message(0).property(Exchange.EXCEPTION_CAUGHT).isNotNull();
+        error.message(0).property(Exchange.EXCEPTION_CAUGHT).convertTo(String.class).isEqualTo("This
is a dummy error James!");
+
+        template.sendBody("direct:start", "James");
+
+        assertMockEndpointsSatisfied();
+    }
+
 
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry jndi = super.createRegistry();
@@ -51,13 +62,18 @@
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
+                context.setTracing(true);
+
                 from("direct:start")
                     .split(body().tokenize("@"))
                     .doTry()
                         .to("bean:error")
                         .to("mock:result")
-                    .doCatch(java.lang.Exception.class)
+                    .doCatch(Exception.class)
                         .to("mock:error")
+                    .doFinally()
+                        .to("mock:foo")
+                        .to("mock:bar")
                     .end();
             }
 
@@ -68,7 +84,7 @@
 
         public String dummyException(String payload) throws Exception {
             if (payload.equals("James")) {
-                throw new Exception("This is a dummy error James!");
+                throw new IllegalArgumentException("This is a dummy error James!");
             }
             return "Hi " + payload;
         }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerOnExceptionTraceTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerOnExceptionTraceTest.java?rev=836346&r1=836345&r2=836346&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerOnExceptionTraceTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DefaultErrorHandlerOnExceptionTraceTest.java
Sun Nov 15 10:14:27 2009
@@ -61,7 +61,7 @@
     public void testWithError() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:boom");
         mock.expectedMessageCount(1);
-        getMockEndpoint("mock:trace").expectedMessageCount(3);
+        getMockEndpoint("mock:trace").expectedMessageCount(4);
 
         template.sendBody("direct:start", "Kabom");
 
@@ -70,15 +70,19 @@
         TraceEventMessage msg1 = getMockEndpoint("mock:trace").getReceivedExchanges().get(0).getIn().getBody(TraceEventMessage.class);
         TraceEventMessage msg2 = getMockEndpoint("mock:trace").getReceivedExchanges().get(1).getIn().getBody(TraceEventMessage.class);
         TraceEventMessage msg3 = getMockEndpoint("mock:trace").getReceivedExchanges().get(2).getIn().getBody(TraceEventMessage.class);
+        TraceEventMessage msg4 = getMockEndpoint("mock:trace").getReceivedExchanges().get(3).getIn().getBody(TraceEventMessage.class);
 
         assertEquals("direct://start", msg1.getFromEndpointUri());
         assertEquals("ref:myProcessor", msg1.getToNode());
 
         assertEquals("ref:myProcessor", msg2.getPreviousNode());
-        assertEquals("log://boom", msg2.getToNode());
+        assertEquals("OnException[IllegalArgumentException]", msg2.getToNode());
 
-        assertEquals("log://boom", msg3.getPreviousNode());
-        assertEquals("mock://boom", msg3.getToNode());
+        assertEquals("OnException[IllegalArgumentException]", msg3.getPreviousNode());
+        assertEquals("log://boom", msg3.getToNode());
+
+        assertEquals("log://boom", msg4.getPreviousNode());
+        assertEquals("mock://boom", msg4.getToNode());
     }
 
     @Override

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=836346&r1=836345&r2=836346&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
Sun Nov 15 10:14:27 2009
@@ -73,8 +73,8 @@
 
             // get the list of intercepted nodes
             List<RouteNode> list = traced.getNodes();
-            // get the 2rd last as its the bean
-            Processor last = list.get(list.size() - 2).getProcessor();
+            // get the 3rd last as its the bean
+            Processor last = list.get(list.size() - 3).getProcessor();
 
             // wrapped by JMX
             if (last instanceof InstrumentationProcessor) {

Modified: 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/AggregatorTimerAndTracerTest.java?rev=836346&r1=836345&r2=836346&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/AggregatorTimerAndTracerTest.java
Sun Nov 15 10:14:27 2009
@@ -40,6 +40,7 @@
                 
                 from("seda:splitted").
                     aggregate(header("id")).
+                    to("mock:foo").
                     to("mock:result");
 
                 from("timer://kickoff?period=9999910000").



Mime
View raw message