commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1344374 [13/14] - in /commons/proper/jcs/trunk: ./ auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/jdk14/src/java/org/apache/jc...
Date Wed, 30 May 2012 18:14:51 GMT
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java Wed May 30 18:14:43 2012
@@ -34,8 +34,8 @@ import org.apache.jcs.engine.behavior.IC
 /**
  * This is a mock impl of the non local cache service.
  */
-public class MockCacheServiceNonLocal
-    implements ICacheServiceNonLocal
+public class MockCacheServiceNonLocal<K extends Serializable, V extends Serializable>
+    implements ICacheServiceNonLocal<K, V>
 {
     /** The key last passed to get */
     public Serializable lastGetKey;
@@ -44,19 +44,19 @@ public class MockCacheServiceNonLocal
     public String lastGetMatchingPattern;
 
     /** The keya last passed to getMatching */
-    public Set<Serializable> lastGetMultipleKeys;
+    public Set<K> lastGetMultipleKeys;
 
     /** The object that was last passed to update. */
-    public Object lastUpdate;
+    public ICacheElement<K, V> lastUpdate;
 
     /** List of updates. */
-    public List<ICacheElement> updateRequestList = new ArrayList<ICacheElement>();
+    public List<ICacheElement<K, V>> updateRequestList = new ArrayList<ICacheElement<K,V>>();
 
     /** List of request ids. */
     public List<Long> updateRequestIdList = new ArrayList<Long>();
 
     /** The key that was last passed to remove. */
-    public Object lastRemoveKey;
+    public K lastRemoveKey;
 
     /** The cache name that was last passed to removeAll. */
     public String lastRemoveAllCacheName;
@@ -67,7 +67,7 @@ public class MockCacheServiceNonLocal
      * @param requesterId - identity of requester
      * @return null
      */
-    public ICacheElement get( String cacheName, Serializable key, long requesterId )
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
     {
         lastGetKey = key;
         return null;
@@ -78,9 +78,9 @@ public class MockCacheServiceNonLocal
      * @param groupName
      * @return empty set
      */
-    public Set<Serializable> getGroupKeys( String cacheName, String groupName )
+    public Set<K> getGroupKeys( String cacheName, String groupName )
     {
-        return new HashSet<Serializable>();
+        return new HashSet<K>();
     }
 
     /**
@@ -90,7 +90,7 @@ public class MockCacheServiceNonLocal
      * @param key
      * @param requesterId - identity of requester
      */
-    public void remove( String cacheName, Serializable key, long requesterId )
+    public void remove( String cacheName, K key, long requesterId )
     {
         lastRemoveKey = key;
     }
@@ -114,7 +114,7 @@ public class MockCacheServiceNonLocal
      * @param item
      * @param requesterId - identity of requester
      */
-    public void update( ICacheElement item, long requesterId )
+    public void update( ICacheElement<K, V> item, long requesterId )
     {
         lastUpdate = item;
         updateRequestList.add( item );
@@ -136,7 +136,7 @@ public class MockCacheServiceNonLocal
      * @param key
      * @return null
      */
-    public ICacheElement get( String cacheName, Serializable key )
+    public ICacheElement<K, V> get( String cacheName, K key )
     {
         return get( cacheName, key, 0 );
     }
@@ -155,7 +155,7 @@ public class MockCacheServiceNonLocal
      * @param cacheName
      * @param key
      */
-    public void remove( String cacheName, Serializable key )
+    public void remove( String cacheName, K key )
     {
         lastRemoveKey = key;
     }
@@ -175,7 +175,7 @@ public class MockCacheServiceNonLocal
      * <p>
      * @param item
      */
-    public void update( ICacheElement item )
+    public void update( ICacheElement<K, V> item )
     {
         lastUpdate = item;
     }
@@ -186,10 +186,10 @@ public class MockCacheServiceNonLocal
      * @param requesterId - identity of requester
      * @return empty map
      */
-    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys, long requesterId )
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
     {
         lastGetMultipleKeys = keys;
-        return new HashMap<Serializable, ICacheElement>();
+        return new HashMap<K, ICacheElement<K, V>>();
     }
 
     /**
@@ -197,7 +197,7 @@ public class MockCacheServiceNonLocal
      * @param keys
      * @return empty map
      */
-    public Map<Serializable, ICacheElement> getMultiple( String cacheName, Set<Serializable> keys )
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
     {
         return getMultiple( cacheName, keys, 0 );
     }
@@ -210,7 +210,7 @@ public class MockCacheServiceNonLocal
      * @return an empty map
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern )
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
         throws IOException
     {
         return getMatching( cacheName, pattern, 0 );
@@ -223,10 +223,10 @@ public class MockCacheServiceNonLocal
      * @return Map
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMatching( String cacheName, String pattern, long requesterId )
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
         throws IOException
     {
         lastGetMatchingPattern = pattern;
-        return new HashMap<Serializable, ICacheElement>();
+        return new HashMap<K, ICacheElement<K, V>>();
     }
 }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java Wed May 30 18:14:43 2012
@@ -46,7 +46,7 @@ public class SystemPropertyUsageUnitTest
 
         JCS.setConfigFilename( "/TestSystemPropertyUsage.ccf" );
 
-        JCS jcs = JCS.getInstance( "someCacheNotInFile" );
+        JCS<String, String> jcs = JCS.getInstance( "someCacheNotInFile" );
 
         assertEquals( "System property value is not reflected", jcs.getCacheAttributes().getMaxObjects(), Integer
             .parseInt( "6789" ) );
@@ -70,7 +70,7 @@ public class SystemPropertyUsageUnitTest
 
         mgr.configure( props, false );
 
-        JCS jcs = JCS.getInstance( "someCacheNotInFile" );
+        JCS<String, String> jcs = JCS.getInstance( "someCacheNotInFile" );
 
         assertFalse( "System property value should not be reflected",
                      jcs.getCacheAttributes().getMaxObjects() == Integer.parseInt( props

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java Wed May 30 18:14:43 2012
@@ -38,14 +38,14 @@ public class ZombieCacheServiceNonLocalU
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal service = new MockCacheServiceNonLocal();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
 
-        ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement element = new CacheElement( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
         zombie.update( element, 123l );
         zombie.propagateEvents( service );
 
@@ -62,14 +62,14 @@ public class ZombieCacheServiceNonLocalU
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal service = new MockCacheServiceNonLocal();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
 
-        ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 0 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 0 );
 
         String cacheName = "testUpdate";
 
         // DO WORK
-        ICacheElement element = new CacheElement( cacheName, "key", "value" );
+        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
         zombie.update( element, 123l );
         zombie.propagateEvents( service );
 
@@ -86,9 +86,9 @@ public class ZombieCacheServiceNonLocalU
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal service = new MockCacheServiceNonLocal();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
 
-        ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
 
         String cacheName = "testRemoveThenWalk";
         String key = "myKey";
@@ -110,9 +110,9 @@ public class ZombieCacheServiceNonLocalU
         throws Exception
     {
         // SETUP
-        MockCacheServiceNonLocal service = new MockCacheServiceNonLocal();
+        MockCacheServiceNonLocal<String, String> service = new MockCacheServiceNonLocal<String, String>();
 
-        ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 );
+        ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 );
 
         String cacheName = "testRemoveThenWalk";
 

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java Wed May 30 18:14:43 2012
@@ -19,11 +19,11 @@ package org.apache.jcs.engine.control;
  * under the License.
  */
 
+import junit.framework.TestCase;
+
 import org.apache.jcs.JCS;
 import org.apache.jcs.engine.stats.behavior.ICacheStats;
 
-import junit.framework.TestCase;
-
 /**
  * @author Aaron Smuts
  *
@@ -39,7 +39,7 @@ public class CacheManagerStatsUnitTest
      */
     public void testSimpleGetStats() throws Exception
     {
-        JCS cache = JCS.getInstance( "testCache1" );
+        JCS<String, String> cache = JCS.getInstance( "testCache1" );
 
         // 1 miss, 1 hit, 1 put
         cache.get( "testKey" );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java Wed May 30 18:14:43 2012
@@ -41,10 +41,11 @@ public class CompositeCacheConfiguratorU
 
         CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( manager );
 
-        CompositeCache cache = new CompositeCache( regionName, new CompositeCacheAttributes(), new ElementAttributes() );
+        CompositeCache<String, String> cache =
+            new CompositeCache<String, String>( regionName, new CompositeCacheAttributes(), new ElementAttributes() );
 
         // DO WORK
-        MockAuxiliaryCache result = (MockAuxiliaryCache) configurator
+        MockAuxiliaryCache<String, String> result = (MockAuxiliaryCache<String, String>) configurator
             .parseAuxiliary( cache, props, auxName, regionName );
 
         // VERIFY
@@ -71,7 +72,7 @@ public class CompositeCacheConfiguratorU
         manager.configure( props );
 
         // VERIFY
-        CompositeCache cache = manager.getCache( regionName );
+        CompositeCache<String, String> cache = manager.getCache( regionName );
         assertEquals( "Wrong chunkSize", cache.getCacheAttributes().getSpoolChunkSize(), chunkSize );
     }
 }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java Wed May 30 18:14:43 2012
@@ -68,7 +68,7 @@ public class CompositeCacheDiskUsageUnit
     public void testSwapConfig()
         throws CacheException
     {
-        JCS swap = JCS.getInstance( "Swap" );
+        JCS<String, String> swap = JCS.getInstance( "Swap" );
         assertEquals( ICompositeCacheAttributes.DISK_USAGE_PATTERN_SWAP, swap.getCacheAttributes()
             .getDiskUsagePattern() );
     }
@@ -81,7 +81,7 @@ public class CompositeCacheDiskUsageUnit
     public void testUpdateConfig()
         throws CacheException
     {
-        JCS swap = JCS.getInstance( "Update" );
+        JCS<String, String> swap = JCS.getInstance( "Update" );
         assertEquals( ICompositeCacheAttributes.DISK_USAGE_PATTERN_UPDATE, swap.getCacheAttributes()
             .getDiskUsagePattern() );
     }
@@ -98,14 +98,14 @@ public class CompositeCacheDiskUsageUnit
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<String, String>( "testSpoolAllowed", cattr, attr );
 
-        MockAuxCache mock = new MockAuxCache();
+        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
         mock.cacheType = AuxiliaryCache.DISK_CACHE;
 
         cache.setAuxCaches( new AuxiliaryCache[] { mock } );
 
-        ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testSpoolAllowed", "key", "value" );
 
         // DO WORK
         cache.spoolToDisk( inputElement );
@@ -127,14 +127,14 @@ public class CompositeCacheDiskUsageUnit
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<String, String>( "testSpoolAllowed", cattr, attr );
 
-        MockAuxCache mock = new MockAuxCache();
+        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
         mock.cacheType = AuxiliaryCache.DISK_CACHE;
 
         cache.setAuxCaches( new AuxiliaryCache[] { mock } );
 
-        ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testSpoolAllowed", "key", "value" );
 
         // DO WORK
         cache.spoolToDisk( inputElement );
@@ -160,14 +160,14 @@ public class CompositeCacheDiskUsageUnit
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<String, String>( "testSpoolAllowed", cattr, attr );
 
-        MockAuxCache mock = new MockAuxCache();
+        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
         mock.cacheType = AuxiliaryCache.DISK_CACHE;
 
         cache.setAuxCaches( new AuxiliaryCache[] { mock } );
 
-        ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testSpoolAllowed", "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, true );
@@ -195,14 +195,14 @@ public class CompositeCacheDiskUsageUnit
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<String, String>( "testSpoolAllowed", cattr, attr );
 
