camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/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.
Date Wed, 17 Jul 2013 07:43:09 GMT
Updated Branches:
  refs/heads/camel-2.10.x 4eb12158d -> c48f06780
  refs/heads/camel-2.11.x ba11b38fb -> c66e94c3e
  refs/heads/master a977e7835 -> c4e503ad8


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/c4e503ad
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c4e503ad
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c4e503ad

Branch: refs/heads/master
Commit: c4e503ad84d65c6ab4f80acb2843631aa7eda3c6
Parents: a977e78
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jul 17 09:40:25 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 17 09:40:25 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/c4e503ad/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 cec7fab..fc55dbe 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
@@ -752,7 +752,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);
     }
 
     /**
@@ -789,6 +789,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/c4e503ad/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')");
+            }
+        };
+    }
+}


Mime
View raw message