You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2015/07/20 21:41:27 UTC
camel git commit: CAMEL-8989 - sjms drops null body messages
Repository: camel
Updated Branches:
refs/heads/master 32b5c8923 -> 13635fc41
CAMEL-8989 - sjms drops null body messages
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/13635fc4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/13635fc4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/13635fc4
Branch: refs/heads/master
Commit: 13635fc415faa461c59c1cff20090aeeb85c1441
Parents: 32b5c89
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Mon Jul 20 17:10:32 2015 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Mon Jul 20 17:10:32 2015 -0230
----------------------------------------------------------------------
.../camel/component/jms/JmsRouteTest.java | 10 ++++
.../component/sjms/producer/InOnlyProducer.java | 3 ++
.../sjms/consumer/EmptyMessageBodyTest.java | 48 ++++++++++++++++++++
3 files changed, 61 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/13635fc4/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
index fb95843..908ae1c 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
@@ -40,6 +40,16 @@ public class JmsRouteTest extends CamelTestSupport {
assertSendAndReceiveBody("Hello there!");
}
+ @Test
+ public void testSendEmptyMessage() throws Exception {
+ resultEndpoint.expectedMessageCount(2);
+
+ sendExchange("");
+ sendExchange(null);
+
+ resultEndpoint.assertIsSatisfied();
+ }
+
protected void assertSendAndReceiveBody(Object expectedBody) throws InterruptedException {
resultEndpoint.expectedBodiesReceived(expectedBody);
resultEndpoint.message(0).header("cheese").isEqualTo(123);
http://git-wip-us.apache.org/repos/asf/camel/blob/13635fc4/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
index 253edbd..71f5770 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOnlyProducer.java
@@ -104,6 +104,9 @@ public class InOnlyProducer extends SjmsProducer {
Message message = JmsMessageHelper.createMessage(producer.getSession(), payload, exchange.getIn().getHeaders(), getEndpoint());
messages.add(message);
}
+ } else {
+ Message message = JmsMessageHelper.createMessage(producer.getSession(), null, exchange.getIn().getHeaders(), getEndpoint());
+ messages.add(message);
}
if (isEndpointTransacted()) {
http://git-wip-us.apache.org/repos/asf/camel/blob/13635fc4/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/EmptyMessageBodyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/EmptyMessageBodyTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/EmptyMessageBodyTest.java
new file mode 100644
index 0000000..b798bd1
--- /dev/null
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/consumer/EmptyMessageBodyTest.java
@@ -0,0 +1,48 @@
+/**
+ * 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.sjms.consumer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.sjms.support.JmsTestSupport;
+
+import org.junit.Test;
+
+/**
+ * @version
+ */
+public class EmptyMessageBodyTest extends JmsTestSupport {
+
+ @Test
+ public void testSynchronous() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(2);
+
+ template.sendBody("sjms:start", "");
+ template.sendBody("sjms:start", null);
+ assertMockEndpointsSatisfied();
+ }
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("sjms:queue:start").to("mock:result");
+ }
+ };
+ }
+
+}