You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/07/28 08:50:57 UTC
[1/3] git commit: Fixed test
Updated Branches:
refs/heads/camel-2.11.x b0e83a72b -> d37b8fa19
refs/heads/master 1c39edc11 -> d3c07055a
Fixed test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0fc542cf
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0fc542cf
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0fc542cf
Branch: refs/heads/master
Commit: 0fc542cfba58c03a31f24ec9e672008b0c06a54a
Parents: 1c39edc
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jul 28 08:30:07 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jul 28 08:30:07 2013 +0200
----------------------------------------------------------------------
.../src/test/java/org/apache/camel/util/ResourceHelperTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0fc542cf/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java
index 98ecb1b..0f5fa13 100644
--- a/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/ResourceHelperTest.java
@@ -98,7 +98,7 @@ public class ResourceHelperTest extends TestSupport {
ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), "classpath:notfound.txt");
fail("Should not find file");
} catch (FileNotFoundException e) {
- assertEquals("Cannot find resource in classpath for URI: notfound.txt", e.getMessage());
+ assertEquals("Cannot find resource: notfound.txt in classpath for URI: notfound.txt", e.getMessage());
}
context.stop();
[2/3] git commit: CAMEL-6580: camel-jms - Dont allow CACHE_NONE for
replyToCacheLevelName for temporary queues
Posted by da...@apache.org.
CAMEL-6580: camel-jms - Dont allow CACHE_NONE for replyToCacheLevelName for temporary queues
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d3c07055
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d3c07055
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d3c07055
Branch: refs/heads/master
Commit: d3c07055a250cc377042b43899d686b0cb774385
Parents: 0fc542c
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jul 28 08:48:54 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jul 28 08:48:54 2013 +0200
----------------------------------------------------------------------
.../jms/reply/TemporaryQueueReplyManager.java | 3 +
.../JmsRequestReplyTemporaryCacheNoneTest.java | 77 ++++++++++++++++++++
2 files changed, 80 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d3c07055/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
index fbfbf5c..8f9084e 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
@@ -120,6 +120,9 @@ public class TemporaryQueueReplyManager extends ReplyManagerSupport {
// we use CACHE_CONSUMER by default to cling to the consumer as long as we can, since we can only consume
// msgs from the JMS Connection that created the temp destination in the first place
if (endpoint.getReplyToCacheLevelName() != null) {
+ if ("CACHE_NONE".equals(endpoint.getReplyToCacheLevelName())) {
+ throw new IllegalArgumentException("ReplyToCacheLevelName cannot be CACHE_NONE when using temporary reply queues. The value must be either CACHE_CONSUMER, or CACHE_SESSION");
+ }
answer.setCacheLevelName(endpoint.getReplyToCacheLevelName());
} else {
answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
http://git-wip-us.apache.org/repos/asf/camel/blob/d3c07055/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java
new file mode 100644
index 0000000..afa691e
--- /dev/null
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java
@@ -0,0 +1,77 @@
+/**
+ * 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.jms;
+
+import javax.jms.ConnectionFactory;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
+
+/**
+ *
+ */
+public class JmsRequestReplyTemporaryCacheNoneTest extends CamelTestSupport {
+
+ protected String componentName = "activemq";
+
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext camelContext = super.createCamelContext();
+
+ ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+ camelContext.addComponent(componentName, jmsComponentAutoAcknowledge(connectionFactory));
+
+ return camelContext;
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testNotAllowed() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("activemq:queue:hello?replyToCacheLevelName=CACHE_NONE");
+
+ from("activemq:queue:hello").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody("Bye World");
+ assertNotNull(exchange.getIn().getHeader("JMSReplyTo"));
+ }
+ }).to("mock:result");
+ }
+ });
+ context.start();
+
+ try {
+ template.requestBody("direct:start", "Hello World");
+ fail("Should throw exception");
+ } catch (CamelExecutionException e) {
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
+ assertEquals("ReplyToCacheLevelName cannot be CACHE_NONE when using temporary reply queues. The value must be either CACHE_CONSUMER, or CACHE_SESSION", iae.getMessage());
+ }
+ }
+}
\ No newline at end of file
[3/3] git commit: CAMEL-6580: camel-jms - Dont allow CACHE_NONE for
replyToCacheLevelName for temporary queues
Posted by da...@apache.org.
CAMEL-6580: camel-jms - Dont allow CACHE_NONE for replyToCacheLevelName for temporary queues
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d37b8fa1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d37b8fa1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d37b8fa1
Branch: refs/heads/camel-2.11.x
Commit: d37b8fa193c3c9ca139fe1ee831a048b705c6b3e
Parents: b0e83a7
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jul 28 08:48:54 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jul 28 08:49:14 2013 +0200
----------------------------------------------------------------------
.../jms/reply/TemporaryQueueReplyManager.java | 3 +
.../JmsRequestReplyTemporaryCacheNoneTest.java | 77 ++++++++++++++++++++
2 files changed, 80 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d37b8fa1/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
index fbfbf5c..8f9084e 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/TemporaryQueueReplyManager.java
@@ -120,6 +120,9 @@ public class TemporaryQueueReplyManager extends ReplyManagerSupport {
// we use CACHE_CONSUMER by default to cling to the consumer as long as we can, since we can only consume
// msgs from the JMS Connection that created the temp destination in the first place
if (endpoint.getReplyToCacheLevelName() != null) {
+ if ("CACHE_NONE".equals(endpoint.getReplyToCacheLevelName())) {
+ throw new IllegalArgumentException("ReplyToCacheLevelName cannot be CACHE_NONE when using temporary reply queues. The value must be either CACHE_CONSUMER, or CACHE_SESSION");
+ }
answer.setCacheLevelName(endpoint.getReplyToCacheLevelName());
} else {
answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
http://git-wip-us.apache.org/repos/asf/camel/blob/d37b8fa1/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java
new file mode 100644
index 0000000..afa691e
--- /dev/null
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyTemporaryCacheNoneTest.java
@@ -0,0 +1,77 @@
+/**
+ * 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.jms;
+
+import javax.jms.ConnectionFactory;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
+
+/**
+ *
+ */
+public class JmsRequestReplyTemporaryCacheNoneTest extends CamelTestSupport {
+
+ protected String componentName = "activemq";
+
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext camelContext = super.createCamelContext();
+
+ ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
+ camelContext.addComponent(componentName, jmsComponentAutoAcknowledge(connectionFactory));
+
+ return camelContext;
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testNotAllowed() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("activemq:queue:hello?replyToCacheLevelName=CACHE_NONE");
+
+ from("activemq:queue:hello").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody("Bye World");
+ assertNotNull(exchange.getIn().getHeader("JMSReplyTo"));
+ }
+ }).to("mock:result");
+ }
+ });
+ context.start();
+
+ try {
+ template.requestBody("direct:start", "Hello World");
+ fail("Should throw exception");
+ } catch (CamelExecutionException e) {
+ IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
+ assertEquals("ReplyToCacheLevelName cannot be CACHE_NONE when using temporary reply queues. The value must be either CACHE_CONSUMER, or CACHE_SESSION", iae.getMessage());
+ }
+ }
+}
\ No newline at end of file