-        MockAuxCache mock = new MockAuxCache();
+        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
         mock.cacheType = AuxiliaryCache.DISK_CACHE;
 
         cache.setAuxCaches( new AuxiliaryCache[] { mock } );
 
-        ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testSpoolAllowed", "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, false );
@@ -230,14 +230,14 @@ public class CompositeCacheDiskUsageUnit
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<String, String>( "testSpoolAllowed", cattr, attr );
 
-        MockAuxCache mock = new MockAuxCache();
+        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
         mock.cacheType = AuxiliaryCache.DISK_CACHE;
 
         cache.setAuxCaches( new AuxiliaryCache[] { mock } );
 
-        ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testSpoolAllowed", "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, true );
@@ -263,17 +263,17 @@ public class CompositeCacheDiskUsageUnit
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr );
+        CompositeCache<String, String> cache = new CompositeCache<String, String>( "testSpoolAllowed", cattr, attr );
 
-        MockAuxCache mock = new MockAuxCache();
+        MockAuxCache<String, String> mock = new MockAuxCache<String, String>();
         mock.cacheType = AuxiliaryCache.DISK_CACHE;
 
-        MockAuxCache mockLateral = new MockAuxCache();
+        MockAuxCache<String, String> mockLateral = new MockAuxCache<String, String>();
         mockLateral.cacheType = AuxiliaryCache.LATERAL_CACHE;
 
         cache.setAuxCaches( new AuxiliaryCache[] { mock, mockLateral } );
 
-        ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" );
+        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testSpoolAllowed", "key", "value" );
 
         // DO WORK
         cache.updateAuxiliaries( inputElement, false );
