camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [06/13] camel git commit: CAMEL-11149: SPI - Allow to plugin different headers map implementation
Date Thu, 25 May 2017 09:33:18 GMT
CAMEL-11149: SPI - Allow to plugin different headers map implementation


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

Branch: refs/heads/master
Commit: 1184a527052356819e4b7049894ec06aa3bc2af7
Parents: 36c3512
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu May 25 08:17:09 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu May 25 11:09:53 2017 +0200

----------------------------------------------------------------------
 camel-core/src/main/docs/eips/split-eip.adoc    |   4 +-
 .../apache/camel/component/bean/MethodInfo.java |   2 +-
 .../org/apache/camel/impl/DefaultExchange.java  |   4 +-
 .../org/apache/camel/impl/DefaultMessage.java   |   4 +-
 .../apache/camel/impl/DefaultUnitOfWork.java    |   2 +-
 .../camel/processor/ConvertBodyProcessor.java   |   2 +-
 .../camel/processor/SetBodyProcessor.java       |   2 +-
 .../camel/processor/TransformProcessor.java     |   2 +-
 .../BeanInfoAMoreComplexOverloadedTest.java     |   6 +-
 .../component/bean/BeanInfoOverloadedTest.java  |   2 +-
 .../rest/RestProducerBindingProcessorTest.java  |   6 +-
 .../apache/camel/impl/DefaultMessageTest.java   |   2 +-
 .../processor/DefaultExchangeFormatterTest.java |   2 +-
 .../camel/processor/UnmarshalProcessorTest.java |   2 +-
 .../org/apache/camel/util/ObjectHelperTest.java |   6 +-
 .../camel/component/cometd/CometdBinding.java   |   7 +-
 .../camel/component/cometd/CometdConsumer.java  |   2 +-
 .../component/cometd/CometBindingTest.java      |  10 +-
 .../component/cometd/CometdConsumerTest.java    |  24 ----
 ...etdProducerConsumerInOutInteractiveMain.java |   2 +-
 .../component/couchdb/CouchDbEndpointTest.java  |   4 +-
 .../cxf/jaxrs/DefaultCxfRsBindingTest.java      |   2 +-
 .../docker/DockerConfigurationTest.java         |   8 +-
 .../camel/component/hdfs/HdfsConsumer.java      |   2 +-
 .../camel/component/hdfs2/HdfsConsumer.java     |   2 +-
 .../component/jcr/EndpointEventListener.java    |  16 ++-
 .../apache/camel/component/jcr/JcrMessage.java  | 102 --------------
 .../camel/component/jcr/JcrConsumerTest.java    | 138 -------------------
 .../component/kafka/KafkaEndpointTest.java      |   5 +-
 .../component/kafka/KafkaProducerTest.java      |   7 +-
 .../mail/SplitAttachmentsExpression.java        |   2 +-
 .../metrics/AbstractMetricsProducerTest.java    |   3 +-
 .../milo/client/MiloClientConsumer.java         |   2 +-
 .../milo/server/MiloServerConsumer.java         |   2 +-
 .../openstack/AbstractProducerTestSupport.java  |   8 +-
 .../rabbitmq/RabbitMQMessageConverter.java      |   2 +-
 .../rabbitmq/RabbitMQProducerTest.java          |   3 +-
 .../AbstractRestProcessorApprovalTest.java      |   2 +-
 .../springldap/SpringLdapProducerTest.java      |  24 ++--
 .../camel/dataformat/tarfile/TarIterator.java   |   2 +-
 .../undertow/DefaultUndertowHttpBinding.java    |   5 +-
 .../camel/dataformat/zipfile/ZipIterator.java   |   2 +-
 .../component/zookeeper/ZooKeeperUtilsTest.java |   6 +-
 43 files changed, 105 insertions(+), 337 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/docs/eips/split-eip.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/eips/split-eip.adoc b/camel-core/src/main/docs/eips/split-eip.adoc
