commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1344374 [10/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/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java Wed May 30 18:14:43 2012
@@ -2,6 +2,7 @@ package org.apache.jcs.auxiliary.disk.bl
 
 import junit.framework.TestCase;
 
+import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.MockCacheEventLogger;
 import org.apache.jcs.engine.behavior.IElementSerializer;
 import org.apache.jcs.engine.control.MockElementSerializer;
@@ -26,7 +27,8 @@ public class BlockDiskCacheManagerUnitTe
                                                                            elementSerializer );
 
         // DO WORK
-        BlockDiskCache cache = (BlockDiskCache) manager.getCache( cacheName );
+        AuxiliaryCache<String, String> auxcache = manager.getCache(cacheName);
+        BlockDiskCache<String, String> cache = (BlockDiskCache<String, String>) auxcache;
 
         // VERIFY
         assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger() );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheRandomConcurrentTestUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheRandomConcurrentTestUtil.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheRandomConcurrentTestUtil.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheRandomConcurrentTestUtil.java Wed May 30 18:14:43 2012
@@ -64,11 +64,11 @@ public class BlockDiskCacheRandomConcurr
 
         // make sure a simple put then get works
         // this may fail if the other tests are flooding the disk cache
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
         String key = "testKey" + testNum;
         String data = "testData" + testNum;
         jcs.put( key, data );
-        String value = (String) jcs.get( key );
+        String value = jcs.get( key );
         assertEquals( data, value );
     }
 

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java Wed May 30 18:14:43 2012
@@ -135,7 +135,7 @@ public class BlockDiskCacheSameRegionCon
     public void runTestForRegion( String region, int start, int end )
         throws Exception
     {
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
 
         // Add items to cache
 
@@ -149,22 +149,22 @@ public class BlockDiskCacheSameRegionCon
         for ( int i = start; i <= end; i++ )
         {
             String key = i + ":key";
-            String value = (String) jcs.get( key );
+            String value = jcs.get( key );
 
             assertEquals( "Wrong value for key [" + key + "]", region + " data " + i + "-" + region, value );
         }
 
         // Test that getElements returns all the expected values
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = start; i <= end; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = jcs.getCacheElements( keys );
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
         for ( int i = start; i <= end; 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 + "-" + region, element.getVal() );
         }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheSteadyLoadTest.java Wed May 30 18:14:43 2012
@@ -66,7 +66,7 @@ public class BlockDiskCacheSteadyLoadTes
         int runs = 1000;
         int upperKB = 50;
 
-        JCS jcs = JCS.getInstance( ( numPerRun / 2 ) + "aSecond" );
+        JCS<String, DiskTestObject> jcs = JCS.getInstance( ( numPerRun / 2 ) + "aSecond" );
 
         ElapsedTimer timer = new ElapsedTimer();
         int numToGet = numPerRun * ( runs / 10 );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java Wed May 30 18:14:43 2012
@@ -30,16 +30,16 @@ public class BlockDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/BlockDiskCacheUnitTest" );
-        BlockDiskCache diskCache = new BlockDiskCache( cattr );
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>( cattr );
 
         // DO WORK
         for ( int i = 0; i <= items; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, i + ":key", cacheName + " data " + i ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, i + ":key", cacheName + " data " + i ) );
         }
         Thread.sleep( 500 );
 
-        Map matchingResults = diskCache.getMatching( "1.8.+" );
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching( "1.8.+" );
 
         // VERIFY
         assertEquals( "Wrong number returned", 10, matchingResults.size() );
@@ -62,16 +62,16 @@ public class BlockDiskCacheUnitTest
         BlockDiskCacheAttributes cattr = new BlockDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
-        cattr.setDiskPath( "target/test-sandbox/BlockDiskCacheUnitTest" );
-        BlockDiskCache diskCache = new BlockDiskCache( cattr );
+        cattr.setDiskPath( "target/test-sandbox/BlockDiskCache<String, String>UnitTest" );
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>( cattr );
 
         // DO WORK
         for ( int i = 0; i <= items; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, i + ":key", cacheName + " data " + i ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, i + ":key", cacheName + " data " + i ) );
         }
 
-        Map matchingResults = diskCache.getMatching( "1.8.+" );
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching( "1.8.+" );
 
         // VERIFY
         assertEquals( "Wrong number returned", 10, matchingResults.size() );
@@ -123,7 +123,7 @@ public class BlockDiskCacheUnitTest
             resultData = newTotal;
         }
 
-        Serializable result = (Serializable) elementSerializer.deSerialize( resultData );
+        Serializable result = elementSerializer.deSerialize( resultData );
         System.out.println( result );
         assertEquals( "wrong string after retrieval", string, result );
     }
@@ -152,18 +152,18 @@ public class BlockDiskCacheUnitTest
         cattr.setMaxKeySize( 100 );
         cattr.setBlockSizeBytes( 200 );
         cattr.setDiskPath( "target/test-sandbox/BlockDiskCacheUnitTest" );
-        BlockDiskCache diskCache = new BlockDiskCache( cattr );
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>( cattr );
 
         // DO WORK
-        diskCache.update( new CacheElement( cacheName, "x", string ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "x", string ) );
 
         // VERIFY
         assertNotNull( diskCache.get( "x" ) );
         Thread.sleep( 1000 );
-        ICacheElement afterElement = diskCache.get( "x" );
+        ICacheElement<String, String> afterElement = diskCache.get( "x" );
         assertNotNull( afterElement );
         System.out.println( "afterElement = " + afterElement );
-        String after = (String) afterElement.getVal();
+        String after = afterElement.getVal();
 
         assertNotNull( after );
         assertEquals( "wrong string after retrieval", string, after );
@@ -195,18 +195,18 @@ public class BlockDiskCacheUnitTest
         cattr.setMaxKeySize( 100 );
         cattr.setBlockSizeBytes( 200 );
         cattr.setDiskPath( "target/test-sandbox/BlockDiskCacheUnitTest" );
-        BlockDiskCache diskCache = new BlockDiskCache( cattr );
+        BlockDiskCache<String, String> diskCache = new BlockDiskCache<String, String>( cattr );
 
         // DO WORK
-        diskCache.update( new CacheElement( cacheName, "x", string ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "x", string ) );
 
         // VERIFY
         assertNotNull( diskCache.get( "x" ) );
         Thread.sleep( 1000 );
-        ICacheElement afterElement = diskCache.get( "x" );
+        ICacheElement<String, String> afterElement = diskCache.get( "x" );
         assertNotNull( afterElement );
         System.out.println( "afterElement = " + afterElement );
-        String after = (String) afterElement.getVal();
+        String after = afterElement.getVal();
 
         assertNotNull( after );
         assertEquals( "wrong string after retrieval", string, after );
@@ -239,18 +239,18 @@ public class BlockDiskCacheUnitTest
         cattr.setMaxKeySize( 100 );
         cattr.setBlockSizeBytes( 200 );
         cattr.setDiskPath( "target/test-sandbox/BlockDiskCacheUnitTest" );
