Updated Branches:
  refs/heads/camel-2.12.x 30e2acac1 -> d94b65fb5
  refs/heads/master 6b0f91f1d -> 30b6ccd9c


CAMEL-7195 logging the Ehcache config used


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1366827d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1366827d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1366827d

Branch: refs/heads/master
Commit: 1366827d91c6224dcab3908b6e3d1de450558e9f
Parents: 80402cb
Author: Grzegorz Grzybek <gr.grzy...@gmail.com>
Authored: Thu Feb 13 09:09:25 2014 +0100
Committer: Grzegorz Grzybek <gr.grzy...@gmail.com>
Committed: Thu Feb 13 09:09:25 2014 +0100

----------------------------------------------------------------------
 .../apache/camel/component/cache/CacheComponent.java  |  2 +-
 .../component/cache/DefaultCacheManagerFactory.java   | 14 ++++++++++++--
 .../cache/DefaultCacheManagerFactoryTest.java         |  4 ++--
 3 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1366827d/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
 
b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
index 1ae2f61..21f1bf1 100755
--- 
a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
+++ 
b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheComponent.java
@@ -99,7 +99,7 @@ public class CacheComponent extends DefaultComponent {
             if (configurationFile != null) {
                 is = 
ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(),
 configurationFile);
             }
-            cacheManagerFactory = new DefaultCacheManagerFactory(is);
+            cacheManagerFactory = new DefaultCacheManagerFactory(is, 
configurationFile);
         }
         ServiceHelper.startService(cacheManagerFactory);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/1366827d/components/camel-cache/src/main/java/org/apache/camel/component/cache/DefaultCacheManagerFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cache/src/main/java/org/apache/camel/component/cache/DefaultCacheManagerFactory.java
 
b/components/camel-cache/src/main/java/org/apache/camel/component/cache/DefaultCacheManagerFactory.java
index dad682f..69cf3f7 100644
--- 
a/components/camel-cache/src/main/java/org/apache/camel/component/cache/DefaultCacheManagerFactory.java
+++ 
b/components/camel-cache/src/main/java/org/apache/camel/component/cache/DefaultCacheManagerFactory.java
@@ -19,26 +19,36 @@ package org.apache.camel.component.cache;
 import java.io.InputStream;
 
 import net.sf.ehcache.CacheManager;
+
+import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.util.IOHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class DefaultCacheManagerFactory extends CacheManagerFactory {
+    private static final Logger LOG = 
LoggerFactory.getLogger(DefaultCacheManagerFactory.class);
 
     private InputStream is;
 
+    private String configurationFile;
+
     public DefaultCacheManagerFactory() {
-        this(null);
+        this(null, null);
     }
 
-    public DefaultCacheManagerFactory(InputStream is) {
+    public DefaultCacheManagerFactory(InputStream is, String 
configurationFile) {
         this.is = is;
+        this.configurationFile = configurationFile;
     }
 
     @Override
     protected CacheManager createCacheManagerInstance() {
         if (is == null) {
             // it will still look for "/ehcache.xml" before defaulting to 
"/ehcache-failsafe.xml"
+            LOG.info("Creating CacheManager using Ehcache defaults");
             return EHCacheUtil.createCacheManager();
         }
+        LOG.info("Creating CacheManager using camel-cache configuration: {}", 
configurationFile);
         return EHCacheUtil.createCacheManager(is);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1366827d/components/camel-cache/src/test/java/org/apache/camel/component/cache/DefaultCacheManagerFactoryTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cache/src/test/java/org/apache/camel/component/cache/DefaultCacheManagerFactoryTest.java
 
b/components/camel-cache/src/test/java/org/apache/camel/component/cache/DefaultCacheManagerFactoryTest.java
index 5f2dc4f..af8e786 100644
--- 
a/components/camel-cache/src/test/java/org/apache/camel/component/cache/DefaultCacheManagerFactoryTest.java
+++ 
b/components/camel-cache/src/test/java/org/apache/camel/component/cache/DefaultCacheManagerFactoryTest.java
@@ -60,7 +60,7 @@ public class DefaultCacheManagerFactoryTest extends Assert {
 
     @Test
     public void testNoProvidedConfiguration() throws Exception {
-        CacheManagerFactory factory = new 
DefaultCacheManagerFactory(getClass().getResourceAsStream("/ehcache.xml"));
+        CacheManagerFactory factory = new 
DefaultCacheManagerFactory(getClass().getResourceAsStream("/ehcache.xml"), 
"/ehcache.xml");
         CacheManager manager = factory.getInstance();
         // CAMEL-7195
         assertThat("There should be no peer providers configured", 
manager.getCacheManagerPeerProviders().size(), is(0));
@@ -69,7 +69,7 @@ public class DefaultCacheManagerFactoryTest extends Assert {
 
     @Test
     public void testFailSafeEHCacheManager() throws Exception {
-        CacheManagerFactory factory1 = new DefaultCacheManagerFactory(null);
+        CacheManagerFactory factory1 = new DefaultCacheManagerFactory(null, 
null);
         CacheManagerFactory factory2 = new DefaultCacheManagerFactory();
         assertSame("The cache managers should be the same, loaded from 
fallback ehcache config",
             factory1.getInstance(), factory2.getInstance());

Reply via email to