@@ -291,14 +291,14 @@ public class CompositeCacheDiskUsageUnit
      * <p>
      * @author Aaron Smuts
      */
-    public static class MockAuxCache
-        extends AbstractAuxiliaryCache
+    public static class MockAuxCache<K extends Serializable, V extends Serializable>
+        extends AbstractAuxiliaryCache<K, V>
     {
         /** Don't change */
         private static final long serialVersionUID = 1L;
 
         /** The last item passed to update. */
-        public ICacheElement lastUpdatedItem;
+        public ICacheElement<K, V> lastUpdatedItem;
 
         /** The number of times update was called. */
         public int updateCount = 0;
@@ -317,7 +317,7 @@ public class CompositeCacheDiskUsageUnit
          * @param ce
          * @throws IOException
          */
-        public void update( ICacheElement ce )
+        public void update( ICacheElement<K, V> ce )
             throws IOException
         {
             lastUpdatedItem = ce;
@@ -329,7 +329,7 @@ public class CompositeCacheDiskUsageUnit
          * @return ICacheElement
          * @throws IOException
          */
-        public ICacheElement get( Serializable key )
+        public ICacheElement<K, V> get( K key )
             throws IOException
         {
             return null;
@@ -339,12 +339,12 @@ public class CompositeCacheDiskUsageUnit
          * Gets multiple items from the cache based on the given set of keys.
          * <p>
          * @param keys
-         * @return a map of Serializable key to ICacheElement element, or an empty map if there is
+         * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is
          *         no data in cache for any of these keys
          */
-        public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
+        public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
         {
-            return new HashMap<Serializable, ICacheElement>();
+            return new HashMap<K, ICacheElement<K, V>>();
         }
 
         /**
@@ -352,7 +352,7 @@ public class CompositeCacheDiskUsageUnit
          * @return false
          * @throws IOException
          */
-        public boolean remove( Serializable key )
+        public boolean remove( K key )
             throws IOException
         {
             return false;
@@ -395,7 +395,7 @@ public class CompositeCacheDiskUsageUnit
          * @return null
          * @throws IOException
          */
-        public Set<Serializable> getGroupKeys( String group )
+        public Set<K> getGroupKeys( String group )
             throws IOException
         {
             return null;
@@ -465,7 +465,7 @@ public class CompositeCacheDiskUsageUnit
          * @return Collections.EMPTY_MAP;
          * @throws IOException
          */
-        public Map<Serializable, ICacheElement> getMatching(String pattern)
+        public Map<K, ICacheElement<K, V>> getMatching(String pattern)
             throws IOException
         {
             return Collections.emptyMap();

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java Wed May 30 18:14:43 2012
@@ -60,25 +60,25 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( cacheName, cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cacheName, cattr, attr );
 
-        MockAuxiliaryCache diskMock = new MockAuxiliaryCache();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = ICache.DISK_CACHE;
-        AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock };
+        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
         cache.setAuxCaches( aux );
 
         // DO WORK
         int numToInsert = 10;
         for ( int i = 0; i < numToInsert; i++ )
         {
-            ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
         cache.dispose();
 
         // VERIFY
-        MockMemoryCache memoryCache = (MockMemoryCache) cache.getMemoryCache();
+        MockMemoryCache<String, Integer> memoryCache = (MockMemoryCache<String, Integer>) cache.getMemoryCache();
         assertEquals( "Wrong number freed.", numToInsert, memoryCache.lastNumberOfFreedElements );
     }
 
@@ -99,25 +99,25 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( cacheName, cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cacheName, cattr, attr );
 
-        MockAuxiliaryCache diskMock = new MockAuxiliaryCache();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = ICache.REMOTE_CACHE;
-        AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock };
+        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
         cache.setAuxCaches( aux );
 
         // DO WORK
         int numToInsert = 10;
         for ( int i = 0; i < numToInsert; i++ )
         {
-            ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
         cache.dispose();
 
         // VERIFY
-        MockMemoryCache memoryCache = (MockMemoryCache) cache.getMemoryCache();
+        MockMemoryCache<String, Integer> memoryCache = (MockMemoryCache<String, Integer>) cache.getMemoryCache();
         assertEquals( "Wrong number freed.", 0, memoryCache.lastNumberOfFreedElements );
     }
 
@@ -141,11 +141,11 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( cacheName, cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cacheName, cattr, attr );
 
-        MockAuxiliaryCache diskMock = new MockAuxiliaryCache();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = ICache.DISK_CACHE;
-        AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock };
+        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
         cache.setAuxCaches( aux );
 
         // DO WORK
@@ -153,7 +153,7 @@ public class CompositeCacheUnitTest
         // insert with prefix1
         for ( int i = 0; i < numToInsertPrefix1; i++ )
         {
-            ICacheElement element = new CacheElement( cacheName, keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
@@ -161,18 +161,18 @@ public class CompositeCacheUnitTest
         // insert with prefix1
         for ( int i = 0; i < numToInsertPrefix2; i++ )
         {
-            ICacheElement element = new CacheElement( cacheName, keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) );
+            ICacheElement<String, Integer> element = new CacheElement<String, Integer>( cacheName, keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) );
             cache.update( element, false );
         }
 
-        Map result1 = cache.getMatching( keyprefix1 + "\\S+" );
-        Map result2 = cache.getMatching( keyprefix2 + "\\S+" );
+        Map<?, ?> result1 = cache.getMatching( keyprefix1 + "\\S+" );
+        Map<?, ?> result2 = cache.getMatching( keyprefix2 + "\\S+" );
 
         // VERIFY
         assertEquals( "Wrong number returned 1:", numToInsertPrefix1, result1.size() );
         assertEquals( "Wrong number returned 2:", numToInsertPrefix2, result2.size() );
     }
-    
+
     /**
      * Verify we try a disk aux on a getMatching call.
      * <p>
@@ -191,11 +191,11 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( cacheName, cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cacheName, cattr, attr );
 
-        MockAuxiliaryCache diskMock = new MockAuxiliaryCache();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = ICache.DISK_CACHE;
-        AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock };
+        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
         cache.setAuxCaches( aux );
 
         // DO WORK
@@ -204,7 +204,7 @@ public class CompositeCacheUnitTest
         // VERIFY
         assertEquals( "Wrong number of calls", 1, diskMock.getMatchingCallCount );
     }
-    
+
     /**
      * Verify we try a remote  aux on a getMatching call.
      * <p>
@@ -223,11 +223,11 @@ public class CompositeCacheUnitTest
 
         IElementAttributes attr = new ElementAttributes();
 
-        CompositeCache cache = new CompositeCache( cacheName, cattr, attr );
+        CompositeCache<String, Integer> cache = new CompositeCache<String, Integer>( cacheName, cattr, attr );
 
-        MockAuxiliaryCache diskMock = new MockAuxiliaryCache();
+        MockAuxiliaryCache<String, Integer> diskMock = new MockAuxiliaryCache<String, Integer>();
         diskMock.cacheType = ICache.REMOTE_CACHE;
-        AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock };
+        AuxiliaryCache<String, Integer>[] aux = new AuxiliaryCache[] { diskMock };
         cache.setAuxCaches( aux );
 
         // DO WORK

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java Wed May 30 18:14:43 2012
@@ -19,6 +19,7 @@ package org.apache.jcs.engine.control;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.Properties;
 
 import org.apache.jcs.engine.CompositeCacheAttributes;
@@ -26,11 +27,11 @@ import org.apache.jcs.engine.ElementAttr
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
 /** For testing. */
-public class MockCompositeCacheManager
+public class MockCompositeCacheManager<K extends Serializable, V extends Serializable>
     implements ICompositeCacheManager
 {
     /** The cache that was returned. */
-    private CompositeCache cache;
+    private CompositeCache<K, V> cache;
 
     /** Properties with which this manager was configured. This is exposed for other managers. */
     private Properties configurationProperties;
@@ -39,12 +40,12 @@ public class MockCompositeCacheManager
      * @param cacheName
      * @return Returns a CompositeCache
      */
-    public CompositeCache getCache( String cacheName )
+    public CompositeCache<K, V> getCache( String cacheName )
     {
         if ( cache == null )
         {
             System.out.println( "Creating mock cache" );
-            CompositeCache newCache = new CompositeCache( cacheName, new CompositeCacheAttributes(),
+            CompositeCache<K, V> newCache = new CompositeCache<K, V>( cacheName, new CompositeCacheAttributes(),
                                                           new ElementAttributes() );
             this.setCache( newCache );
         }
@@ -54,7 +55,7 @@ public class MockCompositeCacheManager
     /**
      * @param cache The cache to set.
      */
-    public void setCache( CompositeCache cache )
+    public void setCache( CompositeCache<K, V> cache )
     {
         this.cache = cache;
     }
@@ -62,7 +63,7 @@ public class MockCompositeCacheManager
     /**
      * @return Returns the cache.
      */
-    public CompositeCache getCache()
+    public CompositeCache<K, V> getCache()
     {
         return cache;
     }

Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java
            ('svn:mergeinfo' removed)

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java Wed May 30 18:14:43 2012
@@ -12,10 +12,10 @@ public class MockElementSerializer
 {
     /** test property */
     private String testProperty;
-    
+
     /** What's used in the background */
-    private StandardSerializer serializer = new StandardSerializer();    
-    
+    private final StandardSerializer serializer = new StandardSerializer();
+
     /** times out was called */
     public int deSerializeCount = 0;
 
@@ -23,13 +23,13 @@ public class MockElementSerializer
     public int serializeCount = 0;
 
     /**
-     * @param bytes 
+     * @param bytes
      * @return Object
-     * @throws IOException 
-     * @throws ClassNotFoundException 
-     * 
+     * @throws IOException
+     * @throws ClassNotFoundException
+     *
      */
-    public Object deSerialize( byte[] bytes )
+    public <T extends Serializable> T deSerialize( byte[] bytes )
         throws IOException, ClassNotFoundException
     {
         deSerializeCount++;
@@ -37,18 +37,18 @@ public class MockElementSerializer
     }
 
     /**
-     * @param obj 
+     * @param obj
      * @return byte[]
-     * @throws IOException 
-     * 
+     * @throws IOException
+     *
      */
-    public byte[] serialize( Serializable obj )
+    public <T extends Serializable> byte[] serialize( T obj )
         throws IOException
     {
         serializeCount++;
         return serializer.serialize( obj );
     }
-    
+
     /**
      * @param testProperty
      */
@@ -63,5 +63,5 @@ public class MockElementSerializer
     public String getTestProperty()
     {
         return testProperty;
-    }    
+    }
 }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java Wed May 30 18:14:43 2012
@@ -56,7 +56,7 @@ public class SimpleEventHandlingUnitTest
         // SETUP
         MyEventHandler meh = new MyEventHandler();
 
-        JCS jcs = JCS.getInstance( "WithDisk" );
+        JCS<String, String> jcs = JCS.getInstance( "WithDisk" );
         // this should add the event handler to all items as they are created.
         IElementAttributes attributes = jcs.getDefaultElementAttributes();
         attributes.addElementEventHandler( meh );
@@ -86,7 +86,7 @@ public class SimpleEventHandlingUnitTest
     public void testSpoolNoDiskEvent()
         throws Exception
     {
-        JCS jcs = JCS.getInstance( "NoDisk" );
+        JCS<String, String> jcs = JCS.getInstance( "NoDisk" );
 
         MyEventHandler meh = new MyEventHandler();
 
@@ -119,7 +119,7 @@ public class SimpleEventHandlingUnitTest
     {
         MyEventHandler meh = new MyEventHandler();
 
-        JCS jcs = JCS.getInstance( "DiskButNotAllowed" );
+        JCS<String, String> jcs = JCS.getInstance( "DiskButNotAllowed" );
         // this should add the event handler to all items as they are created.
         IElementAttributes attributes = jcs.getDefaultElementAttributes();
         attributes.addElementEventHandler( meh );
@@ -149,7 +149,7 @@ public class SimpleEventHandlingUnitTest
     {
         MyEventHandler meh = new MyEventHandler();
 
-        JCS jcs = JCS.getInstance( "DiskButNotAllowed" );
+        JCS<String, String> jcs = JCS.getInstance( "DiskButNotAllowed" );
         // this should add the event handler to all items as they are created.
         //IElementAttributes attributes = jcs.getDefaultElementAttributes();
         //attributes.addElementEventHandler( meh );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java Wed May 30 18:14:43 2012
@@ -33,13 +33,13 @@ public class CacheEventLoggerDebugLogger
         CacheEventLoggerDebugLogger logger = new CacheEventLoggerDebugLogger();
         logger.setLogCategoryName( logCategoryName );
 
-        ICacheEvent event = logger.createICacheEvent( source, region, eventName, optionalDetails, key );
+        ICacheEvent<String> event = logger.createICacheEvent( source, region, eventName, optionalDetails, key );
 
         // DO WORK
         logger.logICacheEvent( event );
-        
+
         // VERIFY
-        String result = stringWriter.toString();     
+        String result = stringWriter.toString();
         assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 );
         assertTrue( "An event with the region should have been logged:" + result, result.indexOf( region ) != -1 );
         assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 );
@@ -65,14 +65,14 @@ public class CacheEventLoggerDebugLogger
 
         // DO WORK
         logger.logApplicationEvent( source, eventName, optionalDetails );
-        
+
         // VERIFY
-        String result = stringWriter.toString();  
+        String result = stringWriter.toString();
         assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 );
         assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 );
         assertTrue( "An event with the optionalDetails should have been logged:" + result, result.indexOf( optionalDetails ) != -1 );
     }
-    
+
     /** verify that we can log */
     public void testLogError_normal()
     {
@@ -91,14 +91,14 @@ public class CacheEventLoggerDebugLogger
 
         // DO WORK
         logger.logError( source, eventName, errorMessage );
-        
+
         // VERIFY
-        String result = stringWriter.toString();  
+        String result = stringWriter.toString();
         assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 );
         assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 );
         assertTrue( "An event with the errorMessage should have been logged:" + result, result.indexOf( errorMessage ) != -1 );
     }
