Repository: camel
Updated Branches:
  refs/heads/master b89a7597e -> 760bfb5a1


Added more asserts for the previous commit about adding tests verifying the IN 
headers get propagated through the Synchronization callback API.

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/760bfb5a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/760bfb5a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/760bfb5a

Branch: refs/heads/master
Commit: 760bfb5a1602b1a012eb90aeb25fa0cfd4d96ac6
Parents: b89a759
Author: Babak Vahdat <bvah...@apache.org>
Authored: Wed May 21 10:58:09 2014 +0200
Committer: Babak Vahdat <bvah...@apache.org>
Committed: Wed May 21 10:58:09 2014 +0200

----------------------------------------------------------------------
 .../UnitOfWorkSynchronizationAdapterTest.java         |  2 ++
 .../org/apache/camel/processor/UnitOfWorkTest.java    | 14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/760bfb5a/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkSynchronizationAdapterTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkSynchronizationAdapterTest.java
 
b/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkSynchronizationAdapterTest.java
index 3df230c..ab7d71a 100644
--- 
a/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkSynchronizationAdapterTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkSynchronizationAdapterTest.java
@@ -38,6 +38,7 @@ public class UnitOfWorkSynchronizationAdapterTest extends 
UnitOfWorkTest {
                             @Override
                             public void onComplete(Exchange exchange) {
                                 completed = exchange;
+                                foo = exchange.getIn().getHeader("foo");
                                 doneLatch.countDown();
                             }
                         });
@@ -46,6 +47,7 @@ public class UnitOfWorkSynchronizationAdapterTest extends 
UnitOfWorkTest {
                             @Override
                             public void onFailure(Exchange exchange) {
                                 failed = exchange;
+                                baz = exchange.getIn().getHeader("baz");
                                 doneLatch.countDown();
                             }
                         });

http://git-wip-us.apache.org/repos/asf/camel/blob/760bfb5a/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkTest.java 
b/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkTest.java
index bf84501..524abb2 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/UnitOfWorkTest.java
@@ -34,6 +34,8 @@ public class UnitOfWorkTest extends ContextTestSupport {
     protected Exchange failed;
     protected String uri = "direct:foo";
     protected CountDownLatch doneLatch = new CountDownLatch(1);
+    protected Object foo;
+    protected Object baz;
 
     public void testSuccess() throws Exception {
         sendMessage();
@@ -41,7 +43,8 @@ public class UnitOfWorkTest extends ContextTestSupport {
         assertTrue("Exchange did not complete.", doneLatch.await(5, 
TimeUnit.SECONDS));
         assertNull("Should not have failed", failed);
         assertNotNull("Should have received completed notification", 
completed);
-        assertEquals("Should have propagated the header inside the 
Synchronization.onComplete() callback", "bar", 
completed.getIn().getHeader("foo"));
+        assertEquals("Should have propagated the header inside the 
Synchronization.onComplete() callback", "bar", foo);
+        assertNull("The Synchronization.onFailure() callback should have not 
been invoked", baz);
 
         log.info("Received completed: " + completed);
     }
@@ -52,7 +55,8 @@ public class UnitOfWorkTest extends ContextTestSupport {
         assertTrue("Exchange did not complete.", doneLatch.await(5, 
TimeUnit.SECONDS));
         assertNull("Should not have completed", completed);
         assertNotNull("Should have received failed notification", failed);
-        assertEquals("Should have propagated the header inside the 
Synchronization.onFailure() callback", "bar", failed.getIn().getHeader("foo"));
+        assertEquals("Should have propagated the header inside the 
Synchronization.onFailure() callback", "bat", baz);
+        assertNull("The Synchronization.onComplete() callback should have not 
been invoked", foo);
 
         log.info("Received fail: " + failed);
     }
@@ -63,7 +67,8 @@ public class UnitOfWorkTest extends ContextTestSupport {
         assertTrue("Exchange did not complete.", doneLatch.await(5, 
TimeUnit.SECONDS));
         assertNull("Should not have completed", completed);
         assertNotNull("Should have received failed notification", failed);
-        assertEquals("Should have propagated the header inside the 
Synchronization.onFailure() callback", "bar", failed.getIn().getHeader("foo"));
+        assertEquals("Should have propagated the header inside the 
Synchronization.onFailure() callback", "bat", baz);
+        assertNull("The Synchronization.onComplete() callback should have not 
been invoked", foo);
 
         log.info("Received fail: " + failed);
     }
@@ -73,11 +78,13 @@ public class UnitOfWorkTest extends ContextTestSupport {
         synchronization = new Synchronization() {
             public void onComplete(Exchange exchange) {
                 completed = exchange;
+                foo = exchange.getIn().getHeader("foo");
                 doneLatch.countDown();
             }
 
             public void onFailure(Exchange exchange) {
                 failed = exchange;
+                baz = exchange.getIn().getHeader("baz");
                 doneLatch.countDown();
             }
         };
@@ -90,6 +97,7 @@ public class UnitOfWorkTest extends ContextTestSupport {
         template.send(uri, new Processor() {
             public void process(Exchange exchange) throws Exception {
                 exchange.getIn().setHeader("foo", "bar");
+                exchange.getIn().setHeader("baz", "bat");
                 exchange.getIn().setBody("<hello>world!</hello>");
             }
         });

Reply via email to