Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
 Sun Jan 29 15:16:25 2017
@@ -24,9 +24,8 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.commons.jcs.engine.CacheStatus;
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
@@ -65,10 +64,8 @@ public abstract class AbstractMemoryCach
     /** How many to spool at a time. */
     protected int chunkSize;
 
-    protected final Lock lock = new ReentrantLock();
-
     /** Map where items are stored by key.  This is created by the concrete 
child class. */
-    protected Map<K, MemoryElementDescriptor<K, V>> map;// TODO privatise
+    protected ConcurrentMap<K, MemoryElementDescriptor<K, V>> map;// TODO 
privatise
 
     /** number of hits */
     protected AtomicLong hitCnt;
@@ -106,7 +103,7 @@ public abstract class AbstractMemoryCach
      * <p>
      * @return a threadsafe Map
      */
-    public abstract Map<K, MemoryElementDescriptor<K, V>> createMap();
+    public abstract ConcurrentMap<K, MemoryElementDescriptor<K, V>> 
createMap();
 
     /**
      * Removes an item from the cache

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java
 Sun Jan 29 15:16:25 2017
@@ -20,25 +20,26 @@ package org.apache.commons.jcs.engine.me
  */
 
 import java.io.IOException;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
 
 import org.apache.commons.jcs.engine.CacheConstants;
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
 import org.apache.commons.jcs.engine.control.CompositeCache;
 import org.apache.commons.jcs.engine.control.group.GroupAttrName;
 import org.apache.commons.jcs.engine.memory.AbstractMemoryCache;
-import 
org.apache.commons.jcs.engine.memory.util.DefaultMemoryElementDescriptor;
 import org.apache.commons.jcs.engine.memory.util.MemoryElementDescriptor;
 import org.apache.commons.jcs.engine.stats.behavior.IStats;
+import org.apache.commons.jcs.utils.clhm.ConcurrentLinkedHashMap;
+import org.apache.commons.jcs.utils.clhm.EvictionListener;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
- * This is a test memory manager using the jdk1.4 LinkedHashMap.
+ * This is a memory manager using Ben Manes ConcurrentLinkedHashMap.
  */
 public class LHMLRUMemoryCache<K, V>
     extends AbstractMemoryCache<K, V>
@@ -59,14 +60,41 @@ public class LHMLRUMemoryCache<K, V>
     }
 
     /**
-     * Returns a synchronized LHMSpooler
+     * Returns a ConcurrentLinkedHashMap
      * <p>
-     * @return Collections.synchronizedMap( new LHMSpooler() )
+     * @return a ConcurrentLinkedHashMap
      */
     @Override