-    
+
     /**
      * Configures a logger for the given name. This allows us to check the log output.
      * <p>

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java Wed May 30 18:14:43 2012
@@ -2,8 +2,6 @@ package org.apache.jcs.engine.logging;
 
 import java.io.Serializable;
 
-import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.logging.CacheEvent;
 import org.apache.jcs.engine.logging.behavior.ICacheEvent;
 import org.apache.jcs.engine.logging.behavior.ICacheEventLogger;
 
@@ -23,7 +21,7 @@ public class MockCacheEventLogger
      */
     public void logApplicationEvent( String source, String eventName, String optionalDetails )
     {
-        // TODO Auto-generated method stub            
+        // TODO Auto-generated method stub
     }
 
     /**
@@ -33,7 +31,7 @@ public class MockCacheEventLogger
      */
     public void logError( String source, String eventName, String errorMessage )
     {
-        // TODO Auto-generated method stub            
+        // TODO Auto-generated method stub
     }
 
     /**
@@ -44,32 +42,18 @@ public class MockCacheEventLogger
      * @param key
      * @return ICacheEvent
      */
-    public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
-                                          Serializable key )
+    public <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region, String eventName, String optionalDetails,
+                                          T key )
     {
-        return new CacheEvent();
-    }
-
-    /**
-     * @param source
-     * @param region
-     * @param eventName
-     * @param optionalDetails
-     * @param item
-     * @return ICacheEvent
-     */
-    public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails,
-                                          ICacheElement item )
-    {
-        return new CacheEvent();
+        return new CacheEvent<T>();
     }
 
     /**
      * @param event
      */
