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 2015/12/05 11:09:42 UTC
[1/2] camel git commit: Fixed CS
Repository: camel
Updated Branches:
refs/heads/master 24dd79f01 -> d04c83c86
Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d04c83c8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d04c83c8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d04c83c8
Branch: refs/heads/master
Commit: d04c83c867b0f38cb886fc567974a652b9b1e197
Parents: 0af3992
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Dec 5 11:09:17 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Dec 5 11:09:35 2015 +0100
----------------------------------------------------------------------
camel-core/src/main/java/org/apache/camel/CamelContext.java | 4 ++--
.../org/apache/camel/impl/DefaultMessageHistoryFactory.java | 6 +++---
.../main/java/org/apache/camel/spi/MessageHistoryFactory.java | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d04c83c8/camel-core/src/main/java/org/apache/camel/CamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index 501f6da..cb21071 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -1384,14 +1384,14 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration {
*
* @return the factory
*/
- public MessageHistoryFactory getMessageHistoryFactory();
+ MessageHistoryFactory getMessageHistoryFactory();
/**
* Sets a custom {@link org.apache.camel.spi.MessageHistoryFactory}
*
* @param messageHistoryFactory the custom factory
*/
- public void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory);
+ void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory);
/**
* Gets the current {@link Debugger}
http://git-wip-us.apache.org/repos/asf/camel/blob/d04c83c8/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistoryFactory.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistoryFactory.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistoryFactory.java
index 42ffeec..89c2f40 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistoryFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistoryFactory.java
@@ -5,9 +5,9 @@
* 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * 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.
http://git-wip-us.apache.org/repos/asf/camel/blob/d04c83c8/camel-core/src/main/java/org/apache/camel/spi/MessageHistoryFactory.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/MessageHistoryFactory.java b/camel-core/src/main/java/org/apache/camel/spi/MessageHistoryFactory.java
index e8020c8..977ff56 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/MessageHistoryFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/MessageHistoryFactory.java
@@ -5,9 +5,9 @@
* 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ * 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.
[2/2] camel git commit: CAMEL-9380: Using method call expression
should be nice and take care if the user specify the bean name with ref or
bean as prefix.
Posted by da...@apache.org.
CAMEL-9380: Using method call expression should be nice and take care if the user specify the bean name with ref or bean as prefix.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0af39922
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0af39922
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0af39922
Branch: refs/heads/master
Commit: 0af399221e1236d5e1cb0367213896f4a3522e0b
Parents: 24dd79f
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Dec 5 11:08:03 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Dec 5 11:09:35 2015 +0100
----------------------------------------------------------------------
.../camel/component/bean/RegistryBean.java | 17 ++++--
.../bean/MethodCallRefOrBeanPrefixTest.java | 58 ++++++++++++++++++++
2 files changed, 71 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0af39922/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java b/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
index 5f645f9..742aaa4 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
@@ -35,15 +35,24 @@ public class RegistryBean implements BeanHolder {
private ParameterMappingStrategy parameterMappingStrategy;
public RegistryBean(CamelContext context, String name) {
- this.context = context;
- this.name = name;
- this.registry = context.getRegistry();
+ this(context.getRegistry(), context, name);
}
public RegistryBean(Registry registry, CamelContext context, String name) {
this.registry = registry;
this.context = context;
- this.name = name;
+ if (name != null) {
+ // for ref it may have "ref:" or "bean:" as prefix by mistake
+ if (name.startsWith("ref:")) {
+ this.name = name.substring(4);
+ } else if (name.startsWith("bean:")) {
+ this.name = name.substring(5);
+ } else {
+ this.name = name;
+ }
+ } else {
+ this.name = null;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/0af39922/camel-core/src/test/java/org/apache/camel/component/bean/MethodCallRefOrBeanPrefixTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/MethodCallRefOrBeanPrefixTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/MethodCallRefOrBeanPrefixTest.java
new file mode 100644
index 0000000..94081c2
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/MethodCallRefOrBeanPrefixTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.bean;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version
+ */
+public class MethodCallRefOrBeanPrefixTest extends ContextTestSupport {
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+ jndi.bind("foo", new MyFooBean());
+ return jndi;
+ }
+
+ public void testRefOrBeanPrefix() throws Exception {
+ getMockEndpoint("mock:a").expectedBodiesReceived("Hello A");
+ getMockEndpoint("mock:b").expectedBodiesReceived("Hello B");
+
+ template.sendBody("direct:a", "A");
+ template.sendBody("direct:b", "B");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:a")
+ .transform().method("ref:foo").to("mock:a");
+
+ from("direct:b")
+ .transform().method("bean:foo").to("mock:b");
+ }
+ };
+ }
+}
\ No newline at end of file