Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java?rev=1408056&r1=1408055&r2=1408056&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java Sun Nov 11 17:49:54 2012 @@ -24,8 +24,8 @@ import java.io.Serializable; import java.util.LinkedList; import java.util.List; -import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes; import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener; +import org.apache.jcs.auxiliary.remote.server.behavior.RemoteType; import org.apache.jcs.engine.behavior.ICacheElement; /** @@ -55,7 +55,7 @@ public class MockRemoteCacheListener<K e public int removeCount; /** The type of remote listener */ - public int remoteType = IRemoteCacheAttributes.LOCAL; + public RemoteType remoteType = RemoteType.LOCAL; /** * @throws IOException @@ -92,7 +92,7 @@ public class MockRemoteCacheListener<K e * @return remoteType * @throws IOException */ - public int getRemoteType() + public RemoteType getRemoteType() throws IOException { return remoteType;
Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java?rev=1408056&r1=1408055&r2=1408056&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java Sun Nov 11 17:49:54 2012 @@ -32,6 +32,7 @@ import org.apache.jcs.access.exception.C import org.apache.jcs.access.exception.ObjectExistsException; import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheConstants; import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener; +import org.apache.jcs.auxiliary.remote.server.behavior.RemoteType; import org.apache.jcs.engine.CacheElement; import org.apache.jcs.engine.behavior.ICacheElement; import org.apache.jcs.engine.behavior.ICacheObserver; @@ -66,10 +67,10 @@ public class RemoteCacheClientTester * @return The remoteType value * @throws IOException */ - public int getRemoteType() + public RemoteType getRemoteType() throws IOException { - return 0; + return RemoteType.LOCAL; } /** Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java?rev=1408056&r1=1408055&r2=1408056&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java Sun Nov 11 17:49:54 2012 @@ -21,7 +21,7 @@ package org.apache.jcs.auxiliary.remote. import junit.framework.TestCase; -import org.apache.jcs.auxiliary.remote.server.behavior.IRemoteCacheServerAttributes; +import org.apache.jcs.auxiliary.remote.server.behavior.RemoteType; /** * Tests for the remote cache server attributes. @@ -48,7 +48,7 @@ public class RemoteCacheServerAttributes { RemoteCacheServerAttributes attributes = new RemoteCacheServerAttributes(); attributes.setRemoteTypeName( "LOCAL" ); - assertEquals( "Wrong type.", IRemoteCacheServerAttributes.LOCAL, attributes.getRemoteType() ); + assertEquals( "Wrong type.", RemoteType.LOCAL, attributes.getRemoteType() ); assertEquals( "Wrong name", "LOCAL", attributes.getRemoteTypeName() ); } @@ -59,7 +59,7 @@ public class RemoteCacheServerAttributes { RemoteCacheServerAttributes attributes = new RemoteCacheServerAttributes(); attributes.setRemoteTypeName( "CLUSTER" ); - assertEquals( "Wrong type.", IRemoteCacheServerAttributes.CLUSTER, attributes.getRemoteType() ); + assertEquals( "Wrong type.", RemoteType.CLUSTER, attributes.getRemoteType() ); assertEquals( "Wrong name", "CLUSTER", attributes.getRemoteTypeName() ); } } Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java?rev=1408056&r1=1408055&r2=1408056&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactoryUnitTest.java Sun Nov 11 17:49:54 2012 @@ -17,165 +17,165 @@ public class RemoteCacheServerFactoryUni // SETUP String eventQueueType = "my.special.type"; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".EventQueueType", eventQueueType ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".EventQueueType", eventQueueType ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong EventQueueType", eventQueueType, result.getEventQueueType() ); } - + /** verify that we get the timeout value */ public void testConfigureRemoteCacheServerAttributes_eventQueuePoolName() { // SETUP String eventQueuePoolName = "specialName"; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".EventQueuePoolName", eventQueuePoolName ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".EventQueuePoolName", eventQueuePoolName ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong eventQueuePoolName", eventQueuePoolName, result.getEventQueuePoolName() ); } - + /** verify that we get the timeout value */ public void testConfigureRemoteCacheServerAttributes_timeoutPresent() { // SETUP int timeout = 123245; Properties props = new Properties(); - props.put( IRemoteCacheConstants.SOCKET_TIMEOUT_MILLIS, String.valueOf( timeout ) ); - + props.put( IRemoteCacheConstants.SOCKET_TIMEOUT_MILLIS, String.valueOf( timeout ) ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong timeout", timeout, result.getRmiSocketFactoryTimeoutMillis() ); - } - + } + /** verify that we get the timeout value */ public void testConfigureRemoteCacheServerAttributes_timeoutNotPresent() { // SETUP - Properties props = new Properties(); - + Properties props = new Properties(); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY - assertEquals( "Wrong timeout", RemoteCacheServerAttributes.DEFAULT_RMI_SOCKET_FACTORY_TIMEOUT_MS, result.getRmiSocketFactoryTimeoutMillis() ); + assertEquals( "Wrong timeout", RemoteCacheServerAttributes.DEFAULT_RMI_SOCKET_FACTORY_TIMEOUT_MILLIS, result.getRmiSocketFactoryTimeoutMillis() ); } - + /** verify that we get the registryKeepAliveDelayMillis value */ public void testConfigureRemoteCacheServerAttributes_registryKeepAliveDelayMillisPresent() { // SETUP int registryKeepAliveDelayMillis = 123245; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".registryKeepAliveDelayMillis", String.valueOf( registryKeepAliveDelayMillis ) ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".registryKeepAliveDelayMillis", String.valueOf( registryKeepAliveDelayMillis ) ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong registryKeepAliveDelayMillis", registryKeepAliveDelayMillis, result.getRegistryKeepAliveDelayMillis() ); } - + /** verify that we get the useRegistryKeepAlive value */ public void testConfigureRemoteCacheServerAttributes_useRegistryKeepAlivePresent() { // SETUP boolean useRegistryKeepAlive = false; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".useRegistryKeepAlive", String.valueOf( useRegistryKeepAlive ) ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".useRegistryKeepAlive", String.valueOf( useRegistryKeepAlive ) ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong useRegistryKeepAlive", useRegistryKeepAlive, result.isUseRegistryKeepAlive() ); } - + /** verify that we get the startRegistry value */ public void testConfigureRemoteCacheServerAttributes_startRegistryPresent() { // SETUP boolean startRegistry = false; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".startRegistry", String.valueOf( startRegistry ) ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".startRegistry", String.valueOf( startRegistry ) ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong startRegistry", startRegistry, result.isStartRegistry() ); } - + /** verify that we get the registryKeepAliveDelayMillis value */ public void testConfigureRemoteCacheServerAttributes_rmiSocketFactoryTimeoutMillisPresent() { // SETUP int rmiSocketFactoryTimeoutMillis = 123245; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".rmiSocketFactoryTimeoutMillis", String.valueOf( rmiSocketFactoryTimeoutMillis ) ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".rmiSocketFactoryTimeoutMillis", String.valueOf( rmiSocketFactoryTimeoutMillis ) ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong rmiSocketFactoryTimeoutMillis", rmiSocketFactoryTimeoutMillis, result.getRmiSocketFactoryTimeoutMillis() ); } - + /** verify that we get the startRegistry value */ public void testConfigureRemoteCacheServerAttributes_allowClusterGetPresent() { // SETUP boolean allowClusterGet = false; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String.valueOf( allowClusterGet ) ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String.valueOf( allowClusterGet ) ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( 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( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".localClusterConsistency", String.valueOf( localClusterConsistency ) ); - + props.put( IRemoteCacheConstants.CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".localClusterConsistency", String.valueOf( localClusterConsistency ) ); + // DO WORK RemoteCacheServerAttributes result = RemoteCacheServerFactory.configureRemoteCacheServerAttributes( props ); - + // VERIFY assertEquals( "Wrong localClusterConsistency", localClusterConsistency, result.isLocalClusterConsistency() ); } - + /** verify that we get the timeout value */ public void testConfigureObjectSpecificCustomFactory_withProperty() { // SETUP String testValue = "123245"; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, MockRMISocketFactory.class.getName() ); - props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".testStringProperty", testValue ); - + props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, MockRMISocketFactory.class.getName() ); + props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".testStringProperty", testValue ); + // DO WORK RMISocketFactory result = RemoteCacheServerFactory.configureObjectSpecificCustomFactory( props ); - + // VERIFY assertNotNull( "Should have a custom socket factory.", result ); assertEquals( "Wrong testValue", testValue, ((MockRMISocketFactory)result).getTestStringProperty() ); } - + /** verify that we get the timeout value */ public void testConfigureObjectSpecificCustomFactory_withProperty_TimeoutConfigurableRMIScoketFactory() { @@ -183,13 +183,13 @@ public class RemoteCacheServerFactoryUni int readTimeout = 1234; int openTimeout = 1234; Properties props = new Properties(); - props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, TimeoutConfigurableRMIScoketFactory.class.getName() ); - props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".readTimeout", String.valueOf( readTimeout ) ); - props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".openTimeout", String.valueOf( openTimeout ) ); - + props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, TimeoutConfigurableRMIScoketFactory.class.getName() ); + props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".readTimeout", String.valueOf( readTimeout ) ); + props.put( IRemoteCacheConstants.CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX + ".openTimeout", String.valueOf( openTimeout ) ); + // DO WORK RMISocketFactory result = RemoteCacheServerFactory.configureObjectSpecificCustomFactory( props ); - + // VERIFY assertNotNull( "Should have a custom socket factory.", result ); assertEquals( "Wrong readTimeout", readTimeout, ((TimeoutConfigurableRMIScoketFactory)result).getReadTimeout() ); Modified: commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java?rev=1408056&r1=1408055&r2=1408056&view=diff ============================================================================== --- commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java (original) +++ commons/proper/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java Sun Nov 11 17:49:54 2012 @@ -27,8 +27,8 @@ import junit.framework.TestCase; import org.apache.jcs.auxiliary.MockCacheEventLogger; import org.apache.jcs.auxiliary.remote.MockRemoteCacheListener; -import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes; import org.apache.jcs.auxiliary.remote.server.behavior.IRemoteCacheServerAttributes; +import org.apache.jcs.auxiliary.remote.server.behavior.RemoteType; import org.apache.jcs.engine.CacheElement; import org.apache.jcs.engine.behavior.ICacheElement; import org.apache.jcs.utils.timing.SleepUtil; @@ -60,10 +60,10 @@ public class RemoteCacheServerUnitTest RemoteCacheServer<String, String> server = new RemoteCacheServer<String, String>( rcsa ); MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>(); - mockListener1.remoteType = IRemoteCacheAttributes.LOCAL; + mockListener1.remoteType = RemoteType.LOCAL; mockListener1.localAddress = expectedIp1; MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>(); - mockListener1.remoteType = IRemoteCacheAttributes.LOCAL; + mockListener1.remoteType = RemoteType.LOCAL; mockListener2.localAddress = expectedIp2; String cacheName = "testAddListener"; @@ -97,10 +97,10 @@ public class RemoteCacheServerUnitTest RemoteCacheServer<String, String> server = new RemoteCacheServer<String, String>( rcsa ); MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>(); - mockListener1.remoteType = IRemoteCacheAttributes.CLUSTER; + mockListener1.remoteType = RemoteType.CLUSTER; mockListener1.localAddress = expectedIp1; MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>(); - mockListener1.remoteType = IRemoteCacheAttributes.CLUSTER; + mockListener1.remoteType = RemoteType.CLUSTER; mockListener2.localAddress = expectedIp2; String cacheName = "testAddListener"; @@ -200,9 +200,9 @@ public class RemoteCacheServerUnitTest RemoteCacheServer<String, String> server = new RemoteCacheServer<String, String>( rcsa ); MockRemoteCacheListener<String, String> mockListener1 = new MockRemoteCacheListener<String, String>(); - mockListener1.remoteType = IRemoteCacheServerAttributes.CLUSTER; + mockListener1.remoteType = RemoteType.CLUSTER; MockRemoteCacheListener<String, String> mockListener2 = new MockRemoteCacheListener<String, String>(); - mockListener2.remoteType = IRemoteCacheServerAttributes.CLUSTER; + mockListener2.remoteType = RemoteType.CLUSTER; String cacheName = "testAddListenerToAllThenRemove"; @@ -281,11 +281,11 @@ public class RemoteCacheServerUnitTest // this is to get the listener id for inserts. MockRemoteCacheListener<String, Long> clusterListener = new MockRemoteCacheListener<String, Long>(); - clusterListener.remoteType = IRemoteCacheAttributes.CLUSTER; + clusterListener.remoteType = RemoteType.CLUSTER; // this should get the updates MockRemoteCacheListener<String, Long> localListener = new MockRemoteCacheListener<String, Long>(); - localListener.remoteType = IRemoteCacheAttributes.LOCAL; + localListener.remoteType = RemoteType.LOCAL; String cacheName = "testSimpleRegisterListenerAndPut_FromClusterWithLCC"; server.addCacheListener( cacheName, clusterListener );