-    public Map<K, MemoryElementDescriptor<K, V>> createMap()
+    public ConcurrentMap<K, MemoryElementDescriptor<K, V>> createMap()
     {
-        return Collections.synchronizedMap( new LHMSpooler() );
+        EvictionListener<K, MemoryElementDescriptor<K, V>> listener = new 
EvictionListener<K, MemoryElementDescriptor<K, V>>()
+        {
+            @Override public void onEviction(K key, MemoryElementDescriptor<K, 
V> value)
+            {
+                ICacheElement<K, V> element = value.getCacheElement();
+
+                if ( log.isDebugEnabled() )
+                {
+                    log.debug( "LHMLRU max size: " + 
getCacheAttributes().getMaxObjects()
+                        + ".  Spooling element, key: " + key );
+                }
+
+                waterfal( element );
+
+                if ( log.isDebugEnabled() )
+                {
+                    log.debug( "LHMLRU size: " + map.size() );
+                }
+            }
+        };
+
+        ConcurrentMap<K, MemoryElementDescriptor<K, V>> map =
+                new ConcurrentLinkedHashMap.Builder<K, 
MemoryElementDescriptor<K,V>>()
+                .maximumWeightedCapacity(getCacheAttributes().getMaxObjects())
+                .listener(listener)
+                .build();
+
+        return map;
     }
 
     /**
@@ -80,7 +108,7 @@ public class LHMLRUMemoryCache<K, V>
         throws IOException
     {
         putCnt.incrementAndGet();
-        map.put( ce.getKey(), new DefaultMemoryElementDescriptor<K, V>(ce) );
+        map.put( ce.getKey(), new MemoryElementDescriptor<K, V>(ce) );
     }
 
     /**
@@ -146,37 +174,31 @@ public class LHMLRUMemoryCache<K, V>
         if ( key instanceof String && ( (String) key ).endsWith( 
CacheConstants.NAME_COMPONENT_DELIMITER ) )
         {
             // remove all keys of the same name hierarchy.
-            synchronized ( map )
+            for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = 
map.entrySet().iterator(); itr.hasNext(); )
             {
-                for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr 
= map.entrySet().iterator(); itr.hasNext(); )
-                {
-                    Map.Entry<K, MemoryElementDescriptor<K, V>> entry = 
itr.next();
-                    K k = entry.getKey();
+                Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
+                K k = entry.getKey();
 
-                    if ( k instanceof String && ( (String) k ).startsWith( 
key.toString() ) )
-                    {
-                        itr.remove();
-                        removed = true;
-                    }
+                if ( k instanceof String && ( (String) k ).startsWith( 
key.toString() ) )
+                {
+                    itr.remove();
+                    removed = true;
                 }
             }
         }
         else if ( key instanceof GroupAttrName && 
((GroupAttrName<?>)key).attrName == null )
         {
             // remove all keys of the same name hierarchy.
-            synchronized ( map )
+            for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = 
map.entrySet().iterator(); itr.hasNext(); )
             {
-                for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr 
= map.entrySet().iterator(); itr.hasNext(); )
-                {
-                    Map.Entry<K, MemoryElementDescriptor<K, V>> entry = 
itr.next();
-                    K k = entry.getKey();
+                Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
+                K k = entry.getKey();
 
-                    if ( k instanceof GroupAttrName &&
-                        
((GroupAttrName<?>)k).groupId.equals(((GroupAttrName<?>)key).groupId) )
-                    {
-                        itr.remove();
-                        removed = true;
-                    }
+                if ( k instanceof GroupAttrName &&
+                    
((GroupAttrName<?>)k).groupId.equals(((GroupAttrName<?>)key).groupId) )
+                {
+                    itr.remove();
+                    removed = true;
                 }
             }
         }
@@ -243,60 +265,4 @@ public class LHMLRUMemoryCache<K, V>
         // can't be implemented using the LHM
         return 0;
     }
-
-    // ---------------------------------------------------------- extended map
-
-    /**
-     * Implementation of removeEldestEntry in LinkedHashMap
-     */
-    protected class LHMSpooler
-        extends java.util.LinkedHashMap<K, MemoryElementDescriptor<K, V>>
-    {
-        /** Don't change. */
-        private static final long serialVersionUID = -1255907868906762484L;
-
-        /**
-         * Initialize to a small size--for now, 1/2 of max 3rd variable "true" 
indicates that it
-         * should be access and not time governed. This could be configurable.
-         */
-        public LHMSpooler()
-        {
-            super( (int) ( getCacheAttributes().getMaxObjects() * .5 ), .75F, 
true );
-        }
-
-        /**
-         * Remove eldest. Automatically called by LinkedHashMap.
-         * <p>
-         * @param eldest
-         * @return true if removed
-         */
-        @SuppressWarnings("synthetic-access")
-        @Override
-        protected boolean removeEldestEntry( Map.Entry<K, 
MemoryElementDescriptor<K, V>> eldest )
-        {
-            ICacheElement<K, V> element = eldest.getValue().getCacheElement();
-
-            if ( size() <= getCacheAttributes().getMaxObjects() )
-            {
-                return false;
-            }
-            else
-            {
-
-                if ( log.isDebugEnabled() )
-                {
-                    log.debug( "LHMLRU max size: " + 
getCacheAttributes().getMaxObjects()
-                        + ".  Spooling element, key: " + element.getKey() );
-                }
-
-                waterfal( element );
-
-                if ( log.isDebugEnabled() )
-                {
-                    log.debug( "LHMLRU size: " + map.size() );
-                }
-            }
-            return true;
-        }
-    }
 }

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java
 Sun Jan 29 15:16:25 2017
@@ -178,17 +178,9 @@ public class SoftReferenceMemoryCache<K,
 
                 if (k instanceof String && ((String) 
k).startsWith(key.toString()))
                 {
-                    lock.lock();
-                    try
-                    {
-                        
strongReferences.remove(entry.getValue().getCacheElement());
-                        itr.remove();
-                        removed = true;
-                    }
-                    finally
-                    {
-                        lock.unlock();
-                    }
+                    itr.remove();
+                    
strongReferences.remove(entry.getValue().getCacheElement());
+                    removed = true;
                 }
             }
         }
@@ -203,36 +195,20 @@ public class SoftReferenceMemoryCache<K,
 
                 if (k instanceof GroupAttrName && ((GroupAttrName<?>) 
k).groupId.equals(((GroupAttrName<?>) key).groupId))
                 {
-                    lock.lock();
-                    try
-                    {
-                        
strongReferences.remove(entry.getValue().getCacheElement());
-                        itr.remove();
-                        removed = true;
-                    }
-                    finally
-                    {
-                        lock.unlock();
-                    }
+                    itr.remove();
+                    
strongReferences.remove(entry.getValue().getCacheElement());
+                    removed = true;
                 }
             }
         }
         else
         {
             // remove single item.
-            lock.lock();
-            try
-            {
-                MemoryElementDescriptor<K, V> me = map.remove(key);
-                if (me != null)
-                {
-                    strongReferences.remove(me.getCacheElement());
-                    removed = true;
-                }
-            }
-            finally
+            MemoryElementDescriptor<K, V> me = map.remove(key);
+            if (me != null)
             {
-                lock.unlock();
+                strongReferences.remove(me.getCacheElement());
+                removed = true;
             }
         }
 
@@ -263,18 +239,9 @@ public class SoftReferenceMemoryCache<K,
         putCnt.incrementAndGet();
         ce.getElementAttributes().setLastAccessTimeNow();
 
