Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8A7C0CEAB for ; Wed, 30 May 2012 18:16:08 +0000 (UTC) Received: (qmail 90772 invoked by uid 500); 30 May 2012 18:16:08 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 90621 invoked by uid 500); 30 May 2012 18:16:07 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 90605 invoked by uid 99); 30 May 2012 18:16:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 May 2012 18:16:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 May 2012 18:16:02 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C77A62388C54 for ; Wed, 30 May 2012 18:15:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1344374 [13/14] - in /commons/proper/jcs/trunk: ./ auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/jdk14/src/java/org/apache/jc... Date: Wed, 30 May 2012 18:14:51 -0000 To: commits@commons.apache.org From: tv@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120530181505.C77A62388C54@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java Wed May 30 18:14:43 2012 @@ -34,8 +34,8 @@ import org.apache.jcs.engine.behavior.IC /** * This is a mock impl of the non local cache service. */ -public class MockCacheServiceNonLocal - implements ICacheServiceNonLocal +public class MockCacheServiceNonLocal + implements ICacheServiceNonLocal { /** The key last passed to get */ public Serializable lastGetKey; @@ -44,19 +44,19 @@ public class MockCacheServiceNonLocal public String lastGetMatchingPattern; /** The keya last passed to getMatching */ - public Set lastGetMultipleKeys; + public Set lastGetMultipleKeys; /** The object that was last passed to update. */ - public Object lastUpdate; + public ICacheElement lastUpdate; /** List of updates. */ - public List updateRequestList = new ArrayList(); + public List> updateRequestList = new ArrayList>(); /** List of request ids. */ public List updateRequestIdList = new ArrayList(); /** The key that was last passed to remove. */ - public Object lastRemoveKey; + public K lastRemoveKey; /** The cache name that was last passed to removeAll. */ public String lastRemoveAllCacheName; @@ -67,7 +67,7 @@ public class MockCacheServiceNonLocal * @param requesterId - identity of requester * @return null */ - public ICacheElement get( String cacheName, Serializable key, long requesterId ) + public ICacheElement get( String cacheName, K key, long requesterId ) { lastGetKey = key; return null; @@ -78,9 +78,9 @@ public class MockCacheServiceNonLocal * @param groupName * @return empty set */ - public Set getGroupKeys( String cacheName, String groupName ) + public Set getGroupKeys( String cacheName, String groupName ) { - return new HashSet(); + return new HashSet(); } /** @@ -90,7 +90,7 @@ public class MockCacheServiceNonLocal * @param key * @param requesterId - identity of requester */ - public void remove( String cacheName, Serializable key, long requesterId ) + public void remove( String cacheName, K key, long requesterId ) { lastRemoveKey = key; } @@ -114,7 +114,7 @@ public class MockCacheServiceNonLocal * @param item * @param requesterId - identity of requester */ - public void update( ICacheElement item, long requesterId ) + public void update( ICacheElement item, long requesterId ) { lastUpdate = item; updateRequestList.add( item ); @@ -136,7 +136,7 @@ public class MockCacheServiceNonLocal * @param key * @return null */ - public ICacheElement get( String cacheName, Serializable key ) + public ICacheElement get( String cacheName, K key ) { return get( cacheName, key, 0 ); } @@ -155,7 +155,7 @@ public class MockCacheServiceNonLocal * @param cacheName * @param key */ - public void remove( String cacheName, Serializable key ) + public void remove( String cacheName, K key ) { lastRemoveKey = key; } @@ -175,7 +175,7 @@ public class MockCacheServiceNonLocal *

* @param item */ - public void update( ICacheElement item ) + public void update( ICacheElement item ) { lastUpdate = item; } @@ -186,10 +186,10 @@ public class MockCacheServiceNonLocal * @param requesterId - identity of requester * @return empty map */ - public Map getMultiple( String cacheName, Set keys, long requesterId ) + public Map> getMultiple( String cacheName, Set keys, long requesterId ) { lastGetMultipleKeys = keys; - return new HashMap(); + return new HashMap>(); } /** @@ -197,7 +197,7 @@ public class MockCacheServiceNonLocal * @param keys * @return empty map */ - public Map getMultiple( String cacheName, Set keys ) + public Map> getMultiple( String cacheName, Set keys ) { return getMultiple( cacheName, keys, 0 ); } @@ -210,7 +210,7 @@ public class MockCacheServiceNonLocal * @return an empty map * @throws IOException */ - public Map getMatching( String cacheName, String pattern ) + public Map> getMatching( String cacheName, String pattern ) throws IOException { return getMatching( cacheName, pattern, 0 ); @@ -223,10 +223,10 @@ public class MockCacheServiceNonLocal * @return Map * @throws IOException */ - public Map getMatching( String cacheName, String pattern, long requesterId ) + public Map> getMatching( String cacheName, String pattern, long requesterId ) throws IOException { lastGetMatchingPattern = pattern; - return new HashMap(); + return new HashMap>(); } } Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/SystemPropertyUsageUnitTest.java Wed May 30 18:14:43 2012 @@ -46,7 +46,7 @@ public class SystemPropertyUsageUnitTest JCS.setConfigFilename( "/TestSystemPropertyUsage.ccf" ); - JCS jcs = JCS.getInstance( "someCacheNotInFile" ); + JCS jcs = JCS.getInstance( "someCacheNotInFile" ); assertEquals( "System property value is not reflected", jcs.getCacheAttributes().getMaxObjects(), Integer .parseInt( "6789" ) ); @@ -70,7 +70,7 @@ public class SystemPropertyUsageUnitTest mgr.configure( props, false ); - JCS jcs = JCS.getInstance( "someCacheNotInFile" ); + JCS jcs = JCS.getInstance( "someCacheNotInFile" ); assertFalse( "System property value should not be reflected", jcs.getCacheAttributes().getMaxObjects() == Integer.parseInt( props Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java Wed May 30 18:14:43 2012 @@ -38,14 +38,14 @@ public class ZombieCacheServiceNonLocalU throws Exception { // SETUP - MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); + MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); - ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 ); + ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 ); String cacheName = "testUpdate"; // DO WORK - ICacheElement element = new CacheElement( cacheName, "key", "value" ); + ICacheElement element = new CacheElement( cacheName, "key", "value" ); zombie.update( element, 123l ); zombie.propagateEvents( service ); @@ -62,14 +62,14 @@ public class ZombieCacheServiceNonLocalU throws Exception { // SETUP - MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); + MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); - ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 0 ); + ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 0 ); String cacheName = "testUpdate"; // DO WORK - ICacheElement element = new CacheElement( cacheName, "key", "value" ); + ICacheElement element = new CacheElement( cacheName, "key", "value" ); zombie.update( element, 123l ); zombie.propagateEvents( service ); @@ -86,9 +86,9 @@ public class ZombieCacheServiceNonLocalU throws Exception { // SETUP - MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); + MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); - ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 ); + ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 ); String cacheName = "testRemoveThenWalk"; String key = "myKey"; @@ -110,9 +110,9 @@ public class ZombieCacheServiceNonLocalU throws Exception { // SETUP - MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); + MockCacheServiceNonLocal service = new MockCacheServiceNonLocal(); - ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 ); + ZombieCacheServiceNonLocal zombie = new ZombieCacheServiceNonLocal( 10 ); String cacheName = "testRemoveThenWalk"; Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CacheManagerStatsUnitTest.java Wed May 30 18:14:43 2012 @@ -19,11 +19,11 @@ package org.apache.jcs.engine.control; * under the License. */ +import junit.framework.TestCase; + import org.apache.jcs.JCS; import org.apache.jcs.engine.stats.behavior.ICacheStats; -import junit.framework.TestCase; - /** * @author Aaron Smuts * @@ -39,7 +39,7 @@ public class CacheManagerStatsUnitTest */ public void testSimpleGetStats() throws Exception { - JCS cache = JCS.getInstance( "testCache1" ); + JCS cache = JCS.getInstance( "testCache1" ); // 1 miss, 1 hit, 1 put cache.get( "testKey" ); Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheConfiguratorUnitTest.java Wed May 30 18:14:43 2012 @@ -41,10 +41,11 @@ public class CompositeCacheConfiguratorU CompositeCacheConfigurator configurator = new CompositeCacheConfigurator( manager ); - CompositeCache cache = new CompositeCache( regionName, new CompositeCacheAttributes(), new ElementAttributes() ); + CompositeCache cache = + new CompositeCache( regionName, new CompositeCacheAttributes(), new ElementAttributes() ); // DO WORK - MockAuxiliaryCache result = (MockAuxiliaryCache) configurator + MockAuxiliaryCache result = (MockAuxiliaryCache) configurator .parseAuxiliary( cache, props, auxName, regionName ); // VERIFY @@ -71,7 +72,7 @@ public class CompositeCacheConfiguratorU manager.configure( props ); // VERIFY - CompositeCache cache = manager.getCache( regionName ); + CompositeCache cache = manager.getCache( regionName ); assertEquals( "Wrong chunkSize", cache.getCacheAttributes().getSpoolChunkSize(), chunkSize ); } } Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java Wed May 30 18:14:43 2012 @@ -68,7 +68,7 @@ public class CompositeCacheDiskUsageUnit public void testSwapConfig() throws CacheException { - JCS swap = JCS.getInstance( "Swap" ); + JCS swap = JCS.getInstance( "Swap" ); assertEquals( ICompositeCacheAttributes.DISK_USAGE_PATTERN_SWAP, swap.getCacheAttributes() .getDiskUsagePattern() ); } @@ -81,7 +81,7 @@ public class CompositeCacheDiskUsageUnit public void testUpdateConfig() throws CacheException { - JCS swap = JCS.getInstance( "Update" ); + JCS swap = JCS.getInstance( "Update" ); assertEquals( ICompositeCacheAttributes.DISK_USAGE_PATTERN_UPDATE, swap.getCacheAttributes() .getDiskUsagePattern() ); } @@ -98,14 +98,14 @@ public class CompositeCacheDiskUsageUnit IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); + CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); - MockAuxCache mock = new MockAuxCache(); + MockAuxCache mock = new MockAuxCache(); mock.cacheType = AuxiliaryCache.DISK_CACHE; cache.setAuxCaches( new AuxiliaryCache[] { mock } ); - ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); + ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); // DO WORK cache.spoolToDisk( inputElement ); @@ -127,14 +127,14 @@ public class CompositeCacheDiskUsageUnit IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); + CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); - MockAuxCache mock = new MockAuxCache(); + MockAuxCache mock = new MockAuxCache(); mock.cacheType = AuxiliaryCache.DISK_CACHE; cache.setAuxCaches( new AuxiliaryCache[] { mock } ); - ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); + ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); // DO WORK cache.spoolToDisk( inputElement ); @@ -160,14 +160,14 @@ public class CompositeCacheDiskUsageUnit IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); + CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); - MockAuxCache mock = new MockAuxCache(); + MockAuxCache mock = new MockAuxCache(); mock.cacheType = AuxiliaryCache.DISK_CACHE; cache.setAuxCaches( new AuxiliaryCache[] { mock } ); - ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); + ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); // DO WORK cache.updateAuxiliaries( inputElement, true ); @@ -195,14 +195,14 @@ public class CompositeCacheDiskUsageUnit IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); + CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); - MockAuxCache mock = new MockAuxCache(); + MockAuxCache mock = new MockAuxCache(); mock.cacheType = AuxiliaryCache.DISK_CACHE; cache.setAuxCaches( new AuxiliaryCache[] { mock } ); - ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); + ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); // DO WORK cache.updateAuxiliaries( inputElement, false ); @@ -230,14 +230,14 @@ public class CompositeCacheDiskUsageUnit IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); + CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); - MockAuxCache mock = new MockAuxCache(); + MockAuxCache mock = new MockAuxCache(); mock.cacheType = AuxiliaryCache.DISK_CACHE; cache.setAuxCaches( new AuxiliaryCache[] { mock } ); - ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); + ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); // DO WORK cache.updateAuxiliaries( inputElement, true ); @@ -263,17 +263,17 @@ public class CompositeCacheDiskUsageUnit IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); + CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr ); - MockAuxCache mock = new MockAuxCache(); + MockAuxCache mock = new MockAuxCache(); mock.cacheType = AuxiliaryCache.DISK_CACHE; - MockAuxCache mockLateral = new MockAuxCache(); + MockAuxCache mockLateral = new MockAuxCache(); mockLateral.cacheType = AuxiliaryCache.LATERAL_CACHE; cache.setAuxCaches( new AuxiliaryCache[] { mock, mockLateral } ); - ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); + ICacheElement inputElement = new CacheElement( "testSpoolAllowed", "key", "value" ); // DO WORK cache.updateAuxiliaries( inputElement, false ); @@ -291,14 +291,14 @@ public class CompositeCacheDiskUsageUnit *

* @author Aaron Smuts */ - public static class MockAuxCache - extends AbstractAuxiliaryCache + public static class MockAuxCache + extends AbstractAuxiliaryCache { /** Don't change */ private static final long serialVersionUID = 1L; /** The last item passed to update. */ - public ICacheElement lastUpdatedItem; + public ICacheElement lastUpdatedItem; /** The number of times update was called. */ public int updateCount = 0; @@ -317,7 +317,7 @@ public class CompositeCacheDiskUsageUnit * @param ce * @throws IOException */ - public void update( ICacheElement ce ) + public void update( ICacheElement ce ) throws IOException { lastUpdatedItem = ce; @@ -329,7 +329,7 @@ public class CompositeCacheDiskUsageUnit * @return ICacheElement * @throws IOException */ - public ICacheElement get( Serializable key ) + public ICacheElement get( K key ) throws IOException { return null; @@ -339,12 +339,12 @@ public class CompositeCacheDiskUsageUnit * Gets multiple items from the cache based on the given set of keys. *

* @param keys - * @return a map of Serializable key to ICacheElement element, or an empty map if there is + * @return a map of K key to ICacheElement element, or an empty map if there is * no data in cache for any of these keys */ - public Map getMultiple(Set keys) + public Map> getMultiple(Set keys) { - return new HashMap(); + return new HashMap>(); } /** @@ -352,7 +352,7 @@ public class CompositeCacheDiskUsageUnit * @return false * @throws IOException */ - public boolean remove( Serializable key ) + public boolean remove( K key ) throws IOException { return false; @@ -395,7 +395,7 @@ public class CompositeCacheDiskUsageUnit * @return null * @throws IOException */ - public Set getGroupKeys( String group ) + public Set getGroupKeys( String group ) throws IOException { return null; @@ -465,7 +465,7 @@ public class CompositeCacheDiskUsageUnit * @return Collections.EMPTY_MAP; * @throws IOException */ - public Map getMatching(String pattern) + public Map> getMatching(String pattern) throws IOException { return Collections.emptyMap(); Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheUnitTest.java Wed May 30 18:14:43 2012 @@ -60,25 +60,25 @@ public class CompositeCacheUnitTest IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( cacheName, cattr, attr ); + CompositeCache cache = new CompositeCache( cacheName, cattr, attr ); - MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); + MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); diskMock.cacheType = ICache.DISK_CACHE; - AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; + AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; cache.setAuxCaches( aux ); // DO WORK int numToInsert = 10; for ( int i = 0; i < numToInsert; i++ ) { - ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) ); + ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) ); cache.update( element, false ); } cache.dispose(); // VERIFY - MockMemoryCache memoryCache = (MockMemoryCache) cache.getMemoryCache(); + MockMemoryCache memoryCache = (MockMemoryCache) 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 cache = new CompositeCache( cacheName, cattr, attr ); - MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); + MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); diskMock.cacheType = ICache.REMOTE_CACHE; - AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; + AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; cache.setAuxCaches( aux ); // DO WORK int numToInsert = 10; for ( int i = 0; i < numToInsert; i++ ) { - ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) ); + ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Integer.valueOf( i ) ); cache.update( element, false ); } cache.dispose(); // VERIFY - MockMemoryCache memoryCache = (MockMemoryCache) cache.getMemoryCache(); + MockMemoryCache memoryCache = (MockMemoryCache) 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 cache = new CompositeCache( cacheName, cattr, attr ); - MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); + MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); diskMock.cacheType = ICache.DISK_CACHE; - AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; + AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; cache.setAuxCaches( aux ); // DO WORK @@ -153,7 +153,7 @@ public class CompositeCacheUnitTest // insert with prefix1 for ( int i = 0; i < numToInsertPrefix1; i++ ) { - ICacheElement element = new CacheElement( cacheName, keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) ); + ICacheElement element = new CacheElement( cacheName, keyprefix1 + String.valueOf( i ), Integer.valueOf( i ) ); cache.update( element, false ); } @@ -161,18 +161,18 @@ public class CompositeCacheUnitTest // insert with prefix1 for ( int i = 0; i < numToInsertPrefix2; i++ ) { - ICacheElement element = new CacheElement( cacheName, keyprefix2 + String.valueOf( i ), Integer.valueOf( i ) ); + ICacheElement element = new CacheElement( 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. *

@@ -191,11 +191,11 @@ public class CompositeCacheUnitTest IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( cacheName, cattr, attr ); + CompositeCache cache = new CompositeCache( cacheName, cattr, attr ); - MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); + MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); diskMock.cacheType = ICache.DISK_CACHE; - AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; + AuxiliaryCache[] 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. *

@@ -223,11 +223,11 @@ public class CompositeCacheUnitTest IElementAttributes attr = new ElementAttributes(); - CompositeCache cache = new CompositeCache( cacheName, cattr, attr ); + CompositeCache cache = new CompositeCache( cacheName, cattr, attr ); - MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); + MockAuxiliaryCache diskMock = new MockAuxiliaryCache(); diskMock.cacheType = ICache.REMOTE_CACHE; - AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; + AuxiliaryCache[] aux = new AuxiliaryCache[] { diskMock }; cache.setAuxCaches( aux ); // DO WORK Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java Wed May 30 18:14:43 2012 @@ -19,6 +19,7 @@ package org.apache.jcs.engine.control; * under the License. */ +import java.io.Serializable; import java.util.Properties; import org.apache.jcs.engine.CompositeCacheAttributes; @@ -26,11 +27,11 @@ import org.apache.jcs.engine.ElementAttr import org.apache.jcs.engine.behavior.ICompositeCacheManager; /** For testing. */ -public class MockCompositeCacheManager +public class MockCompositeCacheManager implements ICompositeCacheManager { /** The cache that was returned. */ - private CompositeCache cache; + private CompositeCache 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 getCache( String cacheName ) { if ( cache == null ) { System.out.println( "Creating mock cache" ); - CompositeCache newCache = new CompositeCache( cacheName, new CompositeCacheAttributes(), + CompositeCache newCache = new CompositeCache( 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 cache ) { this.cache = cache; } @@ -62,7 +63,7 @@ public class MockCompositeCacheManager /** * @return Returns the cache. */ - public CompositeCache getCache() + public CompositeCache getCache() { return cache; } Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java ('svn:mergeinfo' removed) Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java Wed May 30 18:14:43 2012 @@ -12,10 +12,10 @@ public class MockElementSerializer { /** test property */ private String testProperty; - + /** What's used in the background */ - private StandardSerializer serializer = new StandardSerializer(); - + private final StandardSerializer serializer = new StandardSerializer(); + /** times out was called */ public int deSerializeCount = 0; @@ -23,13 +23,13 @@ public class MockElementSerializer public int serializeCount = 0; /** - * @param bytes + * @param bytes * @return Object - * @throws IOException - * @throws ClassNotFoundException - * + * @throws IOException + * @throws ClassNotFoundException + * */ - public Object deSerialize( byte[] bytes ) + public T deSerialize( byte[] bytes ) throws IOException, ClassNotFoundException { deSerializeCount++; @@ -37,18 +37,18 @@ public class MockElementSerializer } /** - * @param obj + * @param obj * @return byte[] - * @throws IOException - * + * @throws IOException + * */ - public byte[] serialize( Serializable obj ) + public byte[] serialize( T obj ) throws IOException { serializeCount++; return serializer.serialize( obj ); } - + /** * @param testProperty */ @@ -63,5 +63,5 @@ public class MockElementSerializer public String getTestProperty() { return testProperty; - } + } } Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/control/event/SimpleEventHandlingUnitTest.java Wed May 30 18:14:43 2012 @@ -56,7 +56,7 @@ public class SimpleEventHandlingUnitTest // SETUP MyEventHandler meh = new MyEventHandler(); - JCS jcs = JCS.getInstance( "WithDisk" ); + JCS jcs = JCS.getInstance( "WithDisk" ); // this should add the event handler to all items as they are created. IElementAttributes attributes = jcs.getDefaultElementAttributes(); attributes.addElementEventHandler( meh ); @@ -86,7 +86,7 @@ public class SimpleEventHandlingUnitTest public void testSpoolNoDiskEvent() throws Exception { - JCS jcs = JCS.getInstance( "NoDisk" ); + JCS jcs = JCS.getInstance( "NoDisk" ); MyEventHandler meh = new MyEventHandler(); @@ -119,7 +119,7 @@ public class SimpleEventHandlingUnitTest { MyEventHandler meh = new MyEventHandler(); - JCS jcs = JCS.getInstance( "DiskButNotAllowed" ); + JCS jcs = JCS.getInstance( "DiskButNotAllowed" ); // this should add the event handler to all items as they are created. IElementAttributes attributes = jcs.getDefaultElementAttributes(); attributes.addElementEventHandler( meh ); @@ -149,7 +149,7 @@ public class SimpleEventHandlingUnitTest { MyEventHandler meh = new MyEventHandler(); - JCS jcs = JCS.getInstance( "DiskButNotAllowed" ); + JCS jcs = JCS.getInstance( "DiskButNotAllowed" ); // this should add the event handler to all items as they are created. //IElementAttributes attributes = jcs.getDefaultElementAttributes(); //attributes.addElementEventHandler( meh ); Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java Wed May 30 18:14:43 2012 @@ -33,13 +33,13 @@ public class CacheEventLoggerDebugLogger CacheEventLoggerDebugLogger logger = new CacheEventLoggerDebugLogger(); logger.setLogCategoryName( logCategoryName ); - ICacheEvent event = logger.createICacheEvent( source, region, eventName, optionalDetails, key ); + ICacheEvent event = logger.createICacheEvent( source, region, eventName, optionalDetails, key ); // DO WORK logger.logICacheEvent( event ); - + // VERIFY - String result = stringWriter.toString(); + String result = stringWriter.toString(); assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 ); assertTrue( "An event with the region should have been logged:" + result, result.indexOf( region ) != -1 ); assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 ); @@ -65,14 +65,14 @@ public class CacheEventLoggerDebugLogger // DO WORK logger.logApplicationEvent( source, eventName, optionalDetails ); - + // VERIFY - String result = stringWriter.toString(); + String result = stringWriter.toString(); assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 ); assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 ); assertTrue( "An event with the optionalDetails should have been logged:" + result, result.indexOf( optionalDetails ) != -1 ); } - + /** verify that we can log */ public void testLogError_normal() { @@ -91,14 +91,14 @@ public class CacheEventLoggerDebugLogger // DO WORK logger.logError( source, eventName, errorMessage ); - + // VERIFY - String result = stringWriter.toString(); + String result = stringWriter.toString(); assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 ); assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 ); assertTrue( "An event with the errorMessage should have been logged:" + result, result.indexOf( errorMessage ) != -1 ); } - + /** * Configures a logger for the given name. This allows us to check the log output. *

Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java Wed May 30 18:14:43 2012 @@ -2,8 +2,6 @@ package org.apache.jcs.engine.logging; import java.io.Serializable; -import org.apache.jcs.engine.behavior.ICacheElement; -import org.apache.jcs.engine.logging.CacheEvent; import org.apache.jcs.engine.logging.behavior.ICacheEvent; import org.apache.jcs.engine.logging.behavior.ICacheEventLogger; @@ -23,7 +21,7 @@ public class MockCacheEventLogger */ public void logApplicationEvent( String source, String eventName, String optionalDetails ) { - // TODO Auto-generated method stub + // TODO Auto-generated method stub } /** @@ -33,7 +31,7 @@ public class MockCacheEventLogger */ public void logError( String source, String eventName, String errorMessage ) { - // TODO Auto-generated method stub + // TODO Auto-generated method stub } /** @@ -44,32 +42,18 @@ public class MockCacheEventLogger * @param key * @return ICacheEvent */ - public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails, - Serializable key ) + public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails, + T key ) { - return new CacheEvent(); - } - - /** - * @param source - * @param region - * @param eventName - * @param optionalDetails - * @param item - * @return ICacheEvent - */ - public ICacheEvent createICacheEvent( String source, String region, String eventName, String optionalDetails, - ICacheElement item ) - { - return new CacheEvent(); + return new CacheEvent(); } /** * @param event */ - public void logICacheEvent( ICacheEvent event ) + public void logICacheEvent( ICacheEvent event ) { - // TODO Auto-generated method stub + // TODO Auto-generated method stub } /** Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java ('svn:mergeinfo' removed) Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java Wed May 30 18:14:43 2012 @@ -1,5 +1,6 @@ package org.apache.jcs.engine.match; +import java.util.HashSet; import java.util.Set; import junit.framework.TestCase; @@ -15,21 +16,20 @@ public class KeyMatcherPatternImpllUnitT { // SETUP int numToInsertPrefix1 = 10; - int araySize = numToInsertPrefix1; - Object[] keyArray = new Object[araySize]; + Set keyArray = new HashSet(); String keyprefix1 = "MyPrefixC"; // insert with prefix1 for ( int i = 0; i < numToInsertPrefix1; i++ ) { - keyArray[i] = keyprefix1 + String.valueOf( i ); + keyArray.add(keyprefix1 + String.valueOf( i )); } - KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl(); + KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl(); // DO WORK - Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".", keyArray ); + Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".", keyArray ); // VERIFY assertEquals( "Wrong number returned 1: " + result1, numToInsertPrefix1, result1.size() ); @@ -42,21 +42,20 @@ public class KeyMatcherPatternImpllUnitT { // SETUP int numToInsertPrefix1 = 10; - int araySize = numToInsertPrefix1 + 1; - Object[] keyArray = new Object[araySize]; + Set keyArray = new HashSet(); String keyprefix1 = "MyPrefixC"; // insert with prefix1 for ( int i = 1; i < numToInsertPrefix1 + 1; i++ ) { - keyArray[i] = keyprefix1 + String.valueOf( i ); + keyArray.add(keyprefix1 + String.valueOf( i )); } - KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl(); + KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl(); // DO WORK - Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + "\\S+", keyArray ); + Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + "\\S+", keyArray ); // VERIFY assertEquals( "Wrong number returned 1: " + result1, numToInsertPrefix1, result1.size() ); @@ -65,13 +64,12 @@ public class KeyMatcherPatternImpllUnitT /** * Verify that the matching method works. */ - public void testGetMathcingKeysFromArray_TwoTypes() + public void testGetMatchingKeysFromArray_TwoTypes() { // SETUP int numToInsertPrefix1 = 10; int numToInsertPrefix2 = 50; - int araySize = numToInsertPrefix1 + numToInsertPrefix2; - Object[] keyArray = new Object[araySize]; + Set keyArray = new HashSet(); String keyprefix1 = "MyPrefixA"; String keyprefix2 = "MyPrefixB"; @@ -79,20 +77,20 @@ public class KeyMatcherPatternImpllUnitT // insert with prefix1 for ( int i = 0; i < numToInsertPrefix1; i++ ) { - keyArray[i] = keyprefix1 + String.valueOf( i ); + keyArray.add(keyprefix1 + String.valueOf( i )); } // insert with prefix2 for ( int i = numToInsertPrefix1; i < numToInsertPrefix2 + numToInsertPrefix1; i++ ) { - keyArray[i] = keyprefix2 + String.valueOf( i ); + keyArray.add(keyprefix2 + String.valueOf( i )); } - KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl(); + KeyMatcherPatternImpl keyMatcher = new KeyMatcherPatternImpl(); // DO WORK - Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".+", keyArray ); - Set result2 = keyMatcher.getMatchingKeysFromArray( keyprefix2 + ".+", keyArray ); + Set result1 = keyMatcher.getMatchingKeysFromArray( keyprefix1 + ".+", keyArray ); + Set result2 = keyMatcher.getMatchingKeysFromArray( keyprefix2 + ".+", keyArray ); // VERIFY assertEquals( "Wrong number returned 1: " + result1, numToInsertPrefix1, result1.size() ); Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java ('svn:mergeinfo' removed) Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java Wed May 30 18:14:43 2012 @@ -23,12 +23,14 @@ import java.io.IOException; import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import org.apache.jcs.engine.behavior.ICacheElement; import org.apache.jcs.engine.behavior.ICompositeCacheAttributes; import org.apache.jcs.engine.control.CompositeCache; +import org.apache.jcs.engine.memory.behavior.IMemoryCache; import org.apache.jcs.engine.memory.util.MemoryElementDescriptor; import org.apache.jcs.engine.stats.behavior.IStats; @@ -37,14 +39,14 @@ import org.apache.jcs.engine.stats.behav *

* @author Aaron Smuts */ -public class MockMemoryCache - implements MemoryCache +public class MockMemoryCache + implements IMemoryCache { /** Config */ private ICompositeCacheAttributes cacheAttr; /** Internal map */ - private final HashMap map = new HashMap(); + private final HashMap> map = new HashMap>(); /** The number of times waterfall was called. */ public int waterfallCallCount = 0; @@ -56,7 +58,7 @@ public class MockMemoryCache * Does nothing * @param cache */ - public void initialize( CompositeCache cache ) + public void initialize( CompositeCache cache ) { // nothing } @@ -85,16 +87,16 @@ public class MockMemoryCache } /** @return null */ - public Iterator> getIterator() + public Iterator>> getIterator() { return null; } /** * @return map.keySet().toArray( */ - public Object[] getKeyArray() + public Set getKeySet() { - return map.keySet().toArray(); + return new LinkedHashSet(map.keySet()); } /** @@ -102,7 +104,7 @@ public class MockMemoryCache * @return map.remove( key ) != null * @throws IOException */ - public boolean remove( Serializable key ) + public boolean remove( K key ) throws IOException { return map.remove( key ) != null; @@ -122,7 +124,7 @@ public class MockMemoryCache * @return (ICacheElement) map.get( key ) * @throws IOException */ - public ICacheElement get( Serializable key ) + public ICacheElement get( K key ) throws IOException { return map.get( key ); @@ -133,20 +135,20 @@ public class MockMemoryCache * @return elements * @throws IOException */ - public Map getMultiple(Set keys) + public Map> getMultiple(Set keys) throws IOException { - Map elements = new HashMap(); + Map> elements = new HashMap>(); if ( keys != null && !keys.isEmpty() ) { - Iterator iterator = keys.iterator(); + Iterator iterator = keys.iterator(); while ( iterator.hasNext() ) { - Serializable key = iterator.next(); + K key = iterator.next(); - ICacheElement element = get( key ); + ICacheElement element = get( key ); if ( element != null ) { @@ -163,7 +165,7 @@ public class MockMemoryCache * @return (ICacheElement) map.get( key ) * @throws IOException */ - public ICacheElement getQuiet( Serializable key ) + public ICacheElement getQuiet( K key ) throws IOException { return map.get( key ); @@ -173,7 +175,7 @@ public class MockMemoryCache * @param ce * @throws IOException */ - public void waterfal( ICacheElement ce ) + public void waterfal( ICacheElement ce ) throws IOException { waterfallCallCount++; @@ -183,7 +185,7 @@ public class MockMemoryCache * @param ce * @throws IOException */ - public void update( ICacheElement ce ) + public void update( ICacheElement ce ) throws IOException { if ( ce != null ) @@ -209,7 +211,7 @@ public class MockMemoryCache } /** @return null */ - public CompositeCache getCompositeCache() + public CompositeCache getCompositeCache() { return null; } @@ -218,7 +220,7 @@ public class MockMemoryCache * @param group * @return null */ - public Set getGroupKeys( String group ) + public Set getGroupKeys( String group ) { return null; } Propchange: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/MockMemoryCache.java ('svn:mergeinfo' removed) Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/fifo/FIFOMemoryCacheUnitTest.java Wed May 30 18:14:43 2012 @@ -30,17 +30,17 @@ public class FIFOMemoryCacheUnitTest attributes.setMaxObjects( maxObjects ); attributes.setSpoolChunkSize( 1 ); - FIFOMemoryCache cache = new FIFOMemoryCache(); - cache.initialize( new CompositeCache( cacheName, attributes, + FIFOMemoryCache cache = new FIFOMemoryCache(); + cache.initialize( new CompositeCache( cacheName, attributes, new ElementAttributes() ) ); - + for ( int i = 0; i <= maxObjects; i++ ) { - CacheElement element = new CacheElement( cacheName, "key" + i, "value" + i ); + CacheElement element = new CacheElement( cacheName, "key" + i, "value" + i ); cache.update( element ); } - CacheElement oneMoreElement = new CacheElement( cacheName, "onemore", "onemore" ); + CacheElement oneMoreElement = new CacheElement( 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 *

@@ -70,16 +70,16 @@ public class FIFOMemoryCacheUnitTest attributes.setMaxObjects( maxObjects ); attributes.setSpoolChunkSize( 1 ); - FIFOMemoryCache cache = new FIFOMemoryCache(); - cache.initialize( new CompositeCache( cacheName, attributes, + FIFOMemoryCache cache = new FIFOMemoryCache(); + cache.initialize( new CompositeCache( cacheName, attributes, new ElementAttributes() ) ); // DO WORK for ( int i = 0; i <= (maxObjects * 2); i++ ) { - CacheElement element = new CacheElement( cacheName, "key" + i, "value" + i ); + CacheElement element = new CacheElement( cacheName, "key" + i, "value" + i ); cache.update( element ); - } + } // VERIFY assertEquals( "Should have max elements", maxObjects, cache.getSize() ); Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheConcurrentUnitTest.java Wed May 30 18:14:43 2012 @@ -83,7 +83,7 @@ public class LHMLRUMemoryCacheConcurrent this.runTestForRegion( "indexedRegion1" ); } } ); - + return suite; } @@ -110,16 +110,16 @@ public class LHMLRUMemoryCacheConcurrent { CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance(); cacheMgr.configure( "/TestLHMLRUCache.ccf" ); - CompositeCache cache = cacheMgr.getCache( region ); + CompositeCache cache = cacheMgr.getCache( region ); - LRUMemoryCache lru = new LRUMemoryCache(); + LRUMemoryCache lru = new LRUMemoryCache(); lru.initialize( cache ); // Add items to cache for ( int i = 0; i < items; i++ ) { - ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", region + " data " + i ); + ICacheElement ice = new CacheElement( 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 keys = new HashSet(); for ( int i = 0; i < items; i++ ) { keys.add( i + ":key" ); } - Map elements = lru.getMultiple( keys ); + Map> elements = lru.getMultiple( keys ); for ( int i = 0; i < 100; i++ ) { assertNull( "Should not have " + i + ":key", elements.get( i + ":key" ) ); } for ( int i = 100; i < items; i++ ) { - ICacheElement element = (ICacheElement) elements.get( i + ":key" ); + ICacheElement element = elements.get( i + ":key" ); assertNotNull( "element " + i + ":key is missing", element ); assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() ); } Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java Wed May 30 18:14:43 2012 @@ -55,7 +55,7 @@ public class LHMLRUMemoryCacheUnitTest public void testLoadFromCCF() throws CacheException { - JCS cache = JCS.getInstance( "testPutGet" ); + JCS 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 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 keys = new HashSet(); for ( int i = 0; i < items; i++ ) { keys.add( i + ":key" ); } - Map elements = cache.getCacheElements( keys ); + Map> elements = cache.getCacheElements( keys ); for ( int i = max-1; i >= 0; i-- ) { assertNull( "Should not have value for key [" + i + ":key" + "] in the cache." + cache.getStats(), elements.get( i + ":key" ) ); } for ( int i = max + 2; i < items; i++ ) { - ICacheElement element = (ICacheElement) elements.get( i + ":key" ); + ICacheElement 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 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 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 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 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 cache = cacheMgr.getCache( "testGetKeyArray" ); - LHMLRUMemoryCache mru = new LHMLRUMemoryCache(); + LHMLRUMemoryCache mru = new LHMLRUMemoryCache(); mru.initialize( cache ); int max = cache.getCacheAttributes().getMaxObjects(); @@ -259,25 +259,25 @@ public class LHMLRUMemoryCacheUnitTest for ( int i = 0; i < items; i++ ) { - ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i ); + ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i ); ice.setElementAttributes( cache.getElementAttributes() ); mru.update( ice ); } - Object[] keys = mru.getKeyArray(); + Set keys = mru.getKeySet(); - assertEquals( "Wrong number of keys.", items, keys.length ); + assertEquals( "Wrong number of keys.", items, keys.size() ); } /** - * Add a few keys with the delimeter. Remove them. + * Add a few keys with the delimiter. Remove them. *

* @throws CacheException */ public void testRemovePartialThroughHub() throws CacheException { - JCS cache = JCS.getInstance( "testGetStatsThroughHub" ); + JCS cache = JCS.getInstance( "testGetStatsThroughHub" ); int max = cache.getCacheAttributes().getMaxObjects(); int items = max / 2; @@ -294,7 +294,7 @@ public class LHMLRUMemoryCacheUnitTest // Test that last items are in cache for ( int i = 0; i < items; i++ ) { - String value = (String) cache.get( root + ":" + i + ":key" ); + String value = cache.get( root + ":" + i + ":key" ); assertEquals( "myregion" + " data " + i, value ); } Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/lru/LRUMemoryCacheConcurrentUnitTest.java Wed May 30 18:14:43 2012 @@ -83,7 +83,7 @@ public class LRUMemoryCacheConcurrentUni this.runTestForRegion( "testRegion1" ); } } ); - + return suite; } @@ -109,16 +109,16 @@ public class LRUMemoryCacheConcurrentUni { CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance(); cacheMgr.configure( "/TestDiskCache.ccf" ); - CompositeCache cache = cacheMgr.getCache( region ); + CompositeCache cache = cacheMgr.getCache( region ); - LRUMemoryCache lru = new LRUMemoryCache(); + LRUMemoryCache lru = new LRUMemoryCache(); lru.initialize( cache ); // Add items to cache for ( int i = 0; i < items; i++ ) { - ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", region + " data " + i ); + ICacheElement ice = new CacheElement( 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 keys = new HashSet(); for ( int i = 0; i < items; i++ ) { keys.add( i + ":key" ); } - Map elements = lru.getMultiple( keys ); + Map> elements = lru.getMultiple( keys ); for ( int i = 0; i < 100; i++ ) { assertNull( "Should not have " + i + ":key", elements.get( i + ":key" ) ); } for ( int i = 100; i < items; i++ ) { - ICacheElement element = (ICacheElement) elements.get( i + ":key" ); + ICacheElement element = elements.get( i + ":key" ); assertNotNull( "element " + i + ":key is missing", element ); assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() ); } Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/LRUvsMRUPerformanceTest.java Wed May 30 18:14:43 2012 @@ -93,8 +93,8 @@ public class LRUvsMRUPerformanceTest { JCS.setConfigFilename( "/TestMRUCache.ccf" ); - JCS cache = JCS.getInstance( "lruDefined" ); - JCS mru = JCS.getInstance( "mruDefined" ); + JCS cache = JCS.getInstance( "lruDefined" ); + JCS mru = JCS.getInstance( "mruDefined" ); System.out.println( "LRU = " + cache ); Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java?rev=1344374&r1=1344373&r2=1344374&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/engine/memory/mru/MRUMemoryCacheUnitTest.java Wed May 30 18:14:43 2012 @@ -56,7 +56,7 @@ public class MRUMemoryCacheUnitTest public void testLoadFromCCF() throws CacheException { - JCS cache = JCS.getInstance( "testPutGet" ); + JCS 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 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 keys = new HashSet(); for ( int i = 0; i < items; i++ ) { keys.add( i + ":key" ); } - Map elements = cache.getCacheElements( keys ); + Map> elements = cache.getCacheElements( keys ); for ( int i = max-1; i >= 0; i-- ) { assertNull( "Should not have value for key [" + i + ":key" + "] in the cache." + cache.getStats(), elements.get( i + ":key" ) ); } for ( int i = max + 2; i < items; i++ ) { - ICacheElement element = (ICacheElement) elements.get( i + ":key" ); + ICacheElement 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 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 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 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 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 cache = cacheMgr.getCache( "testGetKeyArray" ); - MRUMemoryCache mru = new MRUMemoryCache(); + MRUMemoryCache mru = new MRUMemoryCache(); mru.initialize( cache ); int max = cache.getCacheAttributes().getMaxObjects(); @@ -260,25 +260,25 @@ public class MRUMemoryCacheUnitTest for ( int i = 0; i < items; i++ ) { - ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i ); + ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i ); ice.setElementAttributes( cache.getElementAttributes() ); mru.update( ice ); } - Object[] keys = mru.getKeyArray(); + Set keys = mru.getKeySet(); - assertEquals( "Wrong number of keys.", items, keys.length ); + assertEquals( "Wrong number of keys.", items, keys.size() ); } /** - * Add a few keys with the delimeter. Remove them. + * Add a few keys with the delimiter. Remove them. *

* @throws CacheException */ public void testRemovePartialThroughHub() throws CacheException { - JCS cache = JCS.getInstance( "testGetStatsThroughHub" ); + JCS 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 ); }