-    public void logICacheEvent( ICacheEvent event )
+    public <T extends Serializable> void logICacheEvent( ICacheEvent<T> event )
     {
-        // TODO Auto-generated method stub        
+        // TODO Auto-generated method stub
     }
 
     /**

Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java
            ('svn:mergeinfo' removed)

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java Wed May 30 18:14:43 2012
@@ -1,5 +1,6 @@
 package org.apache.jcs.engine.match;
 
+import java.util.HashSet;
 import java.util.Set;
 
 import junit.framework.TestCase;
@@ -15,21 +16,20 @@ public class KeyMatcherPatternImpllUnitT
     {
         // SETUP
         int numToInsertPrefix1 = 10;
-        int araySize = numToInsertPrefix1;
-        Object[] keyArray = new Object[araySize];
+        Set<String> keyArray = new HashSet<String>();
 
         String keyprefix1 = "MyPrefixC";
 
         // insert with prefix1
         for ( int i = 0; i < numToInsertPrefix1; i++ )
         {
-            keyArray[i] = keyprefix1 + String.valueOf( i );
+            keyArray.add(keyprefix1 + String.valueOf( i ));
         }
 
-        KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl();
+        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<String>();
 
         // DO WORK
-        Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".", keyArray );
+        Set<String> result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".", keyArray );
 
         // VERIFY
         assertEquals( "Wrong number returned 1: " + result1, numToInsertPrefix1, result1.size() );
@@ -42,21 +42,20 @@ public class KeyMatcherPatternImpllUnitT
     {
         // SETUP
         int numToInsertPrefix1 = 10;
-        int araySize = numToInsertPrefix1 + 1;
-        Object[] keyArray = new Object[araySize];
+        Set<String> keyArray = new HashSet<String>();
 
         String keyprefix1 = "MyPrefixC";
 
         // insert with prefix1
         for ( int i = 1; i < numToInsertPrefix1 + 1; i++ )
         {
-            keyArray[i] = keyprefix1 + String.valueOf( i );
+            keyArray.add(keyprefix1 + String.valueOf( i ));
         }
 
-        KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl();
+        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<String>();
 
         // DO WORK
-        Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + "\\S+", keyArray );
+        Set<String> result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + "\\S+", keyArray );
 
         // VERIFY
         assertEquals( "Wrong number returned 1: " + result1, numToInsertPrefix1, result1.size() );
@@ -65,13 +64,12 @@ public class KeyMatcherPatternImpllUnitT
     /**
      * Verify that the matching method works.
      */
-    public void testGetMathcingKeysFromArray_TwoTypes()
+    public void testGetMatchingKeysFromArray_TwoTypes()
     {
         // SETUP
         int numToInsertPrefix1 = 10;
         int numToInsertPrefix2 = 50;
-        int araySize = numToInsertPrefix1 + numToInsertPrefix2;
-        Object[] keyArray = new Object[araySize];
+        Set<String> keyArray = new HashSet<String>();
 
         String keyprefix1 = "MyPrefixA";
         String keyprefix2 = "MyPrefixB";
@@ -79,20 +77,20 @@ public class KeyMatcherPatternImpllUnitT
         // insert with prefix1
         for ( int i = 0; i < numToInsertPrefix1; i++ )
         {
-            keyArray[i] = keyprefix1 + String.valueOf( i );
+            keyArray.add(keyprefix1 + String.valueOf( i ));
         }
 
         // insert with prefix2
         for ( int i = numToInsertPrefix1; i < numToInsertPrefix2 + numToInsertPrefix1; i++ )
         {
-            keyArray[i] = keyprefix2 + String.valueOf( i );
+            keyArray.add(keyprefix2 + String.valueOf( i ));
         }
 
-        KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl();
+        KeyMatcherPatternImpl<String> keyMatcher = new KeyMatcherPatternImpl<String>();
 
         // DO WORK
-        Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".+", keyArray );
-        Set result2 = keyMatcher.getMatchingKeysFromArray( keyprefix2 + ".+", keyArray );
+        Set<String> result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".+", keyArray );
+        Set<String> result2 = keyMatcher.getMatchingKeysFromArray( keyprefix2 + ".+", keyArray );
 
         // VERIFY
         assertEquals( "Wrong number returned 1: " + result1, numToInsertPrefix1, result1.size() );

Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java
            ('svn:mergeinfo' removed)

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java Wed May 30 18:14:43 2012
@@ -23,12 +23,14 @@ import java.io.IOException;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
 import org.apache.jcs.engine.control.CompositeCache;