-        lock.lock();
-
-        try
-        {
-            map.put(ce.getKey(), new SoftReferenceElementDescriptor<K, V>(ce));
-            strongReferences.add(ce);
-            trimStrongReferences();
-        }
-        finally
-        {
-            lock.unlock();
-        }
+        map.put(ce.getKey(), new SoftReferenceElementDescriptor<K, V>(ce));
+        strongReferences.add(ce);
+        trimStrongReferences();
     }
 
     /**
@@ -303,24 +270,14 @@ public class SoftReferenceMemoryCache<K,
     @Override
     public ICacheElement<K, V> get(K key) throws IOException
     {
-        ICacheElement<K, V> val = null;
-        lock.lock();
-
-        try
+        ICacheElement<K, V> val = getQuiet(key);
+        if (val != null)
         {
-            val = getQuiet(key);
-            if (val != null)
-            {
-                val.getElementAttributes().setLastAccessTimeNow();
+            val.getElementAttributes().setLastAccessTimeNow();
 
-                // update the ordering of the strong references
-                strongReferences.add(val);
-                trimStrongReferences();
-            }
-        }
-        finally
-        {
-            lock.unlock();
+            // update the ordering of the strong references
+            strongReferences.add(val);
+            trimStrongReferences();
         }
 
         if (val == null)

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/MemoryElementDescriptor.java
 Sun Jan 29 15:16:25 2017
@@ -25,7 +25,7 @@ import org.apache.commons.jcs.utils.stru
 /**
  * This wrapper is needed for double linked lists.
  */
-public abstract class MemoryElementDescriptor<K, V>
+public class MemoryElementDescriptor<K, V>
     extends DoubleLinkedListNode<ICacheElement<K, V>>
 {
     /** Don't change */
@@ -45,5 +45,8 @@ public abstract class MemoryElementDescr
      * Return the cache element wrapped by this descriptor
      * @return the cache element
      */
-    public abstract ICacheElement<K, V> getCacheElement();
+    public ICacheElement<K, V> getCacheElement()
+    {
+        return getPayload();
+    }
 }

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/engine/memory/util/SoftReferenceElementDescriptor.java
 Sun Jan 29 15:16:25 2017
@@ -42,15 +42,15 @@ public class SoftReferenceElementDescrip
      */
     public SoftReferenceElementDescriptor( ICacheElement<K, V> ce )
     {
-        super( ce );
+        super( null );
         this.srce = new SoftReference<ICacheElement<K, V>>(ce);
     }
 
     /**
-     * @return the ce
+     * @see 
org.apache.commons.jcs.utils.struct.DoubleLinkedListNode#getPayload()
      */
     @Override
