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 8F0C5BA29 for ; Mon, 16 Jan 2012 21:06:49 +0000 (UTC) Received: (qmail 67305 invoked by uid 500); 16 Jan 2012 21:06:48 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 67218 invoked by uid 500); 16 Jan 2012 21:06:48 -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 67157 invoked by uid 99); 16 Jan 2012 21:06:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 21:06:48 +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; Mon, 16 Jan 2012 21:06:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 375132388C18 for ; Mon, 16 Jan 2012 21:06:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1232163 [9/10] - in /commons/proper/jcs/branches/generics-interface/src: java/org/apache/jcs/ java/org/apache/jcs/access/ java/org/apache/jcs/access/behavior/ java/org/apache/jcs/admin/ java/org/apache/jcs/auxiliary/ java/org/apache/jcs/au... Date: Mon, 16 Jan 2012 21:05:50 -0000 To: commits@commons.apache.org From: tv@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120116210601.375132388C18@eris.apache.org> Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java Mon Jan 16 21:05:44 2012 @@ -34,8 +34,8 @@ import org.apache.jcs.engine.behavior.IC /** * This is a mock impl of the remote cache service. */ -public class MockRemoteCacheService - implements IRemoteCacheService +public class MockRemoteCacheService + implements IRemoteCacheService { /** The key last passed to get */ public Serializable lastGetKey; @@ -44,19 +44,19 @@ public class MockRemoteCacheService 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 MockRemoteCacheService * @param requesterId * @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 MockRemoteCacheService * @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 MockRemoteCacheService * @param key * @param requesterId */ - 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 MockRemoteCacheService * @param item * @param requesterId */ - 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 MockRemoteCacheService * @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 MockRemoteCacheService * @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 MockRemoteCacheService *

* @param item */ - public void update( ICacheElement item ) + public void update( ICacheElement item ) { lastUpdate = item; } @@ -186,10 +186,10 @@ public class MockRemoteCacheService * @param requesterId * @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 MockRemoteCacheService * @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 MockRemoteCacheService * @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 MockRemoteCacheService * @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/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java Mon Jan 16 21:05:44 2012 @@ -20,7 +20,6 @@ package org.apache.jcs.auxiliary.remote; */ import java.io.IOException; -import java.io.Serializable; import java.net.MalformedURLException; import java.rmi.Naming; import java.rmi.NotBoundException; @@ -42,13 +41,13 @@ import org.apache.jcs.engine.behavior.IC * Manual tester. */ public class RemoteCacheClientTester - implements IRemoteCacheListener, IRemoteCacheConstants, Remote + implements IRemoteCacheListener, IRemoteCacheConstants, Remote { /** the observer */ protected ICacheObserver watch; /** the service */ - protected ICacheService cache; + protected ICacheService cache; /** The registry host name. */ final String host; @@ -65,7 +64,7 @@ public class RemoteCacheClientTester /** * Gets the remoteType attribute of the RemoteCacheClientTest object * @return The remoteType value - * @throws IOException + * @throws IOException */ public int getRemoteType() throws IOException @@ -151,17 +150,17 @@ public class RemoteCacheClientTester p( "server found" ); - cache = (ICacheService) obj; + cache = (ICacheService) obj; watch = (ICacheObserver) obj; p( "subscribing to the server" ); watch.addCacheListener( "testCache", this ); - ICacheElement cb = new CacheElement( "testCache", "testKey", "testVal" ); + ICacheElement cb = new CacheElement( "testCache", "testKey", "testVal" ); for ( int i = 0; i < count; i++ ) { - cb = new CacheElement( "testCache", "" + i, "" + i ); + cb = new CacheElement( "testCache", "" + i, "" + i ); if ( delete ) { @@ -201,7 +200,7 @@ public class RemoteCacheClientTester * @param cb * @throws IOException */ - public void handlePut( ICacheElement cb ) + public void handlePut( ICacheElement cb ) throws IOException { p( "handlePut> cb=" + cb ); @@ -212,7 +211,7 @@ public class RemoteCacheClientTester * @param key * @throws IOException */ - public void handleRemove( String cacheName, Serializable key ) + public void handleRemove( String cacheName, String key ) throws IOException { p( "handleRemove> cacheName=" + cacheName + ", key=" + key ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java Mon Jan 16 21:05:44 2012 @@ -24,6 +24,7 @@ import junit.framework.TestCase; import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes; import org.apache.jcs.engine.CacheElementSerialized; import org.apache.jcs.engine.ElementAttributes; +import org.apache.jcs.engine.behavior.ICache; import org.apache.jcs.engine.behavior.ICacheElement; import org.apache.jcs.engine.behavior.ICacheElementSerialized; import org.apache.jcs.engine.behavior.ICompositeCacheManager; @@ -54,7 +55,7 @@ public class RemoteCacheListenerUnitTest IRemoteCacheAttributes irca = new RemoteCacheAttributes(); irca.setRemoveUponRemotePut( false ); ICompositeCacheManager cacheMgr = new MockCompositeCacheManager(); - RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr ); + RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr ); String cacheName = "testName"; String key = "key"; @@ -64,14 +65,16 @@ public class RemoteCacheListenerUnitTest IElementSerializer elementSerializer = new StandardSerializer(); - ICacheElementSerialized element = new CacheElementSerialized( cacheName, key, elementSerializer + ICacheElementSerialized element = + new CacheElementSerialized( cacheName, key, elementSerializer .serialize( value ), attr ); - + // DO WORK listener.handlePut( element ); // VERIFY - ICacheElement after = cacheMgr.getCache( cacheName ).get( key ); + ICache cache = cacheMgr.getCache( cacheName ); + ICacheElement after = cache.get( key ); assertNotNull( "Should have a deserialized object.", after ); assertEquals( "Values should be the same.", value, after.getVal() ); @@ -95,7 +98,7 @@ public class RemoteCacheListenerUnitTest IRemoteCacheAttributes irca = new RemoteCacheAttributes(); irca.setRemoveUponRemotePut( true ); ICompositeCacheManager cacheMgr = new MockCompositeCacheManager(); - RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr ); + RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr ); String cacheName = "testName"; String key = "key"; @@ -105,14 +108,16 @@ public class RemoteCacheListenerUnitTest IElementSerializer elementSerializer = new StandardSerializer(); - ICacheElementSerialized element = new CacheElementSerialized( cacheName, key, elementSerializer + ICacheElementSerialized element = + new CacheElementSerialized( cacheName, key, elementSerializer .serialize( value ), attr ); - + // DO WORK listener.handlePut( element ); // VERIFY - ICacheElement after = cacheMgr.getCache( cacheName ).get( key ); + ICache cache = cacheMgr.getCache( cacheName ); + ICacheElement after = cache.get( key ); assertNull( "Should not have a deserialized object since remove on put is true.", after ); } Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java Mon Jan 16 21:05:44 2012 @@ -52,7 +52,7 @@ public class RemoteCacheNoWaitUnitTest MockRemoteCacheClient client = new MockRemoteCacheClient(); RemoteCacheNoWait noWait = new RemoteCacheNoWait( client ); - ICacheElement element = new CacheElement( "testUpdate", "key", "value" ); + ICacheElement element = new CacheElement( "testUpdate", "key", "value" ); // DO WORK noWait.update( element ); @@ -76,11 +76,11 @@ public class RemoteCacheNoWaitUnitTest MockRemoteCacheClient client = new MockRemoteCacheClient(); RemoteCacheNoWait noWait = new RemoteCacheNoWait( client ); - ICacheElement input = new CacheElement( "testUpdate", "key", "value" ); + ICacheElement input = new CacheElement( "testUpdate", "key", "value" ); client.getSetupMap.put( "key", input ); // DO WORK - ICacheElement result = noWait.get( "key" ); + ICacheElement result = noWait.get( "key" ); // VERIFY assertEquals( "Wrong element", input, result ); @@ -98,7 +98,7 @@ public class RemoteCacheNoWaitUnitTest MockRemoteCacheClient client = new MockRemoteCacheClient(); RemoteCacheNoWait noWait = new RemoteCacheNoWait( client ); - ICacheElement inputElement = new CacheElement( "testUpdate", "key", "value" ); + ICacheElement inputElement = new CacheElement( "testUpdate", "key", "value" ); Map inputMap = new HashMap(); inputMap.put( "key", inputElement ); @@ -194,7 +194,7 @@ public class RemoteCacheNoWaitUnitTest MockRemoteCacheService service = new MockRemoteCacheService(); - ICacheElement element = new CacheElement( "testUpdate", "key", "value" ); + ICacheElement element = new CacheElement( "testUpdate", "key", "value" ); // DO WORK noWait.update( element ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java Mon Jan 16 21:05:44 2012 @@ -58,13 +58,13 @@ public class RemoteCacheUnitTest String cacheName = "testUpdate"; // DO WORK - ICacheElement element = new CacheElement( cacheName, "key", "value" ); + ICacheElement element = new CacheElement( cacheName, "key", "value" ); remoteCache.update( element ); // VERIFY assertTrue( "The element should be in the serialized warapper.", service.lastUpdate instanceof ICacheElementSerialized ); - ICacheElement result = SerializationConversionUtil + ICacheElement result = SerializationConversionUtil .getDeSerializedCacheElement( (ICacheElementSerialized) service.lastUpdate, remoteCache .getElementSerializer() ); assertEquals( "Wrong element updated.", element.getVal(), result.getVal() ); @@ -91,7 +91,7 @@ public class RemoteCacheUnitTest String cacheName = "testUpdate"; // DO WORK - ICacheElement element = new CacheElement( cacheName, "key", "value" ); + ICacheElement element = new CacheElement( cacheName, "key", "value" ); remoteCache.update( element ); // set the new service, this should call propogate remoteCache.fixCache( service ); @@ -99,7 +99,7 @@ public class RemoteCacheUnitTest // VERIFY assertTrue( "The element should be in the serialized warapper.", service.lastUpdate instanceof ICacheElementSerialized ); - ICacheElement result = SerializationConversionUtil + ICacheElement result = SerializationConversionUtil .getDeSerializedCacheElement( (ICacheElementSerialized) service.lastUpdate, remoteCache .getElementSerializer() ); assertEquals( "Wrong element updated.", element.getVal(), result.getVal() ); @@ -123,7 +123,7 @@ public class RemoteCacheUnitTest MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); remoteCache.setCacheEventLogger( cacheEventLogger ); - ICacheElement item = new CacheElement( "region", "key", "value" ); + ICacheElement item = new CacheElement( "region", "key", "value" ); // DO WORK remoteCache.update( item ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java Mon Jan 16 21:05:44 2012 @@ -46,7 +46,7 @@ public class ZombieRemoteCacheServiceUni 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 ); @@ -70,7 +70,7 @@ public class ZombieRemoteCacheServiceUni 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 ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java Mon Jan 16 21:05:44 2012 @@ -56,7 +56,7 @@ public class RemoteHttpCacheClientUnitTe mockDispatcher.setupRemoteCacheResponse = null; // DO WORK - ICacheElement result = client.get( cacheName, key ); + ICacheElement result = client.get( cacheName, key ); // VERIFY assertNull( "Wrong result.", result ); @@ -82,14 +82,14 @@ public class RemoteHttpCacheClientUnitTe String cacheName = "test"; String key = "key"; - ICacheElement expected = new CacheElement( cacheName, key, "value" ); + ICacheElement expected = new CacheElement( cacheName, key, "value" ); RemoteCacheResponse remoteHttpCacheResponse = new RemoteCacheResponse(); remoteHttpCacheResponse.getPayload().put( key, expected ); mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse; // DO WORK - ICacheElement result = client.get( cacheName, key ); + ICacheElement result = client.get( cacheName, key ); // VERIFY assertEquals( "Wrong result.", expected, result ); @@ -115,7 +115,7 @@ public class RemoteHttpCacheClientUnitTe String cacheName = "test"; String pattern = "key"; - ICacheElement expected = new CacheElement( cacheName, "key", "value" ); + ICacheElement expected = new CacheElement( cacheName, "key", "value" ); RemoteCacheResponse remoteHttpCacheResponse = new RemoteCacheResponse(); remoteHttpCacheResponse.getPayload().put( "key", expected ); @@ -148,7 +148,7 @@ public class RemoteHttpCacheClientUnitTe String cacheName = "test"; Set keys = Collections.EMPTY_SET; - ICacheElement expected = new CacheElement( cacheName, "key", "value" ); + ICacheElement expected = new CacheElement( cacheName, "key", "value" ); RemoteCacheResponse remoteHttpCacheResponse = new RemoteCacheResponse(); remoteHttpCacheResponse.getPayload().put( "key", expected ); @@ -231,7 +231,7 @@ public class RemoteHttpCacheClientUnitTe String cacheName = "test"; - ICacheElement element = new CacheElement( cacheName, "key", "value" ); + ICacheElement element = new CacheElement( cacheName, "key", "value" ); // DO WORK client.update( element ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java Mon Jan 16 21:05:44 2012 @@ -19,7 +19,6 @@ package org.apache.jcs.auxiliary.remote. * under the License. */ -import java.io.Serializable; import java.util.Collections; import java.util.Set; @@ -39,38 +38,38 @@ public class RemoteCacheServiceAdaptorUn public void testProcessRequest_null() { // SETUP - RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); + RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); - MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); + MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); adaptor.setRemoteCacheService( remoteHttpCacheService ); - RemoteCacheRequest request = null; + RemoteCacheRequest request = null; // DO WORK - RemoteCacheResponse result = adaptor.processRequest( request ); + RemoteCacheResponse result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); assertTrue( "Should have 'The request is null' in the errorMessage", result.getErrorMessage().indexOf( "The request is null" ) != -1 ); assertTrue( "Should have 'The request is null' in the toString", result.toString().indexOf( "The request is null" ) != -1 ); } - + /** Verify that the service is called. */ public void testProcessRequest_Get() { // SETUP - RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); + RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); - MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); + MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); adaptor.setRemoteCacheService( remoteHttpCacheService ); String cacheName = "test"; - Serializable key = "key"; + String key = "key"; long requesterId = 2; - RemoteCacheRequest request = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId ); + RemoteCacheRequest request = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId ); // DO WORK - RemoteCacheResponse result = adaptor.processRequest( request ); + RemoteCacheResponse result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); @@ -81,19 +80,19 @@ public class RemoteCacheServiceAdaptorUn public void testProcessRequest_GetMatching() { // SETUP - RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); + RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); - MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); + MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); adaptor.setRemoteCacheService( remoteHttpCacheService ); String cacheName = "test"; String pattern = "pattern"; long requesterId = 2; - RemoteCacheRequest request = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, + RemoteCacheRequest request = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, requesterId ); // DO WORK - RemoteCacheResponse result = adaptor.processRequest( request ); + RemoteCacheResponse result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); @@ -104,19 +103,19 @@ public class RemoteCacheServiceAdaptorUn public void testProcessRequest_GetMultiple() { // SETUP - RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); + RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); - MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); + MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); adaptor.setRemoteCacheService( remoteHttpCacheService ); String cacheName = "test"; - Set keys = Collections.EMPTY_SET; + Set keys = Collections.emptySet(); long requesterId = 2; - RemoteCacheRequest request = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, + RemoteCacheRequest request = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, requesterId ); // DO WORK - RemoteCacheResponse result = adaptor.processRequest( request ); + RemoteCacheResponse result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); @@ -128,62 +127,62 @@ public class RemoteCacheServiceAdaptorUn public void testProcessRequest_Update() { // SETUP - RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); + RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); - MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); + MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); adaptor.setRemoteCacheService( remoteHttpCacheService ); String cacheName = "test"; - Serializable key = "key"; + String key = "key"; long requesterId = 2; - CacheElement element = new CacheElement( cacheName, key, null ); - RemoteCacheRequest request = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId ); + CacheElement element = new CacheElement( cacheName, key, null ); + RemoteCacheRequest request = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId ); // DO WORK - RemoteCacheResponse result = adaptor.processRequest( request ); + RemoteCacheResponse result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); assertEquals( "Wrong object.", element, remoteHttpCacheService.lastUpdate ); } - + /** Verify that the service is called. */ public void testProcessRequest_Remove() { // SETUP - RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); + RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); - MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); + MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); adaptor.setRemoteCacheService( remoteHttpCacheService ); String cacheName = "test"; - Serializable key = "key"; + String key = "key"; long requesterId = 2; - RemoteCacheRequest request = RemoteCacheRequestFactory.createRemoveRequest( cacheName, key, requesterId ); + RemoteCacheRequest request = RemoteCacheRequestFactory.createRemoveRequest( cacheName, key, requesterId ); // DO WORK - RemoteCacheResponse result = adaptor.processRequest( request ); + RemoteCacheResponse result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); assertEquals( "Wrong key.", key, remoteHttpCacheService.lastRemoveKey ); } - + /** Verify that the service is called. */ public void testProcessRequest_RemoveAll() { // SETUP - RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); + RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor(); - MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); + MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService(); adaptor.setRemoteCacheService( remoteHttpCacheService ); String cacheName = "testRemoveALl"; long requesterId = 2; - RemoteCacheRequest request = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); + RemoteCacheRequest request = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); // DO WORK - RemoteCacheResponse result = adaptor.processRequest( request ); + RemoteCacheResponse result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java Mon Jan 16 21:05:44 2012 @@ -19,7 +19,6 @@ package org.apache.jcs.auxiliary.remote. * under the License. */ -import java.io.Serializable; import java.util.HashSet; import junit.framework.TestCase; @@ -43,15 +42,16 @@ public class RemoteHttpCacheServiceUnitT // SETUP MockCompositeCacheManager manager = new MockCompositeCacheManager(); MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); - + RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes(); - RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); + RemoteHttpCacheService server = + new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); String cacheName = "test"; - Serializable key = "key"; + String key = "key"; long requesterId = 2; - CacheElement element = new CacheElement( cacheName, key, null ); - + CacheElement element = new CacheElement( cacheName, key, null ); + // DO WORK server.update( element, requesterId ); @@ -59,7 +59,7 @@ public class RemoteHttpCacheServiceUnitT assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls ); assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls ); } - + /** * Verify event log calls. *

@@ -71,9 +71,10 @@ public class RemoteHttpCacheServiceUnitT // SETUP MockCompositeCacheManager manager = new MockCompositeCacheManager(); MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); - + RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes(); - RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); + RemoteHttpCacheService server = + new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); // DO WORK server.get( "region", "key" ); @@ -94,9 +95,10 @@ public class RemoteHttpCacheServiceUnitT // SETUP MockCompositeCacheManager manager = new MockCompositeCacheManager(); MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); - + RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes(); - RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); + RemoteHttpCacheService server = + new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); // DO WORK server.getMatching( "region", "pattern", 0 ); @@ -117,12 +119,13 @@ public class RemoteHttpCacheServiceUnitT // SETUP MockCompositeCacheManager manager = new MockCompositeCacheManager(); MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); - + RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes(); - RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); + RemoteHttpCacheService server = + new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); // DO WORK - server.getMultiple( "region", new HashSet() ); + server.getMultiple( "region", new HashSet() ); // VERIFY assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls ); @@ -140,9 +143,10 @@ public class RemoteHttpCacheServiceUnitT // SETUP MockCompositeCacheManager manager = new MockCompositeCacheManager(); MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); - + RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes(); - RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); + RemoteHttpCacheService server = + new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); // DO WORK server.remove( "region", "key" ); @@ -163,9 +167,10 @@ public class RemoteHttpCacheServiceUnitT // SETUP MockCompositeCacheManager manager = new MockCompositeCacheManager(); MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); - + RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes(); - RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); + RemoteHttpCacheService server = + new RemoteHttpCacheService( manager, rcsa, cacheEventLogger ); // DO WORK server.removeAll( "region" ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java Mon Jan 16 21:05:44 2012 @@ -23,8 +23,8 @@ import junit.framework.TestCase; import org.apache.jcs.auxiliary.AuxiliaryCache; import org.apache.jcs.auxiliary.MockCacheEventLogger; -import org.apache.jcs.auxiliary.remote.RemoteCacheAttributes; import org.apache.jcs.auxiliary.remote.MockRemoteCacheListener; +import org.apache.jcs.auxiliary.remote.RemoteCacheAttributes; import org.apache.jcs.auxiliary.remote.RemoteCacheManager; import org.apache.jcs.engine.CacheElement; import org.apache.jcs.engine.behavior.ICacheElement; @@ -41,10 +41,10 @@ public class BasicRemoteCacheClientServe extends TestCase { /** Server instance to use in the tests. */ - private RemoteCacheServer server = null; - + private RemoteCacheServer server = null; + /** the remote server port */ - private int remotePort; + private final int remotePort; /** * Starts the server. This is not in a setup, since the server is slow to kill right now. @@ -81,11 +81,11 @@ public class BasicRemoteCacheClientServe RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer() ); String regionName = "testSinglePut"; - AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); + AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); // DO WORK int numPutsPrior = server.getPutCount(); - ICacheElement element = new CacheElement( regionName, "key", "value" ); + ICacheElement element = new CacheElement( regionName, "key", "value" ); cache.update( element ); SleepUtil.sleepAtLeast( 200 ); @@ -94,12 +94,12 @@ public class BasicRemoteCacheClientServe assertEquals( "Wrong number of puts", 1, server.getPutCount() - numPutsPrior ); // DO WORK - ICacheElement result = cache.get( "key" ); + ICacheElement result = cache.get( "key" ); // VERIFY assertEquals( "Wrong element.", element.getVal(), result.getVal() ); } - + /** * Verify that we can remove an item via the remote server. *

@@ -117,14 +117,14 @@ public class BasicRemoteCacheClientServe attributes.setRemotePort( remotePort ); MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); - + RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, cacheEventLogger, null ); String regionName = "testPutRemove"; - AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); + AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); // DO WORK int numPutsPrior = server.getPutCount(); - ICacheElement element = new CacheElement( regionName, "key", "value" ); + ICacheElement element = new CacheElement( regionName, "key", "value" ); cache.update( element ); SleepUtil.sleepAtLeast( 50 ); @@ -133,7 +133,7 @@ public class BasicRemoteCacheClientServe assertEquals( "Wrong number of puts", 1, server.getPutCount() - numPutsPrior ); // DO WORK - ICacheElement result = cache.get( "key" ); + ICacheElement result = cache.get( "key" ); // VERIFY assertEquals( "Wrong element.", element.getVal(), result.getVal() ); @@ -141,7 +141,7 @@ public class BasicRemoteCacheClientServe // DO WORK cache.remove( "key" ); SleepUtil.sleepAtLeast( 200 ); - ICacheElement resultAfterRemote = cache.get( "key" ); + ICacheElement resultAfterRemote = cache.get( "key" ); // VERIFY assertNull( "Element resultAfterRemote should be null.", resultAfterRemote ); @@ -164,14 +164,14 @@ public class BasicRemoteCacheClientServe RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer() ); String regionName = "testPutAndListen"; - AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); + AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); - MockRemoteCacheListener listener = new MockRemoteCacheListener(); + MockRemoteCacheListener listener = new MockRemoteCacheListener(); server.addCacheListener( regionName, listener ); // DO WORK int numPutsPrior = server.getPutCount(); - ICacheElement element = new CacheElement( regionName, "key", "value" ); + ICacheElement element = new CacheElement( regionName, "key", "value" ); cache.update( element ); SleepUtil.sleepAtLeast( 50 ); @@ -206,9 +206,9 @@ public class BasicRemoteCacheClientServe RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer() ); String regionName = "testPutAndListen"; - AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); + AuxiliaryCache cache = remoteCacheManager.getCache( regionName ); - MockRemoteCacheListener listener = new MockRemoteCacheListener(); + MockRemoteCacheListener listener = new MockRemoteCacheListener(); server.addCacheListener( regionName, listener ); // DO WORK @@ -216,7 +216,7 @@ public class BasicRemoteCacheClientServe int numToPut = 100; for ( int i = 0; i < numToPut; i++ ) { - ICacheElement element = new CacheElement( regionName, "key" + 1, "value" + i ); + ICacheElement element = new CacheElement( regionName, "key" + 1, "value" + i ); cache.update( element ); } SleepUtil.sleepAtLeast( 500 ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java Mon Jan 16 21:05:44 2012 @@ -246,7 +246,7 @@ public class RemoteCacheServerUnitTest for ( int i = 0; i < numToPut; i++ ) { - ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Long.valueOf( i ) ); + ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Long.valueOf( i ) ); inputItems.add( element ); server.update( element, 9999 ); } @@ -297,7 +297,7 @@ public class RemoteCacheServerUnitTest for ( int i = 0; i < numToPut; i++ ) { - ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Long.valueOf( i ) ); + ICacheElement element = new CacheElement( cacheName, String.valueOf( i ), Long.valueOf( i ) ); inputItems.add( element ); // update using the cluster listener id server.update( element, clusterListener.getListenerId() ); @@ -370,7 +370,7 @@ public class RemoteCacheServerUnitTest MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger(); server.setCacheEventLogger( cacheEventLogger ); - ICacheElement item = new CacheElement( "region", "key", "value" ); + ICacheElement item = new CacheElement( "region", "key", "value" ); // DO WORK server.update( item ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/auxiliary/remote/util/RemoteCacheRequestFactoryUnitTest.java Mon Jan 16 21:05:44 2012 @@ -6,7 +6,6 @@ import java.util.Set; import junit.framework.TestCase; -import org.apache.jcs.auxiliary.remote.util.RemoteCacheRequestFactory; import org.apache.jcs.auxiliary.remote.value.RemoteCacheRequest; import org.apache.jcs.engine.CacheElement; @@ -23,7 +22,8 @@ public class RemoteCacheRequestFactoryUn long requesterId = 2; // DO WORK - RemoteCacheRequest result = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId ); + RemoteCacheRequest result = + RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); @@ -40,8 +40,8 @@ public class RemoteCacheRequestFactoryUn long requesterId = 2; // DO WORK - RemoteCacheRequest result = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, - requesterId ); + RemoteCacheRequest result = + RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); @@ -54,12 +54,12 @@ public class RemoteCacheRequestFactoryUn { // SETUP String cacheName = "test"; - Set keys = Collections.EMPTY_SET; + Set keys = Collections.emptySet(); long requesterId = 2; // DO WORK - RemoteCacheRequest result = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, - requesterId ); + RemoteCacheRequest result = + RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); @@ -76,7 +76,7 @@ public class RemoteCacheRequestFactoryUn long requesterId = 2; // DO WORK - RemoteCacheRequest result = RemoteCacheRequestFactory + RemoteCacheRequest result = RemoteCacheRequestFactory .createRemoveRequest( cacheName, key, requesterId ); // VERIFY @@ -93,7 +93,8 @@ public class RemoteCacheRequestFactoryUn long requesterId = 2; // DO WORK - RemoteCacheRequest result = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); + RemoteCacheRequest result = + RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); @@ -109,10 +110,12 @@ public class RemoteCacheRequestFactoryUn Serializable key = "key"; long requesterId = 2; - CacheElement element = new CacheElement( cacheName, key, null ); + CacheElement element = + new CacheElement( cacheName, key, null ); // DO WORK - RemoteCacheRequest result = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId ); + RemoteCacheRequest result = + RemoteCacheRequestFactory.createUpdateRequest( element, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/EventQueueConcurrentLoadTest.java Mon Jan 16 21:05:44 2012 @@ -39,15 +39,15 @@ public class EventQueueConcurrentLoadTes extends TestCase { /** The queue implementation */ - private static CacheEventQueue queue = null; + private static CacheEventQueue queue = null; /** The mock listener */ - private static CacheListenerImpl listen = null; + private static CacheListenerImpl listen = null; /** max failure setting */ private final int maxFailure = 3; - /** time to wait before rtrying on failure. */ + /** time to wait before retrying on failure. */ private final int waitBeforeRetry = 100; /** very small idle time */ @@ -169,8 +169,8 @@ public class EventQueueConcurrentLoadTes @Override public void setUp() { - listen = new CacheListenerImpl(); - queue = new CacheEventQueue( listen, 1L, "testCache1", maxFailure, waitBeforeRetry ); + listen = new CacheListenerImpl(); + queue = new CacheEventQueue( listen, 1L, "testCache1", maxFailure, waitBeforeRetry ); queue.setWaitToDieMillis( idleTime ); } @@ -186,7 +186,7 @@ public class EventQueueConcurrentLoadTes { for ( int i = 0; i <= end; i++ ) { - CacheElement elem = new CacheElement( "testCache1", i + ":key", i + "data" ); + CacheElement elem = new CacheElement( "testCache1", i + ":key", i + "data" ); queue.addPutEvent( elem ); } @@ -252,7 +252,7 @@ public class EventQueueConcurrentLoadTes System.out.println( "queue is empty, begin" ); // get it going - CacheElement elem = new CacheElement( "testCache1", "a:key", "adata" ); + CacheElement elem = new CacheElement( "testCache1", "a:key", "adata" ); queue.addPutEvent( elem ); for ( int i = 0; i <= end; i++ ) @@ -268,7 +268,7 @@ public class EventQueueConcurrentLoadTes this.wait( idleTime / 2 ); } } - CacheElement elem2 = new CacheElement( "testCache1", i + ":key", i + "data" ); + CacheElement elem2 = new CacheElement( "testCache1", i + ":key", i + "data" ); queue.addPutEvent( elem2 ); } @@ -294,8 +294,8 @@ public class EventQueueConcurrentLoadTes /** * This is a dummy cache listener to use when testing the event queue. */ - private static class CacheListenerImpl - implements ICacheListener + protected static class CacheListenerImpl + implements ICacheListener { /** * putCount @@ -311,7 +311,7 @@ public class EventQueueConcurrentLoadTes * @param item * @throws IOException */ - public void handlePut( ICacheElement item ) + public void handlePut( ICacheElement item ) throws IOException { synchronized ( this ) @@ -325,7 +325,7 @@ public class EventQueueConcurrentLoadTes * @param key * @throws IOException */ - public void handleRemove( String cacheName, Serializable key ) + public void handleRemove( String cacheName, K key ) throws IOException { synchronized ( this ) Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/MockCacheServiceNonLocal.java Mon Jan 16 21:05:44 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/branches/generics-interface/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/ZombieCacheServiceNonLocalUnitTest.java Mon Jan 16 21:05:44 2012 @@ -45,7 +45,7 @@ public class ZombieCacheServiceNonLocalU 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 ); @@ -69,7 +69,7 @@ public class ZombieCacheServiceNonLocalU 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 ); Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java Mon Jan 16 21:05:44 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/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=1232163&r1=1232162&r2=1232163&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 Jan 16 21:05:44 2012 @@ -71,7 +71,7 @@ public class CompositeCacheUnitTest 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 ); } @@ -110,7 +110,7 @@ public class CompositeCacheUnitTest 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 ); } @@ -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,7 +161,7 @@ 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 ); } Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockElementSerializer.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockElementSerializer.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockElementSerializer.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/control/MockElementSerializer.java Mon Jan 16 21:05:44 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/branches/generics-interface/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/logging/MockCacheEventLogger.java Mon Jan 16 21:05:44 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 } /** Modified: commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java?rev=1232163&r1=1232162&r2=1232163&view=diff ============================================================================== --- commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java (original) +++ commons/proper/jcs/branches/generics-interface/src/test/org/apache/jcs/engine/match/KeyMatcherPatternImpllUnitTest.java Mon Jan 16 21:05:44 2012 @@ -16,7 +16,7 @@ public class KeyMatcherPatternImpllUnitT // SETUP int numToInsertPrefix1 = 10; int araySize = numToInsertPrefix1; - Object[] keyArray = new Object[araySize]; + String[] keyArray = new String[araySize]; String keyprefix1 = "MyPrefixC"; @@ -26,10 +26,10 @@ public class KeyMatcherPatternImpllUnitT keyArray[i] = 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() ); @@ -43,7 +43,7 @@ public class KeyMatcherPatternImpllUnitT // SETUP int numToInsertPrefix1 = 10; int araySize = numToInsertPrefix1 + 1; - Object[] keyArray = new Object[araySize]; + String[] keyArray = new String[araySize]; String keyprefix1 = "MyPrefixC"; @@ -53,10 +53,10 @@ public class KeyMatcherPatternImpllUnitT keyArray[i] = 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() ); @@ -71,7 +71,7 @@ public class KeyMatcherPatternImpllUnitT int numToInsertPrefix1 = 10; int numToInsertPrefix2 = 50; int araySize = numToInsertPrefix1 + numToInsertPrefix2; - Object[] keyArray = new Object[araySize]; + String[] keyArray = new String[araySize]; String keyprefix1 = "MyPrefixA"; String keyprefix2 = "MyPrefixB"; @@ -88,11 +88,11 @@ public class KeyMatcherPatternImpllUnitT keyArray[i] = 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() );