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/17 09:43:11 UTC
[3/3] git commit: CAMEL-6553: Avoid WARN logs for loading non
existing classes with bean component. Also we should not WARN log anymore as
it was sortof a vauge fix for OSGi problems not loading classes in the past.
CAMEL-6553: Avoid WARN logs for loading non existing classes with bean component. Also we should not WARN log anymore as it was sortof a vauge fix for OSGi problems not loading classes in the past.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c48f0678
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c48f0678
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c48f0678
Branch: refs/heads/camel-2.10.x
Commit: c48f06780d344764a34cb77ee5cd7aad0ed34901
Parents: 4eb1215
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 17 09:40:25 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 17 09:41:20 2013 +0200
----------------------------------------------------------------------
.../org/apache/camel/util/ObjectHelper.java | 4 +-
.../camel/component/bean/BeanMapPutTest.java | 60 ++++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c48f0678/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
index aa87c78..d8d1342 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
@@ -740,7 +740,7 @@ public final class ObjectHelper {
* @return the class or <tt>null</tt> if it could not be loaded
*/
public static Class<?> loadClass(String name, ClassLoader loader) {
- return loadClass(name, loader, true);
+ return loadClass(name, loader, false);
}
/**
@@ -777,6 +777,8 @@ public final class ObjectHelper {
if (clazz == null) {
if (needToWarn) {
LOG.warn("Cannot find class: " + name);
+ } else {
+ LOG.debug("Cannot find class: " + name);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c48f0678/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java
new file mode 100644
index 0000000..4743f75
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanMapPutTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version
+ */
+public class BeanMapPutTest extends ContextTestSupport {
+
+ private Map myMap = new HashMap();
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+ jndi.bind("myMap", myMap);
+ return jndi;
+ }
+
+ public void testMapPut() throws Exception {
+ assertEquals(0, myMap.size());
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertEquals(1, myMap.size());
+ assertEquals("true", myMap.get("isMaster"));
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .beanRef("myMap", "put('isMaster','true')");
+ }
+ };
+ }
+}