commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1570993 [19/24] - in /commons/proper/jcs/trunk/src: assembly/ changes/ conf/ java/org/apache/commons/jcs/access/ java/org/apache/commons/jcs/access/exception/ java/org/apache/commons/jcs/admin/ java/org/apache/commons/jcs/auxiliary/ java/o...
Date Sun, 23 Feb 2014 10:37:52 GMT
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListenerUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,266 +1,285 @@
-package org.apache.commons.jcs.auxiliary.lateral.socket.tcp;
-
-import java.util.ArrayList;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.lateral.LateralCache;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCacheAttributes;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCacheNoWait;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
-import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
-import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.engine.control.CompositeCacheManager;
-import org.apache.commons.jcs.engine.logging.MockCacheEventLogger;
-import org.apache.commons.jcs.utils.discovery.DiscoveredService;
-import org.apache.commons.jcs.utils.serialization.StandardSerializer;
-
-/** Test for the listener that observers UDP discovery events. */
-public class LateralTCPDiscoveryListenerUnitTest
-    extends TestCase
-{
-    /** the listener */
-    private LateralTCPDiscoveryListener listener;
-
-    /** The cache manager. */
-    private ICompositeCacheManager cacheMgr;
-
-    /** The event logger. */
-    protected MockCacheEventLogger cacheEventLogger;
-
-    /** The serializer. */
-    protected IElementSerializer elementSerializer;
-
-    /** Create the listener for testing */
-    @Override
-    protected void setUp() throws Exception
-    {
-        cacheMgr = CompositeCacheManager.getInstance();
-        cacheEventLogger = new MockCacheEventLogger();
-        elementSerializer = new StandardSerializer();
-
-        listener = new LateralTCPDiscoveryListener( cacheMgr, cacheEventLogger, elementSerializer );
-    }
-
-    /**
-     * Add a no wait facade.
-     */
-    public void testAddNoWaitFacade_NotInList()
-    {
-        // SETUP
-        String cacheName = "testAddNoWaitFacade_NotInList";
-
-        @SuppressWarnings("unchecked")
-        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
-
-        // DO WORK
-        listener.addNoWaitFacade( cacheName, facade );
-
-        // VERIFY
-        assertTrue( "Should have the facade.", listener.containsNoWaitFacade( cacheName ) );
-    }
-
-    /**
-     * Add a no wait to a known facade.
-     */
-    public void testAddNoWait_FacadeInList()
-    {
-        // SETUP
-        String cacheName = "testAddNoWaitFacade_FacadeInList";
-
-        @SuppressWarnings("unchecked")
-        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
-        listener.addNoWaitFacade( cacheName, facade );
-
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
-
-        // DO WORK
-        boolean result = listener.addNoWait( noWait );
-
-        // VERIFY
-        assertTrue( "Should have added the no wait.", result );
-    }
-
-    /**
-     * Add a no wait from an unknown facade.
-     */
-    public void testAddNoWait_FacadeNotInList()
-    {
-        // SETUP
-        String cacheName = "testAddNoWaitFacade_FacadeInList";
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
-
-        // DO WORK
-        boolean result = listener.addNoWait( noWait );
-
-        // VERIFY
-        assertFalse( "Should not have added the no wait.", result );
-    }
-
-    /**
-     * Remove a no wait from an unknown facade.
-     */
-    public void testRemoveNoWait_FacadeNotInList()
-    {
-        // SETUP
-        String cacheName = "testRemoveNoWaitFacade_FacadeNotInList";
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
-
-        // DO WORK
-        boolean result = listener.removeNoWait( noWait );
-
-        // VERIFY
-        assertFalse( "Should not have removed the no wait.", result );
-    }
-
-    /**
-     * Remove a no wait from a known facade.
-     */
-    public void testRemoveNoWait_FacadeInList_NoWaitNot()
-    {
-        // SETUP
-        String cacheName = "testAddNoWaitFacade_FacadeInList";
-
-        @SuppressWarnings("unchecked")
-        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
-        listener.addNoWaitFacade( cacheName, facade );
-
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
-
-        // DO WORK
-        boolean result = listener.removeNoWait( noWait );
-
-        // VERIFY
-        assertFalse( "Should not have removed the no wait.", result );
-    }
-
-    /**
-     * Remove a no wait from a known facade.
-     */
-    public void testRemoveNoWait_FacadeInList_NoWaitIs()
-    {
-        // SETUP
-        String cacheName = "testRemoveNoWaitFacade_FacadeInListNoWaitIs";
-
-        @SuppressWarnings("unchecked")
-        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
-        listener.addNoWaitFacade( cacheName, facade );
-
-        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
-        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
-        listener.addNoWait( noWait );
-
-        // DO WORK
-        boolean result = listener.removeNoWait( noWait );
-
-        // VERIFY
-        assertTrue( "Should have removed the no wait.", result );
-    }
-
-    /**
-     * Add a no wait to a known facade.
-     */
-    public void testAddDiscoveredService_FacadeInList_NoWaitNot()
-    {
-        // SETUP
-        String cacheName = "testAddDiscoveredService_FacadeInList_NoWaitNot";
-
-        ArrayList<String> cacheNames = new ArrayList<String>();
-        cacheNames.add( cacheName );
-
-        DiscoveredService service = new DiscoveredService();
-        service.setCacheNames( cacheNames );
-        service.setServiceAddress( "localhost" );
-        service.setServicePort( 9999 );
-
-        // since the no waits are compared by object equality, I have to do this
-        // TODO add an equals method to the noWait.  the problem if is figuring out what to compare.
-        ITCPLateralCacheAttributes lca = new TCPLateralCacheAttributes();
-        lca.setTransmissionType( LateralCacheAttributes.TCP );
-        lca.setTcpServer( service.getServiceAddress() + ":" + service.getServicePort() );
-        LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lca, cacheMgr, cacheEventLogger,
-                                                                         elementSerializer );
-        LateralCacheNoWait<String, String> noWait = lcm.getCache( cacheName );
-
-        @SuppressWarnings("unchecked")
-        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
-        listener.addNoWaitFacade( cacheName, facade );
-
-        // DO WORK
-        listener.addDiscoveredService( service );
-
-        // VERIFY
-        assertTrue( "Should have no wait.", listener.containsNoWait( cacheName, noWait ) );
-    }
-
-    /**
-     * Remove a no wait from a known facade.
-     */
-    public void testRemoveDiscoveredService_FacadeInList_NoWaitIs()
-    {
-        // SETUP
-        String cacheName = "testRemoveDiscoveredService_FacadeInList_NoWaitIs";
-
-        ArrayList<String> cacheNames = new ArrayList<String>();
-        cacheNames.add( cacheName );
-
-        DiscoveredService service = new DiscoveredService();
-        service.setCacheNames( cacheNames );
-        service.setServiceAddress( "localhost" );
-        service.setServicePort( 9999 );
-
-        // since the no waits are compared by object equality, I have to do this
-        // TODO add an equals method to the noWait.  the problem if is figuring out what to compare.
-        ITCPLateralCacheAttributes lca = new TCPLateralCacheAttributes();
-        lca.setTransmissionType( LateralCacheAttributes.TCP );
-        lca.setTcpServer( service.getServiceAddress() + ":" + service.getServicePort() );
-        LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lca, cacheMgr, cacheEventLogger,
-                                                                         elementSerializer );
-        LateralCacheNoWait<String, String> noWait = lcm.getCache( cacheName );
-
-        @SuppressWarnings("unchecked")
-        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
-        ILateralCacheAttributes cattr = new LateralCacheAttributes();
-        cattr.setCacheName( cacheName );
-        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
-        listener.addNoWaitFacade( cacheName, facade );
-        listener.addDiscoveredService( service );
-
-        // DO WORK
-        listener.removeDiscoveredService( service );
-
-        // VERIFY
-        assertFalse( "Should not have no wait.", listener.containsNoWait( cacheName, noWait ) );
-    }
-}
+package org.apache.commons.jcs.auxiliary.lateral.socket.tcp;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.lateral.LateralCache;
+import org.apache.commons.jcs.auxiliary.lateral.LateralCacheAttributes;
+import org.apache.commons.jcs.auxiliary.lateral.LateralCacheNoWait;
+import org.apache.commons.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
+import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
+import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
+import org.apache.commons.jcs.engine.control.CompositeCacheManager;
+import org.apache.commons.jcs.engine.logging.MockCacheEventLogger;
+import org.apache.commons.jcs.utils.discovery.DiscoveredService;
+import org.apache.commons.jcs.utils.serialization.StandardSerializer;
+
+/** Test for the listener that observers UDP discovery events. */
+public class LateralTCPDiscoveryListenerUnitTest
+    extends TestCase
+{
+    /** the listener */
+    private LateralTCPDiscoveryListener listener;
+
+    /** The cache manager. */
+    private ICompositeCacheManager cacheMgr;
+
+    /** The event logger. */
+    protected MockCacheEventLogger cacheEventLogger;
+
+    /** The serializer. */
+    protected IElementSerializer elementSerializer;
+
+    /** Create the listener for testing */
+    @Override
+    protected void setUp() throws Exception
+    {
+        cacheMgr = CompositeCacheManager.getInstance();
+        cacheEventLogger = new MockCacheEventLogger();
+        elementSerializer = new StandardSerializer();
+
+        listener = new LateralTCPDiscoveryListener( cacheMgr, cacheEventLogger, elementSerializer );
+    }
+
+    /**
+     * Add a no wait facade.
+     */
+    public void testAddNoWaitFacade_NotInList()
+    {
+        // SETUP
+        String cacheName = "testAddNoWaitFacade_NotInList";
+
+        @SuppressWarnings("unchecked")
+        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+
+        // DO WORK
+        listener.addNoWaitFacade( cacheName, facade );
+
+        // VERIFY
+        assertTrue( "Should have the facade.", listener.containsNoWaitFacade( cacheName ) );
+    }
+
+    /**
+     * Add a no wait to a known facade.
+     */
+    public void testAddNoWait_FacadeInList()
+    {
+        // SETUP
+        String cacheName = "testAddNoWaitFacade_FacadeInList";
+
+        @SuppressWarnings("unchecked")
+        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        listener.addNoWaitFacade( cacheName, facade );
+
+        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+
+        // DO WORK
+        boolean result = listener.addNoWait( noWait );
+
+        // VERIFY
+        assertTrue( "Should have added the no wait.", result );
+    }
+
+    /**
+     * Add a no wait from an unknown facade.
+     */
+    public void testAddNoWait_FacadeNotInList()
+    {
+        // SETUP
+        String cacheName = "testAddNoWaitFacade_FacadeInList";
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+
+        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+
+        // DO WORK
+        boolean result = listener.addNoWait( noWait );
+
+        // VERIFY
+        assertFalse( "Should not have added the no wait.", result );
+    }
+
+    /**
+     * Remove a no wait from an unknown facade.
+     */
+    public void testRemoveNoWait_FacadeNotInList()
+    {
+        // SETUP
+        String cacheName = "testRemoveNoWaitFacade_FacadeNotInList";
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+
+        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+
+        // DO WORK
+        boolean result = listener.removeNoWait( noWait );
+
+        // VERIFY
+        assertFalse( "Should not have removed the no wait.", result );
+    }
+
+    /**
+     * Remove a no wait from a known facade.
+     */
+    public void testRemoveNoWait_FacadeInList_NoWaitNot()
+    {
+        // SETUP
+        String cacheName = "testAddNoWaitFacade_FacadeInList";
+
+        @SuppressWarnings("unchecked")
+        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        listener.addNoWaitFacade( cacheName, facade );
+
+        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+
+        // DO WORK
+        boolean result = listener.removeNoWait( noWait );
+
+        // VERIFY
+        assertFalse( "Should not have removed the no wait.", result );
+    }
+
+    /**
+     * Remove a no wait from a known facade.
+     */
+    public void testRemoveNoWait_FacadeInList_NoWaitIs()
+    {
+        // SETUP
+        String cacheName = "testRemoveNoWaitFacade_FacadeInListNoWaitIs";
+
+        @SuppressWarnings("unchecked")
+        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        listener.addNoWaitFacade( cacheName, facade );
+
+        LateralCache<String, String> cache = new LateralCache<String, String>( cattr );
+        LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache );
+        listener.addNoWait( noWait );
+
+        // DO WORK
+        boolean result = listener.removeNoWait( noWait );
+
+        // VERIFY
+        assertTrue( "Should have removed the no wait.", result );
+    }
+
+    /**
+     * Add a no wait to a known facade.
+     */
+    public void testAddDiscoveredService_FacadeInList_NoWaitNot()
+    {
+        // SETUP
+        String cacheName = "testAddDiscoveredService_FacadeInList_NoWaitNot";
+
+        ArrayList<String> cacheNames = new ArrayList<String>();
+        cacheNames.add( cacheName );
+
+        DiscoveredService service = new DiscoveredService();
+        service.setCacheNames( cacheNames );
+        service.setServiceAddress( "localhost" );
+        service.setServicePort( 9999 );
+
+        // since the no waits are compared by object equality, I have to do this
+        // TODO add an equals method to the noWait.  the problem if is figuring out what to compare.
+        ITCPLateralCacheAttributes lca = new TCPLateralCacheAttributes();
+        lca.setTransmissionType( LateralCacheAttributes.TCP );
+        lca.setTcpServer( service.getServiceAddress() + ":" + service.getServicePort() );
+        LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lca, cacheMgr, cacheEventLogger,
+                                                                         elementSerializer );
+        LateralCacheNoWait<String, String> noWait = lcm.getCache( cacheName );
+
+        @SuppressWarnings("unchecked")
+        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        listener.addNoWaitFacade( cacheName, facade );
+
+        // DO WORK
+        listener.addDiscoveredService( service );
+
+        // VERIFY
+        assertTrue( "Should have no wait.", listener.containsNoWait( cacheName, noWait ) );
+    }
+
+    /**
+     * Remove a no wait from a known facade.
+     */
+    public void testRemoveDiscoveredService_FacadeInList_NoWaitIs()
+    {
+        // SETUP
+        String cacheName = "testRemoveDiscoveredService_FacadeInList_NoWaitIs";
+
+        ArrayList<String> cacheNames = new ArrayList<String>();
+        cacheNames.add( cacheName );
+
+        DiscoveredService service = new DiscoveredService();
+        service.setCacheNames( cacheNames );
+        service.setServiceAddress( "localhost" );
+        service.setServicePort( 9999 );
+
+        // since the no waits are compared by object equality, I have to do this
+        // TODO add an equals method to the noWait.  the problem if is figuring out what to compare.
+        ITCPLateralCacheAttributes lca = new TCPLateralCacheAttributes();
+        lca.setTransmissionType( LateralCacheAttributes.TCP );
+        lca.setTcpServer( service.getServiceAddress() + ":" + service.getServicePort() );
+        LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance( lca, cacheMgr, cacheEventLogger,
+                                                                         elementSerializer );
+        LateralCacheNoWait<String, String> noWait = lcm.getCache( cacheName );
+
+        @SuppressWarnings("unchecked")
+        LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0];
+        ILateralCacheAttributes cattr = new LateralCacheAttributes();
+        cattr.setCacheName( cacheName );
+        LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr );
+        listener.addNoWaitFacade( cacheName, facade );
+        listener.addDiscoveredService( service );
+
+        // DO WORK
+        listener.removeDiscoveredService( service );
+
+        // VERIFY
+        assertFalse( "Should not have no wait.", listener.containsNoWait( cacheName, noWait ) );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPIssueRemoveOnPutUnitTest.java Sun Feb 23 10:37:48 2014
@@ -223,4 +223,4 @@ public class LateralTCPIssueRemoveOnPutU
             System.out.println( s );
         }
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheClient.java Sun Feb 23 10:37:48 2014
@@ -1,263 +1,263 @@
-package org.apache.commons.jcs.auxiliary.remote;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCache;
-import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
-import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
-import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
-import org.apache.commons.jcs.engine.CacheStatus;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
-import org.apache.commons.jcs.engine.stats.behavior.IStats;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Used for testing the no wait.
- * <p>
- * @author Aaron Smuts
- */
-public class MockRemoteCacheClient<K extends Serializable, V extends Serializable>
-    extends AbstractAuxiliaryCache<K, V>
-    implements IRemoteCacheClient<K, V>
-{
-    /** For serialization. Don't change. */
-    private static final long serialVersionUID = 1L;
-
-    /** log instance */
-    private final static Log log = LogFactory.getLog( MockRemoteCacheClient.class );
-
-    /** List of ICacheElement<K, V> objects passed into update. */
-    public List<ICacheElement<K, V>> updateList = new LinkedList<ICacheElement<K,V>>();
-
-    /** List of key objects passed into remove. */
-    public List<K> removeList = new LinkedList<K>();
-
-    /** status to return. */
-    public CacheStatus status = CacheStatus.ALIVE;
-
-    /** Can setup values to return from get. values must be ICacheElement<K, V> */
-    public Map<K, ICacheElement<K, V>> getSetupMap = new HashMap<K, ICacheElement<K,V>>();
-
-    /** Can setup values to return from get. values must be Map<K, ICacheElement<K, V>> */
-    public Map<Set<K>, Map<K, ICacheElement<K, V>>> getMultipleSetupMap =
-        new HashMap<Set<K>, Map<K,ICacheElement<K,V>>>();
-
-    /** The last service passed to fixCache */
-    public ICacheServiceNonLocal<K, V> fixed;
-
-    /** Attributes. */
-    public RemoteCacheAttributes attributes = new RemoteCacheAttributes();
-
-    /**
-     * Stores the last argument as fixed.
-     * <p>
-     * (non-Javadoc)
-     * @see org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheClient#fixCache(org.apache.commons.jcs.auxiliary.remote.behavior.ICacheServiceNonLocal)
-     */
-    @SuppressWarnings("unchecked") // Don't know how to do this properly
-    public void fixCache( ICacheServiceNonLocal<?, ?> remote )
-    {
-        fixed = (ICacheServiceNonLocal<K, V>)remote;
-    }
-
-    /**
-     * @return long
-     */
-    public long getListenerId()
-    {
-        return 0;
-    }
-
-    /**
-     * @return null
-     */
-    public IRemoteCacheListener<K, V> getListener()
-    {
-        return null;
-    }
-
-    /**
-     * Adds the argument to the updatedList.
-     * <p>
-     * (non-Javadoc)
-     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#update(org.apache.commons.jcs.engine.behavior.ICacheElement)
-     */
-    public void update( ICacheElement<K, V> ce )
-    {
-        updateList.add( ce );
-    }
-
-    /**
-     * Looks in the getSetupMap for a value.
-     * <p>
-     * (non-Javadoc)
-     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#get(java.io.Serializable)
-     */
-    public ICacheElement<K, V> get( K key )
-    {
-        log.info( "get [" + key + "]" );
-        return getSetupMap.get( key );
-    }
-
-    /**
-     * Gets multiple items from the cache based on the given set of keys.
-     * <p>
-     * @param keys
-     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
-     *         data in cache for any of these keys
-     */
-    public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
-    {
-        log.info( "get [" + keys + "]" );
-        return getMultipleSetupMap.get( keys );
-    }
-
-    /**
-     * Adds the key to the remove list.
-     * <p>
-     * (non-Javadoc)
-     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#remove(java.io.Serializable)
-     */
-    public boolean remove( K key )
-    {
-        removeList.add( key );
-        return false;
-    }
-
-    /**
-     * Removes all cached items from the cache.
-     */
-    public void removeAll()
-    {
-        // do nothing
-    }
-
-    /**
-     * Prepares for shutdown.
-     */
-    public void dispose()
-    {
-        // do nothing
-    }
-
-    /**
-     * Returns the current cache size in number of elements.
-     * <p>
-     * @return number of elements
-     */
-    public int getSize()
-    {
-        return 0;
-    }
-
-    /**
-     * Returns the status setup variable. (non-Javadoc)
-     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getStatus()
-     */
-    public CacheStatus getStatus()
-    {
-        return status;
-    }
-
-    /**
-     * Returns the cache name.
-     * <p>
-     * @return usually the region name.
-     */
-    public String getCacheName()
-    {
-        return null;
-    }
-
-    /**
-     * @return null
-     */
-    public Set<K> getKeySet( )
-    {
-        return null;
-    }
-
-    /**
-     * @return null
-     */
-    public IStats getStatistics()
-    {
-        return null;
-    }
-
-    /**
-     * Returns the setup attributes. By default they are not null.
-     * <p>
-     * (non-Javadoc)
-     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getAuxiliaryCacheAttributes()
-     */
-    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
-    {
-        return attributes;
-    }
-
-    /**
-     * Returns the cache stats.
-     * <p>
-     * @return String of important historical information.
-     */
-    public String getStats()
-    {
-        return null;
-    }
-
-    /** @return 0 */
-    public CacheType getCacheType()
-    {
-        return CacheType.REMOTE_CACHE;
-    }
-
-    /**
-     * @param pattern
-     * @return Map
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMatching(String pattern)
-        throws IOException
-    {
-        return new HashMap<K, ICacheElement<K,V>>();
-    }
-
-    /**
-     * Nothing important
-     * <p>
-     * @return null
-     */
-    @Override
-    public String getEventLoggingExtraInfo()
-    {
-        return null;
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCache;
+import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
+import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
+import org.apache.commons.jcs.engine.CacheStatus;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
+import org.apache.commons.jcs.engine.stats.behavior.IStats;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Used for testing the no wait.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class MockRemoteCacheClient<K extends Serializable, V extends Serializable>
+    extends AbstractAuxiliaryCache<K, V>
+    implements IRemoteCacheClient<K, V>
+{
+    /** For serialization. Don't change. */
+    private static final long serialVersionUID = 1L;
+
+    /** log instance */
+    private final static Log log = LogFactory.getLog( MockRemoteCacheClient.class );
+
+    /** List of ICacheElement<K, V> objects passed into update. */
+    public List<ICacheElement<K, V>> updateList = new LinkedList<ICacheElement<K,V>>();
+
+    /** List of key objects passed into remove. */
+    public List<K> removeList = new LinkedList<K>();
+
+    /** status to return. */
+    public CacheStatus status = CacheStatus.ALIVE;
+
+    /** Can setup values to return from get. values must be ICacheElement<K, V> */
+    public Map<K, ICacheElement<K, V>> getSetupMap = new HashMap<K, ICacheElement<K,V>>();
+
+    /** Can setup values to return from get. values must be Map<K, ICacheElement<K, V>> */
+    public Map<Set<K>, Map<K, ICacheElement<K, V>>> getMultipleSetupMap =
+        new HashMap<Set<K>, Map<K,ICacheElement<K,V>>>();
+
+    /** The last service passed to fixCache */
+    public ICacheServiceNonLocal<K, V> fixed;
+
+    /** Attributes. */
+    public RemoteCacheAttributes attributes = new RemoteCacheAttributes();
+
+    /**
+     * Stores the last argument as fixed.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheClient#fixCache(org.apache.commons.jcs.auxiliary.remote.behavior.ICacheServiceNonLocal)
+     */
+    @SuppressWarnings("unchecked") // Don't know how to do this properly
+    public void fixCache( ICacheServiceNonLocal<?, ?> remote )
+    {
+        fixed = (ICacheServiceNonLocal<K, V>)remote;
+    }
+
+    /**
+     * @return long
+     */
+    public long getListenerId()
+    {
+        return 0;
+    }
+
+    /**
+     * @return null
+     */
+    public IRemoteCacheListener<K, V> getListener()
+    {
+        return null;
+    }
+
+    /**
+     * Adds the argument to the updatedList.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#update(org.apache.commons.jcs.engine.behavior.ICacheElement)
+     */
+    public void update( ICacheElement<K, V> ce )
+    {
+        updateList.add( ce );
+    }
+
+    /**
+     * Looks in the getSetupMap for a value.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#get(java.io.Serializable)
+     */
+    public ICacheElement<K, V> get( K key )
+    {
+        log.info( "get [" + key + "]" );
+        return getSetupMap.get( key );
+    }
+
+    /**
+     * Gets multiple items from the cache based on the given set of keys.
+     * <p>
+     * @param keys
+     * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
+     *         data in cache for any of these keys
+     */
+    public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
+    {
+        log.info( "get [" + keys + "]" );
+        return getMultipleSetupMap.get( keys );
+    }
+
+    /**
+     * Adds the key to the remove list.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#remove(java.io.Serializable)
+     */
+    public boolean remove( K key )
+    {
+        removeList.add( key );
+        return false;
+    }
+
+    /**
+     * Removes all cached items from the cache.
+     */
+    public void removeAll()
+    {
+        // do nothing
+    }
+
+    /**
+     * Prepares for shutdown.
+     */
+    public void dispose()
+    {
+        // do nothing
+    }
+
+    /**
+     * Returns the current cache size in number of elements.
+     * <p>
+     * @return number of elements
+     */
+    public int getSize()
+    {
+        return 0;
+    }
+
+    /**
+     * Returns the status setup variable. (non-Javadoc)
+     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getStatus()
+     */
+    public CacheStatus getStatus()
+    {
+        return status;
+    }
+
+    /**
+     * Returns the cache name.
+     * <p>
+     * @return usually the region name.
+     */
+    public String getCacheName()
+    {
+        return null;
+    }
+
+    /**
+     * @return null
+     */
+    public Set<K> getKeySet( )
+    {
+        return null;
+    }
+
+    /**
+     * @return null
+     */
+    public IStats getStatistics()
+    {
+        return null;
+    }
+
+    /**
+     * Returns the setup attributes. By default they are not null.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getAuxiliaryCacheAttributes()
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return attributes;
+    }
+
+    /**
+     * Returns the cache stats.
+     * <p>
+     * @return String of important historical information.
+     */
+    public String getStats()
+    {
+        return null;
+    }
+
+    /** @return 0 */
+    public CacheType getCacheType()
+    {
+        return CacheType.REMOTE_CACHE;
+    }
+
+    /**
+     * @param pattern
+     * @return Map
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMatching(String pattern)
+        throws IOException
+    {
+        return new HashMap<K, ICacheElement<K,V>>();
+    }
+
+    /**
+     * Nothing important
+     * <p>
+     * @return null
+     */
+    @Override
+    public String getEventLoggingExtraInfo()
+    {
+        return null;
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/MockRemoteCacheService.java Sun Feb 23 10:37:48 2014
@@ -1,231 +1,231 @@
-package org.apache.commons.jcs.auxiliary.remote;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
-
-/**
- * This is a mock impl of the remote cache service.
- */
-public class MockRemoteCacheService<K extends Serializable, V extends Serializable>
-    implements ICacheServiceNonLocal<K, V>
-{
-    /** The key last passed to get */
-    public Serializable lastGetKey;
-
-    /** The pattern last passed to get */
-    public String lastGetMatchingPattern;
-
-    /** The keya last passed to getMatching */
-    public Set<K> lastGetMultipleKeys;
-
-    /** The object that was last passed to update. */
-    public ICacheElement<K, V> lastUpdate;
-
-    /** List of updates. */
-    public List<ICacheElement<K, V>> updateRequestList = new ArrayList<ICacheElement<K,V>>();
-
-    /** List of request ids. */
-    public List<Long> updateRequestIdList = new ArrayList<Long>();
-
-    /** The key that was last passed to remove. */
-    public K lastRemoveKey;
-
-    /** The cache name that was last passed to removeAll. */
-    public String lastRemoveAllCacheName;
-
-    /**
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     * @return null
-     */
-    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
-    {
-        lastGetKey = key;
-        return null;
-    }
-
-    /**
-     * @param cacheName
-     * @return empty set
-     */
-    public Set<K> getKeySet( String cacheName )
-    {
-        return new HashSet<K>();
-    }
-
-    /**
-     * Set the last remove key.
-     * <p>
-     * @param cacheName
-     * @param key
-     * @param requesterId
-     */
-    public void remove( String cacheName, K key, long requesterId )
-    {
-        lastRemoveKey = key;
-    }
-
-    /**
-     * Set the lastRemoveAllCacheName to the cacheName.
-     * <p>
-     * (non-Javadoc)
-     * @see org.apache.commons.jcs.auxiliary.remote.behavior.ICacheServiceNonLocal#removeAll(java.lang.String,
-     *      long)
-     */
-    public void removeAll( String cacheName, long requesterId )
-        throws IOException
-    {
-        lastRemoveAllCacheName = cacheName;
-    }
-
-    /**
-     * Set the last update item.
-     * <p>
-     * @param item
-     * @param requesterId
-     */
-    public void update( ICacheElement<K, V> item, long requesterId )
-    {
-        lastUpdate = item;
-        updateRequestList.add( item );
-        updateRequestIdList.add( Long.valueOf( requesterId ) );
-    }
-
-    /**
-     * Do nothing.
-     * <p>
-     * @param cacheName
-     */
-    public void dispose( String cacheName )
-    {
-        return;
-    }
-
-    /**
-     * @param cacheName
-     * @param key
-     * @return null
-     */
-    public ICacheElement<K, V> get( String cacheName, K key )
-    {
-        return get( cacheName, key, 0 );
-    }
-
-    /**
-     * Do nothing.
-     */
-    public void release()
-    {
-        return;
-    }
-
-    /**
-     * Set the last remove key.
-     * <p>
-     * @param cacheName
-     * @param key
-     */
-    public void remove( String cacheName, K key )
-    {
-        lastRemoveKey = key;
-    }
-
-    /**
-     * Set the last remove all cache name.
-     * <p>
-     * @param cacheName
-     */
-    public void removeAll( String cacheName )
-    {
-        lastRemoveAllCacheName = cacheName;
-    }
-
-    /**
-     * Set the last update item.
-     * <p>
-     * @param item
-     */
-    public void update( ICacheElement<K, V> item )
-    {
-        lastUpdate = item;
-    }
-
-    /**
-     * @param cacheName
-     * @param keys
-     * @param requesterId
-     * @return empty map
-     */
-    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
-    {
-        lastGetMultipleKeys = keys;
-        return new HashMap<K, ICacheElement<K, V>>();
-    }
-
-    /**
-     * @param cacheName
-     * @param keys
-     * @return empty map
-     */
-    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
-    {
-        return getMultiple( cacheName, keys, 0 );
-    }
-
-    /**
-     * Returns an empty map. Zombies have no internal data.
-     * <p>
-     * @param cacheName
-     * @param pattern
-     * @return an empty map
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
-        throws IOException
-    {
-        return getMatching( cacheName, pattern, 0 );
-    }
-
-    /**
-     * @param cacheName
-     * @param pattern
-     * @param requesterId
-     * @return Map
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
-        throws IOException
-    {
-        lastGetMatchingPattern = pattern;
-        return new HashMap<K, ICacheElement<K, V>>();
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheServiceNonLocal;
+
+/**
+ * This is a mock impl of the remote cache service.
+ */
+public class MockRemoteCacheService<K extends Serializable, V extends Serializable>
+    implements ICacheServiceNonLocal<K, V>
+{
+    /** The key last passed to get */
+    public Serializable lastGetKey;
+
+    /** The pattern last passed to get */
+    public String lastGetMatchingPattern;
+
+    /** The keya last passed to getMatching */
+    public Set<K> lastGetMultipleKeys;
+
+    /** The object that was last passed to update. */
+    public ICacheElement<K, V> lastUpdate;
+
+    /** List of updates. */
+    public List<ICacheElement<K, V>> updateRequestList = new ArrayList<ICacheElement<K,V>>();
+
+    /** List of request ids. */
+    public List<Long> updateRequestIdList = new ArrayList<Long>();
+
+    /** The key that was last passed to remove. */
+    public K lastRemoveKey;
+
+    /** The cache name that was last passed to removeAll. */
+    public String lastRemoveAllCacheName;
+
+    /**
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     * @return null
+     */
+    public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
+    {
+        lastGetKey = key;
+        return null;
+    }
+
+    /**
+     * @param cacheName
+     * @return empty set
+     */
+    public Set<K> getKeySet( String cacheName )
+    {
+        return new HashSet<K>();
+    }
+
+    /**
+     * Set the last remove key.
+     * <p>
+     * @param cacheName
+     * @param key
+     * @param requesterId
+     */
+    public void remove( String cacheName, K key, long requesterId )
+    {
+        lastRemoveKey = key;
+    }
+
+    /**
+     * Set the lastRemoveAllCacheName to the cacheName.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.commons.jcs.auxiliary.remote.behavior.ICacheServiceNonLocal#removeAll(java.lang.String,
+     *      long)
+     */
+    public void removeAll( String cacheName, long requesterId )
+        throws IOException
+    {
+        lastRemoveAllCacheName = cacheName;
+    }
+
+    /**
+     * Set the last update item.
+     * <p>
+     * @param item
+     * @param requesterId
+     */
+    public void update( ICacheElement<K, V> item, long requesterId )
+    {
+        lastUpdate = item;
+        updateRequestList.add( item );
+        updateRequestIdList.add( Long.valueOf( requesterId ) );
+    }
+
+    /**
+     * Do nothing.
+     * <p>
+     * @param cacheName
+     */
+    public void dispose( String cacheName )
+    {
+        return;
+    }
+
+    /**
+     * @param cacheName
+     * @param key
+     * @return null
+     */
+    public ICacheElement<K, V> get( String cacheName, K key )
+    {
+        return get( cacheName, key, 0 );
+    }
+
+    /**
+     * Do nothing.
+     */
+    public void release()
+    {
+        return;
+    }
+
+    /**
+     * Set the last remove key.
+     * <p>
+     * @param cacheName
+     * @param key
+     */
+    public void remove( String cacheName, K key )
+    {
+        lastRemoveKey = key;
+    }
+
+    /**
+     * Set the last remove all cache name.
+     * <p>
+     * @param cacheName
+     */
+    public void removeAll( String cacheName )
+    {
+        lastRemoveAllCacheName = cacheName;
+    }
+
+    /**
+     * Set the last update item.
+     * <p>
+     * @param item
+     */
+    public void update( ICacheElement<K, V> item )
+    {
+        lastUpdate = item;
+    }
+
+    /**
+     * @param cacheName
+     * @param keys
+     * @param requesterId
+     * @return empty map
+     */
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
+    {
+        lastGetMultipleKeys = keys;
+        return new HashMap<K, ICacheElement<K, V>>();
+    }
+
+    /**
+     * @param cacheName
+     * @param keys
+     * @return empty map
+     */
+    public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
+    {
+        return getMultiple( cacheName, keys, 0 );
+    }
+
+    /**
+     * Returns an empty map. Zombies have no internal data.
+     * <p>
+     * @param cacheName
+     * @param pattern
+     * @return an empty map
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
+        throws IOException
+    {
+        return getMatching( cacheName, pattern, 0 );
+    }
+
+    /**
+     * @param cacheName
+     * @param pattern
+     * @param requesterId
+     * @return Map
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
+        throws IOException
+    {
+        lastGetMatchingPattern = pattern;
+        return new HashMap<K, ICacheElement<K, V>>();
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,215 +1,215 @@
-package org.apache.commons.jcs.auxiliary.remote;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.CacheStatus;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheEventQueue;
-import org.apache.commons.jcs.utils.timing.SleepUtil;
-
-/**
- * Unit tests for the remote cache no wait. The no wait manages a queue on top of the client.
- * <p>
- * @author Aaron Smuts
- */
-public class RemoteCacheNoWaitUnitTest
-    extends TestCase
-{
-    /**
-     * Simply verify that the client gets updated via the no wait.
-     * <p>
-     * @throws Exception
-     */
-    public void testUpdate()
-        throws Exception
-    {
-        // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testUpdate", "key", "value" );
-
-        // DO WORK
-        noWait.update( element );
-
-        // VERIFY
-        SleepUtil.sleepAtLeast( 10 );
-
-        assertEquals( "Wrong number updated.", 1, client.updateList.size() );
-        assertEquals( "Wrong element", element, client.updateList.get( 0 ) );
-    }
-
-    /**
-     * Simply verify that the client get is called from the no wait.
-     * <p>
-     * @throws Exception
-     */
-    public void testGet()
-        throws Exception
-    {
-        // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-
-        ICacheElement<String, String> input = new CacheElement<String, String>( "testUpdate", "key", "value" );
-        client.getSetupMap.put( "key", input );
-
-        // DO WORK
-        ICacheElement<String, String> result = noWait.get( "key" );
-
-        // VERIFY
-        assertEquals( "Wrong element", input, result );
-    }
-
-    /**
-     * Simply verify that the client getMultiple is called from the no wait.
-     * <p>
-     * @throws Exception
-     */
-    public void testGetMultiple()
-        throws Exception
-    {
-        // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-
-        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testUpdate", "key", "value" );
-        Map<String, ICacheElement<String, String>> inputMap = new HashMap<String, ICacheElement<String,String>>();
-        inputMap.put( "key", inputElement );
-
-        Set<String> keys = new HashSet<String>();
-        keys.add( "key" );
-
-        client.getMultipleSetupMap.put( keys, inputMap );
-
-        // DO WORK
-        Map<String, ICacheElement<String, String>> result = noWait.getMultiple( keys );
-
-        // VERIFY
-        assertEquals( "elements map", inputMap, result );
-    }
-
-    /**
-     * Simply verify that the client gets updated via the no wait.
-     * <p>
-     * @throws Exception
-     */
-    public void testRemove()
-        throws Exception
-    {
-        // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-
-        String input = "MyKey";
-
-        // DO WORK
-        noWait.remove( input );
-
-        SleepUtil.sleepAtLeast( 10 );
-
-        // VERIFY
-        assertEquals( "Wrong number updated.", 1, client.removeList.size() );
-        assertEquals( "Wrong key", input, client.removeList.get( 0 ) );
-    }
-
-    /**
-     * Simply verify that the client status is returned in the stats.
-     * <p>
-     * @throws Exception
-     */
-    public void testGetStats()
-        throws Exception
-    {
-        // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        client.status = CacheStatus.ALIVE;
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-
-        // DO WORK
-        String result = noWait.getStats();
-
-        // VERIFY
-        assertTrue( "Status should contain 'ALIVE'", result.indexOf( "ALIVE" ) != -1 );
-    }
-
-    /**
-     * Simply verify that we get a status of error if the cache is in error..
-     * <p>
-     * @throws Exception
-     */
-    public void testGetStatus_error()
-        throws Exception
-    {
-        // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        client.status = CacheStatus.ERROR;
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-
-        // DO WORK
-        CacheStatus result = noWait.getStatus();
-
-        // VERIFY
-        assertEquals( "Wrong status", CacheStatus.ERROR, result );
-    }
-
-    /**
-     * Simply verify that the serviced supplied to fix is passed onto the client. Verify that the
-     * original event queue is destroyed. A new event queue willbe plugged in on fix.
-     * <p>
-     * @throws Exception
-     */
-    public void testFixCache()
-        throws Exception
-    {
-        // SETUP
-        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
-        client.status = CacheStatus.ALIVE;
-        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
-
-        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>();
-
-        ICacheElement<String, String> element = new CacheElement<String, String>( "testUpdate", "key", "value" );
-
-        // DO WORK
-        noWait.update( element );
-        SleepUtil.sleepAtLeast( 10 );
-        ICacheEventQueue<String, String> originalQueue = noWait.getCacheEventQueue();
-
-        noWait.fixCache( service );
-
-        noWait.update( element );
-        SleepUtil.sleepAtLeast( 10 );
-        ICacheEventQueue<String, String> newQueue = noWait.getCacheEventQueue();
-
-        // VERIFY
-        assertEquals( "Wrong status", service, client.fixed );
-        assertFalse( "Original queue should not alive", originalQueue.isAlive() );
-        assertTrue( "New queue should be alive." + newQueue, newQueue.isAlive() );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.CacheStatus;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheEventQueue;
+import org.apache.commons.jcs.utils.timing.SleepUtil;
+
+/**
+ * Unit tests for the remote cache no wait. The no wait manages a queue on top of the client.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class RemoteCacheNoWaitUnitTest
+    extends TestCase
+{
+    /**
+     * Simply verify that the client gets updated via the no wait.
+     * <p>
+     * @throws Exception
+     */
+    public void testUpdate()
+        throws Exception
+    {
+        // SETUP
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+
+        ICacheElement<String, String> element = new CacheElement<String, String>( "testUpdate", "key", "value" );
+
+        // DO WORK
+        noWait.update( element );
+
+        // VERIFY
+        SleepUtil.sleepAtLeast( 10 );
+
+        assertEquals( "Wrong number updated.", 1, client.updateList.size() );
+        assertEquals( "Wrong element", element, client.updateList.get( 0 ) );
+    }
+
+    /**
+     * Simply verify that the client get is called from the no wait.
+     * <p>
+     * @throws Exception
+     */
+    public void testGet()
+        throws Exception
+    {
+        // SETUP
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+
+        ICacheElement<String, String> input = new CacheElement<String, String>( "testUpdate", "key", "value" );
+        client.getSetupMap.put( "key", input );
+
+        // DO WORK
+        ICacheElement<String, String> result = noWait.get( "key" );
+
+        // VERIFY
+        assertEquals( "Wrong element", input, result );
+    }
+
+    /**
+     * Simply verify that the client getMultiple is called from the no wait.
+     * <p>
+     * @throws Exception
+     */
+    public void testGetMultiple()
+        throws Exception
+    {
+        // SETUP
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+
+        ICacheElement<String, String> inputElement = new CacheElement<String, String>( "testUpdate", "key", "value" );
+        Map<String, ICacheElement<String, String>> inputMap = new HashMap<String, ICacheElement<String,String>>();
+        inputMap.put( "key", inputElement );
+
+        Set<String> keys = new HashSet<String>();
+        keys.add( "key" );
+
+        client.getMultipleSetupMap.put( keys, inputMap );
+
+        // DO WORK
+        Map<String, ICacheElement<String, String>> result = noWait.getMultiple( keys );
+
+        // VERIFY
+        assertEquals( "elements map", inputMap, result );
+    }
+
+    /**
+     * Simply verify that the client gets updated via the no wait.
+     * <p>
+     * @throws Exception
+     */
+    public void testRemove()
+        throws Exception
+    {
+        // SETUP
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+
+        String input = "MyKey";
+
+        // DO WORK
+        noWait.remove( input );
+
+        SleepUtil.sleepAtLeast( 10 );
+
+        // VERIFY
+        assertEquals( "Wrong number updated.", 1, client.removeList.size() );
+        assertEquals( "Wrong key", input, client.removeList.get( 0 ) );
+    }
+
+    /**
+     * Simply verify that the client status is returned in the stats.
+     * <p>
+     * @throws Exception
+     */
+    public void testGetStats()
+        throws Exception
+    {
+        // SETUP
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        client.status = CacheStatus.ALIVE;
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+
+        // DO WORK
+        String result = noWait.getStats();
+
+        // VERIFY
+        assertTrue( "Status should contain 'ALIVE'", result.indexOf( "ALIVE" ) != -1 );
+    }
+
+    /**
+     * Simply verify that we get a status of error if the cache is in error..
+     * <p>
+     * @throws Exception
+     */
+    public void testGetStatus_error()
+        throws Exception
+    {
+        // SETUP
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        client.status = CacheStatus.ERROR;
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+
+        // DO WORK
+        CacheStatus result = noWait.getStatus();
+
+        // VERIFY
+        assertEquals( "Wrong status", CacheStatus.ERROR, result );
+    }
+
+    /**
+     * Simply verify that the serviced supplied to fix is passed onto the client. Verify that the
+     * original event queue is destroyed. A new event queue willbe plugged in on fix.
+     * <p>
+     * @throws Exception
+     */
+    public void testFixCache()
+        throws Exception
+    {
+        // SETUP
+        MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>();
+        client.status = CacheStatus.ALIVE;
+        RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client );
+
+        MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>();
+
+        ICacheElement<String, String> element = new CacheElement<String, String>( "testUpdate", "key", "value" );
+
+        // DO WORK
+        noWait.update( element );
+        SleepUtil.sleepAtLeast( 10 );
+        ICacheEventQueue<String, String> originalQueue = noWait.getCacheEventQueue();
+
+        noWait.fixCache( service );
+
+        noWait.update( element );
+        SleepUtil.sleepAtLeast( 10 );
+        ICacheEventQueue<String, String> newQueue = noWait.getCacheEventQueue();
+
+        // VERIFY
+        assertEquals( "Wrong status", service, client.fixed );
+        assertFalse( "Original queue should not alive", originalQueue.isAlive() );
+        assertTrue( "New queue should be alive." + newQueue, newQueue.isAlive() );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/MockRemoteCacheDispatcher.java Sun Feb 23 10:37:48 2014
@@ -1,53 +1,53 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.Serializable;
-
-import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheDispatcher;
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
-
-/** For testing the service. */
-public class MockRemoteCacheDispatcher
-    implements IRemoteCacheDispatcher
-{
-    /** The last request passes to dispatch */
-    public RemoteCacheRequest<?, ?> lastRemoteCacheRequest;
-
-    /** The response setup */
-    public RemoteCacheResponse<?> setupRemoteCacheResponse;
-
-    /** Records the last and returns setupRemoteCacheResponse.
-     * <p>
-     * @param remoteCacheRequest
-     * @return RemoteCacheResponse
-     * @throws IOException
-     */
-    @SuppressWarnings("unchecked")
-    public <K extends Serializable, V extends Serializable, T>
-        RemoteCacheResponse<T> dispatchRequest( RemoteCacheRequest<K, V> remoteCacheRequest )
-        throws IOException
-    {
-        this.lastRemoteCacheRequest = remoteCacheRequest;
-        return (RemoteCacheResponse<T>)setupRemoteCacheResponse;
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.client;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+
+import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheDispatcher;
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
+
+/** For testing the service. */
+public class MockRemoteCacheDispatcher
+    implements IRemoteCacheDispatcher
+{
+    /** The last request passes to dispatch */
+    public RemoteCacheRequest<?, ?> lastRemoteCacheRequest;
+
+    /** The response setup */
+    public RemoteCacheResponse<?> setupRemoteCacheResponse;
+
+    /** Records the last and returns setupRemoteCacheResponse.
+     * <p>
+     * @param remoteCacheRequest
+     * @return RemoteCacheResponse
+     * @throws IOException
+     */
+    @SuppressWarnings("unchecked")
+    public <K extends Serializable, V extends Serializable, T>
+        RemoteCacheResponse<T> dispatchRequest( RemoteCacheRequest<K, V> remoteCacheRequest )
+        throws IOException
+    {
+        this.lastRemoteCacheRequest = remoteCacheRequest;
+        return (RemoteCacheResponse<T>)setupRemoteCacheResponse;
+    }
+}



Mime
View raw message