-        BlockDiskCache diskCache = new BlockDiskCache( cattr );
+        BlockDiskCache<String, byte[]> diskCache = new BlockDiskCache<String, byte[]>( cattr );
 
         // DO WORK
-        diskCache.update( new CacheElement( cacheName, "x", bytes ) );
+        diskCache.update( new CacheElement<String, byte[]>( cacheName, "x", bytes ) );
 
         // VERIFY
         assertNotNull( diskCache.get( "x" ) );
         Thread.sleep( 1000 );
-        ICacheElement afterElement = diskCache.get( "x" );
+        ICacheElement<String, byte[]> afterElement = diskCache.get( "x" );
         assertNotNull( afterElement );
         //System.out.println( "afterElement = " + afterElement );
-        byte[] after = (byte[]) afterElement.getVal();
+        byte[] after = afterElement.getVal();
 
         assertNotNull( after );
         assertEquals( "wrong bytes after retrieval", bytes.length, after.length );
@@ -288,17 +288,17 @@ public class BlockDiskCacheUnitTest
         cattr.setMaxKeySize( 100 );
         cattr.setBlockSizeBytes( 500 );
         cattr.setDiskPath( "target/test-sandbox/BlockDiskCacheUnitTest" );
-        BlockDiskCache diskCache = new BlockDiskCache( cattr );
+        BlockDiskCache<String, X> diskCache = new BlockDiskCache<String, X>( cattr );
 
         // DO WORK
-        diskCache.update( new CacheElement( cacheName, "x", before ) );
+        diskCache.update( new CacheElement<String, X>( cacheName, "x", before ) );
 
         // VERIFY
         assertNotNull( diskCache.get( "x" ) );
         Thread.sleep( 1000 );
-        ICacheElement afterElement = diskCache.get( "x" );
+        ICacheElement<String, X> afterElement = diskCache.get( "x" );
         System.out.println( "afterElement = " + afterElement );
-        X after = (X) ( afterElement.getVal() );
+        X after = ( afterElement.getVal() );
 
         assertNotNull( after );
         assertEquals( "wrong string after retrieval", string, after.string );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java Wed May 30 18:14:43 2012
@@ -44,7 +44,7 @@ public class BlockDiskElementDescriptorU
         System.out.println( "Before: " + memoryBefore );
 
         int numElements = 25000;
-        BlockDiskElementDescriptor[] elements = new BlockDiskElementDescriptor[numElements];
+        BlockDiskElementDescriptor<Integer>[] elements = new BlockDiskElementDescriptor[numElements];
 
         long memoryStart = measureMemoryUse();
         System.out.println( "Start: " + memoryStart );
@@ -52,7 +52,7 @@ public class BlockDiskElementDescriptorU
         // DO WORK
         for ( int i = 0; i < numElements; i++ )
         {
-            BlockDiskElementDescriptor descriptor = new BlockDiskElementDescriptor();
+            BlockDiskElementDescriptor<Integer> descriptor = new BlockDiskElementDescriptor<Integer>();
             descriptor.setKey( Integer.valueOf( i ) );
             descriptor.setBlocks( new int[] { 1, 2 } );
             elements[i] = descriptor;

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.disk.bl
  */
 
 import java.io.File;
+import java.util.Random;
 
 import junit.framework.TestCase;
 
@@ -271,14 +272,22 @@ public class BlockDiskUnitTest
         int bytes = getBytesForBlocksOfByteArrays( disk.getBlockSizeBytes(), numBlocksPerElement );
 
         int numElements = 100;
+        Random r = new Random(System.currentTimeMillis());
+        final byte[] src = new byte[bytes];
         for ( int i = 0; i < numElements; i++ )
         {
-            int[] blocks = disk.write( new byte[bytes] );
+            r.nextBytes(src);  // Ensure we don't just write zeros out
+            int[] blocks = disk.write( src );
             byte[] result = (byte[]) disk.read( blocks );
 
             // VERIFY
-            assertEquals( "Wrong item retured.", new byte[bytes].length, result.length );
+            assertEquals( "Wrong item length retured.", src.length, result.length );
             assertEquals( "Wrong number of blocks returned.", numBlocksPerElement, blocks.length );
+
+            // We check the array contents, too, to ensure we read back what we wrote out
+            for (int j = 0 ; j < src.length ; j++) {
+                assertEquals( "Mismatch at offset " + j + " in attempt # " + (i + 1), src[j], result[j] );
+            }
         }
         System.out.println( "testWriteAndReadMultipleMultiBlockElement_setSize " + disk );
         assertEquals( "Wrong number of elements.", numBlocksPerElement * numElements, disk.getNumberOfBlocks() );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java Wed May 30 18:14:43 2012
@@ -57,7 +57,7 @@ public class HugeQuantityBlockDiskCacheL
         long initialMemory = measureMemoryUse();
         System.out.println( "Before getting JCS: " + initialMemory );
 
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
         jcs.clear();
 
         try

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactoryUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactoryUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactoryUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheFactoryUnitTest.java Wed May 30 18:14:43 2012
@@ -22,14 +22,14 @@ public class FileDiskCacheFactoryUnitTes
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/FileDiskCacheFactoryUnitTest" );
 
-        ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
+        ICompositeCacheManager cacheMgr = new MockCompositeCacheManager<String, String>();
         ICacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         IElementSerializer elementSerializer = new MockElementSerializer();
 
         FileDiskCacheFactory factory = new FileDiskCacheFactory();
 
         // DO WORK
-        FileDiskCache result = (FileDiskCache) factory.createCache( cattr, cacheMgr, cacheEventLogger,
+        FileDiskCache<String, String> result = factory.createCache( cattr, cacheMgr, cacheEventLogger,
                                                                     elementSerializer );
 
         // VERIFY

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/file/FileDiskCacheUnitTest.java Wed May 30 18:14:43 2012
@@ -28,7 +28,7 @@ public class FileDiskCacheUnitTest
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
 
         // DO WORK
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
         File directory = diskCache.getDirectory();
 
         // VERIFY
@@ -54,7 +54,7 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         // DO WORK
         diskCache.dispose();
@@ -80,7 +80,7 @@ public class FileDiskCacheUnitTest
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest%$&*#@" );
 
         // DO WORK
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
         File directory = diskCache.getDirectory();
 
         // VERIFY
@@ -102,7 +102,7 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         diskCache.removeAll();
 
@@ -126,10 +126,10 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         diskCache.removeAll();
-        diskCache.update( new CacheElement( cacheName, "key1", "Data" ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "key1", "Data" ) );
         SleepUtil.sleepAtLeast( 100 );
 
         // DO WORK
@@ -152,9 +152,9 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
-        diskCache.update( new CacheElement( cacheName, "key1", "Data" ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "key1", "Data" ) );
         SleepUtil.sleepAtLeast( 100 );
 
         // DO WORK
@@ -179,10 +179,10 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         // DO WORK
-        ICacheElement result = diskCache.get( "key" );
+        ICacheElement<String, String> result = diskCache.get( "key" );
 
         // VERIFY
         assertNull( "Should be null.", result );
@@ -201,13 +201,13 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
-        diskCache.update( new CacheElement( cacheName, "key1", "Data" ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "key1", "Data" ) );
         SleepUtil.sleepAtLeast( 100 );
 
         // DO WORK
-        ICacheElement result = diskCache.get( "key1" );
+        ICacheElement<String, String> result = diskCache.get( "key1" );
 
         // VERIFY
         assertNotNull( "Should NOT be null.", result );
@@ -228,16 +228,16 @@ public class FileDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
         cattr.setMaxNumberOfFiles( maxNumberOfFiles );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         for ( int i = 0; i < maxNumberOfFiles; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, "key" + i, "Data" ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, "key" + i, "Data" ) );
         }
         SleepUtil.sleepAtLeast( 100 );
 
         // DO WORK
