jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject svn commit: r436643 [1/2] - in /jakarta/jcs/trunk/src: conf/ java/org/apache/jcs/admin/ java/org/apache/jcs/auxiliary/ java/org/apache/jcs/auxiliary/disk/indexed/ java/org/apache/jcs/auxiliary/disk/jdbc/ java/org/apache/jcs/auxiliary/lateral/ java/org/...
Date Fri, 25 Aug 2006 04:29:24 GMT
Author: asmuts
Date: Thu Aug 24 21:29:22 2006
New Revision: 436643

URL: http://svn.apache.org/viewvc?rev=436643&view=rev
Log:
minor changes for testing

In order to make parts of the remote cache easier to test, I had to make some minor interface changes.  
I added a get attributes method to the auxiliary cache interface.  This made it necessary to change a few other files.
I added a new IRemoteCacheClient interface, so I could mock it out and test the remote cache no wait by itself.

To get started, I created a few new simple tests for the remote cache. 
The test coverage is still not very good, but it is up to 57% from 54%.

I also improved javadocs in several places. 

In addition, I removed an unused class in the remote package.

I started to take measures to standardize the interface naming convention.  
I don't like the "I prefix, but there are too many to make it worth chaning.  
In a subsequent release, we should deprecate the 3 or 4 interfaces that do not follow the I convention

Added:
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/utils/timing/SleepUtil.java
    jakarta/jcs/trunk/src/test-conf/TestRemoteCacheClientServer.ccf
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientMockImpl.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerStartupUtil.java
Removed:
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheInfo.java
Modified:
    jakarta/jcs/trunk/src/conf/log4j.properties
    jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/MemoryCache.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/behavior/IMemoryCache.java
    jakarta/jcs/trunk/src/test-conf/TestRemoteCacheServer.ccf
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheMockImpl.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerUnitTest.java
    jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/CompositeCacheDiskUsageUnitTest.java

Modified: jakarta/jcs/trunk/src/conf/log4j.properties
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/log4j.properties?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/conf/log4j.properties (original)
+++ jakarta/jcs/trunk/src/conf/log4j.properties Thu Aug 24 21:29:22 2006
@@ -4,13 +4,13 @@
 log4j.appender.A1=org.apache.log4j.ConsoleAppender
 log4j.appender.A1.layout=org.apache.log4j.PatternLayout  
 # Print the date in ISO 8601 format
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+log4j.appender.A1.layout.ConversionPattern=%d %-5p [%c{1}] [%t] [%x] %m%n
   
 # RF --file appender
 log4j.appender.RF=org.apache.log4j.RollingFileAppender
 log4j.appender.RF.File=server.log
 log4j.appender.RF.layout=org.apache.log4j.PatternLayout  
-log4j.appender.RF.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+log4j.appender.RF.layout.ConversionPattern=%d %-5p [%c{1}] [%t] [%x] %m%n
 
 # WF -- special file for warnings
 #log4j.appender.WF=org.apache.log4j.RollingFileAppender
@@ -43,7 +43,7 @@
 #log4j.category.org.apache.jcs.auxiliary.remote.RemoteCacheFailoverRunner=INFO
 #log4j.category.org.apache.jcs.auxiliary.remote.RemoteCacheListener=DEBUG
 #log4j.category.org.apache.jcs.auxiliary.remote.RemoteCacheManager=INFO
-log4j.category.org.apache.jcs.auxiliary.remote.server.RemoteCacheServer=DEBUG
+#log4j.category.org.apache.jcs.auxiliary.remote.server.RemoteCacheServer=DEBUG
 #log4j.category.org.apache.jcs.auxiliary.remote.server=INFO
 #log4j.category.org.apache.jcs.utils=WARN,WF
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/admin/JCSAdminBean.java Thu Aug 24 21:29:22 2006
@@ -27,7 +27,7 @@
 import org.apache.jcs.engine.behavior.IElementAttributes;
 import org.apache.jcs.engine.control.CompositeCache;
 import org.apache.jcs.engine.control.CompositeCacheManager;
-import org.apache.jcs.engine.memory.MemoryCache;
+import org.apache.jcs.engine.memory.behavior.IMemoryCache;
 
 /**
  * A servlet which provides HTTP access to JCS. Allows a summary of regions to
@@ -145,7 +145,7 @@
     public int getByteCount( CompositeCache cache )
         throws Exception
     {
-        MemoryCache memCache = cache.getMemoryCache();
+        IMemoryCache memCache = cache.getMemoryCache();
 
         Iterator iter = memCache.getIterator();
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCache.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/AuxiliaryCache.java Thu Aug 24 21:29:22 2006
@@ -1,19 +1,12 @@
 package org.apache.jcs.auxiliary;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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.
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed 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;
@@ -25,12 +18,10 @@
 import org.apache.jcs.engine.stats.behavior.IStats;
 
 /**
- * Tag interface for auxiliary caches. Currently this provides no additional
- * methods over what is in ICache, but I anticipate that will change. For
- * example, there will be a mechanism for determining the type
- * (disk/lateral/remote) of the auxiliary here -- and the existing getCacheType
- * will be removed from ICache.
- * 
+ * Tag interface for auxiliary caches. Currently this provides no additional methods over what is in
+ * ICache, but I anticipate that will change. For example, there will be a mechanism for determining
+ * the type (disk/lateral/remote) of the auxiliary here -- and the existing getCacheType will be
+ * removed from ICache.
  * @version $Id$
  */
 public interface AuxiliaryCache