+import org.apache.jcs.engine.memory.behavior.IMemoryCache;
 import org.apache.jcs.engine.memory.util.MemoryElementDescriptor;
 import org.apache.jcs.engine.stats.behavior.IStats;
 
@@ -37,14 +39,14 @@ import org.apache.jcs.engine.stats.behav
  * <p>
  * @author Aaron Smuts
  */
-public class MockMemoryCache
-    implements MemoryCache
+public class MockMemoryCache<K extends Serializable, V extends Serializable>
+    implements IMemoryCache<K, V>
 {
     /** Config */
     private ICompositeCacheAttributes cacheAttr;
 
     /** Internal map */
-    private final HashMap<Serializable, ICacheElement> map = new HashMap<Serializable, ICacheElement>();
+    private final HashMap<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K, V>>();
 
     /** The number of times waterfall was called. */
     public int waterfallCallCount = 0;
@@ -56,7 +58,7 @@ public class MockMemoryCache
      * Does nothing
      * @param cache
      */
-    public void initialize( CompositeCache cache )
+    public void initialize( CompositeCache<K, V> cache )
     {
         // nothing
     }
@@ -85,16 +87,16 @@ public class MockMemoryCache
     }
 
     /** @return null */
-    public Iterator<Map.Entry<Serializable, MemoryElementDescriptor>> getIterator()
+    public Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> getIterator()
     {
         return null;
     }
 
     /**
      * @return map.keySet().toArray( */
-    public Object[] getKeyArray()
+    public Set<K> getKeySet()
     {
-        return map.keySet().toArray();
+        return new LinkedHashSet<K>(map.keySet());
     }
 
     /**
@@ -102,7 +104,7 @@ public class MockMemoryCache
      * @return map.remove( key ) != null
      * @throws IOException
      */