-        ICacheElement result = diskCache.get( "key0" );
+        ICacheElement<String, String> result = diskCache.get( "key0" );
 
         // VERIFY
         assertNotNull( "Should NOT be null.", result );
@@ -258,16 +258,16 @@ public class FileDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
         cattr.setMaxNumberOfFiles( maxNumberOfFiles );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         for ( int i = 0; i <= maxNumberOfFiles; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, "key" + i, "Data" ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, "key" + i, "Data" ) );
         }
         SleepUtil.sleepAtLeast( 100 );
 
         // DO WORK
-        ICacheElement result = diskCache.get( "key0" );
+        ICacheElement<String, String> result = diskCache.get( "key0" );
 
         // VERIFY
         assertNull( "Should be null.", result );
@@ -290,12 +290,12 @@ public class FileDiskCacheUnitTest
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
         cattr.setMaxNumberOfFiles( maxNumberOfFiles );
         cattr.setTouchOnGet( true );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
         diskCache.removeAll();
 
         for ( int i = 0; i < maxNumberOfFiles; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, "key" + i, "Data" ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, "key" + i, "Data" ) );
         }
         SleepUtil.sleepAtLeast( 100 );
 
@@ -303,18 +303,19 @@ public class FileDiskCacheUnitTest
         {
             // tv: The Mac file system has 1 sec resolution, so this is the minimum value
             // to make this test work.
-            SleepUtil.sleepAtLeast( 500 );
-            ICacheElement ice = diskCache.get( "key" + i );
+            SleepUtil.sleepAtLeast( 501 );
+            ICacheElement<String, String> ice = diskCache.get( "key" + i );
             assertNotNull("Value of key" + i + " should not be null", ice);
         }
+
         SleepUtil.sleepAtLeast( 100 );
 
         // This will push it over.  number 9, the youngest, but LRU item should be removed
-        diskCache.update( new CacheElement( cacheName, "key" + maxNumberOfFiles, "Data" ) );
-        SleepUtil.sleepAtLeast( 500 );
+        diskCache.update( new CacheElement<String, String>( cacheName, "key" + maxNumberOfFiles, "Data" ) );
+        SleepUtil.sleepAtLeast( 501 );
 
         // DO WORK
-        ICacheElement result = diskCache.get( "key9" );
+        ICacheElement<String, String> result = diskCache.get( "key9" );
 
         // VERIFY
         assertNull( "Should be null.", result );
@@ -337,12 +338,12 @@ public class FileDiskCacheUnitTest
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
         cattr.setMaxNumberOfFiles( maxNumberOfFiles );
         cattr.setTouchOnGet( false );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
         diskCache.removeAll();
 
         for ( int i = 0; i < maxNumberOfFiles; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, "key" + i, "Data" ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, "key" + i, "Data" ) );
         }
         SleepUtil.sleepAtLeast( 100 );
 
@@ -354,11 +355,11 @@ public class FileDiskCacheUnitTest
         SleepUtil.sleepAtLeast( 100 );
 
         // This will push it over.  number 0, the oldest should be removed
-        diskCache.update( new CacheElement( cacheName, "key" + maxNumberOfFiles, "Data" ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "key" + maxNumberOfFiles, "Data" ) );
         SleepUtil.sleepAtLeast( 100 );
 
         // DO WORK
-        ICacheElement result = diskCache.get( "key0" );
+        ICacheElement<String, String> result = diskCache.get( "key0" );
 
         // VERIFY
         assertNull( "Should be null.", result );
@@ -376,7 +377,7 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         String key = "simplestring";
 
@@ -400,7 +401,7 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         String key = "simple string";
 
@@ -424,7 +425,7 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         String key = "simple%string";
 
@@ -448,7 +449,7 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         String key = "simple%string";
         File firstResult = diskCache.file( key );
@@ -473,9 +474,9 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
-        diskCache.update( new CacheElement( cacheName, "key1", "Data" ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "key1", "Data" ) );
         SleepUtil.sleepAtLeast( 100 );
 
         // DO WORK
@@ -500,7 +501,7 @@ public class FileDiskCacheUnitTest
         FileDiskCacheAttributes cattr = new FileDiskCacheAttributes();
         cattr.setCacheName( cacheName );
         cattr.setDiskPath( "target/test-sandbox/DiskFileCacheUnitTest" );
-        FileDiskCache diskCache = new FileDiskCache( cattr );
+        FileDiskCache<String, String> diskCache = new FileDiskCache<String, String>( cattr );
 
         String string = "This is my big string ABCDEFGH";
         StringBuffer sb = new StringBuffer();
@@ -512,14 +513,14 @@ public class FileDiskCacheUnitTest
         string = sb.toString();
 
         // DO WORK
-        diskCache.update( new CacheElement( cacheName, "x", string ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "x", string ) );
         SleepUtil.sleepAtLeast( 300 );
 
         // VERIFY
-        ICacheElement afterElement = diskCache.get( "x" );
+        ICacheElement<String, String> afterElement = diskCache.get( "x" );
         assertNotNull( afterElement );
         System.out.println( "afterElement = " + afterElement );
-        String after = (String) afterElement.getVal();
+        String after = afterElement.getVal();
 
         assertNotNull( after );
         assertEquals( "wrong string after retrieval", string, after );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/DiskTestObjectUtil.java Wed May 30 18:14:43 2012
@@ -20,6 +20,7 @@ package org.apache.jcs.auxiliary.disk.in
  */
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.Random;
 
 import org.apache.jcs.auxiliary.disk.DiskTestObject;
@@ -63,7 +64,7 @@ public class DiskTestObjectUtil
      * @return size
      * @throws IOException
      */