@@ -38,7 +29,6 @@
 {
     /**
      * Puts an item to the cache.
-     * 
      * @param ce
      * @throws IOException
      */
@@ -47,7 +37,6 @@
 
     /**
      * Gets an item from the cache.
-     * 
      * @param key
      * @return
      * @throws IOException
@@ -57,7 +46,6 @@
 
     /**
      * Removes an item from the cache.
-     * 
      * @param key
      * @return
      * @throws IOException
@@ -67,7 +55,6 @@
 
     /**
      * Removes all cached items from the cache.
-     * 
      * @throws IOException
      */
     public void removeAll()
@@ -75,7 +62,6 @@
 
     /**
      * Prepares for shutdown.
-     * 
      * @throws IOException
      */
     public void dispose()
@@ -83,28 +69,24 @@
 
     /**
      * Returns the current cache size.
-     * 
      * @return
      */
     public int getSize();
 
     /**
      * Returns the cache status.
-     * 
      * @return
      */
     public int getStatus();
 
     /**
      * Returns the cache name.
-     * 
      * @return
      */
     public String getCacheName();
 
     /**
      * Gets the set of keys of objects currently in the group
-     * 
      * @param group
      * @return a set of group keys
      * @throws IOException
@@ -113,10 +95,16 @@
         throws IOException;
 
     /**
-     * Returns the historical and statistical data for a region's auxiliary
-     * cache.
-     * 
+     * Returns the historical and statistical data for a region's auxiliary cache.
      * @return
      */
     public IStats getStatistics();
+
+    /**
+     * This returns the generic attributes for an auxiliary cache. Most implementations will cast
+     * this to a more specific type.
+     * <p>
+     * @return
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes();
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Thu Aug 24 21:29:22 2006
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.disk.AbstractDiskCache;
 import org.apache.jcs.auxiliary.disk.LRUMapJCS;
 import org.apache.jcs.engine.CacheConstants;
@@ -1290,6 +1291,14 @@
         }
     }
 
+    /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return this.cattr;
+    }
+    
     /**
      * Gets basic stats for the disk cache.
      * <p>

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java Thu Aug 24 21:29:22 2006
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.disk.AbstractDiskCache;
 import org.apache.jcs.engine.CacheConstants;
 import org.apache.jcs.engine.behavior.ICacheElement;
@@ -886,6 +887,14 @@
         return jdbcDiskCacheAttributes;
     }
 
+    /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return this.getJdbcDiskCacheAttributes();
+    }
+    
     /**
      * Extends the parent stats.
      */

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java Thu Aug 24 21:29:22 2006
@@ -3,6 +3,7 @@
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 
 /*
@@ -31,9 +32,8 @@
  * old factory could no longer import it.  This motivated the change.
  * <p>
  * This abstraction layer should keep things cleaner.  
- * 
+ * <p>
  * @author Aaron Smuts
- *
  */
 public abstract class LateralCacheAbstractFactory
 	implements AuxiliaryCacheFactory
@@ -51,16 +51,15 @@
      * is used.
      * <p>
      * This should be called by create cache.
-     * 
-     * @param lac  LateralCacheAttributes
+     * <p>
+     * @param lac  ILateralCacheAttributes
      * @param cacheMgr
      */
-    public abstract void createListener( LateralCacheAttributes lac, ICompositeCacheManager cacheMgr );
-    
-    
+    public abstract void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr );
+        
     /**
      * Gets the name attribute of the LateralCacheFactory object
-     * 
+     * <p>
      * @return The name value
      */
     public String getName()
@@ -70,7 +69,7 @@
 
     /**
      * Sets the name attribute of the LateralCacheFactory object
-     * 
+     * <p>
      * @param name
      *            The new name value
      */
@@ -78,5 +77,4 @@
     {
         this.name = name;
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java Thu Aug 24 21:29:22 2006
@@ -28,6 +28,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheService;
 import org.apache.jcs.engine.CacheAdaptor;
 import org.apache.jcs.engine.CacheConstants;
@@ -263,6 +264,14 @@
             .getAuxiliaryCacheAttributes().getEventQueueTypeFactoryCode() );
     }
 
+    /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return cache.getAuxiliaryCacheAttributes();
+    }
+    
     /**
      * getStats
      * 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java Thu Aug 24 21:29:22 2006
@@ -27,6 +27,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICacheType;
 import org.apache.jcs.engine.stats.StatElement;
@@ -48,27 +50,34 @@
 
     private final static Log log = LogFactory.getLog( LateralCacheNoWaitFacade.class );
 
-    /** Description of the Field */
+    /** The queuing facade to the client. */
     public LateralCacheNoWait[] noWaits;
 
     private String cacheName;
 
+    private ILateralCacheAttributes lateralCacheAttributes;
+    
     /**
      * Constructs with the given lateral cache, and fires events to any
      * listeners.
      * 
      * @param noWaits
-     * @param cacheName
+     * @param cattr
      */
-    public LateralCacheNoWaitFacade( LateralCacheNoWait[] noWaits, String cacheName )
+    public LateralCacheNoWaitFacade( LateralCacheNoWait[] noWaits, ILateralCacheAttributes cattr )
     {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "CONSTRUCTING NO WAIT FACADE" );
+        }        
         this.noWaits = noWaits;
-        this.cacheName = cacheName;
+        this.cacheName = cattr.getCacheName();
+        this.lateralCacheAttributes = cattr;
     }
 
     /**
      * Adds a no wait to the list if it isn't already in the list.
-     * 
+     * <p>
      * @param noWait
      * @return true if it wasn't alreay contained
      */
@@ -132,7 +141,7 @@
 
     /**
      * Synchronously reads from the lateral cache.
-     * 
+     * <p>
      * @param key
      * @return ICacheElement
      */
@@ -189,7 +198,7 @@
 
     /**
      * Adds a remove request to the lateral cache.
-     * 
+     * <p>
      * @param key
      * @return always false.
      */
@@ -287,6 +296,14 @@
         //q.isAlive() ? cache.getStatus() : cache.STATUS_ERROR;
     }
 
+    /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return this.lateralCacheAttributes;
+    }
+    
     /*
      * (non-Javadoc)
      * 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/socket/tcp/LateralTCPCacheFactory.java Thu Aug 24 21:29:22 2006
@@ -24,9 +24,9 @@
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory;
-import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryManager;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryService;
@@ -38,7 +38,7 @@
  * lateral service / local relationship is managed by one manager. This manager
  * can have multiple caches. The remote relationships are consolidated and
  * restored via these managers.
- * 
+ * <p>
  * The facade provides a front to the composite cache so the implmentation is
  * transparent.
  * 
@@ -94,11 +94,11 @@
             }
         }
 
-        createListener( (LateralCacheAttributes) iaca, cacheMgr );
+        createListener( (ILateralCacheAttributes) iaca, cacheMgr );
 
         // create the no wait facade.
         LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
-            .toArray( new LateralCacheNoWait[0] ), iaca.getCacheName() );
+            .toArray( new LateralCacheNoWait[0] ), (ILateralCacheAttributes)iaca );
 
         // create udp discovery if available.
         createDiscoveryService( lac, lcnwf, cacheMgr );
@@ -112,7 +112,7 @@
      * @see org.apache.jcs.auxiliary.lateral.LateralCacheAbstractFactory#createListener(org.apache.jcs.auxiliary.lateral.LateralCacheAttributes,
      *      org.apache.jcs.engine.behavior.ICompositeCacheManager)
      */