-    public ICacheElement<K, V> getCacheElement()
+    public ICacheElement<K, V> getPayload()
     {
         if (srce != null)
         {

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/DoubleLinkedList.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/DoubleLinkedList.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/DoubleLinkedList.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/main/java/org/apache/commons/jcs/utils/struct/DoubleLinkedList.java
 Sun Jan 29 15:16:25 2017
@@ -96,7 +96,7 @@ public class DoubleLinkedList<T extends
      * <p>
      * @return The last node.
      */
-    public synchronized T getLast()
+    public T getLast()
     {
         if ( log.isDebugEnabled() )
         {
@@ -110,7 +110,7 @@ public class DoubleLinkedList<T extends
      * <p>
      * @return DoubleLinkedListNode, the first node.
      */
-    public synchronized T getFirst()
+    public T getFirst()
     {
         if ( log.isDebugEnabled() )
         {
@@ -208,50 +208,53 @@ public class DoubleLinkedList<T extends
      * @param me Description of the Parameter
      * @return true if an element was removed.
      */
-    public synchronized boolean remove(T me)
+    public boolean remove(T me)
     {
         if ( log.isDebugEnabled() )
         {
             log.debug( "removing node" );
         }
 
-        if ( me.next == null )
+        synchronized (this)
         {
-            if ( me.prev == null )
+            if ( me.next == null )
             {
-                // Make sure it really is the only node before setting head and
-                // tail to null. It is possible that we will be passed a node
-                // which has already been removed from the list, in which case
-                // we should ignore it
-
-                if ( me == first && me == last )
+                if ( me.prev == null )
+                {
+                    // Make sure it really is the only node before setting 
head and
+                    // tail to null. It is possible that we will be passed a 
node
+                    // which has already been removed from the list, in which 
case
+                    // we should ignore it
+
+                    if ( me == first && me == last )
+                    {
+                        first = last = null;
+                    }
+                }
+                else
                 {
-                    first = last = null;
+                    // last but not the first.
+                    last = (T) me.prev;
+                    last.next = null;
+                    me.prev = null;
                 }
             }
+            else if ( me.prev == null )
+            {
+                // first but not the last.
+                first = (T) me.next;
+                first.prev = null;
+                me.next = null;
+            }
             else
             {
-                // last but not the first.
-                last = (T) me.prev;
-                last.next = null;
-                me.prev = null;
+                // neither the first nor the last.
+                me.prev.next = me.next;
+                me.next.prev = me.prev;
+                me.prev = me.next = null;
             }
+            size--;
         }
-        else if ( me.prev == null )
-        {
-            // first but not the last.
-            first = (T) me.next;
-            first.prev = null;
-            me.next = null;
-        }
-        else
-        {
-            // neither the first nor the last.
-            me.prev.next = me.next;
-            me.next.prev = me.prev;
-            me.prev = me.next = null;
-        }
-        size--;
 
         return true;
     }
@@ -261,17 +264,22 @@ public class DoubleLinkedList<T extends
      * <p>
      * @return The last node if there was one to remove.
      */
-    public synchronized T removeLast()
+    public T removeLast()
     {
         if ( log.isDebugEnabled() )
         {
             log.debug( "removing last node" );
         }
         T temp = last;
-        if ( last != null )
+
+        synchronized (this)
         {
-            remove( last );
+            if ( last != null )
+            {
+                remove( last );
+            }
         }
+
         return temp;
     }
 

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
 Sun Jan 29 15:16:25 2017
@@ -24,11 +24,11 @@ import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.jcs.access.GroupCacheAccess;
 import org.apache.commons.jcs.access.exception.CacheException;
 
+import junit.framework.TestCase;
+
 /**
  * Test Case for JCS-73, modeled after the Groovy code by Alexander Kleymenov
  *
@@ -37,7 +37,7 @@ import org.apache.commons.jcs.access.exc
  */
 public class JCSConcurrentCacheAccessUnitTest extends TestCase
 {
-    private final static int THREADS = 10;
+    private final static int THREADS = 30;
     private final static int LOOPS = 10000;
 
     /**

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
 Sun Jan 29 15:16:25 2017
@@ -42,9 +42,15 @@ public class MockAuxiliaryCache<K, V>
     /** Can setup status */
     public CacheStatus status = CacheStatus.ALIVE;
 
-    /** Times getMatching was Called */
+    /** Times getMatching was called */
     public int getMatchingCallCount = 0;
 
+    /** Times update was called */
+    public int updateCallCount = 0;
+
+    /** Last updated item */
+    public ICacheElement<K, V> lastUpdatedItem = null;
+
     /**
      * @param ce
      * @throws IOException
@@ -53,8 +59,8 @@ public class MockAuxiliaryCache<K, V>
     public void update( ICacheElement<K, V> ce )
         throws IOException
     {
-        // TODO Auto-generated method stub
-
+        updateCallCount++;
+        lastUpdatedItem = ce;
     }
 
     /**

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheKeyStoreUnitTest.java
 Sun Jan 29 15:16:25 2017
@@ -1,5 +1,7 @@
 package org.apache.commons.jcs.auxiliary.disk.block;
 
+import 
org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes.DiskLimitType;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,8 +23,6 @@ package org.apache.commons.jcs.auxiliary
 
 import junit.framework.TestCase;
 
-import 
org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes.DiskLimitType;
-
 /**
  * Tests for the keyStore.
  * <p>
@@ -170,7 +170,7 @@ public class BlockDiskCacheKeyStoreUnitT
         }
     }
 
-    public void testObjectLargerThanMaxSize()
+    public void OFFtestObjectLargerThanMaxSize()
     {
         BlockDiskCacheAttributes attributes = new BlockDiskCacheAttributes();
         attributes.setCacheName("testObjectLargerThanMaxSize");

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexDiskCacheSizeUnitTest.java
 Sun Jan 29 15:16:25 2017
@@ -26,85 +26,85 @@ import org.apache.commons.jcs.auxiliary.
 import org.apache.commons.jcs.engine.CacheElement;
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
 
-public class IndexDiskCacheSizeUnitTest extends IndexDiskCacheUnitTestAbstract 
{
+public class IndexDiskCacheSizeUnitTest extends IndexDiskCacheUnitTestAbstract
+{
+    @Override
+    public IndexedDiskCacheAttributes getCacheAttributes()
+    {
+        IndexedDiskCacheAttributes ret = new IndexedDiskCacheAttributes();
+        ret.setDiskLimitType(DiskLimitType.SIZE);
+        return ret;
+    }
+
+    public void testRecycleBin()
+            throws IOException
+    {
+        IndexedDiskCacheAttributes cattr = getCacheAttributes();
+        cattr.setCacheName("testRemoveItems");
+        cattr.setOptimizeAtRemoveCount(7);
+        cattr.setMaxKeySize(8); // 1kb DiskTestObject takes 1420 bytes, so
+                                // 5*1420 = 7100, so to keep 5 objects, we need
+                                // max key size of 8
+        cattr.setMaxPurgatorySize(0);
+        cattr.setDiskPath("target/test-sandbox/BreakIndexTest");
+        IndexedDiskCache<String, DiskTestObject> disk = new 
IndexedDiskCache<String, DiskTestObject>(cattr);
+
+        String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", 
"ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
+        String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, 
"hhhhhhhhh", "iiiiiiiiii" };
+        DiskTestObject value = 
DiskTestObjectUtil.createCacheElementsWithTestObjects(1, 1, 
cattr.getCacheName())[0].getVal();
+        // System.out.println( "------------------------- testRecycleBin " );
+
+        for (int i = 0; i < 6; i++)
+        {
+            ICacheElement<String, DiskTestObject> element = new 
CacheElement<String, DiskTestObject>("testRecycleBin", "key:" + test[i], value);
+            // System.out.println( "About to add " + "key:" + test[i] + " i = "
+            // + i );
+            disk.processUpdate(element);
+        }
+
+        for (int i = 3; i < 5; i++)
+        {
+            // System.out.println( "About to remove " + "key:" + test[i] + " i 
=
+            // " + i );
+            disk.remove("key:" + test[i]);
+        }
+
+        // there was a bug where 7 would try to be put in the empty slot left 
by
+        // 4's removal, but it
+        // will not fit.
+        for (int i = 7; i < 9; i++)
+        {
+            ICacheElement<String, DiskTestObject> element = new 
CacheElement<String, DiskTestObject>("testRecycleBin", "key:" + test[i], value);
+            // System.out.println( "About to add " + "key:" + test[i] + " i = "
+            // + i );
+            disk.processUpdate(element);
+        }
+
+        for (int i = 0; i < 9; i++)
+        {
+            ICacheElement<String, DiskTestObject> element = disk.get("key:" + 
test[i]);
+            if (element != null)
+            {
+                // System.out.println( "element = " + element.getVal() );
+            }
+            else
+            {
+                // System.out.println( "null --" + "key:" + test[i] );
+            }
+
+            String expectedValue = expect[i];
+            if (expectedValue == null)
+            {
+                assertNull("Expected a null element", element);
+            }
+            else
+            {
+                assertNotNull("The element for key [" + "key:" + test[i] + "] 
should not be null. i = " + i,
+                        element);
+                assertEquals("Elements contents do not match expected", 
element.getVal(), value);
+            }
+        }
 
-       @Override
-       public IndexedDiskCacheAttributes getCacheAttributes() {
-               IndexedDiskCacheAttributes ret = new 
IndexedDiskCacheAttributes();
-               ret.setDiskLimitType(DiskLimitType.SIZE);
-               return ret;
-       }
-         public void testRecycleBin()
-                       throws IOException
-                   {
-                       IndexedDiskCacheAttributes cattr = getCacheAttributes();
-                       cattr.setCacheName( "testRemoveItems" );
-                       cattr.setOptimizeAtRemoveCount( 7 );
-                       cattr.setMaxKeySize( 8); // 1kb DiskTestObject takes 
1420 bytes, so 5*1420 = 7100, so to keep 5 ojbects, we need max key size of 8
-                       cattr.setMaxPurgatorySize( 0 );
-                       cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" 
);
-                       IndexedDiskCache<String, DiskTestObject> disk = new 
IndexedDiskCache<String, DiskTestObject>( cattr );
-
-                       String[] test = { "a", "bb", "ccc", "dddd", "eeeee", 
"ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
-                       String[] expect = { null, "bb", "ccc", null, null, 
"ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
-                       DiskTestObject value = 
DiskTestObjectUtil.createCacheElementsWithTestObjects( 1, 1, cattr 
.getCacheName())[0].getVal();
-                       //System.out.println( "------------------------- 
testRecycleBin " );
-
-                       for ( int i = 0; i < 6; i++ )
-                       {
-                           ICacheElement<String, DiskTestObject> element = new 
CacheElement<String, DiskTestObject>( "testRecycleBin", "key:" + test[i], 
value);
-                           //System.out.println( "About to add " + "key:" + 
test[i] + " i = " + i );
-                           disk.processUpdate( element );
-                       }
-
-                       for ( int i = 3; i < 5; i++ )
-                       {
-                           //System.out.println( "About to remove " + "key:" + 
test[i] + " i = " + i );
-                           disk.remove( "key:" + test[i] );
-                       }
-
-                       // there was a bug where 7 would try to be put in the 
empty slot left by 4's removal, but it
-                       // will not fit.
-                       for ( int i = 7; i < 9; i++ )
-                       {
-                           ICacheElement<String, DiskTestObject> element = new 
CacheElement<String, DiskTestObject>( "testRecycleBin", "key:" + test[i], 
value);
-                           //System.out.println( "About to add " + "key:" + 
test[i] + " i = " + i );
-                           disk.processUpdate( element );
-                       }
-
-                       try
-                       {
-                           for ( int i = 0; i < 9; i++ )
-                           {
-                               ICacheElement<String, DiskTestObject> element = 
disk.get( "key:" + test[i] );
-                               if ( element != null )
-                               {
-                                   //System.out.println( "element = " + 
element.getVal() );
-                               }
-                               else
-                               {
-                                   //System.out.println( "null --" + "key:" + 
test[i] );
-                               }
-
-                               String expectedValue = expect[i];
-                               if ( expectedValue == null )
-                               {
-                                   assertNull( "Expected a null element", 
element );
-                               }
-                               else
-                               {
-                                   assertNotNull( "The element for key [" + 
"key:" + test[i] + "] should not be null. i = " + i,
-                                                  element );
-                                   assertEquals( "Elements contents do not 
match expected", element.getVal(), value );
-                               }
-                           }
-                       }
-                       catch ( Exception e )
-                       {
-                           e.printStackTrace();
-                           fail( "Should not get an exception: " + 
e.toString() );
-                       }
-
-                       disk.removeAll();
-                   }
+        disk.removeAll();
+    }
 }

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
 Sun Jan 29 15:16:25 2017
@@ -1,5 +1,22 @@
 package org.apache.commons.jcs.auxiliary.lateral.socket.tcp;
 
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.auxiliary.lateral.LateralCacheAttributes;
+import org.apache.commons.jcs.auxiliary.lateral.LateralCommand;
+import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.commons.jcs.engine.control.CompositeCache;
+import org.apache.commons.jcs.engine.control.CompositeCacheManager;
+import org.apache.commons.jcs.engine.control.MockCompositeCacheManager;
+import org.apache.commons.jcs.engine.control.group.GroupAttrName;
+import org.apache.commons.jcs.engine.control.group.GroupId;
+import org.apache.commons.jcs.utils.timing.SleepUtil;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,22 +37,6 @@ package org.apache.commons.jcs.auxiliary
  */
 
 import junit.framework.TestCase;
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCacheAttributes;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCommand;
-import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
-import org.apache.commons.jcs.engine.control.CompositeCache;
-import org.apache.commons.jcs.engine.control.CompositeCacheManager;
-import org.apache.commons.jcs.engine.control.MockCompositeCacheManager;
-import org.apache.commons.jcs.engine.control.group.GroupAttrName;
-import org.apache.commons.jcs.engine.control.group.GroupId;
-import org.apache.commons.jcs.utils.timing.SleepUtil;
-
-import java.util.Map;
-import java.util.Set;
 
 /**
  * Basic unit tests for the sending and receiving portions of the lateral 
cache.
@@ -123,7 +124,7 @@ public class TestTCPLateralUnitTest
         service.setListenerId( 123456 );
 
         // DO WORK
-        int cnt = 100;
+        long cnt = 100;
         for ( int i = 0; i < cnt; i++ )
         {
             ICacheElement<String, String> element = new CacheElement<String, 
String>( "test", "key" + i, "value1" );
@@ -133,7 +134,7 @@ public class TestTCPLateralUnitTest
         SleepUtil.sleepAtLeast( 1000 );
 
         // VERIFY
-        assertEquals( "Didn't get the correct number", cnt, 
cacheMgr.getCache().getUpdateCount() );
+        assertEquals( "Didn't get the correct number", cnt, 
cacheMgr.getCache().getUpdateCountLong() );
     }
 
     /**

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
 Sun Jan 29 15:16:25 2017
@@ -20,30 +20,22 @@ package org.apache.commons.jcs.engine.co
  */
 
 import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
+import java.util.Arrays;
+import java.util.List;
 
 import org.apache.commons.jcs.JCS;
 import org.apache.commons.jcs.access.CacheAccess;
 import org.apache.commons.jcs.access.exception.CacheException;
-import org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCache;
-import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
-import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.commons.jcs.auxiliary.MockAuxiliaryCache;
 import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.CacheStatus;
 import org.apache.commons.jcs.engine.CompositeCacheAttributes;
 import org.apache.commons.jcs.engine.ElementAttributes;
 import org.apache.commons.jcs.engine.behavior.ICacheElement;
 import org.apache.commons.jcs.engine.behavior.ICacheType.CacheType;
 import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
 import org.apache.commons.jcs.engine.behavior.IElementAttributes;
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
-import org.apache.commons.jcs.engine.stats.behavior.IStats;
+
+import junit.framework.TestCase;
 
 /**
  * Tests of the disk usage settings for the CompositeCache.
@@ -105,12 +97,12 @@ public class CompositeCacheDiskUsageUnit
 
         CompositeCache<String, String> cache = new CompositeCache<String, 
String>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxiliaryCache<String, String> mock = new 
MockAuxiliaryCache<String, String>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { 
mock };
-        cache.setAuxCaches( auxArray );
+        List<MockAuxiliaryCache<String, String>> aux = Arrays.asList( mock );
+        cache.setAuxCaches( aux );
 
         ICacheElement<String, String> inputElement = new CacheElement<String, 
String>( CACHE_NAME, "key", "value" );
 
@@ -118,7 +110,7 @@ public class CompositeCacheDiskUsageUnit
         cache.spoolToDisk( inputElement );
 
         // VERIFY
-        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCount );
+        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCallCount );
         assertEquals( "Wrong element updated.", inputElement, 
mock.lastUpdatedItem );
     }
 
@@ -137,12 +129,12 @@ public class CompositeCacheDiskUsageUnit
 
         CompositeCache<String, String> cache = new CompositeCache<String, 
String>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxiliaryCache<String, String> mock = new 
MockAuxiliaryCache<String, String>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { 
mock };
-        cache.setAuxCaches( auxArray );
+        List<MockAuxiliaryCache<String, String>> aux = Arrays.asList( mock );
+        cache.setAuxCaches( aux );
 
         ICacheElement<String, String> inputElement = new CacheElement<String, 
String>( CACHE_NAME, "key", "value" );
 
@@ -150,7 +142,7 @@ public class CompositeCacheDiskUsageUnit
         cache.spoolToDisk( inputElement );
 
         // VERIFY
-        assertEquals( "Wrong number of calls to the disk cache update.", 0, 
mock.updateCount );
+        assertEquals( "Wrong number of calls to the disk cache update.", 0, 
mock.updateCallCount );
     }
 
     /**
@@ -173,12 +165,12 @@ public class CompositeCacheDiskUsageUnit
 
         CompositeCache<String, String> cache = new CompositeCache<String, 
String>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxiliaryCache<String, String> mock = new 
MockAuxiliaryCache<String, String>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { 
mock };
-        cache.setAuxCaches( auxArray );
+        List<MockAuxiliaryCache<String, String>> aux = Arrays.asList( mock );
+        cache.setAuxCaches( aux );
 
         ICacheElement<String, String> inputElement = new CacheElement<String, 
String>( CACHE_NAME, "key", "value" );
 
@@ -186,7 +178,7 @@ public class CompositeCacheDiskUsageUnit
         cache.updateAuxiliaries( inputElement, true );
 
         // VERIFY
-        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCount );
+        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCallCount );
         assertEquals( "Wrong element updated.", inputElement, 
mock.lastUpdatedItem );
     }
 
@@ -211,12 +203,12 @@ public class CompositeCacheDiskUsageUnit
 
         CompositeCache<String, String> cache = new CompositeCache<String, 
String>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxiliaryCache<String, String> mock = new 
MockAuxiliaryCache<String, String>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { 
mock };
-        cache.setAuxCaches( auxArray );
+        List<MockAuxiliaryCache<String, String>> aux = Arrays.asList( mock );
+        cache.setAuxCaches( aux );
 
         ICacheElement<String, String> inputElement = new CacheElement<String, 
String>( CACHE_NAME, "key", "value" );
 
@@ -224,7 +216,7 @@ public class CompositeCacheDiskUsageUnit
         cache.updateAuxiliaries( inputElement, false );
 
         // VERIFY
-        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCount );
+        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCallCount );
         assertEquals( "Wrong element updated.", inputElement, 
mock.lastUpdatedItem );
     }
 
@@ -249,12 +241,12 @@ public class CompositeCacheDiskUsageUnit
 
         CompositeCache<String, String> cache = new CompositeCache<String, 
String>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxiliaryCache<String, String> mock = new 
MockAuxiliaryCache<String, String>();
         mock.cacheType = CacheType.DISK_CACHE;
 
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { 
mock };
-        cache.setAuxCaches( auxArray );
+        List<MockAuxiliaryCache<String, String>> aux = Arrays.asList( mock );
+        cache.setAuxCaches( aux );
 
         ICacheElement<String, String> inputElement = new CacheElement<String, 
String>( CACHE_NAME, "key", "value" );
 
@@ -262,7 +254,7 @@ public class CompositeCacheDiskUsageUnit
         cache.updateAuxiliaries( inputElement, true );
 
         // VERIFY
-        assertEquals( "Wrong number of calls to the disk cache update.", 0, 
mock.updateCount );
+        assertEquals( "Wrong number of calls to the disk cache update.", 0, 
mock.updateCallCount );
     }
 
     /**
@@ -285,15 +277,15 @@ public class CompositeCacheDiskUsageUnit
 
         CompositeCache<String, String> cache = new CompositeCache<String, 
String>( cattr, attr );
 
-        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
+        MockAuxiliaryCache<String, String> mock = new 
MockAuxiliaryCache<String, String>();
         mock.cacheType = CacheType.DISK_CACHE;
 
-        MockAuxCache<String, String> mockLateral = new MockAuxCache<String, 
String>();
+        MockAuxiliaryCache<String, String> mockLateral = new 
MockAuxiliaryCache<String, String>();
         mockLateral.cacheType = CacheType.LATERAL_CACHE;
 
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, String>[] auxArray = new AuxiliaryCache[] { 
mock, mockLateral };
-        cache.setAuxCaches( auxArray );
+        List<MockAuxiliaryCache<String, String>> aux = Arrays.asList( mock, 
mockLateral );
+        cache.setAuxCaches( aux );
 
         ICacheElement<String, String> inputElement = new CacheElement<String, 
String>( CACHE_NAME, "key", "value" );
 
@@ -301,210 +293,10 @@ public class CompositeCacheDiskUsageUnit
         cache.updateAuxiliaries( inputElement, false );
 
         // VERIFY
-        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCount );
+        assertEquals( "Wrong number of calls to the disk cache update.", 1, 
mock.updateCallCount );
         assertEquals( "Wrong element updated.", inputElement, 
mock.lastUpdatedItem );
 
-        assertEquals( "Wrong number of calls to the lateral cache update.", 1, 
mockLateral.updateCount );
+        assertEquals( "Wrong number of calls to the lateral cache update.", 1, 
mockLateral.updateCallCount );
         assertEquals( "Wrong element updated with lateral.", inputElement, 
mockLateral.lastUpdatedItem );
     }
-
-    /**
-     * Used to test the disk cache functionality.
-     * <p>
-     * @author Aaron Smuts
-     */
-    public static class MockAuxCache<K, V>
-        extends AbstractAuxiliaryCache<K, V>
-    {
-        /** The last item passed to update. */
-        public ICacheElement<K, V> lastUpdatedItem;
-
-        /** The number of times update was called. */
-        public int updateCount = 0;
-
-        /** The type that should be returned from getCacheType. */
-        public CacheType cacheType = CacheType.DISK_CACHE;
-
-        /** Resets counters and catchers. */
-        public void reset()
-        {
-            updateCount = 0;
-            lastUpdatedItem = null;
-        }
-
-        /**
-         * @param ce
-         * @throws IOException
-         */
-        @Override
-        public void update( ICacheElement<K, V> ce )
-            throws IOException
-        {
-            lastUpdatedItem = ce;
-            updateCount++;
-        }
-
-        /**
-         * @param key
-         * @return ICacheElement
-         * @throws IOException
-         */
-        @Override
-        public ICacheElement<K, V> get( K key )
-            throws IOException
-        {
-            return null;
-        }
-
-        /**
-         * Gets multiple items from the cache based on the given set of keys.
-         * <p>
-         * @param keys
-         * @return a map of K key to ICacheElement&lt;K, V&gt; element, or an 
empty map if there is
-         *         no data in cache for any of these keys
-         */
-        @Override
-        public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
-        {
-            return new HashMap<K, ICacheElement<K, V>>();
-        }
-
-        /**
-         * @param key
-         * @return false
-         * @throws IOException
-         */
-        @Override
-        public boolean remove( K key )
-            throws IOException
-        {
-            return false;
-        }
-
-        /** @throws IOException */
-        @Override
-        public void removeAll()
-            throws IOException
-        {
-            // noop
-        }
-
-        /** @throws IOException */
-        @Override
-        public void dispose()
-            throws IOException
-        {
-            // noop
-        }
-
-        /** @return 0 */
-        @Override
-        public int getSize()
-        {
-            return 0;
-        }
-
-        /** @return 0 */
-        @Override
-        public CacheStatus getStatus()
-        {
-            return CacheStatus.ALIVE;
-        }
-
-        /** @return null */
-        @Override
-        public String getCacheName()
-        {
-            return null;
-        }
-
-        /**
-         * @return null
-         * @throws IOException
-         */
-        @Override
-        public Set<K> getKeySet( )
-            throws IOException
-        {
-            return null;
-        }
-
-        /** @return null */
-        @Override
-        public IStats getStatistics()
-        {
-            return null;
-        }
-
-        /** @return null */
-        @Override
-        public String getStats()
-        {
-            return null;
-        }
-
-        /**
-         * Returns the setup cache type. This allows you to use this mock as 
multiple cache types.
-         * <p>
-         * @see 
org.apache.commons.jcs.engine.behavior.ICacheType#getCacheType()
-         * @return cacheType
-         */
-        @Override
-        public CacheType getCacheType()
-        {
-            return cacheType;
-        }
-
-        /**
-         * @return Returns the AuxiliaryCacheAttributes.
-         */
-        @Override
-        public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
-        {
-            return null;
-        }
-
-        /**
-         * @param cacheEventLogger
-         */
-        @Override
-        public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
-        {
-            // TODO Auto-generated method stub
-
-        }
-
-        /**
-         * @param elementSerializer
-         */
-        @Override
-        public void setElementSerializer( IElementSerializer elementSerializer 
)
-        {
-            // TODO Auto-generated method stub
-
-        }
-
-        /** @return null */
-        @Override
-        public String getEventLoggingExtraInfo()
-        {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        /**
-         * @param pattern
-         * @return Collections.EMPTY_MAP;
-         * @throws IOException
-         */
-        @Override
-        public Map<K, ICacheElement<K, V>> getMatching(String pattern)
-            throws IOException
-        {
-            return Collections.emptyMap();
-        }
-
-
-    }
-
 }

Modified: 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java?rev=1780805&r1=1780804&r2=1780805&view=diff
==============================================================================
--- 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java
 (original)
+++ 
commons/proper/jcs/branches/jcs-core-with-clhm/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/CompositeCacheUnitTest.java
 Sun Jan 29 15:16:25 2017
@@ -1,5 +1,20 @@
 package org.apache.commons.jcs.engine.control;
 
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.jcs.auxiliary.MockAuxiliaryCache;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.CompositeCacheAttributes;
+import org.apache.commons.jcs.engine.ElementAttributes;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheType.CacheType;
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
+import org.apache.commons.jcs.engine.memory.MockMemoryCache;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,19 +35,6 @@ package org.apache.commons.jcs.engine.co
  */
 
 import junit.framework.TestCase;
-import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
-import org.apache.commons.jcs.auxiliary.MockAuxiliaryCache;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.CompositeCacheAttributes;
-import org.apache.commons.jcs.engine.ElementAttributes;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheType.CacheType;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
-import org.apache.commons.jcs.engine.behavior.IElementAttributes;
-import org.apache.commons.jcs.engine.memory.MockMemoryCache;
-
-import java.io.IOException;
-import java.util.Map;
 
 /**
  * Tests that directly engage the composite cache.
@@ -64,7 +66,7 @@ public class CompositeCacheUnitTest
         MockAuxiliaryCache<String, Integer> diskMock = new 
MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = CacheType.DISK_CACHE;
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { 
diskMock };
+        List<MockAuxiliaryCache<String, Integer>> aux = Arrays.asList( 
diskMock );
         cache.setAuxCaches( aux );
 
         // DO WORK
@@ -104,7 +106,7 @@ public class CompositeCacheUnitTest
         MockAuxiliaryCache<String, Integer> diskMock = new 
MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = CacheType.REMOTE_CACHE;
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { 
diskMock };
+        List<MockAuxiliaryCache<String, Integer>> aux = Arrays.asList( 
diskMock );
         cache.setAuxCaches( aux );
 
         // DO WORK
@@ -147,7 +149,7 @@ public class CompositeCacheUnitTest
         MockAuxiliaryCache<String, Integer> diskMock = new 
MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = CacheType.DISK_CACHE;
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { 
diskMock };
+        List<MockAuxiliaryCache<String, Integer>> aux = Arrays.asList( 
diskMock );
         cache.setAuxCaches( aux );
 
         // DO WORK
@@ -199,7 +201,7 @@ public class CompositeCacheUnitTest
         MockAuxiliaryCache<String, Integer> diskMock = new 
MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = CacheType.DISK_CACHE;
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { 
diskMock };
+        List<MockAuxiliaryCache<String, Integer>> aux = Arrays.asList( 
diskMock );
         cache.setAuxCaches( aux );
 
         // DO WORK
@@ -233,7 +235,7 @@ public class CompositeCacheUnitTest
         MockAuxiliaryCache<String, Integer> diskMock = new 
MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = CacheType.REMOTE_CACHE;
         @SuppressWarnings("unchecked")
-        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { 
diskMock };
+        List<MockAuxiliaryCache<String, Integer>> aux = Arrays.asList( 
diskMock );
         cache.setAuxCaches( aux );
 
         // DO WORK


Reply via email to