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 2014/02/13 09:18:33 UTC

[3/3] git commit: CAMEL-7195 logging the Ehcache config used

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

Branch: refs/heads/camel-2.12.x
Commit: d94b65fb50c3ea2e2e7609d2fc7d10da80a6b664
Parents: 30e2aca
Author: Grzegorz Grzybek <gr...@gmail.com>
Authored: Thu Feb 13 09:09:25 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Feb 13 09:19:43 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/d94b65fb/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/d94b65fb/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/d94b65fb/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());