-    public boolean remove( Serializable key )
+    public boolean remove( K key )
         throws IOException
     {
         return map.remove( key ) != null;
@@ -122,7 +124,7 @@ public class MockMemoryCache
      * @return (ICacheElement) map.get( key )
      * @throws IOException
      */
-    public ICacheElement get( Serializable key )
+    public ICacheElement<K, V> get( K key )
         throws IOException
     {
         return map.get( key );
@@ -133,20 +135,20 @@ public class MockMemoryCache
      * @return elements
      * @throws IOException
      */
-    public Map<Serializable, ICacheElement> getMultiple(Set<Serializable> keys)
+    public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
         throws IOException
     {
-        Map<Serializable, ICacheElement> elements = new HashMap<Serializable, ICacheElement>();
+        Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
 
         if ( keys != null && !keys.isEmpty() )
         {
-            Iterator<Serializable> iterator = keys.iterator();
+            Iterator<K> iterator = keys.iterator();
 
             while ( iterator.hasNext() )
             {
-                Serializable key = iterator.next();
+                K key = iterator.next();
 
-                ICacheElement element = get( key );
+                ICacheElement<K, V> element = get( key );
 
                 if ( element != null )
                 {
@@ -163,7 +165,7 @@ public class MockMemoryCache
      * @return (ICacheElement) map.get( key )
      * @throws IOException
      */
-    public ICacheElement getQuiet( Serializable key )
+    public ICacheElement<K, V> getQuiet( K key )
         throws IOException
     {
         return map.get( key );
@@ -173,7 +175,7 @@ public class MockMemoryCache
      * @param ce
      * @throws IOException
      */
-    public void waterfal( ICacheElement ce )
+    public void waterfal( ICacheElement<K, V> ce )
         throws IOException
     {
         waterfallCallCount++;
@@ -183,7 +185,7 @@ public class MockMemoryCache
      * @param ce
      * @throws IOException
      */
-    public void update( ICacheElement ce )
+    public void update( ICacheElement<K, V> ce )
         throws IOException
     {
         if ( ce != null )
@@ -209,7 +211,7 @@ public class MockMemoryCache
     }
 
     /** @return null */
-    public CompositeCache getCompositeCache()
+    public CompositeCache<K, V> getCompositeCache()
     {
         return null;
     }
@@ -218,7 +220,7 @@ public class MockMemoryCache
      * @param group
      * @return null
      */
-    public Set<Serializable> getGroupKeys( String group )
+    public Set<K> getGroupKeys( String group )
     {
         return null;
     }

Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java
            ('svn:mergeinfo' removed)

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java Wed May 30 18:14:43 2012
@@ -30,17 +30,17 @@ public class FIFOMemoryCacheUnitTest
         attributes.setMaxObjects( maxObjects );
         attributes.setSpoolChunkSize( 1 );
 
-        FIFOMemoryCache cache = new FIFOMemoryCache();
-        cache.initialize( new CompositeCache( cacheName, attributes,
+        FIFOMemoryCache<String, String> cache = new FIFOMemoryCache<String, String>();
+        cache.initialize( new CompositeCache<String, String>( cacheName, attributes,
                                               new ElementAttributes() ) );
-        
+
         for ( int i = 0; i <= maxObjects; i++ )
         {
-            CacheElement element = new CacheElement( cacheName, "key" + i, "value" + i );
+            CacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key" + i, "value" + i );
             cache.update( element );
         }
 
-        CacheElement oneMoreElement = new CacheElement( cacheName, "onemore", "onemore" );
+        CacheElement<String, String> oneMoreElement = new CacheElement<String, String>( cacheName, "onemore", "onemore" );
 
         // DO WORK
         cache.update( oneMoreElement );
@@ -53,7 +53,7 @@ public class FIFOMemoryCacheUnitTest
         }
         assertNotNull( "Shjould have oneMoreElement", cache.get( "onemore" ) );
     }
-    
+
     /**
      * Verify that the oldest inserted item is removed
      * <p>
@@ -70,16 +70,16 @@ public class FIFOMemoryCacheUnitTest
         attributes.setMaxObjects( maxObjects );
         attributes.setSpoolChunkSize( 1 );
 
-        FIFOMemoryCache cache = new FIFOMemoryCache();
-        cache.initialize( new CompositeCache( cacheName, attributes,
+        FIFOMemoryCache<String, String> cache = new FIFOMemoryCache<String, String>();
+        cache.initialize( new CompositeCache<String, String>( cacheName, attributes,
                                               new ElementAttributes() ) );
 
         // DO WORK
         for ( int i = 0; i <= (maxObjects * 2); i++ )
         {
-            CacheElement element = new CacheElement( cacheName, "key" + i, "value" + i );
+            CacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key" + i, "value" + i );
             cache.update( element );
-        }       
+        }
 
         // VERIFY
         assertEquals( "Should have max elements", maxObjects, cache.getSize() );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java Wed May 30 18:14:43 2012
@@ -83,7 +83,7 @@ public class LHMLRUMemoryCacheConcurrent
                 this.runTestForRegion( "indexedRegion1" );
             }
         } );
-        
+
         return suite;
     }
 
@@ -110,16 +110,16 @@ public class LHMLRUMemoryCacheConcurrent
     {
         CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance();
         cacheMgr.configure( "/TestLHMLRUCache.ccf" );
-        CompositeCache cache = cacheMgr.getCache( region );
+        CompositeCache<String, String> cache = cacheMgr.getCache( region );
 
-        LRUMemoryCache lru = new LRUMemoryCache();
+        LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>();
         lru.initialize( cache );
 
         // Add items to cache
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", region + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", region + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             lru.update( ice );
         }
@@ -133,25 +133,25 @@ public class LHMLRUMemoryCacheConcurrent
         // Test that last items are in cache
         for ( int i = 100; i < items; i++ )
         {
-            String value = (String) lru.get( i + ":key" ).getVal();
+            String value = lru.get( i + ":key" ).getVal();
             assertEquals( region + " data " + i, value );
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = lru.getMultiple( keys );
+        Map<String, ICacheElement<String, String>> elements = lru.getMultiple( keys );
         for ( int i = 0; i < 100; i++ )
         {
             assertNull( "Should not have " + i + ":key", elements.get( i + ":key" ) );
         }
         for ( int i = 100; i < items; i++ )
         {
-            ICacheElement element = (ICacheElement) elements.get( i + ":key" );
+            ICacheElement<String, String> element = elements.get( i + ":key" );
             assertNotNull( "element " + i + ":key is missing", element );
             assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() );
         }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java Wed May 30 18:14:43 2012
@@ -55,7 +55,7 @@ public class LHMLRUMemoryCacheUnitTest
     public void testLoadFromCCF()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGet" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGet" );
         String memoryCacheName = cache.getCacheAttributes().getMemoryCacheName();
         assertTrue( "Cache name should have LHMLRU in it.", memoryCacheName.indexOf( "LHMLRUMemoryCache" ) != -1 );
     }
@@ -68,7 +68,7 @@ public class LHMLRUMemoryCacheUnitTest
     public void testPutGetThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -81,7 +81,7 @@ public class LHMLRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max -1; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache." + cache.getStats(), value );
         }
 
@@ -89,25 +89,25 @@ public class LHMLRUMemoryCacheUnitTest
         // skip 2 for the buffer.
         for ( int i = max + 2; i < items; i++ )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertEquals( "myregion" + " data " + i, value );
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = cache.getCacheElements( keys );
+        Map<String, ICacheElement<String, String>> elements = cache.getCacheElements( keys );
         for ( int i = max-1; i >= 0; i-- )
         {
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache." + cache.getStats(), elements.get( i + ":key" ) );
         }
         for ( int i = max + 2; i < items; i++ )
         {
-            ICacheElement element = (ICacheElement) elements.get( i + ":key" );
+            ICacheElement<String, String> element = elements.get( i + ":key" );
             assertNotNull( "element " + i + ":key is missing", element );
             assertEquals( "value " + i + ":key", "myregion" + " data " + i, element.getVal() );
         }
@@ -121,7 +121,7 @@ public class LHMLRUMemoryCacheUnitTest
     public void testPutGetThroughHubTwice()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -139,7 +139,7 @@ public class LHMLRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max -1; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value );
         }
 
@@ -147,7 +147,7 @@ public class LHMLRUMemoryCacheUnitTest
         // skip 2 for the buffer.
         for ( int i = max + 2; i < items; i++ )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertEquals( "myregion" + " data " + i, value );
         }
 
@@ -161,7 +161,7 @@ public class LHMLRUMemoryCacheUnitTest
     public void testPutRemoveThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -179,7 +179,7 @@ public class LHMLRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value );
         }
     }
@@ -192,7 +192,7 @@ public class LHMLRUMemoryCacheUnitTest
     public void testClearThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -207,7 +207,7 @@ public class LHMLRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value );
         }
     }
@@ -220,7 +220,7 @@ public class LHMLRUMemoryCacheUnitTest
     public void testGetStatsThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testGetStatsThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testGetStatsThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -249,9 +249,9 @@ public class LHMLRUMemoryCacheUnitTest
     {
         CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance();
         cacheMgr.configure( "/TestLHMLRUCache.ccf" );
-        CompositeCache cache = cacheMgr.getCache( "testGetKeyArray" );
+        CompositeCache<String, String> cache = cacheMgr.getCache( "testGetKeyArray" );
 
-        LHMLRUMemoryCache mru = new LHMLRUMemoryCache();
+        LHMLRUMemoryCache<String, String> mru = new LHMLRUMemoryCache<String, String>();
         mru.initialize( cache );
 
         int max = cache.getCacheAttributes().getMaxObjects();
@@ -259,25 +259,25 @@ public class LHMLRUMemoryCacheUnitTest
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             mru.update( ice );
         }
 
-        Object[] keys = mru.getKeyArray();
+        Set<String> keys = mru.getKeySet();
 
-        assertEquals( "Wrong number of keys.", items, keys.length );
+        assertEquals( "Wrong number of keys.", items, keys.size() );
     }
 
     /**
-     * Add a few keys with the delimeter. Remove them.
+     * Add a few keys with the delimiter. Remove them.
      * <p>
      * @throws CacheException
      */
     public void testRemovePartialThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testGetStatsThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testGetStatsThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max / 2;
@@ -294,7 +294,7 @@ public class LHMLRUMemoryCacheUnitTest
         // Test that last items are in cache
         for ( int i = 0; i < items; i++ )
         {
-            String value = (String) cache.get( root + ":" + i + ":key" );
+            String value = cache.get( root + ":" + i + ":key" );
             assertEquals( "myregion" + " data " + i, value );
         }
 

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java Wed May 30 18:14:43 2012
@@ -83,7 +83,7 @@ public class LRUMemoryCacheConcurrentUni
                 this.runTestForRegion( "testRegion1" );
             }
         } );
-        
+
         return suite;
     }
 
@@ -109,16 +109,16 @@ public class LRUMemoryCacheConcurrentUni
     {
         CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance();
         cacheMgr.configure( "/TestDiskCache.ccf" );
-        CompositeCache cache = cacheMgr.getCache( region );
+        CompositeCache<String, String> cache = cacheMgr.getCache( region );
 
-        LRUMemoryCache lru = new LRUMemoryCache();
+        LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>();
         lru.initialize( cache );
 
         // Add items to cache
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", region + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", region + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             lru.update( ice );
         }
@@ -132,25 +132,25 @@ public class LRUMemoryCacheConcurrentUni
         // Test that last items are in cache
         for ( int i = 100; i < items; i++ )
         {
-            String value = (String) lru.get( i + ":key" ).getVal();
+            String value = lru.get( i + ":key" ).getVal();
             assertEquals( region + " data " + i, value );
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = lru.getMultiple( keys );
+        Map<String, ICacheElement<String, String>> elements = lru.getMultiple( keys );
         for ( int i = 0; i < 100; i++ )
         {
             assertNull( "Should not have " + i + ":key", elements.get( i + ":key" ) );
         }
         for ( int i = 100; i < items; i++ )
         {
-            ICacheElement element = (ICacheElement) elements.get( i + ":key" );
+            ICacheElement<String, String> element = elements.get( i + ":key" );
             assertNotNull( "element " + i + ":key is missing", element );
             assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() );
         }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java Wed May 30 18:14:43 2012
@@ -93,8 +93,8 @@ public class LRUvsMRUPerformanceTest
         {
 
             JCS.setConfigFilename( "/TestMRUCache.ccf" );
-            JCS cache = JCS.getInstance( "lruDefined" );
-            JCS mru = JCS.getInstance( "mruDefined" );
+            JCS<String, String> cache = JCS.getInstance( "lruDefined" );
+            JCS<String, String> mru = JCS.getInstance( "mruDefined" );
 
             System.out.println( "LRU = " + cache );
 

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java Wed May 30 18:14:43 2012
@@ -56,7 +56,7 @@ public class MRUMemoryCacheUnitTest
     public void testLoadFromCCF()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGet" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGet" );
         String memoryCacheName = cache.getCacheAttributes().getMemoryCacheName();
         assertTrue( "Cache name should have MRU in it.", memoryCacheName.indexOf( "MRUMemoryCache" ) != -1 );
     }
@@ -69,7 +69,7 @@ public class MRUMemoryCacheUnitTest
     public void testPutGetThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -82,7 +82,7 @@ public class MRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max -1; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache." + cache.getStats(), value );
         }
 
@@ -90,25 +90,25 @@ public class MRUMemoryCacheUnitTest
         // skip 2 for the buffer.
         for ( int i = max + 2; i < items; i++ )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertEquals( "myregion" + " data " + i, value );
         }
 
         // Test that getMultiple returns all the items remaining in cache and none of the missing ones
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = 0; i < items; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = cache.getCacheElements( keys );
+        Map<String, ICacheElement<String, String>> elements = cache.getCacheElements( keys );
         for ( int i = max-1; i >= 0; i-- )
         {
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache." + cache.getStats(), elements.get( i + ":key" ) );
         }
         for ( int i = max + 2; i < items; i++ )
         {
-            ICacheElement element = (ICacheElement) elements.get( i + ":key" );
+            ICacheElement<String, String> element = elements.get( i + ":key" );
             assertNotNull( "element " + i + ":key is missing", element );
             assertEquals( "value " + i + ":key", "myregion" + " data " + i, element.getVal() );
         }
@@ -122,7 +122,7 @@ public class MRUMemoryCacheUnitTest
     public void testPutGetThroughHubTwice()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -140,7 +140,7 @@ public class MRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max-1; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value );
         }
 