index 647bed0..ca23453 100644
--- a/camel-core/src/main/docs/eips/split-eip.adoc
+++ b/camel-core/src/main/docs/eips/split-eip.adoc
@@ -451,7 +451,7 @@ public class MySplitterBean {
      * @param body the payload of the incoming message
      * @return a list containing each part splitted
      */
-    public List<Message> splitMessage(@Header(value = "user") String header, @Body String body) {
+    public List<Message> splitMessage(@Header(value = "user") String header, @Body String body, CamelContext camelContext) {
         // we can leverage the Parameter Binding Annotations
         // http://camel.apache.org/parameter-binding-annotations.html
         // to access the message header and body at same time,
@@ -461,7 +461,7 @@ public class MySplitterBean {
         List<Message> answer = new ArrayList<Message>();
         String[] parts = header.split(",");
         for (String part : parts) {
-            DefaultMessage message = new DefaultMessage();
+            DefaultMessage message = new DefaultMessage(camelContext);
             message.setHeader("user", part);
             message.setBody(body);
             answer.add(message);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
index 3e5a314..410de08 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
@@ -376,7 +376,7 @@ public class MethodInfo {
         boolean copyNeeded = !(old.getClass().equals(DefaultMessage.class));
 
         if (copyNeeded) {
-            Message msg = new DefaultMessage();
+            Message msg = new DefaultMessage(exchange.getContext());
             msg.copyFromWithNewBody(old, result);
 
             // replace message on exchange

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
index b8e7a9d..3534296 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
@@ -269,7 +269,7 @@ public final class DefaultExchange implements Exchange {
 
     public Message getIn() {
         if (in == null) {
-            in = new DefaultMessage();
+            in = new DefaultMessage(getContext());
             configureMessage(in);
         }
         return in;
@@ -297,7 +297,7 @@ public final class DefaultExchange implements Exchange {
         // lazy create
         if (out == null) {
             out = (in != null && in instanceof MessageSupport)
-                ? ((MessageSupport)in).newInstance() : new DefaultMessage();
+                ? ((MessageSupport)in).newInstance() : new DefaultMessage(getContext());
             configureMessage(out);
         }
         return out;

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
index 7adb123..397298d 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
@@ -239,9 +239,7 @@ public class DefaultMessage extends MessageSupport {
     public DefaultMessage newInstance() {
         ObjectHelper.notNull(getCamelContext(), "CamelContext", this);
 
-        DefaultMessage answer = new DefaultMessage();
-        answer.setCamelContext(getCamelContext());
-        return answer;
+        return new DefaultMessage(getCamelContext());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
index 75a798e..607afff 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
@@ -84,7 +84,7 @@ public class DefaultUnitOfWork implements UnitOfWork, Service {
         if (context.isAllowUseOriginalMessage()) {
             // special for JmsMessage as it can cause it to loose headers later.
             if (exchange.getIn().getClass().getName().equals("org.apache.camel.component.jms.JmsMessage")) {
-                this.originalInMessage = new DefaultMessage();
+                this.originalInMessage = new DefaultMessage(context);
                 this.originalInMessage.setBody(exchange.getIn().getBody());
                 this.originalInMessage.getHeaders().putAll(exchange.getIn().getHeaders());
             } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/java/org/apache/camel/processor/ConvertBodyProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ConvertBodyProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ConvertBodyProcessor.java
index 828ff8f..41a94a7 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ConvertBodyProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ConvertBodyProcessor.java
@@ -100,7 +100,7 @@ public class ConvertBodyProcessor extends ServiceSupport implements AsyncProcess
         boolean copyNeeded = !(old.getClass().equals(DefaultMessage.class));
 
         if (copyNeeded) {
-            Message msg = new DefaultMessage();
+            Message msg = new DefaultMessage(exchange.getContext());
             msg.copyFromWithNewBody(old, value);
 
             // replace message on exchange

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
index 58ef191..a41fe9a 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
@@ -62,7 +62,7 @@ public class SetBodyProcessor extends ServiceSupport implements AsyncProcessor,
             boolean copyNeeded = !(old.getClass().equals(DefaultMessage.class));
 
             if (copyNeeded) {
-                Message msg = new DefaultMessage();
+                Message msg = new DefaultMessage(exchange.getContext());
                 msg.copyFromWithNewBody(old, newBody);
 
                 // replace message on exchange

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
index 1ea97ab..4ad0a06 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
@@ -63,7 +63,7 @@ public class TransformProcessor extends ServiceSupport implements AsyncProcessor
             boolean copyNeeded = !(old.getClass().equals(DefaultMessage.class));
 
             if (copyNeeded) {
-                Message msg = new DefaultMessage();
+                Message msg = new DefaultMessage(exchange.getContext());
                 msg.copyFromWithNewBody(old, newBody);
 
                 // replace message on exchange (must set as OUT)

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoAMoreComplexOverloadedTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoAMoreComplexOverloadedTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoAMoreComplexOverloadedTest.java
index 6dbfb21..6796d30 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoAMoreComplexOverloadedTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoAMoreComplexOverloadedTest.java
@@ -32,7 +32,7 @@ public class BeanInfoAMoreComplexOverloadedTest extends ContextTestSupport {
     public void testRequestA() throws Exception {
         BeanInfo beanInfo = new BeanInfo(context, Bean.class);
 
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(context);
         message.setBody(new RequestA());
         Exchange exchange = new DefaultExchange(context);
         exchange.setIn(message);
@@ -48,7 +48,7 @@ public class BeanInfoAMoreComplexOverloadedTest extends ContextTestSupport {
     public void testRequestB() throws Exception {
         BeanInfo beanInfo = new BeanInfo(context, Bean.class);
 
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(context);
         message.setBody(new RequestB());
         Exchange exchange = new DefaultExchange(context);
         exchange.setIn(message);
@@ -64,7 +64,7 @@ public class BeanInfoAMoreComplexOverloadedTest extends ContextTestSupport {
     public void testAmbigious() throws Exception {
         BeanInfo beanInfo = new BeanInfo(context, Bean.class);
 
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(context);
         message.setBody("Hello World");
         Exchange exchange = new DefaultExchange(context);
         exchange.setIn(message);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedTest.java
index 85f48b0..f16ebf2 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedTest.java
@@ -32,7 +32,7 @@ public class BeanInfoOverloadedTest extends ContextTestSupport {
     public void testBeanInfoOverloaded() throws Exception {
         BeanInfo beanInfo = new BeanInfo(context, Bean.class);
 
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(context);
         message.setBody(new RequestB());
         Exchange exchange = new DefaultExchange(context);
         exchange.setIn(message);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerBindingProcessorTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerBindingProcessorTest.java b/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerBindingProcessorTest.java
index e918d31..0ee264e 100644
--- a/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerBindingProcessorTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/RestProducerBindingProcessorTest.java
@@ -68,7 +68,7 @@ public class RestProducerBindingProcessorTest {
             jsonDataFormat, xmlDataFormat, outJsonDataFormat, outXmlDataFormat, "json", true, outType);
 
         final Exchange exchange = new DefaultExchange(context);
-        final Message input = new DefaultMessage();
+        final Message input = new DefaultMessage(context);
 
         final RequestPojo request = new RequestPojo();
         input.setBody(request);
@@ -107,7 +107,7 @@ public class RestProducerBindingProcessorTest {
             jsonDataFormat, xmlDataFormat, outJsonDataFormat, outXmlDataFormat, "xml", true, outType);
 
         final Exchange exchange = new DefaultExchange(context);
-        final Message input = new DefaultMessage();
+        final Message input = new DefaultMessage(context);
 
         final RequestPojo request = new RequestPojo();
         input.setBody(request);
@@ -146,7 +146,7 @@ public class RestProducerBindingProcessorTest {
             jsonDataFormat, xmlDataFormat, outJsonDataFormat, outXmlDataFormat, "off", true, outType);
 
         final Exchange exchange = new DefaultExchange(context);
-        final Message input = new DefaultMessage();
+        final Message input = new DefaultMessage(context);
 
         final RequestPojo request = new RequestPojo();
         input.setBody(request);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/test/java/org/apache/camel/impl/DefaultMessageTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultMessageTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultMessageTest.java
index f8073d2..112c2a9 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultMessageTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultMessageTest.java
@@ -29,7 +29,7 @@ public class DefaultMessageTest {
 
     @Test
     public void testAttachmentsAreSorted() {
-        DefaultMessage message = new DefaultMessage();
+        DefaultMessage message = new DefaultMessage(new DefaultCamelContext());
 
         Map<String, Attachment> attachments = message.createAttachments();
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/test/java/org/apache/camel/processor/DefaultExchangeFormatterTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DefaultExchangeFormatterTest.java b/camel-core/src/test/java/org/apache/camel/processor/DefaultExchangeFormatterTest.java
index 5182948..f5f0cc2 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/DefaultExchangeFormatterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/DefaultExchangeFormatterTest.java
@@ -36,7 +36,7 @@ public class DefaultExchangeFormatterTest {
     @Before
     public void setUp() {
         camelContext = new DefaultCamelContext();
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(camelContext);
         message.setBody("This is the message body");
         exchange = new DefaultExchange(camelContext);
         exchange.setIn(message);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/test/java/org/apache/camel/processor/UnmarshalProcessorTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/UnmarshalProcessorTest.java b/camel-core/src/test/java/org/apache/camel/processor/UnmarshalProcessorTest.java
index 7592ee3..b6b02cb 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/UnmarshalProcessorTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/UnmarshalProcessorTest.java
@@ -55,7 +55,7 @@ public class UnmarshalProcessorTest extends TestSupport {
 
     public void testDataFormatReturnsMessage() throws Exception {
         Exchange exchange = createExchangeWithBody(new DefaultCamelContext(), "body");
-        Message out = new DefaultMessage();
+        Message out = new DefaultMessage(exchange.getContext());
         out.setBody(new Object());
         Processor processor = new UnmarshalProcessor(new MyDataFormat(out));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java
index f0d60a5..35def33 100644
--- a/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java
@@ -741,7 +741,7 @@ public class ObjectHelperTest extends TestCase {
     }
 
     public void testIteratorWithMessage() {
-        Message msg = new DefaultMessage();
+        Message msg = new DefaultMessage(new DefaultCamelContext());
         msg.setBody("a,b,c");
 
         Iterator<?> it = ObjectHelper.createIterator(msg);
@@ -758,7 +758,7 @@ public class ObjectHelperTest extends TestCase {
     }
 
     public void testIteratorWithEmptyMessage() {
-        Message msg = new DefaultMessage();
+        Message msg = new DefaultMessage(new DefaultCamelContext());
         msg.setBody("");
 
         Iterator<Object> it = ObjectHelper.createIterator(msg);
@@ -773,7 +773,7 @@ public class ObjectHelperTest extends TestCase {
     }
 
     public void testIteratorWithNullMessage() {
-        Message msg = new DefaultMessage();
+        Message msg = new DefaultMessage(new DefaultCamelContext());
         msg.setBody(null);
 
         Iterator<Object> it = ObjectHelper.createIterator(msg);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
index 38f6c09..5600490 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.impl.DefaultMessage;
@@ -57,7 +58,6 @@ public class CometdBinding {
         this.bayeux = bayeux;
         this.enableSessionHeader = enableSessionHeader;
     }
-    
 
     public ServerMessage.Mutable createCometdMessage(ServerChannel channel, ServerSession serverSession, Message camelMessage) {
         ServerMessage.Mutable mutable = bayeux.newMessage();
@@ -71,12 +71,12 @@ public class CometdBinding {
         return mutable;
     }
 
-    public Message createCamelMessage(ServerSession remote, ServerMessage cometdMessage, Object data) {
+    public Message createCamelMessage(CamelContext camelContext, ServerSession remote, ServerMessage cometdMessage, Object data) {
         if (cometdMessage != null) {
             data = cometdMessage.getData();
         }
 
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(camelContext);
         message.setBody(data);
         Map headers = getHeadersFromMessage(cometdMessage);
         if (headers != null) {
@@ -112,7 +112,6 @@ public class CometdBinding {
         }
     }
 
-
     public void addHeadersToMessage(ServerMessage.Mutable cometdMessage, Message camelMessage) {
         if (camelMessage.hasHeaders()) {
             Map<String, Object> ext = cometdMessage.getExt(true);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
index 175715a..c35f48b 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdConsumer.java
@@ -94,7 +94,7 @@ public class CometdConsumer extends DefaultConsumer implements CometdProducerCon
         public void push(ServerSession remote, ServerMessage cometdMessage) throws Exception {
             Object data = null;
 
-            Message message = binding.createCamelMessage(remote, cometdMessage, data);
+            Message message = binding.createCamelMessage(endpoint.getCamelContext(), remote, cometdMessage, data);
 
             Exchange exchange = endpoint.createExchange();
             exchange.setIn(message);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java
index d289e2b..de88b56 100644
--- a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java
+++ b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java
@@ -20,7 +20,9 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.cometd.bayeux.server.ServerMessage;
 import org.cometd.bayeux.server.ServerSession;
 import org.cometd.server.BayeuxServerImpl;
@@ -56,6 +58,8 @@ public class CometBindingTest {
     @Mock
     private ServerMessage cometdMessage;
 
+    private final CamelContext camelContext = new DefaultCamelContext();
+
     @Before
     public void before() {
         testObj = new CometdBinding(bayeux);
@@ -79,7 +83,7 @@ public class CometBindingTest {
         testObj = new CometdBinding(bayeux, true);
 
         // act
-        Message result = testObj.createCamelMessage(remote, cometdMessage, null);
+        Message result = testObj.createCamelMessage(camelContext, remote, cometdMessage, null);
 
         // assert
         assertEquals(6, result.getHeaders().size());
@@ -94,7 +98,7 @@ public class CometBindingTest {
     @Test
     public void testBindingHonorsFlagForSessionAttributtes() {
         // act
-        Message result = testObj.createCamelMessage(remote, cometdMessage, null);
+        Message result = testObj.createCamelMessage(camelContext, remote, cometdMessage, null);
 
         // assert
         assertEquals(1, result.getHeaders().size());
@@ -114,7 +118,7 @@ public class CometBindingTest {
             .thenReturn(expectedSubscriptionInfo);
 
         // act
-        Message result = testObj.createCamelMessage(remote, cometdMessage, null);
+        Message result = testObj.createCamelMessage(camelContext, remote, cometdMessage, null);
 
         // assert
         assertEquals(2, result.getHeaders().size());

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
index ca9fdf6..c2fc987 100644
--- a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
+++ b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java
@@ -19,28 +19,22 @@ package org.apache.camel.component.cometd;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.component.cometd.CometdConsumer.ConsumerService;
 import org.cometd.bayeux.MarkedReference;
 import org.cometd.bayeux.server.LocalSession;
 import org.cometd.bayeux.server.ServerChannel;
-import org.cometd.bayeux.server.ServerMessage;
 import org.cometd.bayeux.server.ServerSession;
 import org.cometd.server.BayeuxServerImpl;
 import org.eclipse.jetty.util.log.Logger;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -98,24 +92,6 @@ public class CometdConsumerTest {
         assertEquals(expectedService, result);
     }
     
-    @Test
-    public void testSessionHeadersAdded() throws Exception {
-        // setup
-        when(endpoint.isSessionHeadersEnabled()).thenReturn(true);
-        testObj.start();
-        ServerMessage cometdMessage = mock(ServerMessage.class);
-        Exchange exchange = mock(Exchange.class);
-        when(endpoint.createExchange()).thenReturn(exchange);
-        ArgumentCaptor<Message> transferredMessage = ArgumentCaptor.forClass(Message.class);
-
-        // act
-        testObj.getConsumerService().push(remote, cometdMessage);
-
-        // verify
-        verify(exchange).setIn(transferredMessage.capture());
-        Message message = transferredMessage.getValue();
-        assertEquals(MEMEBER_USER_NAME, message.getHeader(USER_NAME));
-    }
 }
 
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerInOutInteractiveMain.java
----------------------------------------------------------------------
diff --git a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerInOutInteractiveMain.java b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerInOutInteractiveMain.java
index 4844bd5..bd51a28 100644
--- a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerInOutInteractiveMain.java
+++ b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerInOutInteractiveMain.java
@@ -65,7 +65,7 @@ public class CometdProducerConsumerInOutInteractiveMain {
 
                 from(URI, URIS).setExchangePattern(ExchangePattern.InOut).process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
-                        Message out = new DefaultMessage();
+                        Message out = new DefaultMessage(exchange.getContext());
                         out.setBody("reply: " + exchange.getIn().getBody());
                         exchange.setOut(out);
                     }

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java
index e279d39..fc9456c 100644
--- a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java
+++ b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java
@@ -19,7 +19,9 @@ package org.apache.camel.component.couchdb;
 import java.util.UUID;
 
 import com.google.gson.JsonObject;
+import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -29,7 +31,7 @@ public class CouchDbEndpointTest {
 
     @Test
     public void testCreateCouchExchangeHeadersAreSet() throws Exception {
-        CouchDbEndpoint endpoint = new CouchDbEndpoint("couchdb:http://localhost/db", "http://localhost/db", new CouchDbComponent());
+        CouchDbEndpoint endpoint = new CouchDbEndpoint("couchdb:http://localhost/db", "http://localhost/db", new CouchDbComponent(new DefaultCamelContext()));
 
         String id = UUID.randomUUID().toString();
         String rev = UUID.randomUUID().toString();

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBindingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBindingTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBindingTest.java
index 2617a37..5472d5f 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBindingTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBindingTest.java
@@ -57,7 +57,7 @@ public class DefaultCxfRsBindingTest extends Assert {
         DefaultCxfRsBinding cxfRsBinding = new DefaultCxfRsBinding();
         cxfRsBinding.setHeaderFilterStrategy(new DefaultHeaderFilterStrategy());
         Exchange exchange = new DefaultExchange(context);
-        Message camelMessage = new DefaultMessage();
+        Message camelMessage = new DefaultMessage(context);
         org.apache.cxf.message.Message cxfMessage = new MessageImpl();
         Map<String, List<String>> headers = new HashMap<String, List<String>>();
         headers.put("emptyList", Collections.EMPTY_LIST);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-docker/src/test/java/org/apache/camel/component/docker/DockerConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-docker/src/test/java/org/apache/camel/component/docker/DockerConfigurationTest.java b/components/camel-docker/src/test/java/org/apache/camel/component/docker/DockerConfigurationTest.java
index 147bea5..e56dbad 100644
--- a/components/camel-docker/src/test/java/org/apache/camel/component/docker/DockerConfigurationTest.java
+++ b/components/camel-docker/src/test/java/org/apache/camel/component/docker/DockerConfigurationTest.java
@@ -19,7 +19,9 @@ package org.apache.camel.component.docker;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultMessage;
 import org.junit.Before;
 import org.junit.Test;
@@ -29,17 +31,19 @@ import static org.junit.Assert.assertEquals;
 public class DockerConfigurationTest {
 
     private DockerConfiguration configuration;
+    private CamelContext camelContext;
 
     @Before
     public void setupTest() {
         configuration = new DockerConfiguration();
+        camelContext = new DefaultCamelContext();
     }
 
     @Test
     public void testPropertyFromHeader() {
         String host = "camelhost";
 
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(camelContext);
         message.setHeader(DockerConstants.DOCKER_HOST, host);
 
         String configurationProp = DockerHelper.getProperty(DockerConstants.DOCKER_HOST, configuration, message, String.class);
@@ -54,7 +58,7 @@ public class DockerConfigurationTest {
         parameters.put(DockerHelper.transformFromHeaderName(DockerConstants.DOCKER_HOST), host);
         configuration.setParameters(parameters);
 
-        Message message = new DefaultMessage();
+        Message message = new DefaultMessage(camelContext);
         String configurationProp = DockerHelper.getProperty(DockerConstants.DOCKER_HOST, configuration, message, String.class);
         assertEquals(host, configurationProp);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
index a8d09db..83b62cc 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
@@ -153,7 +153,7 @@ public final class HdfsConsumer extends ScheduledPollConsumer {
                 Holder<Object> value = new Holder<Object>();
                 while (this.istream.next(key, value) >= 0) {
                     Exchange exchange = this.getEndpoint().createExchange();
-                    Message message = new DefaultMessage();
+                    Message message = new DefaultMessage(this.getEndpoint().getCamelContext());
                     String fileName = StringUtils.substringAfterLast(status.getPath().toString(), "/");
                     message.setHeader(Exchange.FILE_NAME, fileName);
                     message.setHeader(Exchange.FILE_PATH, status.getPath().toString());

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsConsumer.java b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsConsumer.java
index 3d5d8d4..36af8da 100644
--- a/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsConsumer.java
+++ b/components/camel-hdfs2/src/main/java/org/apache/camel/component/hdfs2/HdfsConsumer.java
@@ -155,7 +155,7 @@ public final class HdfsConsumer extends ScheduledPollConsumer {
                 Holder<Object> value = new Holder<Object>();
                 while (this.istream.next(key, value) >= 0) {
                     Exchange exchange = this.getEndpoint().createExchange();
-                    Message message = new DefaultMessage();
+                    Message message = new DefaultMessage(this.getEndpoint().getCamelContext());
                     String fileName = StringUtils.substringAfterLast(status.getPath().toString(), "/");
                     message.setHeader(Exchange.FILE_NAME, fileName);
                     if (key.value != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/EndpointEventListener.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/EndpointEventListener.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/EndpointEventListener.java
index cdad721..df42ba3 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/EndpointEventListener.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/EndpointEventListener.java
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.component.jcr;
 
+import java.util.LinkedList;
+import java.util.List;
+import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
 
@@ -30,8 +33,6 @@ import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 /**
  * A JCR {@link EventListener} which can be used to delegate processing to a
  * Camel endpoint.
- *
- * @version $Id$
  */
 public class EndpointEventListener implements EventListener {
 
@@ -75,7 +76,16 @@ public class EndpointEventListener implements EventListener {
 
     private Exchange createExchange(EventIterator events) {
         Exchange exchange = endpoint.createExchange();
-        exchange.setIn(new JcrMessage(events));
+
+        List<Event> eventList = new LinkedList<Event>();
+        if (events != null) {
+            while (events.hasNext()) {
+                eventList.add(events.nextEvent());
+            }
+        }
+        exchange.getIn().setBody(eventList);
+
         return exchange;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrMessage.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrMessage.java
deleted file mode 100644
index 0cf02ac..0000000
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrMessage.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * 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.component.jcr;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-
-import org.apache.camel.impl.DefaultMessage;
-import org.apache.camel.util.ObjectHelper;
-
-/**
- * Represents a {@link org.apache.camel.Message} for working with JCR
- *
- * @version $Id$
- */
-public class JcrMessage extends DefaultMessage {
-
-    private EventIterator eventIterator;
-    private List<Event> eventList;
-
-    public JcrMessage(EventIterator eventIterator) {
-        this.eventIterator = eventIterator;
-    }
-
-    @Override
-    public String toString() {
-        if (eventIterator != null) {
-            return "JcrMessage[eventIterator: " + eventIterator + ", eventList: " + eventList + "]";
-        }
-
-        return "JcrMessage@" + ObjectHelper.getIdentityHashCode(this);
-    }
-
-    @Override
-    public void copyFrom(org.apache.camel.Message that) {
-        if (that == this) {
-            // the same instance so do not need to copy
-            return;
-        }
-
-        // must initialize headers before we set the JmsMessage to avoid Camel
-        // populating it before we do the copy
-        getHeaders().clear();
-
-        if (that instanceof JcrMessage) {
-            JcrMessage thatMessage = (JcrMessage) that;
-            this.eventIterator = thatMessage.eventIterator;
-            this.eventList = thatMessage.eventList;
-        }
-
-        // copy body and fault flag
-        setBody(that.getBody());
-        setFault(that.isFault());
-
-        // we have already cleared the headers
-        if (that.hasHeaders()) {
-            getHeaders().putAll(that.getHeaders());
-        }
-
-        getAttachments().clear();
-
-        if (that.hasAttachments()) {
-            getAttachmentObjects().putAll(that.getAttachmentObjects());
-        }
-    }
-
-    public EventIterator getEventIterator() {
-        return eventIterator;
-    }
-
-    @Override
-    protected Object createBody() {
-        if (eventList == null) {
-            eventList = new LinkedList<Event>();
-
-            if (eventIterator != null) {
-                while (eventIterator.hasNext()) {
-                    eventList.add(eventIterator.nextEvent());
-                }
-            }
-        }
-
-        return eventList;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerTest.java
deleted file mode 100644
index 65a8ad0..0000000
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * 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.component.jcr;
-
-import java.util.List;
-import javax.jcr.Node;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * JcrConsumerTest
- *
- * @version $Id$
- */
-public class JcrConsumerTest extends JcrRouteTestSupport {
-
-    private static final Logger LOG = LoggerFactory.getLogger(JcrConsumerTest.class);
-
-    private String absPath = "/home/test";
-
-    @Test
-    public void testJcrConsumer() throws Exception {
-        // start consumer thread first
-        JcrConsumerThread consumerThread = new JcrConsumerThread();
-        consumerThread.start();
-        // wait until the consumer thread has tried to receive event at least once
-        while (consumerThread.getReceiveTrialTimes() < 1) {
-            Thread.sleep(10L);
-        }
-
-        // now create a node under the specified event node path
-
-        Session session = openSession();
-
-        try {
-            Node folderNode = session.getRootNode();
-
-            for (String folderNodeName : absPath.split("\\/")) {
-                if (!"".equals(folderNodeName)) {
-                    if (folderNode.hasNode(folderNodeName)) {
-                        folderNode.getNode(folderNodeName).remove();
-                    }
-
-                    folderNode = folderNode.addNode(folderNodeName, "nt:unstructured");
-                }
-            }
-
-            folderNode.addNode("node", "nt:unstructured");
-            session.save();
-        } finally {
-            if (session != null && session.isLive()) {
-                session.logout();
-            }
-        }
-
-        // wait until the consumer thread captures an event
-        consumerThread.join();
-
-        Exchange exchange = consumerThread.getExchange();
-        assertNotNull(exchange);
-
-        Message message = exchange.getIn();
-        assertNotNull(message);
-        assertTrue(message instanceof JcrMessage);
-        EventIterator eventIterator = ((JcrMessage)message).getEventIterator();
-        assertNotNull(eventIterator);
-        assertEquals(1, eventIterator.getSize());
-
-        List<?> eventList = message.getBody(List.class);
-        assertEquals(1, eventList.size());
-        Event event = (Event) eventList.get(0);
-        assertEquals(Event.NODE_ADDED, event.getType());
-        assertNotNull(event.getPath());
-        assertTrue(event.getPath().startsWith(absPath));
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("jcr://user:pass@repository/home/test?eventTypes=1&deep=true&noLocal=false")
-                        .to("direct:a");
-            }
-        };
-    }
-
-    private class JcrConsumerThread extends Thread {
-
-        private Exchange exchange;
-        private int receiveTrialTimes;
-
-        public void run() {
-            while (exchange == null) {
-                exchange = consumer.receive("direct:a", 10L);
-                ++receiveTrialTimes;
-
-                try {
-                    Thread.sleep(10);
-                } catch (InterruptedException e) {
-                    break;
-                }
-            }
-
-            LOG.debug("JcrConsumerThread receive exchange, {} after {} trials", exchange, receiveTrialTimes);
-        }
-
-        public Exchange getExchange() {
-            return exchange;
-        }
-
-        public int getReceiveTrialTimes() {
-            return receiveTrialTimes;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaEndpointTest.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaEndpointTest.java
index 3e5300d..f968932 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaEndpointTest.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaEndpointTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.kafka;
 import java.net.URISyntaxException;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.kafka.clients.consumer.ConsumerRecord;
 import org.junit.Test;
 
@@ -29,7 +30,7 @@ public class KafkaEndpointTest {
 
     @Test
     public void testCreatingKafkaExchangeSetsHeaders() throws URISyntaxException {
-        KafkaEndpoint endpoint = new KafkaEndpoint("kafka:mytopic?brokers=localhost", new KafkaComponent());
+        KafkaEndpoint endpoint = new KafkaEndpoint("kafka:mytopic?brokers=localhost", new KafkaComponent(new DefaultCamelContext()));
 
         ConsumerRecord<String, String> record = new ConsumerRecord<String, String>("topic", 4, 56, "somekey", "");
         Exchange exchange = endpoint.createKafkaExchange(record);
@@ -41,7 +42,7 @@ public class KafkaEndpointTest {
 
     @Test
     public void assertSingleton() throws URISyntaxException {
-        KafkaEndpoint endpoint = new KafkaEndpoint("kafka:mytopic?brokers=localhost", new KafkaComponent());
+        KafkaEndpoint endpoint = new KafkaEndpoint("kafka:mytopic?brokers=localhost", new KafkaComponent(new DefaultCamelContext()));
         endpoint.getConfiguration().setBrokers("localhost");
         assertTrue(endpoint.isSingleton());
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaProducerTest.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaProducerTest.java
index 41378b8..256208e 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaProducerTest.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaProducerTest.java
@@ -29,6 +29,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultHeadersMapFactory;
 import org.apache.camel.impl.DefaultMessage;
 import org.apache.kafka.clients.producer.Callback;
 import org.apache.kafka.clients.producer.ProducerConfig;
@@ -52,8 +53,9 @@ public class KafkaProducerTest {
     private TypeConverter converter = Mockito.mock(TypeConverter.class);
     private CamelContext context = Mockito.mock(CamelContext.class);
     private Exchange exchange = Mockito.mock(Exchange.class);
-    private Message in = new DefaultMessage();
-    private Message out = new DefaultMessage();
+    private CamelContext camelContext = Mockito.mock(CamelContext.class);
+    private Message in = new DefaultMessage(camelContext);
+    private Message out = new DefaultMessage(camelContext);
     private AsyncCallback callback = Mockito.mock(AsyncCallback.class);
 
     @SuppressWarnings({"unchecked"})
@@ -75,6 +77,7 @@ public class KafkaProducerTest {
         Mockito.when(exchange.getContext()).thenReturn(context);
         Mockito.when(context.getTypeConverter()).thenReturn(converter);
         Mockito.when(converter.tryConvertTo(String.class, exchange, null)).thenReturn(null);
+        Mockito.when(camelContext.getHeadersMapFactory()).thenReturn(new DefaultHeadersMapFactory());
 
         producer.setKafkaProducer(kp);
         producer.setWorkerPool(Executors.newFixedThreadPool(1));

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-mail/src/main/java/org/apache/camel/component/mail/SplitAttachmentsExpression.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/SplitAttachmentsExpression.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/SplitAttachmentsExpression.java
index ca5aae5..569b99c 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/SplitAttachmentsExpression.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/SplitAttachmentsExpression.java
@@ -107,7 +107,7 @@ public class SplitAttachmentsExpression extends ExpressionAdapter {
     }
 
     private Message extractAttachment(Message inMessage, String attachmentName) throws Exception {
-        final Message outMessage = new DefaultMessage();
+        final Message outMessage = new DefaultMessage(inMessage.getExchange().getContext());
         outMessage.setHeader(HEADER_NAME, attachmentName);
         Object attachment = inMessage.getAttachment(attachmentName).getContent();
         if (attachment instanceof InputStream) {

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/AbstractMetricsProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/AbstractMetricsProducerTest.java b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/AbstractMetricsProducerTest.java
index 037f473..d96f4d0 100644
--- a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/AbstractMetricsProducerTest.java
+++ b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/AbstractMetricsProducerTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.metrics;
 import com.codahale.metrics.MetricRegistry;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultMessage;
 import org.junit.Before;
 import org.junit.Test;
@@ -171,7 +172,7 @@ public class AbstractMetricsProducerTest {
 
     @Test
     public void testClearRealHeaders() throws Exception {
-        Message msg = new DefaultMessage();
+        Message msg = new DefaultMessage(new DefaultCamelContext());
         Object val = new Object();
         msg.setHeader(HEADER_HISTOGRAM_VALUE, 109L);
         msg.setHeader(HEADER_METRIC_NAME, "the metric");

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConsumer.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConsumer.java
index b05ce87..57f08ed 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConsumer.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConsumer.java
@@ -82,7 +82,7 @@ public class MiloClientConsumer extends DefaultConsumer {
             return null;
         }
 
-        final DefaultMessage result = new DefaultMessage();
+        final DefaultMessage result = new DefaultMessage(getEndpoint().getCamelContext());
 
         Messages.fillFromDataValue(value, result);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
index ca91d14..d0f05da 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerConsumer.java
@@ -68,7 +68,7 @@ public class MiloServerConsumer extends DefaultConsumer {
             return null;
         }
 
-        final DefaultMessage result = new DefaultMessage();
+        final DefaultMessage result = new DefaultMessage(getEndpoint().getCamelContext());
 
         Messages.fillFromDataValue(value, result);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/AbstractProducerTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/AbstractProducerTestSupport.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/AbstractProducerTestSupport.java
index ea87b57..6caeddb 100644
--- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/AbstractProducerTestSupport.java
+++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/AbstractProducerTestSupport.java
@@ -18,9 +18,11 @@ package org.apache.camel.component.openstack;
 
 import java.io.IOException;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultHeadersMapFactory;
 import org.apache.camel.impl.DefaultMessage;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -39,13 +41,17 @@ public abstract class AbstractProducerTestSupport {
     @Mock
     protected Exchange exchange;
 
+    @Mock
+    protected CamelContext camelContext;
+
     protected Message msg;
 
     protected Producer producer;
 
     @Before
     public void before() throws IOException {
-        msg = new DefaultMessage();
+        msg = new DefaultMessage(camelContext);
         when(exchange.getIn()).thenReturn(msg);
+        when(camelContext.getHeadersMapFactory()).thenReturn(new DefaultHeadersMapFactory());
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java
index b0d72d9..55d7cc2 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java
@@ -230,7 +230,7 @@ public class RabbitMQMessageConverter {
                 // Use the existing message so we keep the headers
                 message = camelExchange.getIn();
             } else {
-                message = new DefaultMessage();
+                message = new DefaultMessage(camelExchange.getContext());
                 camelExchange.setIn(message);
             }
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java
index 523e5c7..602e4b7 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java
@@ -30,6 +30,7 @@ import com.rabbitmq.client.Connection;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultMessage;
 import org.junit.Before;
 import org.junit.Test;
@@ -44,7 +45,7 @@ public class RabbitMQProducerTest {
 
     private RabbitMQEndpoint endpoint = Mockito.mock(RabbitMQEndpoint.class);
     private Exchange exchange = Mockito.mock(Exchange.class);
-    private Message message = new DefaultMessage();
+    private Message message = new DefaultMessage(new DefaultCamelContext());
     private Connection conn = Mockito.mock(Connection.class);
 
     @Before

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessorApprovalTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessorApprovalTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessorApprovalTest.java
index 30a7768..12e3073 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessorApprovalTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessorApprovalTest.java
@@ -254,7 +254,7 @@ public class AbstractRestProcessorApprovalTest {
         final CamelContext context = new DefaultCamelContext();
         final Exchange exchange = new DefaultExchange(context);
 
-        final Message message = new DefaultMessage();
+        final Message message = new DefaultMessage(context);
         if (headers != null) {
             message.setHeaders(headers);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-spring-ldap/src/test/java/org/apache/camel/component/springldap/SpringLdapProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ldap/src/test/java/org/apache/camel/component/springldap/SpringLdapProducerTest.java b/components/camel-spring-ldap/src/test/java/org/apache/camel/component/springldap/SpringLdapProducerTest.java
index 7bda60e..cc53c30 100644
--- a/components/camel-spring-ldap/src/test/java/org/apache/camel/component/springldap/SpringLdapProducerTest.java
+++ b/components/camel-spring-ldap/src/test/java/org/apache/camel/component/springldap/SpringLdapProducerTest.java
@@ -67,7 +67,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
     @Test(expected = NullPointerException.class)
     public void testWrongBodyType() throws Exception {
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
         in.setBody("");
 
         exchange.setIn(in);
@@ -77,7 +77,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
     @Test(expected = UnsupportedOperationException.class)
     public void testNoDN() throws Exception {
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
 
@@ -87,7 +87,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
     @Test
     public void testNoDNForFunctionDrivenOperation() throws Exception {
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.FUNCTION, Mockito.mock(BiFunction.class));
@@ -106,7 +106,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
     @Test(expected = UnsupportedOperationException.class)
     public void testEmptyDN() throws Exception {
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, "");
@@ -117,7 +117,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
     @Test(expected = UnsupportedOperationException.class)
     public void testNullDN() throws Exception {
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, null);
@@ -128,7 +128,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
     @Test(expected = UnsupportedOperationException.class)
     public void testNullOperation() throws Exception {
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, " ");
@@ -143,7 +143,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
         Integer scope = SearchControls.SUBTREE_SCOPE;
 
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, dn);
@@ -162,7 +162,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
         BasicAttributes attributes = new BasicAttributes();
 
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, dn);
@@ -179,7 +179,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
         String dn = "some dn";
 
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, dn);
@@ -197,7 +197,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
         String password = "password";
 
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, dn);
@@ -216,7 +216,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
         ModificationItem[] modificationItems = new ModificationItem[] {new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute("key", "value"))};
 
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, dn);
@@ -233,7 +233,7 @@ public class SpringLdapProducerTest extends CamelTestSupport {
         String dn = "cn=dn";
 
         Exchange exchange = new DefaultExchange(context);
-        Message in = new DefaultMessage();
+        Message in = new DefaultMessage(context);
 
         Map<String, Object> body = new HashMap<String, Object>();
         body.put(SpringLdapProducer.DN, dn);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
----------------------------------------------------------------------
diff --git a/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java b/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
index 8b7e22a..8dbcaa3 100644
--- a/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
+++ b/components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java
@@ -118,7 +118,7 @@ public class TarIterator implements Iterator<Message>, Closeable {
 
             if (current != null) {
                 LOGGER.debug("Reading tarEntry {}", current.getName());
-                Message answer = new DefaultMessage();
+                Message answer = new DefaultMessage(inputMessage.getExchange().getContext());
                 answer.getHeaders().putAll(inputMessage.getHeaders());
                 answer.setHeader(TARFILE_ENTRY_NAME_HEADER, current.getName());
                 answer.setHeader(Exchange.FILE_NAME, current.getName());

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
index 3d2578a..3b2449f 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.net.URI;
 import java.nio.ByteBuffer;
 import java.nio.channels.ReadableByteChannel;
 import java.util.Deque;
@@ -101,7 +100,7 @@ public class DefaultUndertowHttpBinding implements UndertowHttpBinding {
 
     @Override
     public Message toCamelMessage(HttpServerExchange httpExchange, Exchange exchange) throws Exception {
-        Message result = new DefaultMessage();
+        Message result = new DefaultMessage(exchange.getContext());
 
         populateCamelHeaders(httpExchange, result.getHeaders(), exchange);
 
@@ -137,7 +136,7 @@ public class DefaultUndertowHttpBinding implements UndertowHttpBinding {
 
     @Override
     public Message toCamelMessage(ClientExchange clientExchange, Exchange exchange) throws Exception {
-        Message result = new DefaultMessage();
+        Message result = new DefaultMessage(exchange.getContext());
 
         //retrieve response headers
         populateCamelHeaders(clientExchange.getResponse(), result.getHeaders(), exchange);

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
index 0e64d2c..8d448c6 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
@@ -102,7 +102,7 @@ public class ZipIterator implements Iterator<Message>, Closeable {
 
             if (current != null) {
                 LOGGER.debug("read zipEntry {}", current.getName());
-                Message answer = new DefaultMessage();
+                Message answer = new DefaultMessage(inputMessage.getExchange().getContext());
                 answer.getHeaders().putAll(inputMessage.getHeaders());
                 answer.setHeader("zipFileName", current.getName());
                 answer.setHeader(Exchange.FILE_NAME, current.getName());

http://git-wip-us.apache.org/repos/asf/camel/blob/1184a527/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperUtilsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperUtilsTest.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperUtilsTest.java
index 3b4329c..7cc4236 100644
--- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperUtilsTest.java
+++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperUtilsTest.java
@@ -16,7 +16,9 @@
  */
 package org.apache.camel.component.zookeeper;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultMessage;
 import org.apache.zookeeper.CreateMode;
 import org.junit.Test;
@@ -28,6 +30,8 @@ import static org.junit.Assert.assertEquals;
 
 public class ZooKeeperUtilsTest {
 
+    private CamelContext camelContext = new DefaultCamelContext();
+
     @Test
     public void testCreateModeExtraction() {
         assertEquals(CreateMode.EPHEMERAL, getCreateModeFromString("EPHEMERAL", CreateMode.EPHEMERAL));
@@ -47,7 +51,7 @@ public class ZooKeeperUtilsTest {
     }
 
     private CreateMode testModeInMessage(String mode, CreateMode defaultMode) {
-        Message m = new DefaultMessage();
+        Message m = new DefaultMessage(camelContext);
         m.setHeader(ZooKeeperMessage.ZOOKEEPER_CREATE_MODE, mode);
         return getCreateMode(m, defaultMode);
     }


Mime
View raw message