Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java Mon Mar 12 21:21:03 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java Mon Mar 12 21:21:03 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; } Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java Mon Mar 12 21:21:03 2012 @@ -29,6 +29,7 @@ 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; @@ -38,7 +39,7 @@ import org.apache.jcs.engine.stats.behav * @author Aaron Smuts */ public class MockMemoryCache<K extends Serializable, V extends Serializable> - implements MemoryCache<K, V> + implements IMemoryCache<K, V> { /** Config */ private ICompositeCacheAttributes cacheAttr; Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java Mon Mar 12 21:21:03 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/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java Mon Mar 12 21:21:03 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<String, String> 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<String, String> 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/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java Mon Mar 12 21:21:03 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<String, String> 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,7 +259,7 @@ public class LHMLRUMemoryCacheUnitTest for ( int i = 0; i < items; i++ ) { - ICacheElement<String, String> 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 ); } @@ -270,14 +270,14 @@ public class LHMLRUMemoryCacheUnitTest } /** - * 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/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java Mon Mar 12 21:21:03 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<String, String> 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<String, String> 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/branches/generics-interface/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java Mon Mar 12 21:21:03 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<String, String> 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,7 +260,7 @@ public class MRUMemoryCacheUnitTest for ( int i = 0; i < items; i++ ) { - ICacheElement<String, String> 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 ); } @@ -271,14 +271,14 @@ public class MRUMemoryCacheUnitTest } /** - * 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 ); } Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java Mon Mar 12 21:21:03 2012 @@ -38,144 +38,144 @@ import org.apache.jcs.engine.memory.Mock public class ShrinkerThreadUnitTest extends TestCase { - /** verify the check for removal + /** verify the check for removal * <p> * @throws IOException */ public void testCheckForRemoval_Expired() throws IOException { // SETUP - MockMemoryCache memory = new MockMemoryCache(); + MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 10 ); cacheAttr.setMaxSpoolPerRun( 10 ); memory.setCacheAttributes( cacheAttr ); - - ShrinkerThread shrinker = new ShrinkerThread( memory ); - + + ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); + String key = "key"; String value = "value"; - ICacheElement<String, String> element = new CacheElement( "testRegion", key, value ); + ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.setIsEternal( false ); element.setElementAttributes( elementAttr ); element.getElementAttributes().setMaxLifeSeconds( 1 ); - + long now = System.currentTimeMillis(); // add two seconds now += 2000; - + // DO WORK boolean result = shrinker.checkForRemoval( element, now ); - + // VERIFY assertTrue( "Item should have expired.", result ); } - - /** verify the check for removal + + /** verify the check for removal * <p> * @throws IOException */ public void testCheckForRemoval_NotExpired() throws IOException { // SETUP - MockMemoryCache memory = new MockMemoryCache(); + MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 10 ); cacheAttr.setMaxSpoolPerRun( 10 ); memory.setCacheAttributes( cacheAttr ); - - ShrinkerThread shrinker = new ShrinkerThread( memory ); - + + ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); + String key = "key"; String value = "value"; - ICacheElement<String, String> element = new CacheElement( "testRegion", key, value ); + ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.setIsEternal( false ); element.setElementAttributes( elementAttr ); element.getElementAttributes().setMaxLifeSeconds( 1 ); - + long now = System.currentTimeMillis(); // subtract two seconds now -= 2000; - + // DO WORK boolean result = shrinker.checkForRemoval( element, now ); - + // VERIFY assertFalse( "Item should not have expired.", result ); } - - /** verify the check for removal + + /** verify the check for removal * <p> * @throws IOException */ public void testCheckForRemoval_IdleTooLong() throws IOException { // SETUP - MockMemoryCache memory = new MockMemoryCache(); + MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 10 ); cacheAttr.setMaxSpoolPerRun( 10 ); memory.setCacheAttributes( cacheAttr ); - - ShrinkerThread shrinker = new ShrinkerThread( memory ); - + + ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); + String key = "key"; String value = "value"; - ICacheElement<String, String> element = new CacheElement( "testRegion", key, value ); + ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.setIsEternal( false ); element.setElementAttributes( elementAttr ); element.getElementAttributes().setMaxLifeSeconds( 100 ); element.getElementAttributes().setIdleTime( 1 ); - + long now = System.currentTimeMillis(); // add two seconds now += 2000; - + // DO WORK boolean result = shrinker.checkForRemoval( element, now ); - + // VERIFY assertTrue( "Item should have expired.", result ); } - - /** verify the check for removal + + /** verify the check for removal * <p> * @throws IOException */ public void testCheckForRemoval_NotIdleTooLong() throws IOException { // SETUP - MockMemoryCache memory = new MockMemoryCache(); + MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 10 ); cacheAttr.setMaxSpoolPerRun( 10 ); memory.setCacheAttributes( cacheAttr ); - - ShrinkerThread shrinker = new ShrinkerThread( memory ); - + + ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); + String key = "key"; String value = "value"; - ICacheElement<String, String> element = new CacheElement( "testRegion", key, value ); + ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.setIsEternal( false ); element.setElementAttributes( elementAttr ); element.getElementAttributes().setMaxLifeSeconds( 100 ); element.getElementAttributes().setIdleTime( 1 ); - + long now = System.currentTimeMillis(); // subtract two seconds now -= 2000; - + // DO WORK boolean result = shrinker.checkForRemoval( element, now ); - + // VERIFY assertFalse( "Item should not have expired.", result ); } - + /** * Setup cache attributes in mock. Create the shrinker with the mock. Add some elements into the * mock memory cache see that they get spooled. @@ -186,7 +186,7 @@ public class ShrinkerThreadUnitTest throws Exception { // SETUP - MockMemoryCache memory = new MockMemoryCache(); + MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 1 ); @@ -197,7 +197,7 @@ public class ShrinkerThreadUnitTest String key = "key"; String value = "value"; - ICacheElement<String, String> element = new CacheElement( "testRegion", key, value ); + ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.setIsEternal( false ); @@ -212,7 +212,7 @@ public class ShrinkerThreadUnitTest elementAttr.lastAccessTime = System.currentTimeMillis() - 2000; // DO WORK - ShrinkerThread shrinker = new ShrinkerThread( memory ); + ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); Thread runner = new Thread( shrinker ); runner.run(); @@ -233,7 +233,7 @@ public class ShrinkerThreadUnitTest throws Exception { // SETUP - MockMemoryCache memory = new MockMemoryCache(); + MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 1 ); @@ -246,7 +246,7 @@ public class ShrinkerThreadUnitTest String key = "key" + i; String value = "value"; - ICacheElement<String, String> element = new CacheElement( "testRegion", key, value ); + ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.setIsEternal( false ); @@ -262,7 +262,7 @@ public class ShrinkerThreadUnitTest } // DO WORK - ShrinkerThread shrinker = new ShrinkerThread( memory ); + ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); Thread runner = new Thread( shrinker ); runner.run(); @@ -283,7 +283,7 @@ public class ShrinkerThreadUnitTest throws Exception { // SETUP - MockMemoryCache memory = new MockMemoryCache(); + MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 1 ); @@ -298,7 +298,7 @@ public class ShrinkerThreadUnitTest String key = "key" + i; String value = "value"; - ICacheElement<String, String> element = new CacheElement( "testRegion", key, value ); + ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.addElementEventHandler( handler ); @@ -315,7 +315,7 @@ public class ShrinkerThreadUnitTest } // DO WORK - ShrinkerThread shrinker = new ShrinkerThread( memory ); + ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); Thread runner = new Thread( shrinker ); runner.run(); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java?rev=1299873&r1=1299872&r2=1299873&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java Mon Mar 12 21:21:03 2012 @@ -51,8 +51,8 @@ public class SerializationConversionUtil ICacheElement<String, String> before = null; // DO WORK - ICacheElementSerialized result = SerializationConversionUtil.getSerializedCacheElement( before, - elementSerializer ); + ICacheElementSerialized<String, String> result = + SerializationConversionUtil.getSerializedCacheElement( before, elementSerializer ); // VERIFY assertNull( "Should get null for null", result ); @@ -68,10 +68,11 @@ public class SerializationConversionUtil { // SETUP IElementSerializer elementSerializer = new StandardSerializer(); - ICacheElementSerialized before = null; + ICacheElementSerialized<String, String> before = null; // DO WORK - ICacheElement<String, String> result = SerializationConversionUtil.getDeSerializedCacheElement( before, elementSerializer ); + ICacheElement<String, String> result = + SerializationConversionUtil.getDeSerializedCacheElement( before, elementSerializer ); // VERIFY assertNull( "Should get null for null", result ); @@ -95,19 +96,20 @@ public class SerializationConversionUtil IElementAttributes attr = new ElementAttributes(); attr.setMaxLifeSeconds( 34 ); - ICacheElement<String, String> before = new CacheElement( cacheName, key, value ); + ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value ); before.setElementAttributes( attr ); // DO WORK - ICacheElementSerialized serialized = SerializationConversionUtil.getSerializedCacheElement( before, - elementSerializer ); + ICacheElementSerialized<String, String> serialized = + SerializationConversionUtil.getSerializedCacheElement( before, elementSerializer ); // VERIFY assertNotNull( "Should have a serialized object.", serialized ); System.out.println( "testSimpleConversion, " + serialized ); // DO WORK - ICacheElement<String, String> after = SerializationConversionUtil.getDeSerializedCacheElement( serialized, elementSerializer ); + ICacheElement<String, String> after = + SerializationConversionUtil.getDeSerializedCacheElement( serialized, elementSerializer ); // VERIFY assertNotNull( "Should have a deserialized object.", after ); @@ -136,21 +138,22 @@ public class SerializationConversionUtil IElementAttributes attr = new ElementAttributes(); attr.setMaxLifeSeconds( 34 ); - ICacheElement<String, String> before = new CacheElement( cacheName, key, value ); + ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value ); before.setElementAttributes( attr ); // DO WORK - ICacheElementSerialized alreadySerialized = SerializationConversionUtil - .getSerializedCacheElement( before, elementSerializer ); - ICacheElementSerialized serialized = SerializationConversionUtil.getSerializedCacheElement( alreadySerialized, - elementSerializer ); + ICacheElementSerialized<String, String> alreadySerialized = + SerializationConversionUtil.getSerializedCacheElement( before, elementSerializer ); + ICacheElementSerialized<String, String> serialized = + SerializationConversionUtil.getSerializedCacheElement( alreadySerialized, elementSerializer ); // VERIFY assertNotNull( "Should have a serialized object.", serialized ); System.out.println( "testSimpleConversion, " + serialized ); // DO WORK - ICacheElement<String, String> after = SerializationConversionUtil.getDeSerializedCacheElement( serialized, elementSerializer ); + ICacheElement<String, String> after = + SerializationConversionUtil.getDeSerializedCacheElement( serialized, elementSerializer ); // VERIFY assertNotNull( "Should have a deserialized object.", after ); @@ -176,7 +179,7 @@ public class SerializationConversionUtil IElementAttributes attr = new ElementAttributes(); attr.setMaxLifeSeconds( 34 ); - ICacheElement<String, String> before = new CacheElement( cacheName, key, value ); + ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value ); before.setElementAttributes( attr ); // DO WORK