@@ -148,7 +148,7 @@ public class MRUMemoryCacheUnitTest
         // skip 2 for the buffer.
         for ( int i = max + 2; i < items; i++ )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertEquals( "myregion" + " data " + i, value );
         }
 
@@ -162,7 +162,7 @@ public class MRUMemoryCacheUnitTest
     public void testPutRemoveThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -180,7 +180,7 @@ public class MRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value );
         }
     }
@@ -193,7 +193,7 @@ public class MRUMemoryCacheUnitTest
     public void testClearThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testPutGetThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testPutGetThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -208,7 +208,7 @@ public class MRUMemoryCacheUnitTest
         // Test that first items are not in the cache
         for ( int i = max; i >= 0; i-- )
         {
-            String value = (String) cache.get( i + ":key" );
+            String value = cache.get( i + ":key" );
             assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value );
         }
     }
@@ -221,7 +221,7 @@ public class MRUMemoryCacheUnitTest
     public void testGetStatsThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testGetStatsThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testGetStatsThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max * 2;
@@ -250,9 +250,9 @@ public class MRUMemoryCacheUnitTest
     {
         CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance();
         cacheMgr.configure( "/TestMRUCache.ccf" );
-        CompositeCache cache = cacheMgr.getCache( "testGetKeyArray" );
+        CompositeCache<String, String> cache = cacheMgr.getCache( "testGetKeyArray" );
 
-        MRUMemoryCache mru = new MRUMemoryCache();
+        MRUMemoryCache<String, String> mru = new MRUMemoryCache<String, String>();
         mru.initialize( cache );
 
         int max = cache.getCacheAttributes().getMaxObjects();
@@ -260,25 +260,25 @@ public class MRUMemoryCacheUnitTest
 
         for ( int i = 0; i < items; i++ )
         {
-            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
+            ICacheElement<String, String> ice = new CacheElement<String, String>( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
             ice.setElementAttributes( cache.getElementAttributes() );
             mru.update( ice );
         }
 
-        Object[] keys = mru.getKeyArray();
+        Set<String> keys = mru.getKeySet();
 
-        assertEquals( "Wrong number of keys.", items, keys.length );
+        assertEquals( "Wrong number of keys.", items, keys.size() );
     }
 
     /**
-     * Add a few keys with the delimeter. Remove them.
+     * Add a few keys with the delimiter. Remove them.
      * <p>
      * @throws CacheException
      */
     public void testRemovePartialThroughHub()
         throws CacheException
     {
-        JCS cache = JCS.getInstance( "testGetStatsThroughHub" );
+        JCS<String, String> cache = JCS.getInstance( "testGetStatsThroughHub" );
 
         int max = cache.getCacheAttributes().getMaxObjects();
         int items = max / 2;
@@ -295,7 +295,7 @@ public class MRUMemoryCacheUnitTest
         // Test that last items are in cache
         for ( int i = 0; i < items; i++ )
         {
-            String value = (String) cache.get( root + ":" + i + ":key" );
+            String value = cache.get( root + ":" + i + ":key" );
             assertEquals( "myregion" + " data " + i, value );
         }
 



Mime
View raw message