camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject git commit: Added more asserts for the previous commit about adding tests verifying the IN headers get propagated through the Synchronization callback API.
Date Wed, 21 May 2014 09:02:04 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 210163ad8 -> 68db8a284


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/68db8a28
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/68db8a28
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/68db8a28

Branch: refs/heads/camel-2.12.x
Commit: 68db8a284e8d277659258d26972c334e8d927619
Parents: 210163a
Author: Babak Vahdat <bvahdat@apache.org>
Authored: Wed May 21 10:58:09 2014 +0200
Committer: Babak Vahdat <bvahdat@apache.org>
Committed: Wed May 21 11:01:40 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/68db8a28/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/68db8a28/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>");
             }
         });


Mime
View raw message