You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/02/12 10:07:53 UTC
svn commit: r1445068 - in /camel/trunk/camel-core/src:
main/java/org/apache/camel/processor/WireTapProcessor.java
test/java/org/apache/camel/processor/WireTapOnPrepareTest.java
Author: davsclaus
Date: Tue Feb 12 09:07:52 2013
New Revision: 1445068
URL: http://svn.apache.org/r1445068
Log:
CAMEL-6064: Fixed WiraTap EIP onPrepare. Thanks to Scott Cranton for the patch.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapOnPrepareTest.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java?rev=1445068&r1=1445067&r2=1445068&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java Tue Feb 12 09:07:52 2013
@@ -143,7 +143,7 @@ public class WireTapProcessor extends Se
// invoke on prepare on the exchange if specified
if (onPrepare != null) {
try {
- onPrepare.process(exchange);
+ onPrepare.process(answer);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapOnPrepareTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapOnPrepareTest.java?rev=1445068&r1=1445067&r2=1445068&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapOnPrepareTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapOnPrepareTest.java Tue Feb 12 09:07:52 2013
@@ -32,9 +32,16 @@ public class WireTapOnPrepareTest extend
getMockEndpoint("mock:b").expectedMessageCount(1);
getMockEndpoint("mock:b").message(0).body(String.class).isEqualTo("1 Tiger");
- template.sendBody("direct:start", new Animal(1, "Tiger"));
+ final Animal original = new Animal(1, "Tiger");
+ template.sendBody("direct:start", original);
assertMockEndpointsSatisfied();
+
+ final Animal aAnimal = getMockEndpoint("mock:a").getExchanges().get(0).getIn().getBody(Animal.class);
+ final Animal bAnimal = getMockEndpoint("mock:b").getExchanges().get(0).getIn().getBody(Animal.class);
+
+ assertSame("Original instance should stay in main route", original, bAnimal);
+ assertNotSame("Copy should go to Wire Tap Endpoint", original, aAnimal);
}
@Override