-    public static long totalSize( ICacheElement[] elements, int endPosition )
+    public static <K extends Serializable, V extends Serializable> long totalSize( ICacheElement<K, V>[] elements, int endPosition )
         throws IOException
     {
         return totalSize( elements, 0, endPosition );
@@ -78,7 +79,7 @@ public class DiskTestObjectUtil
      * @return size
      * @throws IOException
      */
-    public static long totalSize( ICacheElement[] elements, int startPosition, int endPosition )
+    public static <K extends Serializable, V extends Serializable> long totalSize( ICacheElement<K, V>[] elements, int startPosition, int endPosition )
         throws IOException
     {
         StandardSerializer serializer = new StandardSerializer();
@@ -99,16 +100,16 @@ public class DiskTestObjectUtil
      * @param cacheName
      * @return ICacheElement[]
      */
-    public static ICacheElement[] createCacheElementsWithTestObjects( int numToCreate, int bytes, String cacheName )
+    public static ICacheElement<Integer, DiskTestObject>[] createCacheElementsWithTestObjects( int numToCreate, int bytes, String cacheName )
     {
-        ICacheElement[] elements = new ICacheElement[numToCreate];
+        ICacheElement<Integer, DiskTestObject>[] elements = new ICacheElement[numToCreate];
         for ( int i = 0; i < numToCreate; i++ )
         {
             // 24 KB
             int size = bytes * 1024;
             DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
 
-            ICacheElement element = new CacheElement( cacheName, tile.id, tile );
+            ICacheElement<Integer, DiskTestObject> element = new CacheElement<Integer, DiskTestObject>( cacheName, tile.id, tile );
             elements[i] = element;
         }
         return elements;
@@ -121,9 +122,9 @@ public class DiskTestObjectUtil
      * @param cacheName
      * @return ICacheElement[]
      */
-    public static ICacheElement[] createCacheElementsWithTestObjectsOfVariableSizes( int numToCreate, String cacheName )
+    public static ICacheElement<Integer, DiskTestObject>[] createCacheElementsWithTestObjectsOfVariableSizes( int numToCreate, String cacheName )
     {
-        ICacheElement[] elements = new ICacheElement[numToCreate];
+        ICacheElement<Integer, DiskTestObject>[] elements = new ICacheElement[numToCreate];
         Random random = new Random( 89 );
         for ( int i = 0; i < numToCreate; i++ )
         {
@@ -132,7 +133,7 @@ public class DiskTestObjectUtil
             int size = ( bytes + 4 ) * 1024;
             DiskTestObject tile = new DiskTestObject( Integer.valueOf( i ), new byte[size] );
 
-            ICacheElement element = new CacheElement( cacheName, tile.id, tile );
+            ICacheElement<Integer, DiskTestObject> element = new CacheElement<Integer, DiskTestObject>( cacheName, tile.id, tile );
             elements[i] = element;
         }
         return elements;

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/HugeQuantityIndDiskCacheLoadTest.java Wed May 30 18:14:43 2012
@@ -49,7 +49,7 @@ public class HugeQuantityIndDiskCacheLoa
         int items = 300000;
         String region = "testCache1";
 
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
 
         try
         {

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexDiskCacheUnitTest.java Wed May 30 18:14:43 2012
@@ -27,6 +27,7 @@ import java.util.Set;
 import junit.framework.TestCase;
 
 import org.apache.jcs.auxiliary.MockCacheEventLogger;
+import org.apache.jcs.auxiliary.disk.DiskTestObject;
 import org.apache.jcs.engine.CacheElement;
 import org.apache.jcs.engine.ElementAttributes;
 import org.apache.jcs.engine.behavior.ICacheElement;
@@ -54,7 +55,7 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testSimplePutAndGet" );
         cattr.setMaxKeySize( 1000 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         disk.processRemoveAll();
 
@@ -63,29 +64,29 @@ public class IndexDiskCacheUnitTest
         {
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
-            ICacheElement element = new CacheElement( "testSimplePutAndGet", "key:" + i, "data:" + i );
+            ICacheElement<String, String> element = new CacheElement<String, String>( "testSimplePutAndGet", "key:" + i, "data:" + i );
             element.setElementAttributes( eAttr );
             disk.processUpdate( element );
         }
 
         for ( int i = 0; i < cnt; i++ )
         {
-            ICacheElement element = disk.processGet( "key:" + i );
-            assertNotNull( "Should have recevied an element.", element );
+            ICacheElement<String, String> element = disk.processGet( "key:" + i );
+            assertNotNull( "Should have received an element.", element );
             assertEquals( "Element is wrong.", "data:" + i, element.getVal() );
         }
 
         // Test that getMultiple returns all the expected values
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = 0; i < cnt; i++ )
         {
             keys.add( "key:" + i );
         }
 
-        Map elements = disk.getMultiple( keys );
+        Map<String, ICacheElement<String, String>> elements = disk.getMultiple( keys );
         for ( int i = 0; i < cnt; i++ )
         {
-            ICacheElement element = (ICacheElement) elements.get( "key:" + i );
+            ICacheElement<String, String> element = elements.get( "key:" + i );
             assertNotNull( "element " + i + ":key is missing", element );
             assertEquals( "value key:" + i, "data:" + i, element.getVal() );
         }
@@ -103,7 +104,7 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testRemoveItems" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         disk.processRemoveAll();
 
@@ -112,7 +113,7 @@ public class IndexDiskCacheUnitTest
         {
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
-            ICacheElement element = new CacheElement( "testRemoveItems", "key:" + i, "data:" + i );
+            ICacheElement<String, String> element = new CacheElement<String, String>( "testRemoveItems", "key:" + i, "data:" + i );
             element.setElementAttributes( eAttr );
             disk.processUpdate( element );
         }
@@ -121,8 +122,8 @@ public class IndexDiskCacheUnitTest
         for ( int i = 0; i < cnt; i++ )
         {
             disk.remove( "key:" + i );
-            ICacheElement element = disk.processGet( "key:" + i );
-            assertNull( "Should not have recevied an element.", element );
+            ICacheElement<String, String> element = disk.processGet( "key:" + i );
+            assertNull( "Should not have received an element.", element );
         }
     }
 
@@ -141,7 +142,7 @@ public class IndexDiskCacheUnitTest
         cattr.setMaxKeySize( 5 );
         cattr.setMaxPurgatorySize( 0 );
         cattr.setDiskPath( "target/test-sandbox/BreakIndexTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         String[] test = { "a", "bb", "ccc", "dddd", "eeeee", "ffffff", "ggggggg", "hhhhhhhhh", "iiiiiiiiii" };
         String[] expect = { null, "bb", "ccc", null, null, "ffffff", null, "hhhhhhhhh", "iiiiiiiiii" };
@@ -150,7 +151,7 @@ public class IndexDiskCacheUnitTest
 
         for ( int i = 0; i < 6; i++ )
         {
-            ICacheElement element = new CacheElement( "testRecycleBin", "key:" + test[i], test[i] );
+            ICacheElement<String, String> element = new CacheElement<String, String>( "testRecycleBin", "key:" + test[i], test[i] );
             //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
             disk.processUpdate( element );
         }
@@ -165,7 +166,7 @@ public class IndexDiskCacheUnitTest
         // will not fit.
         for ( int i = 7; i < 9; i++ )
         {
-            ICacheElement element = new CacheElement( "testRecycleBin", "key:" + test[i], test[i] );
+            ICacheElement<String, String> element = new CacheElement<String, String>( "testRecycleBin", "key:" + test[i], test[i] );
             //System.out.println( "About to add " + "key:" + test[i] + " i = " + i );
             disk.processUpdate( element );
         }
@@ -174,7 +175,7 @@ public class IndexDiskCacheUnitTest
         {
             for ( int i = 0; i < 9; i++ )
             {
-                ICacheElement element = disk.get( "key:" + test[i] );
+                ICacheElement<String, String> element = disk.get( "key:" + test[i] );
                 if ( element != null )
                 {
                     //System.out.println( "element = " + element.getVal() );
@@ -215,7 +216,7 @@ public class IndexDiskCacheUnitTest
         IndexedDiskCacheAttributes cattr = new IndexedDiskCacheAttributes();
         cattr.setCacheName( "testCheckForDedOverlaps_noOverlap" );
         cattr.setDiskPath( "target/test-sandbox/UnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         int numDescriptors = 5;
         int pos = 0;
@@ -243,7 +244,7 @@ public class IndexDiskCacheUnitTest
         IndexedDiskCacheAttributes cattr = new IndexedDiskCacheAttributes();
         cattr.setCacheName( "testCheckForDedOverlaps_overlaps" );
         cattr.setDiskPath( "target/test-sandbox/UnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         int numDescriptors = 5;
         int pos = 0;
@@ -276,11 +277,11 @@ public class IndexDiskCacheUnitTest
         IndexedDiskCacheAttributes cattr = new IndexedDiskCacheAttributes();
         cattr.setCacheName( "testFileSize" );
         cattr.setDiskPath( "target/test-sandbox/UnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>( cattr );
 
         int numberToInsert = 20;
         int bytes = 24;
-        ICacheElement[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
             .getCacheName() );
 
         for ( int i = 0; i < elements.length; i++ )
@@ -301,7 +302,7 @@ public class IndexDiskCacheUnitTest
     }
 
     /**
-     * Verify that items are added to the recyle bin on removal.
+     * Verify that items are added to the recycle bin on removal.
      * <p>
      * @throws IOException
      * @throws InterruptedException
@@ -319,10 +320,10 @@ public class IndexDiskCacheUnitTest
         cattr.setOptimizeAtRemoveCount( numberToInsert );
         cattr.setMaxKeySize( numberToInsert * 2 );
         cattr.setMaxPurgatorySize( numberToInsert );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>( cattr );
 
         int bytes = 24;
-        ICacheElement[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
             .getCacheName() );
 
         for ( int i = 0; i < elements.length; i++ )
@@ -341,7 +342,7 @@ public class IndexDiskCacheUnitTest
             disk.processRemove( elements[i].getKey() );
         }
 
-        // verify that the recyle bin has the correct amount.
+        // verify that the recycle bin has the correct amount.
         assertEquals( "The recycle bin should have the number removed.", numberToRemove, disk.getRecyleBinSize() );
     }
 
@@ -365,11 +366,11 @@ public class IndexDiskCacheUnitTest
         cattr.setOptimizeAtRemoveCount( numberToInsert );
         cattr.setMaxKeySize( numberToInsert * 2 );
         cattr.setMaxPurgatorySize( numberToInsert );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>( cattr );
 
         // we will reuse these
         int bytes = 24;
-        ICacheElement[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
             .getCacheName() );
 
         // Add some to the disk
@@ -389,7 +390,7 @@ public class IndexDiskCacheUnitTest
             disk.processRemove( elements[i].getKey() );
         }
 
-        // verify that the recyle bin has the correct amount.
+        // verify that the recycle bin has the correct amount.
         assertEquals( "The recycle bin should have the number removed.", numberToRemove, disk.getRecyleBinSize() );
 
         // add half as many as we removed. These should all use spots in the recycle bin.
@@ -418,11 +419,11 @@ public class IndexDiskCacheUnitTest
         IndexedDiskCacheAttributes cattr = new IndexedDiskCacheAttributes();
         cattr.setCacheName( "testBytesFreeSize" );
         cattr.setDiskPath( "target/test-sandbox/UnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>( cattr );
 
         int numberToInsert = 20;
         int bytes = 24;
-        ICacheElement[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil.createCacheElementsWithTestObjects( numberToInsert, bytes, cattr
             .getCacheName() );
 
         for ( int i = 0; i < elements.length; i++ )
@@ -472,7 +473,7 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testRemove_PartialKey" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         disk.processRemoveAll();
 
@@ -481,7 +482,7 @@ public class IndexDiskCacheUnitTest
         {
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
-            ICacheElement element = new CacheElement( "testRemove_PartialKey", i + ":key", "data:" + i );
+            ICacheElement<String, String> element = new CacheElement<String, String>( "testRemove_PartialKey", i + ":key", "data:" + i );
             element.setElementAttributes( eAttr );
             disk.processUpdate( element );
         }
@@ -489,16 +490,16 @@ public class IndexDiskCacheUnitTest
         // verif each
         for ( int i = 0; i < cnt; i++ )
         {
-            ICacheElement element = disk.processGet( i + ":key" );
-            assertNotNull( "Shoulds have recevied an element.", element );
+            ICacheElement<String, String> element = disk.processGet( i + ":key" );
+            assertNotNull( "Shoulds have received an element.", element );
         }
 
         // remove each
         for ( int i = 0; i < cnt; i++ )
         {
             disk.remove( i + ":" );
-            ICacheElement element = disk.processGet( i + ":key" );
-            assertNull( "Should not have recevied an element.", element );
+            ICacheElement<String, String> element = disk.processGet( i + ":key" );
+            assertNull( "Should not have received an element.", element );
         }
         // https://issues.apache.org/jira/browse/JCS-67
         assertEquals( "Recylenbin should not have more elements than we removed. Check for JCS-67", cnt, disk
@@ -517,7 +518,7 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testRemove_Group" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<GroupAttrName<String>, String> disk = new IndexedDiskCache<GroupAttrName<String>, String>( cattr );
 
         disk.processRemoveAll();
 
@@ -527,9 +528,8 @@ public class IndexDiskCacheUnitTest
         int cnt = 25;
         for ( int i = 0; i < cnt; i++ )
         {
-            GroupAttrName groupAttrName = getGroupAttrName( cacheName, groupName, i + ":key" );
-
-            CacheElement element = new CacheElement( cacheName, groupAttrName, "data:" + i );
+            GroupAttrName<String> groupAttrName = getGroupAttrName( cacheName, groupName, i + ":key" );
+            CacheElement<GroupAttrName<String>, String> element = new CacheElement<GroupAttrName<String>, String>( cacheName, groupAttrName, "data:" + i );
 
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
@@ -541,23 +541,22 @@ public class IndexDiskCacheUnitTest
         // verify each
         for ( int i = 0; i < cnt; i++ )
         {
-            GroupAttrName groupAttrName = getGroupAttrName( cacheName, groupName, i + ":key" );
-            ICacheElement element = disk.processGet( groupAttrName );
-            assertNotNull( "Should have recevied an element.", element );
+            GroupAttrName<String> groupAttrName = getGroupAttrName( cacheName, groupName, i + ":key" );
+            ICacheElement<GroupAttrName<String>, String> element = disk.processGet( groupAttrName );
+            assertNotNull( "Should have received an element.", element );
         }
 
         // DO WORK
         // remove the group
-        GroupId gid = new GroupId( cacheName, groupName );
-        disk.remove( gid );
+        disk.remove( getGroupAttrName( cacheName, groupName, null ) );
 
         for ( int i = 0; i < cnt; i++ )
         {
-            GroupAttrName groupAttrName = getGroupAttrName( cacheName, groupName, i + ":key" );
-            ICacheElement element = disk.processGet( groupAttrName );
+            GroupAttrName<String> groupAttrName = getGroupAttrName( cacheName, groupName, i + ":key" );
+            ICacheElement<GroupAttrName<String>, String> element = disk.processGet( groupAttrName );
 
             // VERIFY
-            assertNull( "Should not have recevied an element.", element );
+            assertNull( "Should not have received an element.", element );
         }
 
     }
@@ -570,10 +569,10 @@ public class IndexDiskCacheUnitTest
      * @param name
      * @return GroupAttrName
      */
-    private GroupAttrName getGroupAttrName( String cacheName, String group, Object name )
+    private GroupAttrName<String> getGroupAttrName( String cacheName, String group, String name )
     {
         GroupId gid = new GroupId( cacheName, group );
-        return new GroupAttrName( gid, name );
+        return new GroupAttrName<String>( gid, name );
     }
 
     /**
@@ -589,13 +588,13 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testUpdate_EventLogging_simple" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTestCEL" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
         diskCache.processRemoveAll();
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         diskCache.setCacheEventLogger( cacheEventLogger );
 
-        ICacheElement item = new CacheElement( "region", "key", "value" );
+        ICacheElement<String, String> item = new CacheElement<String, String>( "region", "key", "value" );
 
         // DO WORK
         diskCache.update( item );
@@ -620,7 +619,7 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testGet_EventLogging_simple" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTestCEL" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
         diskCache.processRemoveAll();
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
@@ -647,13 +646,13 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testGetMultiple_EventLogging_simple" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTestCEL" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
         diskCache.processRemoveAll();
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
         diskCache.setCacheEventLogger( cacheEventLogger );
 
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         keys.add( "junk" );
 
         // DO WORK
@@ -678,7 +677,7 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testRemoveAll_EventLogging_simple" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTestCEL" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
         diskCache.processRemoveAll();
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
@@ -705,7 +704,7 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( "testRemoveAll_EventLogging_simple" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTestCEL" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
         diskCache.processRemoveAll();
 
         MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
@@ -735,16 +734,16 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
 
         // DO WORK
         for ( int i = 0; i <= items; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, i + ":key", cacheName + " data " + i ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, i + ":key", cacheName + " data " + i ) );
         }
         Thread.sleep( 500 );
 
-        Map matchingResults = diskCache.getMatching( "1.8.+" );
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching( "1.8.+" );
 
         // VERIFY
         assertEquals( "Wrong number returned", 10, matchingResults.size() );
@@ -768,15 +767,15 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
 
         // DO WORK
         for ( int i = 0; i <= items; i++ )
         {
-            diskCache.update( new CacheElement( cacheName, i + ":key", cacheName + " data " + i ) );
+            diskCache.update( new CacheElement<String, String>( cacheName, i + ":key", cacheName + " data " + i ) );
         }
 
-        Map matchingResults = diskCache.getMatching( "1.8.+" );
+        Map<String, ICacheElement<String, String>> matchingResults = diskCache.getMatching( "1.8.+" );
 
         // VERIFY
         assertEquals( "Wrong number returned", 10, matchingResults.size() );
@@ -809,18 +808,18 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
 
         // DO WORK
-        diskCache.update( new CacheElement( cacheName, "x", string ) );
+        diskCache.update( new CacheElement<String, String>( cacheName, "x", string ) );
 
         // VERIFY
         assertNotNull( diskCache.get( "x" ) );
         Thread.sleep( 1000 );
-        ICacheElement afterElement = diskCache.get( "x" );
+        ICacheElement<String, String> afterElement = diskCache.get( "x" );
         assertNotNull( afterElement );
         System.out.println( "afterElement = " + afterElement );
-        String after = (String) afterElement.getVal();
+        String after = afterElement.getVal();
 
         assertNotNull( after );
         assertEquals( "wrong string after retrieval", string, after );
@@ -852,18 +851,18 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, byte[]> diskCache = new IndexedDiskCache<String, byte[]>( cattr );
 
         // DO WORK
-        diskCache.update( new CacheElement( cacheName, "x", bytes ) );
+        diskCache.update( new CacheElement<String, byte[]>( cacheName, "x", bytes ) );
 
         // VERIFY
         assertNotNull( diskCache.get( "x" ) );
         Thread.sleep( 1000 );
-        ICacheElement afterElement = diskCache.get( "x" );
+        ICacheElement<String, byte[]> afterElement = diskCache.get( "x" );
         assertNotNull( afterElement );
         System.out.println( "afterElement = " + afterElement );
-        byte[] after = (byte[]) afterElement.getVal();
+        byte[] after = afterElement.getVal();
 
         assertNotNull( after );
         assertEquals( "wrong bytes after retrieval", string, new String( after, UTF8 ) );
@@ -883,15 +882,15 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
 
         String key = "myKey";
         String value = "myValue";
-        ICacheElement ce = new CacheElement( cacheName, key, value );
+        ICacheElement<String, String> ce = new CacheElement<String, String>( cacheName, key, value );
 
         // DO WORK
         diskCache.processUpdate( ce );
-        ICacheElement result = diskCache.processGet( key );
+        ICacheElement<String, String> result = diskCache.processGet( key );
 
         // VERIFY
         assertNotNull( "Should have a result", result );
@@ -913,20 +912,20 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
 
         String key = "myKey";
         String value = "myValue";
-        ICacheElement ce1 = new CacheElement( cacheName, key, value );
+        ICacheElement<String, String> ce1 = new CacheElement<String, String>( cacheName, key, value );
 
         // DO WORK
         diskCache.processUpdate( ce1 );
         long fileSize1 = diskCache.getDataFileSize();
 
         // DO WORK
-        ICacheElement ce2 = new CacheElement( cacheName, key, value );
+        ICacheElement<String, String> ce2 = new CacheElement<String, String>( cacheName, key, value );
         diskCache.processUpdate( ce2 );
-        ICacheElement result = diskCache.processGet( key );
+        ICacheElement<String, String> result = diskCache.processGet( key );
 
         // VERIFY
         assertNotNull( "Should have a result", result );
@@ -950,21 +949,21 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
 
         String key = "myKey";
         String value = "myValue";
         String value2 = "myValu";
-        ICacheElement ce1 = new CacheElement( cacheName, key, value );
+        ICacheElement<String, String> ce1 = new CacheElement<String, String>( cacheName, key, value );
 
         // DO WORK
         diskCache.processUpdate( ce1 );
         long fileSize1 = diskCache.getDataFileSize();
 
         // DO WORK
-        ICacheElement ce2 = new CacheElement( cacheName, key, value2 );
+        ICacheElement<String, String> ce2 = new CacheElement<String, String>( cacheName, key, value2 );
         diskCache.processUpdate( ce2 );
-        ICacheElement result = diskCache.processGet( key );
+        ICacheElement<String, String> result = diskCache.processGet( key );
 
         // VERIFY
         assertNotNull( "Should have a result", result );
@@ -988,21 +987,21 @@ public class IndexDiskCacheUnitTest
         cattr.setCacheName( cacheName );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/IndexDiskCacheUnitTest" );
-        IndexedDiskCache diskCache = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> diskCache = new IndexedDiskCache<String, String>( cattr );
 
         String key = "myKey";
         String value = "myValue";
         String value2 = "myValue2";
-        ICacheElement ce1 = new CacheElement( cacheName, key, value );
+        ICacheElement<String, String> ce1 = new CacheElement<String, String>( cacheName, key, value );
 
         // DO WORK
         diskCache.processUpdate( ce1 );
         long fileSize1 = diskCache.getDataFileSize();
 
         // DO WORK
-        ICacheElement ce2 = new CacheElement( cacheName, key, value2 );
+        ICacheElement<String, String> ce2 = new CacheElement<String, String>( cacheName, key, value2 );
         diskCache.processUpdate( ce2 );
-        ICacheElement result = diskCache.processGet( key );
+        ICacheElement<String, String> result = diskCache.processGet( key );
 
         // VERIFY
         assertNotNull( "Should have a result", result );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheConcurrentUnitTest.java Wed May 30 18:14:43 2012
@@ -135,7 +135,7 @@ public class IndexedDiskCacheConcurrentU
     public void runTestForRegion( String region )
         throws Exception
     {
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
 
         // Add items to cache
         for ( int i = 0; i <= items; i++ )
@@ -146,22 +146,22 @@ public class IndexedDiskCacheConcurrentU
         // Test that all items are in cache
         for ( int i = 0; i <= items; i++ )
         {
-            String value = (String) jcs.get( i + ":key" );
+            String value = jcs.get( i + ":key" );
 
             assertEquals( region + " data " + i, value );
         }
 
         // Test that getElements returns all the expected values
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = jcs.getCacheElements( keys );
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
         for ( int i = 0; 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() );
         }
@@ -196,7 +196,7 @@ public class IndexedDiskCacheConcurrentU
     public void runTestForRegionInRange( String region, int start, int end )
         throws Exception
     {
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
 
         // Add items to cache
         for ( int i = start; i <= end; i++ )
@@ -207,22 +207,22 @@ public class IndexedDiskCacheConcurrentU
         // Test that all items are in cache
         for ( int i = start; i <= end; i++ )
         {
-            String value = (String) jcs.get( i + ":key" );
+            String value = jcs.get( i + ":key" );
 
             assertEquals( region + " data " + i, value );
         }
 
         // Test that getElements returns all the expected values
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = start; i <= end; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = jcs.getCacheElements( keys );
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
         for ( int i = start; i <= end; 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/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheDefragPerformanceTest.java Wed May 30 18:14:43 2012
@@ -74,7 +74,7 @@ public class IndexedDiskCacheDefragPerfo
         throws Exception
     {
         JCS.setConfigFilename( "/TestDiskCacheDefragPerformance.ccf" );
-        JCS jcs = JCS.getInstance( "defrag" );
+        JCS<Integer, Tile> jcs = JCS.getInstance( "defrag" );
 
         Tile tile;
         System.out.println( "Cache Defrag Test" );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheKeyStoreUnitTest.java Wed May 30 18:14:43 2012
@@ -50,7 +50,7 @@ public class IndexedDiskCacheKeyStoreUni
         cattr.setCacheName( "testStoreKeys" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/KeyStoreUnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         disk.processRemoveAll();
 
@@ -59,15 +59,15 @@ public class IndexedDiskCacheKeyStoreUni
         {
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
-            ICacheElement element = new CacheElement( cattr.getCacheName(), "key:" + i, "data:" + i );
+            ICacheElement<String, String> element = new CacheElement<String, String>( cattr.getCacheName(), "key:" + i, "data:" + i );
             element.setElementAttributes( eAttr );
             disk.processUpdate( element );
         }
 
         for ( int i = 0; i < cnt; i++ )
         {
-            ICacheElement element = disk.processGet( "key:" + i );
-            assertNotNull( "presave, Should have recevied an element.", element );
+            ICacheElement<String, String> element = disk.processGet( "key:" + i );
+            assertNotNull( "presave, Should have received an element.", element );
             assertEquals( "presave, element is wrong.", "data:" + i, element.getVal() );
         }
 
@@ -79,8 +79,8 @@ public class IndexedDiskCacheKeyStoreUni
 
         for ( int i = 0; i < cnt; i++ )
         {
-            ICacheElement element = disk.processGet( "key:" + i );
-            assertNotNull( "postsave, Should have recevied an element.", element );
+            ICacheElement<String, String> element = disk.processGet( "key:" + i );
+            assertNotNull( "postsave, Should have received an element.", element );
             assertEquals( "postsave, element is wrong.", "data:" + i, element.getVal() );
         }
 
@@ -90,7 +90,7 @@ public class IndexedDiskCacheKeyStoreUni
 
 
     /**
-     * Add some elements, remove 1, call optiiize, verify that the removed isn't present.
+     * Add some elements, remove 1, call optimize, verify that the removed isn't present.
      *
      * We should also compare the data file sizes. . . .
      *
@@ -104,7 +104,7 @@ public class IndexedDiskCacheKeyStoreUni
         cattr.setCacheName( "testOptimize" );
         cattr.setMaxKeySize( 100 );
         cattr.setDiskPath( "target/test-sandbox/KeyStoreUnitTest" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<String, String> disk = new IndexedDiskCache<String, String>( cattr );
 
         disk.processRemoveAll();
 
@@ -113,7 +113,7 @@ public class IndexedDiskCacheKeyStoreUni
         {
             IElementAttributes eAttr = new ElementAttributes();
             eAttr.setIsSpool( true );
-            ICacheElement element = new CacheElement( cattr.getCacheName(), "key:" + i, "data:" + i );
+            ICacheElement<String, String> element = new CacheElement<String, String>( cattr.getCacheName(), "key:" + i, "data:" + i );
             element.setElementAttributes( eAttr );
             disk.processUpdate( element );
         }
@@ -122,12 +122,12 @@ public class IndexedDiskCacheKeyStoreUni
 
         IElementAttributes eAttr = new ElementAttributes();
         eAttr.setIsSpool( true );
-        ICacheElement elementSetup = new CacheElement( cattr.getCacheName(), "key:" + "A", "data:" + "A" );
+        ICacheElement<String, String> elementSetup = new CacheElement<String, String>( cattr.getCacheName(), "key:" + "A", "data:" + "A" );
         elementSetup.setElementAttributes( eAttr );
         disk.processUpdate( elementSetup );
 
-        ICacheElement elementRet = disk.processGet( "key:" + "A" );
-        assertNotNull( "postsave, Should have recevied an element.", elementRet );
+        ICacheElement<String, String> elementRet = disk.processGet( "key:" + "A" );
+        assertNotNull( "postsave, Should have received an element.", elementRet );
         assertEquals( "postsave, element is wrong.", "data:" + "A", elementRet.getVal() );
 
         disk.remove( "key:" + "A" );
@@ -146,8 +146,8 @@ public class IndexedDiskCacheKeyStoreUni
 
         for ( int i = 0; i < cnt; i++ )
         {
-            ICacheElement element = disk.processGet( "key:" + i );
-            assertNotNull( "postsave, Should have recevied an element.", element );
+            ICacheElement<String, String> element = disk.processGet( "key:" + i );
+            assertNotNull( "postsave, Should have received an element.", element );
             assertEquals( "postsave, element is wrong.", "data:" + i, element.getVal() );
         }
     }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java Wed May 30 18:14:43 2012
@@ -31,16 +31,16 @@ public class IndexedDiskCacheManagerUnit
         MockElementSerializer elementSerializer = new MockElementSerializer();
 
         String key = "myKey";
-        ICacheElement cacheElement = new CacheElement( "test", key, "MyValue" );
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( "test", key, "MyValue" );
 
         IndexedDiskCacheManager manager = IndexedDiskCacheManager.getInstance( defaultCacheAttributes,
                                                                                cacheEventLogger, elementSerializer );
 
         // DO WORK
-        IndexedDiskCache cache = (IndexedDiskCache) manager.getCache( cacheName );
+        IndexedDiskCache<String, String> cache = manager.getCache( cacheName );
 
-        cache.update( cacheElement );        
-        SleepUtil.sleepAtLeast( 100 );        
+        cache.update( cacheElement );
+        SleepUtil.sleepAtLeast( 100 );
         cache.get( key );
 
         // VERIFY

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheNoMemoryUnitTest.java Wed May 30 18:14:43 2012
@@ -123,7 +123,7 @@ public class IndexedDiskCacheNoMemoryUni
     public void runTestForRegion( String region )
         throws Exception
     {
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
 
         // Add items to cache
 
@@ -136,22 +136,22 @@ public class IndexedDiskCacheNoMemoryUni
 
         for ( int i = 0; i <= items; i++ )
         {
-            String value = (String) jcs.get( i + ":key" );
+            String value = jcs.get( i + ":key" );
 
             assertEquals( region + " data " + i, value );
         }
 
         // Test that getElements returns all the expected values
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = 0; i <= items; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = jcs.getCacheElements( keys );
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
         for ( int i = 0; 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/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheOptimizationUnitTest.java Wed May 30 18:14:43 2012
@@ -21,6 +21,7 @@ package org.apache.jcs.auxiliary.disk.in
 
 import junit.framework.TestCase;
 
+import org.apache.jcs.auxiliary.disk.DiskTestObject;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.utils.timing.SleepUtil;
 
@@ -49,12 +50,12 @@ public class IndexedDiskCacheOptimizatio
         cattr.setOptimizeAtRemoveCount( removeCount );
         cattr.setMaxRecycleBinSize( removeCount * 3 );
         cattr.setDiskPath( "target/test-sandbox/testOptimization" );
-        IndexedDiskCache disk = new IndexedDiskCache( cattr );
+        IndexedDiskCache<Integer, DiskTestObject> disk = new IndexedDiskCache<Integer, DiskTestObject>( cattr );
 
         disk.removeAll();
 
         int numberToInsert = removeCount * 2;
-        ICacheElement[] elements = DiskTestObjectUtil
+        ICacheElement<Integer, DiskTestObject>[] elements = DiskTestObjectUtil
             .createCacheElementsWithTestObjectsOfVariableSizes( numberToInsert, cattr.getCacheName() );
 
         for ( int i = 0; i < elements.length; i++ )

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheRandomConcurrentTestUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheRandomConcurrentTestUtil.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheRandomConcurrentTestUtil.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheRandomConcurrentTestUtil.java Wed May 30 18:14:43 2012
@@ -65,7 +65,7 @@ public class IndexedDiskCacheRandomConcu
 
         // make sure a simple put then get works
         // this may fail if the other tests are flooding the disk cache
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
         String key = "testKey" + testNum;
         String data = "testData" + testNum;
         jcs.put( key, data );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSameRegionConcurrentUnitTest.java Wed May 30 18:14:43 2012
@@ -156,7 +156,7 @@ public class IndexedDiskCacheSameRegionC
     public void runTestForRegion( String region, int start, int end )
         throws Exception
     {
-        JCS jcs = JCS.getInstance( region );
+        JCS<String, String> jcs = JCS.getInstance( region );
 
         // Add items to cache
 
@@ -170,32 +170,32 @@ public class IndexedDiskCacheSameRegionC
         for ( int i = start; i <= end; i++ )
         {
             String key = i + ":key";
-            String value = (String) jcs.get( key );
+            String value = jcs.get( key );
 
             assertEquals( "Wrong value for key [" + key + "]", region + " data " + i, value );
         }
 
         // Test that getElements returns all the expected values
-        Set keys = new HashSet();
+        Set<String> keys = new HashSet<String>();
         for ( int i = start; i <= end; i++ )
         {
             keys.add( i + ":key" );
         }
 
-        Map elements = jcs.getCacheElements( keys );
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
         for ( int i = start; i <= end; 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() );
         }
 
         // you can't remove in one thread and expect them to be in another //
         //          Remove all the items
-        //         
+        //
         //          for ( int i = start; i <= end; i++ ) { jcs.remove( i + ":key" ); } //
         //          Verify removal
-        //         
+        //
         //          for ( int i = start; i <= end; i++ ) { assertNull( "Removed key
         //          should be null: " + i + ":key", jcs.get( i + ":key" ) ); }
     }

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java Wed May 30 18:14:43 2012
@@ -66,7 +66,7 @@ public class IndexedDiskCacheSteadyLoadT
         int runs = 1000;
         int upperKB = 50;
 
-        JCS jcs = JCS.getInstance( ( numPerRun / 2 ) + "aSecond" );
+        JCS<String, DiskTestObject> jcs = JCS.getInstance( ( numPerRun / 2 ) + "aSecond" );
 
         ElapsedTimer timer = new ElapsedTimer();
         int numToGet = numPerRun * ( runs / 10 );

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java Wed May 30 18:14:43 2012
@@ -27,7 +27,7 @@ public class JDBCDiskCacheManagerUnitTes
             .getUnconfiguredInstance(), cacheEventLogger, elementSerializer );
 
         // DO WORK
-        JDBCDiskCache cache = (JDBCDiskCache) manager.getCache( cacheName );
+        JDBCDiskCache<String, String> cache = manager.getCache( cacheName );
 
         // VERIFY
         assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger() );



Mime
View raw message