svn commit: r724518 [2/2] - in /jakarta/jcs/trunk/src: java/org/apache/jcs/auxiliary/lateral/ java/org/apache/jcs/auxiliary/remote/http/ java/org/apache/jcs/auxiliary/remote/http/behavior/ java/org/apache/jcs/auxiliary/remote/http/client/ java/org/apac...
[email protected] Mon, 08 Dec 2008 22:24:43 -0000
| Newsgroups | gmane.comp.jakarta.turbine.jcs.devel |
|---|---|
| Message-ID | <[email protected]> |
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientRequestFactoryUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientRequestFactoryUnitTest.java?rev=724518&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientRequestFactoryUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/client/RemoteHttpClientRequestFactoryUnitTest.java Mon Dec 8 14:24:42 2008
@@ -0,0 +1,121 @@
+package org.apache.jcs.auxiliary.remote.http.client;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.jcs.auxiliary.remote.http.behavior.IRemoteHttpCacheConstants;
+import org.apache.jcs.auxiliary.remote.http.value.RemoteHttpCacheRequest;
+import org.apache.jcs.engine.CacheElement;
+
+import junit.framework.TestCase;
+
+/** Unit tests for the request creator. */
+public class RemoteHttpClientRequestFactoryUnitTest
+ extends TestCase
+{
+ /** Simple test */
+ public void testCreateGetRequest_Normal()
+ {
+ // SETUP
+ String cacheName = "test";
+ Serializable key = "key";
+ long requesterId = 2;
+
+ // DO WORK
+ RemoteHttpCacheRequest result = RemoteHttpClientRequestFactory.createGetRequest( cacheName, key, requesterId );
+
+ // VERIFY
+ assertNotNull( "Should have a result", result );
+ assertEquals( "Wrong cacheName", cacheName, result.getCacheName() );
+ assertEquals( "Wrong type", IRemoteHttpCacheConstants.REQUEST_TYPE_GET, result.getRequestType() );
+ }
+
+ /** Simple test */
+ public void testCreateGetMatchingRequest_Normal()
+ {
+ // SETUP
+ String cacheName = "test";
+ String pattern = "pattern";
+ long requesterId = 2;
+
+ // DO WORK
+ RemoteHttpCacheRequest result = RemoteHttpClientRequestFactory.createGetMatchingRequest( cacheName, pattern, requesterId );
+
+ // VERIFY
+ assertNotNull( "Should have a result", result );
+ assertEquals( "Wrong cacheName", cacheName, result.getCacheName() );
+ assertEquals( "Wrong type", IRemoteHttpCacheConstants.REQUEST_TYPE_GET_MATCHING, result.getRequestType() );
+ }
+
+ /** Simple test */
+ public void testCreateGetMultipleRequest_Normal()
+ {
+ // SETUP
+ String cacheName = "test";
+ Set keys = Collections.EMPTY_SET;
+ long requesterId = 2;
+
+ // DO WORK
+ RemoteHttpCacheRequest result = RemoteHttpClientRequestFactory.createGetMultipleRequest( cacheName, keys, requesterId );
+
+ // VERIFY
+ assertNotNull( "Should have a result", result );
+ assertEquals( "Wrong cacheName", cacheName, result.getCacheName() );
+ assertEquals( "Wrong type", IRemoteHttpCacheConstants.REQUEST_TYPE_GET_MULTIPLE, result.getRequestType() );
+ }
+
+
+ /** Simple test */
+ public void testCreateRemoveRequest_Normal()
+ {
+ // SETUP
+ String cacheName = "test";
+ Serializable key = "key";
+ long requesterId = 2;
+
+ // DO WORK
+ RemoteHttpCacheRequest result = RemoteHttpClientRequestFactory.createRemoveRequest( cacheName, key, requesterId );
+
+ // VERIFY
+ assertNotNull( "Should have a result", result );
+ assertEquals( "Wrong cacheName", cacheName, result.getCacheName() );
+ assertEquals( "Wrong type", IRemoteHttpCacheConstants.REQUEST_TYPE_REMOVE, result.getRequestType() );
+ }
+
+
+ /** Simple test */
+ public void testCreateRemoveAllRequest_Normal()
+ {
+ // SETUP
+ String cacheName = "test";
+ long requesterId = 2;
+
+ // DO WORK
+ RemoteHttpCacheRequest result = RemoteHttpClientRequestFactory.createRemoveAllRequest( cacheName, requesterId );
+
+ // VERIFY
+ assertNotNull( "Should have a result", result );
+ assertEquals( "Wrong cacheName", cacheName, result.getCacheName() );
+ assertEquals( "Wrong type", IRemoteHttpCacheConstants.REQUEST_TYPE_REMOVE_ALL, result.getRequestType() );
+ }
+
+ /** Simple test */
+ public void testCreateUpdateRequest_Normal()
+ {
+ // SETUP
+ String cacheName = "test";
+ Serializable key = "key";
+ long requesterId = 2;
+
+ CacheElement element = new CacheElement( cacheName, key, null );
+
+ // DO WORK
+ RemoteHttpCacheRequest result = RemoteHttpClientRequestFactory.createUpdateRequest( element, requesterId );
+
+ // VERIFY
+ assertNotNull( "Should have a result", result );
+ assertEquals( "Wrong cacheName", cacheName, result.getCacheName() );
+ assertEquals( "Wrong type", IRemoteHttpCacheConstants.REQUEST_TYPE_UPDATE, result.getRequestType() );
+ }
+}
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java?rev=724518&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java Mon Dec 8 14:24:42 2008
@@ -0,0 +1,153 @@
+package org.apache.jcs.auxiliary.remote.http.server;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.jcs.auxiliary.remote.MockRemoteCacheService;
+import org.apache.jcs.auxiliary.remote.http.client.RemoteHttpClientRequestFactory;
+import org.apache.jcs.auxiliary.remote.http.value.RemoteHttpCacheRequest;
+import org.apache.jcs.auxiliary.remote.http.value.RemoteHttpCacheResponse;
+import org.apache.jcs.engine.CacheElement;
+
+/** Unit tests for the adaptor. */
+public class RemoteCacheServiceAdaptorUnitTest
+ extends TestCase
+{
+ /** Verify that the service is called. */
+ public void testProcessRequest_Get()
+ {
+ // SETUP
+ RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor();
+
+ MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService();
+ adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+ String cacheName = "test";
+ Serializable key = "key";
+ long requesterId = 2;
+ RemoteHttpCacheRequest request = RemoteHttpClientRequestFactory.createGetRequest( cacheName, key, requesterId );
+
+ // DO WORK
+ RemoteHttpCacheResponse result = adaptor.processRequest( request );
+
+ // VERIFY
+ assertNotNull( "Should have a result.", result );
+ assertEquals( "Wrong key.", key, remoteHttpCacheService.lastGetKey );
+ }
+
+ /** Verify that the service is called. */
+ public void testProcessRequest_GetMatching()
+ {
+ // SETUP
+ RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor();
+
+ MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService();
+ adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+ String cacheName = "test";
+ String pattern = "pattern";
+ long requesterId = 2;
+ RemoteHttpCacheRequest request = RemoteHttpClientRequestFactory.createGetMatchingRequest( cacheName, pattern,
+ requesterId );
+
+ // DO WORK
+ RemoteHttpCacheResponse result = adaptor.processRequest( request );
+
+ // VERIFY
+ assertNotNull( "Should have a result.", result );
+ assertEquals( "Wrong pattern.", pattern, remoteHttpCacheService.lastGetMatchingPattern );
+ }
+
+ /** Verify that the service is called. */
+ public void testProcessRequest_GetMultiple()
+ {
+ // SETUP
+ RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor();
+
+ MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService();
+ adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+ String cacheName = "test";
+ Set keys = Collections.EMPTY_SET;
+ long requesterId = 2;
+ RemoteHttpCacheRequest request = RemoteHttpClientRequestFactory.createGetMultipleRequest( cacheName, keys,
+ requesterId );
+
+ // DO WORK
+ RemoteHttpCacheResponse result = adaptor.processRequest( request );
+
+ // VERIFY
+ assertNotNull( "Should have a result.", result );
+ assertEquals( "Wrong keys.", keys, remoteHttpCacheService.lastGetMultipleKeys );
+
+ }
+
+ /** Verify that the service is called. */
+ public void testProcessRequest_Update()
+ {
+ // SETUP
+ RemoteCacheServiceAdaptor adaptor = new RemoteCacheServiceAdaptor();
+
+ MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService();
+ adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+ String cacheName = "test";
+ Serializable key = "key";
+ long requesterId = 2;
+ CacheElement element = new CacheElement( cacheName, key, null );
+ RemoteHttpCacheRequest request = RemoteHttpClientRequestFactory.createUpdateRequest( element, requesterId );
+
+ // DO WORK
+ RemoteHttpCacheResponse 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();
+
+ MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService();
+ adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+ String cacheName = "test";
+ Serializable key = "key";
+ long requesterId = 2;
+ RemoteHttpCacheRequest request = RemoteHttpClientRequestFactory.createRemoveRequest( cacheName, key, requesterId );
+
+ // DO WORK
+ RemoteHttpCacheResponse 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();
+
+ MockRemoteCacheService remoteHttpCacheService = new MockRemoteCacheService();
+ adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+ String cacheName = "testRemoveALl";
+ long requesterId = 2;
+ RemoteHttpCacheRequest request = RemoteHttpClientRequestFactory.createRemoveAllRequest( cacheName, requesterId );
+
+ // DO WORK
+ RemoteHttpCacheResponse result = adaptor.processRequest( request );
+
+ // VERIFY
+ assertNotNull( "Should have a result.", result );
+ assertEquals( "Wrong cacheName.", cacheName, remoteHttpCacheService.lastRemoveAllCacheName );
+ }
+}
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java?rev=724518&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java Mon Dec 8 14:24:42 2008
@@ -0,0 +1,158 @@
+package org.apache.jcs.auxiliary.remote.http.server;
+
+import java.io.Serializable;
+import java.util.HashSet;
+
+import junit.framework.TestCase;
+
+import org.apache.jcs.auxiliary.MockCacheEventLogger;
+import org.apache.jcs.engine.CacheElement;
+import org.apache.jcs.engine.control.MockCompositeCacheManager;
+
+/** Unit tests for the service. */
+public class RemoteHttpCacheServiceUnitTest
+ extends TestCase
+{
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testUpdate_simple()
+ throws Exception
+ {
+ // SETUP
+ MockCompositeCacheManager manager = new MockCompositeCacheManager();
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+ RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+ RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger );
+
+ String cacheName = "test";
+ Serializable key = "key";
+ long requesterId = 2;
+ CacheElement element = new CacheElement( cacheName, key, null );
+
+ // DO WORK
+ server.update( element, requesterId );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testGet_simple()
+ throws Exception
+ {
+ // SETUP
+ MockCompositeCacheManager manager = new MockCompositeCacheManager();
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+ RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+ RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger );
+
+ // DO WORK
+ server.get( "region", "key" );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testGetMatching_simple()
+ throws Exception
+ {
+ // SETUP
+ MockCompositeCacheManager manager = new MockCompositeCacheManager();
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+ RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+ RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger );
+
+ // DO WORK
+ server.getMatching( "region", "pattern", 0 );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testGetMultiple_simple()
+ throws Exception
+ {
+ // SETUP
+ MockCompositeCacheManager manager = new MockCompositeCacheManager();
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+ RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+ RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger );
+
+ // DO WORK
+ server.getMultiple( "region", new HashSet() );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testRemove_simple()
+ throws Exception
+ {
+ // SETUP
+ MockCompositeCacheManager manager = new MockCompositeCacheManager();
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+ RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+ RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger );
+
+ // DO WORK
+ server.remove( "region", "key" );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testRemoveAll_simple()
+ throws Exception
+ {
+ // SETUP
+ MockCompositeCacheManager manager = new MockCompositeCacheManager();
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+ RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+ RemoteHttpCacheService server = new RemoteHttpCacheService( manager, rcsa, cacheEventLogger );
+
+ // DO WORK
+ server.removeAll( "region" );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+}
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java?rev=724518&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java Mon Dec 8 14:24:42 2008
@@ -0,0 +1,97 @@
+package org.apache.jcs.auxiliary.remote.http.server;
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.jcs.auxiliary.AuxiliaryCacheConfigurator;
+import org.apache.jcs.auxiliary.remote.http.behavior.IRemoteHttpCacheConstants;
+import org.apache.jcs.engine.control.MockCompositeCacheManager;
+import org.apache.jcs.engine.logging.MockCacheEventLogger;
+
+/** Unit tests for the factory */
+public class RemoteHttpCacheSeviceFactoryUnitTest
+ extends TestCase
+{
+ /** verify that we get the CacheEventLogger value */
+ public void testCreateRemoteHttpCacheService_WithLogger()
+ {
+ // SETUP
+ MockCompositeCacheManager manager = new MockCompositeCacheManager();
+ String className = MockCacheEventLogger.class.getName();
+
+ Properties props = new Properties();
+ props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
+ + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
+
+ boolean allowClusterGet = false;
+ props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String
+ .valueOf( allowClusterGet ) );
+
+ manager.setConfigurationProperties( props );
+
+ // DO WORK
+ RemoteHttpCacheService result = RemoteHttpCacheSeviceFactory
+ .createRemoteHttpCacheService( manager );
+
+ // VERIFY
+ assertNotNull( "Should have a service.", result );
+ }
+
+ /** verify that we get the CacheEventLogger value */
+ public void testConfigureCacheEventLogger_Present()
+ {
+ // SETUP
+ String testPropertyValue = "This is the value";
+ String className = MockCacheEventLogger.class.getName();
+
+ Properties props = new Properties();
+ props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
+ + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
+ props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
+ + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX + AuxiliaryCacheConfigurator.ATTRIBUTE_PREFIX
+ + ".testProperty", testPropertyValue );
+
+ // DO WORK
+ MockCacheEventLogger result = (MockCacheEventLogger) RemoteHttpCacheSeviceFactory
+ .configureCacheEventLogger( props );
+
+ // VERIFY
+ assertNotNull( "Should have a logger.", result );
+ assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() );
+ }
+
+ /** verify that we get the allowClusterGet value */
+ public void testConfigureRemoteCacheServerAttributes_allowClusterGetPresent()
+ {
+ // SETUP
+ boolean allowClusterGet = false;
+ Properties props = new Properties();
+ props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String
+ .valueOf( allowClusterGet ) );
+
+ // DO WORK
+ RemoteHttpCacheServerAttributes result = RemoteHttpCacheSeviceFactory
+ .configureRemoteHttpCacheServerAttributes( props );
+
+ // VERIFY
+ assertEquals( "Wrong allowClusterGet", allowClusterGet, result.isAllowClusterGet() );
+ }
+
+ /** verify that we get the startRegistry value */
+ public void testConfigureRemoteCacheServerAttributes_localClusterConsistencyPresent()
+ {
+ // SETUP
+ boolean localClusterConsistency = false;
+ Properties props = new Properties();
+ props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".localClusterConsistency",
+ String.valueOf( localClusterConsistency ) );
+
+ // DO WORK
+ RemoteHttpCacheServerAttributes result = RemoteHttpCacheSeviceFactory
+ .configureRemoteHttpCacheServerAttributes( props );
+
+ // VERIFY
+ assertEquals( "Wrong localClusterConsistency", localClusterConsistency, result.isLocalClusterConsistency() );
+ }
+}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java?rev=724518&r1=724517&r2=724518&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java Mon Dec 8 14:24:42 2008
@@ -75,8 +75,8 @@
// VERIFY
assertEquals( "Wrong listener id.", 1, mockListener1.getListenerId() );
assertEquals( "Wrong listener id.", 2, mockListener2.getListenerId() );
- assertEquals( "Wrong ip.", expectedIp1, server.getIPAddressForRequesterId( 1 ) );
- assertEquals( "Wrong ip.", expectedIp2, server.getIPAddressForRequesterId( 2 ) );
+ assertEquals( "Wrong ip.", expectedIp1, server.getExtraInfoForRequesterId( 1 ) );
+ assertEquals( "Wrong ip.", expectedIp2, server.getExtraInfoForRequesterId( 2 ) );
}
/**
@@ -112,8 +112,8 @@
// VERIFY
assertEquals( "Wrong listener id.", 1, mockListener1.getListenerId() );
assertEquals( "Wrong listener id.", 2, mockListener2.getListenerId() );
- assertEquals( "Wrong ip.", expectedIp1, server.getIPAddressForRequesterId( 1 ) );
- assertEquals( "Wrong ip.", expectedIp2, server.getIPAddressForRequesterId( 2 ) );
+ assertEquals( "Wrong ip.", expectedIp1, server.getExtraInfoForRequesterId( 1 ) );
+ assertEquals( "Wrong ip.", expectedIp2, server.getExtraInfoForRequesterId( 2 ) );
}
/**
@@ -146,8 +146,8 @@
// VERIFY
assertEquals( "Wrong listener id.", 1, mockListener1.getListenerId() );
assertEquals( "Wrong listener id.", 2, mockListener2.getListenerId() );
- assertEquals( "Wrong ip.", expectedIp1, server.getIPAddressForRequesterId( 1 ) );
- assertEquals( "Wrong ip.", expectedIp2, server.getIPAddressForRequesterId( 2 ) );
+ assertEquals( "Wrong ip.", expectedIp1, server.getExtraInfoForRequesterId( 1 ) );
+ assertEquals( "Wrong ip.", expectedIp2, server.getExtraInfoForRequesterId( 2 ) );
}
/**
@@ -219,7 +219,7 @@
// DO WORK
server.removeCacheListener( cacheName, mockListener1.getListenerId() );
assertEquals( "Wrong number of listeners.", 1, server.getClusterListeners( cacheName ).eventQMap.size() );
- assertNull( "Should be no entry in the ip map.", server.getIPAddressForRequesterId( 1 ) );
+ assertNull( "Should be no entry in the ip map.", server.getExtraInfoForRequesterId( 1 ) );
}
/**
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java?rev=724518&r1=724517&r2=724518&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockCompositeCacheManager.java Mon Dec 8 14:24:42 2008
@@ -34,9 +34,9 @@
/** Properties with which this manager was configured. This is exposed for other managers. */
private Properties configurationProperties;
-
+
/**
- * @param cacheName
+ * @param cacheName
* @return Returns a CompositeCache
*/
public CompositeCache getCache( String cacheName )
@@ -66,7 +66,7 @@
{
return cache;
}
-
+
/**
* This is exposed so other manager can get access to the props.
* <p>
@@ -86,4 +86,10 @@
{
return configurationProperties;
}
+
+ /** @return Mock */
+ public String getStats()
+ {
+ return "Mock";
+ }
}