-    public void createListener( LateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
+    public void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr )
     {
         ITCPLateralCacheAttributes attr = (ITCPLateralCacheAttributes) lac;
         // don't create a listener if we are not receiving.

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java Thu Aug 24 21:29:22 2006
@@ -22,10 +22,10 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
+import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
 import org.apache.jcs.engine.CacheConstants;
-import org.apache.jcs.engine.behavior.ICache;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICacheElementSerialized;
 import org.apache.jcs.engine.behavior.IElementAttributes;
@@ -49,7 +49,7 @@
  * failover recovery when an error is encountered.
  */
 public class RemoteCache
-    implements ICache
+    implements IRemoteCacheClient
 {
     private static final long serialVersionUID = -5329231850422826460L;
 
@@ -602,7 +602,7 @@
             log.debug( "Initiating failover, rcnf = " + rcnwf );
         }
 
-        if ( rcnwf != null && rcnwf.rca.getRemoteType() == RemoteCacheAttributes.LOCAL )
+        if ( rcnwf != null && rcnwf.remoteCacheAttributes.getRemoteType() == RemoteCacheAttributes.LOCAL )
         {
             if ( log.isDebugEnabled() )
             {
@@ -675,9 +675,10 @@
     /**
      * Allows other member of this package to access the listerner. This is mainly needed for
      * deregistering alistener.
+     * <p>
      * @return IRemoteCacheListener, the listener for this remote server
      */
-    protected IRemoteCacheListener getListener()
+    public IRemoteCacheListener getListener()
     {
         return listener;
     }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java Thu Aug 24 21:29:22 2006
@@ -102,12 +102,12 @@
 
         if ( log.isInfoEnabled() )
         {
-            log.info( "Exiting failover runner. Failover index = " + facade.rca.getFailoverIndex() );
-            if ( facade.rca.getFailoverIndex() <= 0 )
+            log.info( "Exiting failover runner. Failover index = " + facade.remoteCacheAttributes.getFailoverIndex() );
+            if ( facade.remoteCacheAttributes.getFailoverIndex() <= 0 )
             {
                 log.info( "Failover index is <= 0, meaning we are not " + "connected to a failover server." );
             }
-            else if ( facade.rca.getFailoverIndex() > 0 )
+            else if ( facade.remoteCacheAttributes.getFailoverIndex() > 0 )
             {
                 log.info( "Failover index is > 0, meaning we are " + "connected to a failover server." );
             }
@@ -132,7 +132,7 @@
             {
                 // Monitor each RemoteCacheManager instance one after the other.
                 // Each RemoteCacheManager corresponds to one remote connection.
-                String[] failovers = facade.rca.getFailovers();
+                String[] failovers = facade.remoteCacheAttributes.getFailovers();
                 // we should probalby check to see if there are any failovers,
                 // even though the caller
                 // should have already.
@@ -152,7 +152,7 @@
                     }
                 }
 
-                int fidx = facade.rca.getFailoverIndex();
+                int fidx = facade.remoteCacheAttributes.getFailoverIndex();
                 log.debug( "fidx = " + fidx + " failovers.length = " + failovers.length );
 
                 // shouldn't we see if the primary is backup?
@@ -177,7 +177,7 @@
                     RemoteCacheAttributes rca = null;
                     try
                     {
-                        rca = (RemoteCacheAttributes) facade.rca.copy();
+                        rca = (RemoteCacheAttributes) facade.remoteCacheAttributes.copy();
                         rca.setRemoteHost( server.substring( 0, server.indexOf( ":" ) ) );
                         rca.setRemotePort( Integer.parseInt( server.substring( server.indexOf( ":" ) + 1 ) ) );
                         RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr );
@@ -198,7 +198,7 @@
                                 log.debug( "reseting no wait" );
                                 facade.noWaits = new RemoteCacheNoWait[1];
                                 facade.noWaits[0] = (RemoteCacheNoWait) ic;
-                                facade.rca.setFailoverIndex( i );
+                                facade.remoteCacheAttributes.setFailoverIndex( i );
 
                                 synchronized ( this )
                                 {
@@ -265,13 +265,13 @@
                 if ( log.isInfoEnabled() )
                 {
                     log.info( "Failover runner is in primary recovery mode. Failover index = "
-                        + facade.rca.getFailoverIndex() + "\n" + "Will now try to reconnect to primary server." );
+                        + facade.remoteCacheAttributes.getFailoverIndex() + "\n" + "Will now try to reconnect to primary server." );
                 }
             }
 
             boolean primaryRestoredSuccessfully = false;
             // if we are not connected to the primary, try.
-            if ( facade.rca.getFailoverIndex() > 0 )
+            if ( facade.remoteCacheAttributes.getFailoverIndex() > 0 )
             {
                 primaryRestoredSuccessfully = restorePrimary();
                 if ( log.isDebugEnabled() )
@@ -298,7 +298,7 @@
 
             // try to bring the listener back to the primary
         }
-        while ( facade.rca.getFailoverIndex() > 0 || !alright );
+        while ( facade.remoteCacheAttributes.getFailoverIndex() > 0 || !alright );
         // continue if the primary is not restored or if things are not alright.
 
     }
@@ -316,7 +316,7 @@
     private boolean restorePrimary()
     {
         // try to move back to the primary
-        String[] failovers = facade.rca.getFailovers();
+        String[] failovers = facade.remoteCacheAttributes.getFailovers();
         String server = failovers[0];
 
         if ( log.isInfoEnabled() )
@@ -326,7 +326,7 @@
 
         try
         {
-            RemoteCacheAttributes rca = (RemoteCacheAttributes) facade.rca.copy();
+            RemoteCacheAttributes rca = (RemoteCacheAttributes) facade.remoteCacheAttributes.copy();
             rca.setRemoteHost( server.substring( 0, server.indexOf( ":" ) ) );
             rca.setRemotePort( Integer.parseInt( server.substring( server.indexOf( ":" ) + 1 ) ) );
             RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca, cacheMgr );
@@ -353,7 +353,7 @@
                         // stop duplicate listening.
                         if ( facade.noWaits[0] != null && facade.noWaits[0].getStatus() == CacheConstants.STATUS_ALIVE )
                         {
-                            int fidx = facade.rca.getFailoverIndex();
+                            int fidx = facade.remoteCacheAttributes.getFailoverIndex();
 
                             if ( fidx > 0 )
                             {
@@ -369,7 +369,7 @@
                                 {
                                     // create attributes that reflect the
                                     // previous failed over configuration.
-                                    RemoteCacheAttributes rcaOld = (RemoteCacheAttributes) facade.rca.copy();
+                                    RemoteCacheAttributes rcaOld = (RemoteCacheAttributes) facade.remoteCacheAttributes.copy();
                                     rcaOld.setRemoteHost( serverOld.substring( 0, serverOld.indexOf( ":" ) ) );
                                     rcaOld.setRemotePort( Integer.parseInt( serverOld.substring( serverOld
                                         .indexOf( ":" ) + 1 ) ) );
@@ -420,7 +420,7 @@
                     // swap in a new one
                     facade.noWaits = new RemoteCacheNoWait[1];
                     facade.noWaits[0] = (RemoteCacheNoWait) ic;
-                    facade.rca.setFailoverIndex( 0 );
+                    facade.remoteCacheAttributes.setFailoverIndex( 0 );
 
                     if ( log.isInfoEnabled() )
                     {

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java Thu Aug 24 21:29:22 2006
@@ -21,6 +21,7 @@
 import org.apache.jcs.auxiliary.AuxiliaryCache;
 import org.apache.jcs.auxiliary.AuxiliaryCacheManager;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
+import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheObserver;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
@@ -99,7 +100,11 @@
         this.cacheMgr = cacheMgr;
 
         // register shutdown observer
-        ( (CompositeCacheManager) this.cacheMgr ).registerShutdownObserver( this );
+        // TODO add the shutdown observable methods to the interface
+        if ( this.cacheMgr instanceof CompositeCacheManager )
+        {
+            ( (CompositeCacheManager) this.cacheMgr ).registerShutdownObserver( this );
+        }
 
         this.registry = "//" + host + ":" + port + "/" + service;
         if ( log.isDebugEnabled() )
@@ -216,7 +221,7 @@
             RemoteCacheNoWait cache = (RemoteCacheNoWait) caches.get( cattr.getCacheName() );
             if ( cache != null )
             {
-                RemoteCache rc = cache.getRemoteCache();
+                IRemoteCacheClient rc = cache.getRemoteCache();
                 if ( log.isDebugEnabled() )
                 {
                     log.debug( "Found cache for[ " + cattr.getCacheName() + "], deregistering listener." );
@@ -258,7 +263,7 @@
             RemoteCacheNoWait cache = (RemoteCacheNoWait) caches.get( cacheName );
             if ( cache != null )
             {
-                RemoteCache rc = cache.getRemoteCache();
+                IRemoteCacheClient rc = cache.getRemoteCache();
                 if ( log.isDebugEnabled() )
                 {
                     log.debug( "Found cache for [" + cacheName + "], deregistering listener." );

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWait.java Thu Aug 24 21:29:22 2006
@@ -20,6 +20,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
 import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
 import org.apache.jcs.engine.CacheAdaptor;
 import org.apache.jcs.engine.CacheConstants;
@@ -56,9 +58,9 @@
 
     private final static Log log = LogFactory.getLog( RemoteCacheNoWait.class );
 
-    private final RemoteCache cache;
+    private final IRemoteCacheClient cache;
 
-    private ICacheEventQueue q;
+    private ICacheEventQueue cacheEventQueue;
 
     /**
      * Constructs with the given remote cache, and fires up an event queue for aysnchronous
@@ -66,17 +68,17 @@
      * <p>
      * @param cache
      */
-    public RemoteCacheNoWait( RemoteCache cache )
+    public RemoteCacheNoWait( IRemoteCacheClient cache )
     {
         this.cache = cache;
         CacheEventQueueFactory fact = new CacheEventQueueFactory();
-        this.q = fact.createCacheEventQueue( new CacheAdaptor( cache ), cache.getListenerId(), cache.getCacheName(),
+        this.cacheEventQueue = fact.createCacheEventQueue( new CacheAdaptor( cache ), cache.getListenerId(), cache.getCacheName(),
                                              cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), cache
                                                  .getAuxiliaryCacheAttributes().getEventQueueTypeFactoryCode() );
 
         if ( cache.getStatus() == CacheConstants.STATUS_ERROR )
         {
-            q.destroy();
+            cacheEventQueue.destroy();
         }
     }
 
@@ -91,12 +93,12 @@
     {
         try
         {
-            q.addPutEvent( ce );
+            cacheEventQueue.addPutEvent( ce );
         }
         catch ( IOException ex )
         {
             log.error( "Problem adding putEvent to queue.", ex );
-            q.destroy();
+            cacheEventQueue.destroy();
             throw ex;
         }
     }
@@ -161,12 +163,12 @@
     {
         try
         {
-            q.addRemoveEvent( key );
+            cacheEventQueue.addRemoveEvent( key );
         }
         catch ( IOException ex )
         {
             log.error( "Problem adding RemoveEvent to queue.", ex );
-            q.destroy();
+            cacheEventQueue.destroy();
             throw ex;
         }
         return false;
@@ -174,6 +176,7 @@
 
     /**
      * Adds a removeAll request to the remote cache.
+     * <p>
      * @throws IOException
      */
     public void removeAll()
@@ -181,12 +184,12 @@
     {
         try
         {
-            q.addRemoveAllEvent();
+            cacheEventQueue.addRemoveAllEvent();
         }
         catch ( IOException ex )
         {
             log.error( "Problem adding RemoveAllEvent to queue.", ex );
-            q.destroy();
+            cacheEventQueue.destroy();
             throw ex;
         }
     }
@@ -196,12 +199,12 @@
     {
         try
         {
-            q.addDisposeEvent();
+            cacheEventQueue.addDisposeEvent();
         }
         catch ( IOException ex )
         {
             log.error( "Problem adding DisposeEvent to queue.", ex );
-            q.destroy();
+            cacheEventQueue.destroy();
         }
     }
 
@@ -233,7 +236,7 @@
      */
     public int getStatus()
     {
-        return q.isWorking() ? cache.getStatus() : CacheConstants.STATUS_ERROR;
+        return cacheEventQueue.isWorking() ? cache.getStatus() : CacheConstants.STATUS_ERROR;
     }
 
     /**
@@ -268,10 +271,10 @@
      */
     public void resetEventQ()
     {
-        ICacheEventQueue previousQueue = q;
+        ICacheEventQueue previousQueue = cacheEventQueue;
 
         CacheEventQueueFactory fact = new CacheEventQueueFactory();
-        this.q = fact.createCacheEventQueue( new CacheAdaptor( cache ), cache.getListenerId(), cache.getCacheName(),
+        this.cacheEventQueue = fact.createCacheEventQueue( new CacheAdaptor( cache ), cache.getListenerId(), cache.getCacheName(),
                                              cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), cache
                                                  .getAuxiliaryCacheAttributes().getEventQueueTypeFactoryCode() );
 
@@ -282,7 +285,6 @@
             {
                 log.info( "resetEventQ, previous queue has [" + previousQueue.size() + "] items queued up." );
             }
-            // TODO consider waiting.
             previousQueue.destroy();
         }
     }
@@ -292,12 +294,30 @@
      * <p>
      * @return
      */
-    protected RemoteCache getRemoteCache()
+    protected IRemoteCacheClient getRemoteCache()
     {
         return cache;
     }
 
     /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return cache.getAuxiliaryCacheAttributes();
+    }
+
+    /**
+     * This is for testing only.  It allows you to take a look at the event queue.
+     * <p>
+     * @return ICacheEventQueue
+     */
+    protected ICacheEventQueue getCacheEventQueue()
+    {
+        return this.cacheEventQueue;
+    }
+    
+    /**
      * Returns the stats and the cache.toString().
      * <p>
      * (non-Javadoc)
@@ -309,7 +329,8 @@
     }
 
     /**
-     * getStats
+     * Returns the statistics in String form.
+     * <p>
      * @return String
      */
     public String getStats()
@@ -356,13 +377,16 @@
         // get the stats from the cache queue too
         // get as array, convert to list, add list to our outer list
         IStats cStats = this.cache.getStatistics();
-        IStatElement[] cSEs = cStats.getStatElements();
-        List cL = Arrays.asList( cSEs );
-        elems.addAll( cL );
+        if ( cStats != null )
+        {
+            IStatElement[] cSEs = cStats.getStatElements();
+            List cL = Arrays.asList( cSEs );
+            elems.addAll( cL );
+        }
 
         // get the stats from the event queue too
         // get as array, convert to list, add list to our outer list
-        IStats eqStats = this.q.getStatistics();
+        IStats eqStats = this.cacheEventQueue.getStatistics();
         IStatElement[] eqSEs = eqStats.getStatElements();
         List eqL = Arrays.asList( eqSEs );
         elems.addAll( eqL );

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java Thu Aug 24 21:29:22 2006
@@ -20,6 +20,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 import org.apache.jcs.engine.CacheConstants;
 import org.apache.jcs.engine.behavior.ICacheElement;
 import org.apache.jcs.engine.behavior.ICacheType;
@@ -49,7 +50,7 @@
     private String cacheName;
 
     /** holds failover and cluster information */
-    protected RemoteCacheAttributes rca;
+    protected RemoteCacheAttributes remoteCacheAttributes;
 
     private ICompositeCacheManager cacheMgr;
 
@@ -60,7 +61,7 @@
      */
     public RemoteCacheAttributes getRemoteCacheAttributes()
     {
-        return rca;
+        return remoteCacheAttributes;
     }
 
     /**
@@ -70,7 +71,7 @@
      */
     public void setRemoteCacheAttributes( RemoteCacheAttributes rca )
     {
-        this.rca = rca;
+        this.remoteCacheAttributes = rca;
     }
 
     /**
@@ -88,7 +89,7 @@
             log.debug( "CONSTRUCTING NO WAIT FACADE" );
         }
         this.noWaits = noWaits;
-        this.rca = rca;
+        this.remoteCacheAttributes = rca;
         this.cacheName = rca.getCacheName();
         this.cacheMgr = cacheMgr;
     }
@@ -267,7 +268,7 @@
      */
     public String getCacheName()
     {
-        return rca.getCacheName();
+        return remoteCacheAttributes.getCacheName();
     }
 
     /**
@@ -296,7 +297,7 @@
      */
     public String toString()
     {
-        return "RemoteCacheNoWaitFacade: " + cacheName + ", rca = " + rca;
+        return "RemoteCacheNoWaitFacade: " + cacheName + ", rca = " + remoteCacheAttributes;
     }
 
     /**
@@ -311,7 +312,7 @@
             log.info( "in failover for " + i );
         }
 
-        if ( rca.getRemoteType() == RemoteCacheAttributes.LOCAL )
+        if ( remoteCacheAttributes.getRemoteType() == RemoteCacheAttributes.LOCAL )
         {
             if ( noWaits[i].getStatus() == CacheConstants.STATUS_ERROR )
             {
@@ -337,6 +338,14 @@
         }
     }
 
+    /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return this.remoteCacheAttributes;
+    }
+    
     /**
      * getStats
      * @return String

Added: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java?rev=436643&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheClient.java Thu Aug 24 21:29:22 2006
@@ -0,0 +1,50 @@
+package org.apache.jcs.auxiliary.remote.behavior;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed 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 org.apache.jcs.auxiliary.AuxiliaryCache;
+
+/**
+ * This defines the behavior expected of a remote cache client. This extends Auxiliary cache which
+ * in turn extends ICache.
+ * <p>
+ * I'd like generalize this a bit.
+ * <p>
+ * @author Aaron Smuts
+ */
+public interface IRemoteCacheClient
+    extends AuxiliaryCache
+{
+    /**
+     * Replaces the current remote cache service handle with the given handle. If the current remote
+     * is a Zombie, the propagate teh events that may be queued to the restored service.
+     * <p>
+     * @param remote IRemoteCacheService -- the remote server or proxy to the remote server
+     */
+    public void fixCache( IRemoteCacheService remote );
+
+    /**
+     * Gets the listenerId attribute of the RemoteCacheListener object.
+     * <p>
+     * All requests to the remote cache must include a listener id. This allows the server to avoid
+     * sending updates the the listener associated with this client.
+     * <p>
+     * @return The listenerId value
+     */
+    public long getListenerId();
+
+    /**
+     * This returns the listener associated with this remote cache. TODO we should try to get this
+     * out of the interface.
+     * <p>
+     * @return IRemoteCacheListener
+     */
+    public IRemoteCacheListener getListener();
+}

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java Thu Aug 24 21:29:22 2006
@@ -744,6 +744,16 @@
     }
 
     /**
+     * How many put events have we received.
+     * <p>
+     * @return puts
+     */
+    protected int getPutCount()
+    {
+        return puts;
+    }
+    
+    /**
      * Frees the specified remote cache.
      * <p>
      * @param cacheName

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerFactory.java Thu Aug 24 21:29:22 2006
@@ -153,6 +153,11 @@
             boolean acg = Boolean.valueOf( acgStr ).booleanValue();
             rcsa.setAllowClusterGet( acg );
 
+            if ( log.isInfoEnabled() )
+            {
+                log.info( "Creating server with these attributes " + rcsa );
+            }
+            
             // CREATE SERVER
             remoteCacheServer = new RemoteCacheServer( rcsa );
 

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/ICacheType.java Thu Aug 24 21:29:22 2006
@@ -19,7 +19,7 @@
 import java.io.Serializable;
 
 /**
- * Inteface implemented by a specific cache.
+ * Interface implemented by a specific cache.
  *  
  */
 public interface ICacheType
@@ -39,7 +39,7 @@
 
     /**
      * Returns the cache type.
-     * 
+     * <p>
      * @return The cacheType value
      */
     public int getCacheType();

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/MemoryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/MemoryCache.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/MemoryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/MemoryCache.java Thu Aug 24 21:29:22 2006
@@ -1,193 +1,27 @@
 package org.apache.jcs.engine.memory;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation. Licensed 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.
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed 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.Iterator;
-import java.util.Set;
-
-import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
-import org.apache.jcs.engine.control.CompositeCache;
-import org.apache.jcs.engine.stats.behavior.IStats;
+import org.apache.jcs.engine.memory.behavior.IMemoryCache;
 
 /**
- * For the framework. Insures methods a MemoryCache needs to access. Not sure
- * why we use this. Should use the IMemeoryCache interface. I'll change it
- * later.
+ * For the framework. Insures methods a MemoryCache needs to access. Not sure why we use this.
+ * Should use the IMemeoryCache interface. I'll change it later.
+ * <p>
+ * This extends IMemoryCache. There was an aborted attemopt to change the interface naming
+ * convention to not use the "I" prefix. At this point, there are too many "I" interfaces to get rid
+ * of.
  * <p>
- * @version $Id$
  */
 public interface MemoryCache
+    extends IMemoryCache
 {
-    /**
-     * Initialize the memory cache
-     * <p>
-     * @param cache
-     *            The cache (region) this memory store is attached to.
-     */
-    public void initialize( CompositeCache cache );
-
-    /**
-     * Destroy the memory cache
-     * <p>
-     * @throws IOException
-     */
-    public void dispose()
-        throws IOException;
-
-    /**
-     * Get the number of elements contained in the memory store
-     * <p>
-     * @return Element count
-     */
-    public int getSize();
-
-    /**
-     * Returns the historical and statistical data for a region's memory cache.
-     * <p>
-     * @return Statistics and Infor for the Memory Cache.
-     */
-    public IStats getStatistics();
-
-    /**
-     * Get an iterator for all elements in the memory cache. This should be
-     * removed since it is fairly dangerous. Other classes should not be able to
-     * directly access items in the memory cache.
-     * <p>
-     * @return An iterator
-     */
-    public Iterator getIterator();
-
-    /**
-     * Get an Array of the keys for all elements in the memory cache.
-     * <p>
-     * @return Object[]
-     * @TODO This should probably be done in chunks with a range pased in. This
-     *       will be a problem if someone puts a 1,000,000 or so items in a
-     *       region.
-     */
-    public Object[] getKeyArray();
-
-    /**
-     * Removes an item from the cache
-     * <p>
-     * @param key
-     *            Identifies item to be removed
-     * @return Description of the Return Value
-     * @exception IOException
-     *                Description of the Exception
-     */
-    public boolean remove( Serializable key )
-        throws IOException;
-
-    /**
-     * Removes all cached items from the cache.
-     * <p>
-     * @exception IOException
-     *                Description of the Exception
-     */
-    public void removeAll()
-        throws IOException;
-
-    /**
-     * This instructs the memory cache to remove the <i>numberToFree</i>
-     * according to its eviction policy. For example, the LRUMemoryCache will
-     * remove the <i>numberToFree</i> least recently used items. These will be
-     * spooled to disk if a disk auxiliary is available.
-     * <p>
-     * @param numberToFree
-     * @return the number that were removed. if you ask to free 5, but there are
-     *         only 3, you will get 3.
-     * @throws IOException
-     */
-    public int freeElements( int numberToFree )
-        throws IOException;
-
-    /**
-     * Get an item from the cache
-     * <p>
-     * @param key
-     *            Description of the Parameter
-     * @return Description of the Return Value
-     * @exception IOException
-     *                Description of the Exception
-     */
-    public ICacheElement get( Serializable key )
-        throws IOException;
-
-    /**
-     * Get an item from the cache without effecting its order or last access
-     * time
-     * <p>
-     * @param key
-     *            Description of the Parameter
-     * @return The quiet value
-     * @exception IOException
-     *                Description of the Exception
-     */
-    public ICacheElement getQuiet( Serializable key )
-        throws IOException;
-
-    /**
-     * Spools the item contained in the provided element to disk
-     * <p>
-     * @param ce
-     *            Description of the Parameter
-     * @exception IOException
-     *                Description of the Exception
-     */
-    public void waterfal( ICacheElement ce )
-        throws IOException;
-
-    /**
-     * Puts an item to the cache.
-     * <p>
-     * @param ce
-     *            Description of the Parameter
-     * @exception IOException
-     *                Description of the Exception
-     */
-    public void update( ICacheElement ce )
-        throws IOException;
-
-    /**
-     * Returns the CacheAttributes for the region.
-     * <p>
-     * @return The cacheAttributes value
-     */
-    public ICompositeCacheAttributes getCacheAttributes();
-
-    /**
-     * Sets the CacheAttributes of the region.
-     * <p>
-     * @param cattr
-     *            The new cacheAttributes value
-     */
-    public void setCacheAttributes( ICompositeCacheAttributes cattr );
-
-    /**
-     * Gets the cache hub / region that uses the MemoryCache.
-     * <p>
-     * @return The cache value
-     */
-    public CompositeCache getCompositeCache();
-
-    /**
-     * Gets the set of keys of objects currently in the group.
-     * <p>
-     * @param group
-     * @return a Set of group keys.
-     */
-    public Set getGroupKeys( String group );
+    // temporary, for backward compatibility.
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/behavior/IMemoryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/behavior/IMemoryCache.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/behavior/IMemoryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/behavior/IMemoryCache.java Thu Aug 24 21:29:22 2006
@@ -19,70 +19,73 @@
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.Iterator;
+import java.util.Set;
 
 import org.apache.jcs.engine.behavior.ICacheElement;
-import org.apache.jcs.engine.behavior.ICacheType;
 import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
 import org.apache.jcs.engine.control.CompositeCache;
+import org.apache.jcs.engine.stats.behavior.IStats;
 
 /**
  * For the framework. Insures methods a MemoryCache needs to access.
  *  
  */
 public interface IMemoryCache
-    extends ICacheType
 {
-
     /**
-     * Initialize the memory cache.
-     * 
-     * @param cacheName
-     *            Description of the Parameter
-     * @param cattr
-     *            Description of the Parameter
+     * Initialize the memory cache
+     * <p>
      * @param cache
-     *            Description of the Parameter
+     *            The cache (region) this memory store is attached to.
      */
-    public void initialize( String cacheName, ICompositeCacheAttributes cattr, CompositeCache cache );
-
-    // TODO: need a setCacheAttributes or reInitialize method
+    public void initialize( CompositeCache cache );
 
     /**
-     * Description of the Method
-     * 
-     * @return The size value
+     * Destroy the memory cache
+     * <p>
+     * @throws IOException
      */
-    //public void makeFirst( MemoryElementDescriptor me );
-    //public void moveToMemory( ICacheElement ce );
+    public void dispose()
+        throws IOException;
+
     /**
-     * Gets the size attribute of the IMemoryCache object
-     * 
-     * @return The size value
+     * Get the number of elements contained in the memory store
+     * <p>
+     * @return Element count
      */
     public int getSize();
 
     /**
+     * Returns the historical and statistical data for a region's memory cache.
+     * <p>
+     * @return Statistics and Infor for the Memory Cache.
+     */
+    public IStats getStatistics();
+
+    /**
      * Get an iterator for all elements in the memory cache. This should be
      * removed since it is fairly dangerous. Other classes should not be able to
      * directly access items in the memory cache.
-     * 
+     * <p>
      * @return An iterator
-     * @deprecated
      */
     public Iterator getIterator();
 
     /**
-     * Get an Array of the keys for all elements in the memory cache
-     * 
-     * @return An Object[]
+     * Get an Array of the keys for all elements in the memory cache.
+     * <p>
+     * @return Object[]
+     * @TODO This should probably be done in chunks with a range pased in. This
+     *       will be a problem if someone puts a 1,000,000 or so items in a
+     *       region.
      */
     public Object[] getKeyArray();
 
     /**
-     * Removes an item from the cache.
-     * 
+     * Removes an item from the cache
+     * <p>
      * @param key
-     *            Description of the Parameter
+     *            Identifies item to be removed
      * @return Description of the Return Value
      * @exception IOException
      *                Description of the Exception
@@ -92,7 +95,7 @@
 
     /**
      * Removes all cached items from the cache.
-     * 
+     * <p>
      * @exception IOException
      *                Description of the Exception
      */
@@ -100,21 +103,35 @@
         throws IOException;
 
     /**
-     * Description of the Method
-     * 
+     * This instructs the memory cache to remove the <i>numberToFree</i>
+     * according to its eviction policy. For example, the LRUMemoryCache will
+     * remove the <i>numberToFree</i> least recently used items. These will be
+     * spooled to disk if a disk auxiliary is available.
+     * <p>
+     * @param numberToFree
+     * @return the number that were removed. if you ask to free 5, but there are
+     *         only 3, you will get 3.
+     * @throws IOException
+     */
+    public int freeElements( int numberToFree )
+        throws IOException;
+
+    /**
+     * Get an item from the cache
+     * <p>
      * @param key
      *            Description of the Parameter
      * @return Description of the Return Value
      * @exception IOException
      *                Description of the Exception
      */
-    public Serializable get( Serializable key )
+    public ICacheElement get( Serializable key )
         throws IOException;
 
     /**
      * Get an item from the cache without effecting its order or last access
      * time
-     * 
+     * <p>
      * @param key
      *            Description of the Parameter
      * @return The quiet value
@@ -125,23 +142,8 @@
         throws IOException;
 
     /**
-     * Description of the Method
-     * 
-     * @param key
-     *            Description of the Parameter
-     * @param container
-     *            Description of the Parameter
-     * @return Description of the Return Value
-     * @exception IOException
-     *                Description of the Exception
-     */
-    public Serializable get( Serializable key, boolean container )
-        throws IOException;
-
-    /**
-     * Throws an item out of memory, if there is a disk cache it will be
-     * spooled.
-     * 
+     * Spools the item contained in the provided element to disk
+     * <p>
      * @param ce
      *            Description of the Parameter
      * @exception IOException
@@ -152,7 +154,7 @@
 
     /**
      * Puts an item to the cache.
-     * 
+     * <p>
      * @param ce
      *            Description of the Parameter
      * @exception IOException
@@ -162,25 +164,33 @@
         throws IOException;
 
     /**
-     * Returns the CacheAttributes.
-     * 
+     * Returns the CacheAttributes for the region.
+     * <p>
      * @return The cacheAttributes value
      */
     public ICompositeCacheAttributes getCacheAttributes();
 
     /**
-     * Sets the CacheAttributes.
-     * 
+     * Sets the CacheAttributes of the region.
+     * <p>
      * @param cattr
      *            The new cacheAttributes value
      */
     public void setCacheAttributes( ICompositeCacheAttributes cattr );
 
     /**
-     * Gets the cache hub / region taht the MemoryCache is used by
-     * 
+     * Gets the cache hub / region that uses the MemoryCache.
+     * <p>
      * @return The cache value
      */
     public CompositeCache getCompositeCache();
+
+    /**
+     * Gets the set of keys of objects currently in the group.
+     * <p>
+     * @param group
+     * @return a Set of group keys.
+     */
+    public Set getGroupKeys( String group );
 
 }

Added: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/timing/SleepUtil.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/timing/SleepUtil.java?rev=436643&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/timing/SleepUtil.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/timing/SleepUtil.java Thu Aug 24 21:29:22 2006
@@ -0,0 +1,31 @@
+package org.apache.jcs.utils.timing;
+
+/**
+ * Utility methods to help deal with thread issues.
+ */
+public class SleepUtil
+{
+    /**
+     * Sleep for a specified duration in milliseconds. This method is a
+     * platform-specific workaround for Windows due to its inability to resolve
+     * durations of time less than approximately 10 - 16 ms.
+     * <p>
+     * @param milliseconds the number of milliseconds to sleep
+     */
+    public static void sleepAtLeast( long milliseconds )
+    {
+        long endTime = System.currentTimeMillis() + milliseconds;
+
+        while ( System.currentTimeMillis() <= endTime )
+        {
+            try
+            {
+                Thread.sleep( milliseconds );
+            }
+            catch ( InterruptedException e )
+            {
+                // TODO - Do something here?
+            }
+        }
+    }
+}

Added: jakarta/jcs/trunk/src/test-conf/TestRemoteCacheClientServer.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test-conf/TestRemoteCacheClientServer.ccf?rev=436643&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/TestRemoteCacheClientServer.ccf (added)
+++ jakarta/jcs/trunk/src/test-conf/TestRemoteCacheClientServer.ccf Thu Aug 24 21:29:22 2006
@@ -0,0 +1,20 @@
+##############################################################
+################## REMOTE SERVER CONFIG  #####################
+# Registry used to register and provide the IRmiCacheService service.
+registry.host=localhost
+registry.port=1101
+# call back port to local caches.
+remote.cache.service.port=1101
+# cluster setting
+remote.cluster.LocalClusterConsistency=true
+
+##############################################################
+################## DEFAULT CACHE REGION  #####################
+jcs.default=
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=1000
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+
+##############################################################
+################## AUXILIARY CACHES AVAILABLE ################

Modified: jakarta/jcs/trunk/src/test-conf/TestRemoteCacheServer.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test-conf/TestRemoteCacheServer.ccf?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/TestRemoteCacheServer.ccf (original)
+++ jakarta/jcs/trunk/src/test-conf/TestRemoteCacheServer.ccf Thu Aug 24 21:29:22 2006
@@ -1,4 +1,6 @@
+##############################################################
+################## DEFAULT CACHE REGION  #####################
 jcs.default=
 jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
 jcs.default.cacheattributes.MaxObjects=1000
-jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
\ No newline at end of file

Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheMockImpl.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheMockImpl.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheMockImpl.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheMockImpl.java Thu Aug 24 21:29:22 2006
@@ -150,4 +150,11 @@
         return cacheType;
     }
 
+    /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return null;
+    }    
 }

Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryUnitTest.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/discovery/UDPDiscoveryUnitTest.java Thu Aug 24 21:29:22 2006
@@ -9,6 +9,7 @@
 import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWait;
 import org.apache.jcs.auxiliary.lateral.LateralCacheNoWaitFacade;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 import org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes;
 import org.apache.jcs.engine.behavior.ICompositeCacheManager;
 import org.apache.jcs.engine.control.CompositeCacheManager;
@@ -70,8 +71,11 @@
 
         // create a no wait facade for the service
         ArrayList noWaits = new ArrayList();
+        ILateralCacheAttributes attr = new LateralCacheAttributes();
+        attr.setCacheName( "testCache1" );
+        
         LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
-            .toArray( new LateralCacheNoWait[0] ), "testCache1" );
+            .toArray( new LateralCacheNoWait[0] ), attr );
 
         // add the facade to the service under the name testCache1
         service.addNoWaitFacade( lcnwf, "testCache1" );
@@ -145,15 +149,17 @@
 
     /**
      * Make sure the no wait facade doesn't add dupes.
-     * 
+     * <p>
      * @throws Exception
      */
     public void testNoWaitFacadeAdd()
         throws Exception
     {
         ArrayList noWaits = new ArrayList();
+        ILateralCacheAttributes attr = new LateralCacheAttributes();
+        attr.setCacheName( "testCache1" );        
         LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade( (LateralCacheNoWait[]) noWaits
-            .toArray( new LateralCacheNoWait[0] ), "testCache1" );
+            .toArray( new LateralCacheNoWait[0] ), attr );
 
         TCPLateralCacheAttributes lac = new TCPLateralCacheAttributes();
         lac.setTransmissionType( LateralCacheAttributes.TCP );

Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientMockImpl.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientMockImpl.java?rev=436643&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientMockImpl.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientMockImpl.java Thu Aug 24 21:29:22 2006
@@ -0,0 +1,240 @@
+package org.apache.jcs.auxiliary.remote;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed 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.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
+import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
+import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService;
+import org.apache.jcs.engine.CacheConstants;
+import org.apache.jcs.engine.behavior.ICacheElement;
+import org.apache.jcs.engine.stats.behavior.IStats;
+
+/**
+ * Used for testing the no wait.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class RemoteCacheClientMockImpl
+    implements IRemoteCacheClient
+{
+    private static final long serialVersionUID = 1L;
+
+    private final static Log log = LogFactory.getLog( RemoteCacheClientMockImpl.class );
+
+    /**
+     * List of ICacheElement objects passed into update.
+     */
+    public List updateList = new LinkedList();
+
+    /**
+     * List of key objects passed into remove.
+     */
+    public List removeList = new LinkedList();
+
+    /** status to return. */
+    public int status = CacheConstants.STATUS_ALIVE;
+
+    /** Can setup values to return from get. values must be ICacheElement */
+    public Map getSetupMap = new HashMap();
+
+    /**
+     * The last service passed to fixCache
+     */
+    public IRemoteCacheService fixed;
+
+    /**
+     * Attributes.
+     */
+    public RemoteCacheAttributes attributes = new RemoteCacheAttributes();
+
+    /**
+     * Stores the last argument as fixed.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient#fixCache(org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheService)
+     */
+    public void fixCache( IRemoteCacheService remote )
+    {
+        fixed = remote;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient#getListenerId()
+     */
+    public long getListenerId()
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient#getListener()
+     */
+    public IRemoteCacheListener getListener()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * Adds the argument to the updatedList.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#update(org.apache.jcs.engine.behavior.ICacheElement)
+     */
+    public void update( ICacheElement ce )
+        throws IOException
+    {
+        updateList.add( ce );
+    }
+
+    /**
+     * Looks in the getSetupMap for a value.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#get(java.io.Serializable)
+     */
+    public ICacheElement get( Serializable key )
+        throws IOException
+    {
+        log.info( "get [" + key + "]" );
+        return (ICacheElement) getSetupMap.get( key );
+    }
+
+    /**
+     * Adds the key to the remove list.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#remove(java.io.Serializable)
+     */
+    public boolean remove( Serializable key )
+        throws IOException
+    {
+        removeList.add( key );
+        return false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#removeAll()
+     */
+    public void removeAll()
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#dispose()
+     */
+    public void dispose()
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#getSize()
+     */
+    public int getSize()
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /**
+     * Returns the status setup variable. (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#getStatus()
+     */
+    public int getStatus()
+    {
+        return status;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#getCacheName()
+     */
+    public String getCacheName()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#getGroupKeys(java.lang.String)
+     */
+    public Set getGroupKeys( String group )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#getStatistics()
+     */
+    public IStats getStatistics()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * Returns the setup attributes. By default they are not null.
+     * <p>
+     * (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCache#getAuxiliaryCacheAttributes()
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return attributes;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.engine.behavior.ICache#getStats()
+     */
+    public String getStats()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jcs.engine.behavior.ICacheType#getCacheType()
+     */
+    public int getCacheType()
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+}

Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java?rev=436643&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java Thu Aug 24 21:29:22 2006
@@ -0,0 +1,172 @@
+package org.apache.jcs.auxiliary.remote;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed 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 junit.framework.TestCase;
+
+import org.apache.jcs.engine.CacheConstants;
+import org.apache.jcs.engine.CacheElement;
+import org.apache.jcs.engine.behavior.ICacheElement;
+import org.apache.jcs.engine.behavior.ICacheEventQueue;
+import org.apache.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
+        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+        RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
+
+        ICacheElement element = new CacheElement( "testUpdate", "key", "value" );
+
+        // DO WORK
+        noWait.update( element );
+
+        SleepUtil.sleepAtLeast( 10 );
+
+        // VERIFY
+        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
+        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+        RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
+
+        ICacheElement input = new CacheElement( "testUpdate", "key", "value" );
+        client.getSetupMap.put( "key", input );
+
+        // DO WORK
+        ICacheElement result = noWait.get( "key" );
+
+        // VERIFY
+        assertEquals( "Wrong element", input, result );
+    }
+
+    /**
+     * Simply verify that the client gets updated via the no wait.
+     * <p>
+     * @throws Exception
+     */
+    public void testRemove()
+        throws Exception
+    {
+        // SETUP
+        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+        RemoteCacheNoWait noWait = new RemoteCacheNoWait( 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
+        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+        client.status = CacheConstants.STATUS_ALIVE;
+        RemoteCacheNoWait noWait = new RemoteCacheNoWait( 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
+        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+        client.status = CacheConstants.STATUS_ERROR;
+        RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
+
+        // DO WORK
+        int result = noWait.getStatus();
+
+        // VERIFY
+        assertEquals( "Wrong status", CacheConstants.STATUS_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
+        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+        client.status = CacheConstants.STATUS_ALIVE;
+        RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
+
+        RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
+
+        ICacheElement element = new CacheElement( "testUpdate", "key", "value" );
+
+        // DO WORK
+        noWait.update( element );
+        SleepUtil.sleepAtLeast( 10 );        
+        ICacheEventQueue originalQueue = noWait.getCacheEventQueue();
+        
+        noWait.fixCache( service );
+
+        noWait.update( element );
+        SleepUtil.sleepAtLeast( 10 );        
+        ICacheEventQueue 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() );
+    }
+}

Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java?rev=436643&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java Thu Aug 24 21:29:22 2006
@@ -0,0 +1,77 @@
+package org.apache.jcs.auxiliary.remote.server;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed 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 junit.framework.TestCase;
+
+import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.remote.RemoteCacheAttributes;
+import org.apache.jcs.auxiliary.remote.RemoteCacheManager;
+import org.apache.jcs.engine.CacheElement;
+import org.apache.jcs.engine.behavior.ICacheElement;
+import org.apache.jcs.engine.control.CompositeCacheManagerMockImpl;
+import org.apache.jcs.utils.timing.SleepUtil;
+
+/**
+ * These tests startup the remote server and make requests to it.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class BasicRemoteCacheClientServerUnitTest
+    extends TestCase
+{
+
+    /**
+     * Verify that we can start the remote cache server. Send an item to the remote. Verify that the
+     * remote put count goes up. If we go through JCS, the manager will be shared and we will get
+     * into an endless loop. We will use a mock cache manager instead.
+     * <p>
+     * The remote server uses the real JCS. We can verify that items are added to JCS behind the
+     * server by calling get. We cannot access it directly via JCS since it is serialized.
+     * <p>
+     * This test uses a mock injected client to test a normal server.
+     * <p>
+     * @throws Exception
+     */
+    public void testSinglePut()
+        throws Exception
+    {
+        // SETUP
+        String configFile = "TestRemoteCacheClientServer.ccf";
+        RemoteCacheServer server = RemoteCacheServerStartupUtil.startServerUsingProperties( configFile );
+
+        CompositeCacheManagerMockImpl compositeCacheManager = new CompositeCacheManagerMockImpl();
+
+        RemoteCacheAttributes attributes = new RemoteCacheAttributes();
+        attributes.setRemoteHost( "localhost" );
+        attributes.setLocalPort( 1202 );
+        attributes.setRemotePort( 1101 );
+
+        RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager );
+        String regionName = "testSinglePut";
+        AuxiliaryCache cache = remoteCacheManager.getCache( regionName );
+
+        // DO WORK
+        ICacheElement element = new CacheElement( regionName, "key", "value" );
+        cache.update( element );
+        SleepUtil.sleepAtLeast( 50 );
+
+        // VERIFY
+        System.out.println( server.getStats() );
+        assertEquals( "Wrong number of puts", 1, server.getPutCount() );
+
+        // DO WORK
+        ICacheElement result = cache.get( "key" );
+
+        // VERIFY
+        assertEquals( "Wrong element.", element.getVal(), result.getVal() );
+    }
+
+}

Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java?rev=436643&r1=436642&r2=436643&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/RemoteCacheServerAttributesUnitTest.java Thu Aug 24 21:29:22 2006
@@ -1,5 +1,14 @@
 package org.apache.jcs.auxiliary.remote.server;
 
+/*
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed 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 junit.framework.TestCase;
 
 import org.apache.jcs.auxiliary.remote.server.behavior.IRemoteCacheServerAttributes;



---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org


Mime
View raw message