increased storage capacity of mock cdm cachers
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 9 Jul 2014 16:42:02 +0000 (16:42 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 9 Jul 2014 16:42:02 +0000 (16:42 +0000)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/init/MockCdmCacher.java
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/cache/MockCdmCacher.java

index e8162c4607c7ed33d9b058c8d49331af44c2d8e3..40de46b8b656224a95bee7c66c4c3a27562137f2 100644 (file)
@@ -16,7 +16,13 @@ import eu.etaxonomy.cdm.model.common.Language;
 
 /**
  * Since cdmlib-model cannot access CdmCacher we need to create a mock class
- * for the tests
+ * for the tests.
+ * 
+ * NOTES:
+ *      - All terms are put into the cache in the constructor
+ *      - The number of elements allowed in the cache is set to a big number - 10000
+ *      
+ * FIXME : Once the CDMCacher is externalised this class should just subclass it.
  * 
  * @author cmathew
  *
@@ -69,7 +75,7 @@ public class MockCdmCacher implements ICdmCacher {
         * @return
         */
        private CacheConfiguration getDefaultCacheConfiguration() {
-               return new CacheConfiguration(DEFAULT_CACHE_NAME, 50)
+               return new CacheConfiguration(DEFAULT_CACHE_NAME, 10000)
            .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
            .eternal(false)
            // default ttl and tti set to 2 hours
index 9f31e52a0dbe1a294635f6ff119f2b05e31fbc05..6d739096cdc20bce48bf48a2604b1401b4470af2 100644 (file)
@@ -6,8 +6,6 @@ import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
 import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.PersistenceConfiguration;
-import net.sf.ehcache.config.PersistenceConfiguration.Strategy;
 import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
 
 import eu.etaxonomy.cdm.model.ICdmCacher;
@@ -16,8 +14,16 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.Language;
 
 /**
- * Since cdmlib-model cannot access CdmCacher we need to create a mock class
- * for the tests
+ * Since cdmlib-services cannot access CdmCacher we need to create a mock class
+ * for the tests.
+ * See comment in {@link eu.etaxonomy.cdm.api.service.TaxonServiceSearchTest} for 
+ * why we need a mock cdm cacher class
+ * 
+ * NOTES:
+ *      - All terms are put into the cache in the constructor
+ *      - The number of elements allowed in the cache is set to a big number - 10000
+ *      
+ * FIXME : Once the CDMCacher is externalised this class should just subclass it.
  * 
  * @author cmathew
  *
@@ -67,14 +73,13 @@ public class MockCdmCacher implements ICdmCacher {
         * @return
         */
        private CacheConfiguration getDefaultCacheConfiguration() {
-               return new CacheConfiguration(DEFAULT_CACHE_NAME, 50)
+               // setting
+               return new CacheConfiguration(DEFAULT_CACHE_NAME, 10000)
            .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
            .eternal(false)
            // default ttl and tti set to 2 hours
            .timeToLiveSeconds(60*60*2)
-           .timeToIdleSeconds(60*60*2)
-           .diskExpiryThreadIntervalSeconds(0)
-           .persistence(new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP));
+           .timeToIdleSeconds(60*60*2);
        }
        
        /**