camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-8415: DefaultExchangeHolder - Only transfer primitive headers/properties
Date Tue, 08 Sep 2015 07:46:54 GMT
Repository: camel
Updated Branches:
  refs/heads/master 6ce476ed0 -> 345203a12


CAMEL-8415: DefaultExchangeHolder - Only transfer primitive headers/properties


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

Branch: refs/heads/master
Commit: 345203a12672d330ec832151982426d7cee40056
Parents: 6ce476e
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Sep 8 09:47:46 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Sep 8 09:47:46 2015 +0200

----------------------------------------------------------------------
 .../JmsDeadLetterQueueUsingTransferExchangeTest.java | 15 ++++++++++++---
 .../component/jms/JmsInOutTransferExchangeTest.java  | 12 +-----------
 2 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/345203a1/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsDeadLetterQueueUsingTransferExchangeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsDeadLetterQueueUsingTransferExchangeTest.java
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsDeadLetterQueueUsingTransferExchangeTest.java
index 2128eed..fff728b 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsDeadLetterQueueUsingTransferExchangeTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsDeadLetterQueueUsingTransferExchangeTest.java
@@ -58,8 +58,9 @@ public class JmsDeadLetterQueueUsingTransferExchangeTest extends CamelTestSuppor
         assertMockEndpointsSatisfied();
 
         Exchange dead = mock.getReceivedExchanges().get(0);
-        // caused exception is stored as a property
-        assertEquals("Kabom", dead.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class).getMessage());
+        // caused exception details is stored as headers
+        assertEquals("Kabom", dead.getIn().getHeader("CausedExceptionMessage", String.class));
+        assertEquals("java.lang.IllegalArgumentException", dead.getIn().getHeader("CausedExceptionType",
String.class));
     }
 
     protected CamelContext createCamelContext() throws Exception {
@@ -76,7 +77,15 @@ public class JmsDeadLetterQueueUsingTransferExchangeTest extends CamelTestSuppor
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                errorHandler(deadLetterChannel(getUri()).disableRedelivery());
+                errorHandler(deadLetterChannel(getUri()).onPrepareFailure(new Processor()
{
+                    @Override
+                    public void process(Exchange exchange) throws Exception {
+                        // store exception as a string
+                        Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
Exception.class);
+                        exchange.getIn().setHeader("CausedExceptionMessage", cause.getMessage());
+                        exchange.getIn().setHeader("CausedExceptionType", cause.getClass().getName());
+                    }
+                }).disableRedelivery());
 
                 from("direct:start").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/345203a1/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutTransferExchangeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutTransferExchangeTest.java
b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutTransferExchangeTest.java
index e737922..01d1697 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutTransferExchangeTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutTransferExchangeTest.java
@@ -64,10 +64,8 @@ public class JmsInOutTransferExchangeTest extends CamelTestSupport {
                 map.put("string", "hello");
                 map.put("long", new Long(123));
                 map.put("double", new Double(1.23));
-                map.put("requestObject", new SerializableRequestDto("Restless Camel"));
-                
+
                 exchange.getIn().setHeaders(map);
-                exchange.setProperty("requestObjectProperty", new SerializableRequestDto("Restless
Camel"));
             }
         });
 
@@ -76,23 +74,17 @@ public class JmsInOutTransferExchangeTest extends CamelTestSupport {
         Exchange transferExchange = transfer.getExchanges().get(0);
         Message transferMessage = transferExchange.getIn();
         assertNotNull(transferMessage.getBody(SerializableRequestDto.class));
-        assertNotNull(transferMessage.getHeader("requestObject", SerializableRequestDto.class));
         assertEquals(Boolean.TRUE, transferMessage.getHeader("boolean", Boolean.class));
         assertEquals((Long) 123L, transferMessage.getHeader("long", Long.class));
         assertEquals((Double) 1.23, transferMessage.getHeader("double", Double.class));
         assertEquals("hello", transferMessage.getHeader("string", String.class));
-        assertNotNull(transferExchange.getProperty("requestObjectProperty", SerializableRequestDto.class));
 
-        Exchange resultExchange = result.getExchanges().get(0);
         Message resultMessage = result.getExchanges().get(0).getIn();
         assertNotNull(resultMessage.getBody(SerializableResponseDto.class));
-        assertNotNull(resultMessage.getHeader("requestObject", SerializableRequestDto.class));
         assertEquals(Boolean.TRUE, resultMessage.getHeader("boolean", Boolean.class));
         assertEquals((Long) 123L, resultMessage.getHeader("long", Long.class));
         assertEquals((Double) 1.23, resultMessage.getHeader("double", Double.class));
         assertEquals("hello", resultMessage.getHeader("string", String.class));
-        assertNotNull(resultMessage.getHeader("responseHeader", SerializableResponseDto.class));
-        assertNotNull(resultExchange.getProperty("responseObjectProperty", SerializableResponseDto.class));
     }
 
     @Override
@@ -108,8 +100,6 @@ public class JmsInOutTransferExchangeTest extends CamelTestSupport {
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             exchange.getIn().setBody(new SerializableResponseDto(true));
-                            exchange.getIn().setHeader("responseHeader", new SerializableResponseDto(true));
-                            exchange.setProperty("responseObjectProperty", new SerializableResponseDto(true));
                         }
                     });
             }


Mime
View raw message