You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2008/08/14 00:14:48 UTC
svn commit: r685702 [4/5] - in /jakarta/jcs/trunk: ./
src/java/org/apache/jcs/auxiliary/ src/java/org/apache/jcs/auxiliary/disk/
src/java/org/apache/jcs/auxiliary/disk/block/
src/java/org/apache/jcs/auxiliary/disk/indexed/
src/java/org/apache/jcs/auxil...
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java Wed Aug 13 15:14:46 2008
@@ -38,10 +38,12 @@
import org.apache.jcs.engine.CacheConstants;
import org.apache.jcs.engine.CompositeCacheAttributes;
import org.apache.jcs.engine.ElementAttributes;
+import org.apache.jcs.engine.behavior.ICacheEventLogger;
import org.apache.jcs.engine.behavior.ICacheType;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.behavior.IElementAttributes;
+import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.behavior.IShutdownObservable;
import org.apache.jcs.engine.behavior.IShutdownObserver;
import org.apache.jcs.engine.stats.CacheStats;
@@ -49,16 +51,14 @@
import org.apache.jcs.utils.threadpool.ThreadPoolManager;
/**
- * Manages a composite cache. This provides access to caches and is the primary
- * way to shutdown the caching system as a whole.
+ * Manages a composite cache. This provides access to caches and is the primary way to shutdown the
+ * caching system as a whole.
* <p>
- * The composite cache manager is responsible for creating / configuring cache
- * regions. It serves as a factory for the ComositeCache class. The
- * CompositeCache is the core of JCS, the hub for various auxiliaries.
+ * The composite cache manager is responsible for creating / configuring cache regions. It serves as
+ * a factory for the ComositeCache class. The CompositeCache is the core of JCS, the hub for various
+ * auxiliaries.
* <p>
- * It is recommended that you use the JCS convenience class for all cache
- * access.
- *
+ * It is recommended that you use the JCS convenience class for all cache access.
*/
public class CompositeCacheManager
implements IRemoteCacheConstants, Serializable, ICompositeCacheManager, IShutdownObservable
@@ -83,10 +83,10 @@
protected IElementAttributes defaultElementAttr = new ElementAttributes();
/** Used to keep track of configured auxiliaries */
- protected Hashtable auxFacs = new Hashtable( 11 );
+ protected Hashtable auxiliaryFactoryRegistry = new Hashtable( 11 );
- /** ??? */
- protected Hashtable auxAttrs = new Hashtable( 11 );
+ /** Used to keep track of attributes for auxiliaries. */
+ protected Hashtable auxiliaryAttributeRegistry = new Hashtable( 11 );
/** Properties with which this manager was configured */
protected Properties props;
@@ -104,12 +104,10 @@
private Set shutdownObservers = new HashSet();
/**
- * Gets the CacheHub instance. For backward compatibility, if this creates
- * the instance it will attempt to configure it with the default
- * configuration. If you want to configure from your own source, use
- * {@link #getUnconfiguredInstance}and then call {@link #configure}
- *
- * @return
+ * Gets the CacheHub instance. For backward compatibility, if this creates the instance it will
+ * attempt to configure it with the default configuration. If you want to configure from your
+ * own source, use {@link #getUnconfiguredInstance}and then call {@link #configure}
+ * @return CompositeCacheManager
*/
public static synchronized CompositeCacheManager getInstance()
{
@@ -129,7 +127,6 @@
/**
* Initializes the cache manager using the props file for the given name.
- *
* @param propsFilename
* @return CompositeCacheManager configured from the give propsFileName
*/
@@ -153,10 +150,10 @@
}
/**
- * Get a CacheHub instance which is not configured. If an instance already
- * exists, it will be returned.
- *
- * @return
+ * Get a CacheHub instance which is not configured. If an instance already exists, it will be
+ * returned.
+ *<p>
+ * @return CompositeCacheManager
*/
public static synchronized CompositeCacheManager getUnconfiguredInstance()
{
@@ -176,9 +173,8 @@
}
/**
- * Simple factory method, must override in subclasses so getInstance creates /
- * returns the correct object.
- *
+ * Simple factory method, must override in subclasses so getInstance creates / returns the
+ * correct object.
* @return CompositeCacheManager
*/
protected static CompositeCacheManager createInstance()
@@ -196,9 +192,8 @@
/**
* Configure from specific properties file.
- *
- * @param propFile
- * Path <u>within classpath </u> to load configuration from
+ * <p>
+ * @param propFile Path <u>within classpath </u> to load configuration from
*/
public void configure( String propFile )
{
@@ -248,9 +243,7 @@
/**
* Configure from properties object.
* <p>
- * This method will call confiure, instructing it to use ssytem properties
- * as a default.
- *
+ * This method will call confiure, instructing it to use ssytem properties as a default.
* @param props
*/
public void configure( Properties props )
@@ -259,19 +252,16 @@
}
/**
- * Configure from properties object, overriding with values from the system
- * properteis if instructed.
+ * Configure from properties object, overriding with values from the system properteis if
+ * instructed.
* <p>
- * You can override a specif value by passing in a ssytem property:
+ * You can override a specific value by passing in a ssytem property:
+ * <p>
+ * For example, you could override this value in the cache.ccf file by starting up your program
+ * with the argument: -Djcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
* <p>
- * For example, you could override this value in the cache.ccf file by
- * starting up your program with the argument:
- * -Djcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
- *
- *
* @param props
- * @param useSystemProperties --
- * if true, values starting with jcs will be put into the props
+ * @param useSystemProperties -- if true, values starting with jcs will be put into the props
* file prior to configuring the cache.
*/
public void configure( Properties props, boolean useSystemProperties )
@@ -323,7 +313,7 @@
/**
* Gets the defaultCacheAttributes attribute of the CacheHub object
- *
+ * <p>
* @return The defaultCacheAttributes value
*/
public ICompositeCacheAttributes getDefaultCacheAttributes()
@@ -333,9 +323,8 @@
/**
* Sets the defaultCacheAttributes attribute of the CacheHub object
- *
- * @param icca
- * The new defaultCacheAttributes value
+ * <p>
+ * @param icca The new defaultCacheAttributes value
*/
public void setDefaultCacheAttributes( ICompositeCacheAttributes icca )
{
@@ -344,9 +333,8 @@
/**
* Sets the defaultElementAttributes attribute of the CacheHub object
- *
- * @param iea
- * The new defaultElementAttributes value
+ * <p>
+ * @param iea The new defaultElementAttributes value
*/
public void setDefaultElementAttributes( IElementAttributes iea )
{
@@ -355,7 +343,7 @@
/**
* Gets the defaultElementAttributes attribute of the CacheHub object
- *
+ * <p>
* @return The defaultElementAttributes value
*/
public IElementAttributes getDefaultElementAttributes()
@@ -365,7 +353,7 @@
/**
* Gets the cache attribute of the CacheHub object
- *
+ * <p>
* @param cacheName
* @return CompositeCache -- the cache region controller
*/
@@ -376,10 +364,10 @@
/**
* Gets the cache attribute of the CacheHub object
- *
+ * <p>
* @param cacheName
* @param cattr
- * @return
+ * @return CompositeCache
*/
public CompositeCache getCache( String cacheName, ICompositeCacheAttributes cattr )
{
@@ -389,11 +377,11 @@
/**
* Gets the cache attribute of the CacheHub object
- *
+ * <p>
* @param cacheName
* @param cattr
* @param attr
- * @return
+ * @return CompositeCache
*/
public CompositeCache getCache( String cacheName, ICompositeCacheAttributes cattr, IElementAttributes attr )
{
@@ -403,9 +391,9 @@
/**
* Gets the cache attribute of the CacheHub object
- *
+ * <p>
* @param cattr
- * @return
+ * @return CompositeCache
*/
public CompositeCache getCache( ICompositeCacheAttributes cattr )
{
@@ -413,16 +401,14 @@
}
/**
- * If the cache has already been created, then the CacheAttributes and the
- * element Attributes will be ignored. Currently there is no overiding the
- * CacheAttributes once it is set up. You can change the default
- * ElementAttributes for a region later.
- * <p>
- * Overriding the default elemental atributes will require changing the way
- * the atributes are assigned to elements. Get cache creates a cache with
- * defaults if none are specified. We might want to create separate method
- * for creating/getting. . .
- *
+ * If the cache has already been created, then the CacheAttributes and the element Attributes
+ * will be ignored. Currently there is no overiding the CacheAttributes once it is set up. You
+ * can change the default ElementAttributes for a region later.
+ * <p>
+ * Overriding the default elemental attributes will require changing the way the attributes are
+ * assigned to elements. Get cache creates a cache with defaults if none are specified. We might
+ * want to create separate method for creating/getting. . .
+ * <p>
* @param cattr
* @param attr
* @return CompositeCache
@@ -555,7 +541,6 @@
/**
* Returns a list of the current cache names.
- *
* @return String[]
*/
public String[] getCacheNames()
@@ -570,7 +555,7 @@
}
/**
- * @return
+ * @return ICacheType.CACHE_HUB
*/
public int getCacheType()
{
@@ -590,7 +575,7 @@
*/
void registryFacPut( AuxiliaryCacheFactory auxFac )
{
- auxFacs.put( auxFac.getName(), auxFac );
+ auxiliaryFactoryRegistry.put( auxFac.getName(), auxFac );
}
/**
@@ -599,7 +584,7 @@
*/
AuxiliaryCacheFactory registryFacGet( String name )
{
- return (AuxiliaryCacheFactory) auxFacs.get( name );
+ return (AuxiliaryCacheFactory) auxiliaryFactoryRegistry.get( name );
}
/**
@@ -607,7 +592,7 @@
*/
void registryAttrPut( AuxiliaryCacheAttributes auxAttr )
{
- auxAttrs.put( auxAttr.getName(), auxAttr );
+ auxiliaryAttributeRegistry.put( auxAttr.getName(), auxAttr );
}
/**
@@ -616,13 +601,14 @@
*/
AuxiliaryCacheAttributes registryAttrGet( String name )
{
- return (AuxiliaryCacheAttributes) auxAttrs.get( name );
+ return (AuxiliaryCacheAttributes) auxiliaryAttributeRegistry.get( name );
}
+
/**
- * Gets stats for debugging. This calls gets statistics and then puts all
- * the results in a string. This returns data for all regions.
- *
+ * Gets stats for debugging. This calls gets statistics and then puts all the results in a
+ * string. This returns data for all regions.
+ * <p>
* @return String
*/
public String getStats()
@@ -645,10 +631,9 @@
}
/**
- * This returns data gathered for all regions and all the auxiliaries they
- * currently uses.
- *
- * @return
+ * This returns data gathered for all regions and all the auxiliaries they currently uses.
+ * <p>
+ * @return ICacheStats[]
*/
public ICacheStats[] getStatistics()
{
@@ -667,11 +652,10 @@
}
/**
- * Perhaps the composite cache itself should be the observable object. It
- * doesn't make much of a difference. There are some problems with region by
- * region shutdown. Some auxiliaries are global. They will need to track
- * when every region has shutdown before doing things like closing the
- * socket with a lateral.
+ * Perhaps the composite cache itself should be the observable object. It doesn't make much of a
+ * difference. There are some problems with region by region shutdown. Some auxiliaries are
+ * global. They will need to track when every region has shutdown before doing things like
+ * closing the socket with a lateral.
* <p>
* @param observer
*/
@@ -686,10 +670,8 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jcs.engine.behavior.ShutdownObservable#deregisterShutdownObserver(org.apache.jcs.engine.behavior.ShutdownObserver)
+ /**
+ * @param observer
*/
public void deregisterShutdownObserver( IShutdownObserver observer )
{
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/memory/AbstractMemoryCache.java Wed Aug 13 15:14:46 2008
@@ -47,14 +47,15 @@
/**
* Some common code for the LRU and MRU caches.
* <p>
- * This keeps a static reference to a memory shrinker clock daemon. If this
- * region is configured to use the shrinker, the clock daemon will be setup to
- * run the shrinker on this region.
- * @version $Id$
+ * This keeps a static reference to a memory shrinker clock daemon. If this region is configured to
+ * use the shrinker, the clock daemon will be setup to run the shrinker on this region.
*/
public abstract class AbstractMemoryCache
implements MemoryCache, Serializable
{
+ /** Don't change. */
+ private static final long serialVersionUID = -4494626991630099575L;
+
/** log instance */
private final static Log log = LogFactory.getLog( AbstractMemoryCache.class );
@@ -64,24 +65,16 @@
/** The region name. This defines a namespace of sorts. */
protected String cacheName;
- /**
- * Map where items are stored by key
- */
+ /** Map where items are stored by key */
protected Map map;
- /**
- * Region Elemental Attributes, used as a default.
- */
+ /** Region Elemental Attributes, used as a default. */
public IElementAttributes attr;
- /**
- * Cache Attributes
- */
+ /** Cache Attributes */
public ICompositeCacheAttributes cattr;
- /**
- * The cache region this store is associated with
- */
+ /** The cache region this store is associated with */
protected CompositeCache cache;
/** status */
@@ -90,14 +83,10 @@
/** How many to spool at a time. TODO make configurable */
protected int chunkSize = DEFAULT_CHUNK_SIZE;
- /**
- * The background memory shrinker, one for all regions.
- */
+ /** The background memory shrinker, one for all regions. */
private static ClockDaemon shrinkerDaemon;
- /**
- * Constructor for the LRUMemoryCache object
- */
+ /** Constructor for the LRUMemoryCache object */
public AbstractMemoryCache()
{
status = CacheConstants.STATUS_ERROR;
@@ -106,6 +95,7 @@
/**
* For post reflection creation initialization
+ * <p>
* @param hub
*/
public synchronized void initialize( CompositeCache hub )
@@ -131,22 +121,20 @@
/**
* Removes an item from the cache
- * @param key
- * Identifies item to be removed
+ * <p>
+ * @param key Identifies item to be removed
* @return Description of the Return Value
- * @exception IOException
- * Description of the Exception
+ * @exception IOException Description of the Exception
*/
public abstract boolean remove( Serializable key )
throws IOException;
/**
* Get an item from the cache
- * @param key
- * Description of the Parameter
+ * <p>
+ * @param key Description of the Parameter
* @return Description of the Return Value
- * @exception IOException
- * Description of the Exception
+ * @exception IOException Description of the Exception
*/
public abstract ICacheElement get( Serializable key )
throws IOException;
@@ -155,9 +143,9 @@
* Gets multiple items from the cache based on the given set of keys.
* <p>
* @param keys
- * @return a map of Serializable key to ICacheElement element, or an empty map
- * if there is no data in cache for any of these keys
- * @throws IOException
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
+ * @throws IOException
*/
public Map getMultiple( Set keys )
throws IOException
@@ -185,35 +173,34 @@
}
/**
- * Get an item from the cache without affecting its order or last access
- * time
- * @param key
- * Description of the Parameter
+ * Get an item from the cache without affecting its order or last access time
+ * <p>
+ * @param key Description of the Parameter
* @return The quiet value
- * @exception IOException
- * Description of the Exception
+ * @exception IOException Description of the Exception
*/
public abstract ICacheElement getQuiet( Serializable key )
throws IOException;
/**
* Puts an item to the cache.
- * @param ce
- * Description of the Parameter
- * @exception IOException
- * Description of the Exception
+ * <p>
+ * @param ce Description of the Parameter
+ * @exception IOException Description of the Exception
*/
public abstract void update( ICacheElement ce )
throws IOException;
/**
* Get an Array of the keys for all elements in the memory cache
+ * <p>
* @return An Object[]
*/
public abstract Object[] getKeyArray();
/**
* Removes all cached items from the cache.
+ * <p>
* @exception IOException
*/
public void removeAll()
@@ -224,6 +211,7 @@
/**
* Prepares for shutdown.
+ * <p>
* @exception IOException
*/
public void dispose()
@@ -248,6 +236,7 @@
/**
* Returns the current cache size.
+ * <p>
* @return The size value
*/
public int getSize()
@@ -257,6 +246,7 @@
/**
* Returns the cache status.
+ * <p>
* @return The status value
*/
public int getStatus()
@@ -266,6 +256,7 @@
/**
* Returns the cache name.
+ * <p>
* @return The cacheName value
*/
public String getCacheName()
@@ -275,6 +266,7 @@
/**
* Puts an item to the cache.
+ * <p>
* @param ce
* @exception IOException
*/
@@ -286,6 +278,7 @@
/**
* Gets the iterator attribute of the LRUMemoryCache object
+ * <p>
* @return The iterator value
*/
public Iterator getIterator()
@@ -295,6 +288,7 @@
/**
* Returns the CacheAttributes.
+ * <p>
* @return The CacheAttributes value
*/
public ICompositeCacheAttributes getCacheAttributes()
@@ -304,8 +298,8 @@
/**
* Sets the CacheAttributes.
- * @param cattr
- * The new CacheAttributes value
+ * <p>
+ * @param cattr The new CacheAttributes value
*/
public void setCacheAttributes( ICompositeCacheAttributes cattr )
{
@@ -314,6 +308,7 @@
/**
* Gets the cache hub / region that the MemoryCache is used by
+ * <p>
* @return The cache value
*/
public CompositeCache getCompositeCache()
@@ -322,7 +317,7 @@
}
/**
- * @param groupName
+ * @param groupName
* @return group keys
*/
public Set getGroupKeys( String groupName )
@@ -347,13 +342,14 @@
/**
* Allows us to set the daemon status on the clockdaemon
+ * <p>
* @author aaronsm
*/
class MyThreadFactory
implements ThreadFactory
{
- /**
- * @param runner
+ /**
+ * @param runner
* @return a new thread for the given Runnable
*/
public Thread newThread( Runnable runner )
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/AbstractJCSWorkerHelper.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/AbstractJCSWorkerHelper.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/AbstractJCSWorkerHelper.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/AbstractJCSWorkerHelper.java Wed Aug 13 15:14:46 2008
@@ -20,8 +20,8 @@
*/
/**
- * This is an abstract template for JCSWorkerHelper implementations. it simple
- * has a convenience method for setting the finished flag.
+ * This is an abstract template for JCSWorkerHelper implementations. it simple has a convenience
+ * method for setting the finished flag.
* <p>
* @author tsavo
*/
@@ -38,11 +38,17 @@
super();
}
+ /**
+ * @return finished
+ */
public boolean isFinished()
{
return finished;
}
+ /**
+ * @param isFinished
+ */
public void setFinished( boolean isFinished )
{
finished = isFinished;
Copied: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java (from r682483, jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java)
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java?p2=jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java&p1=jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java&r1=682483&r2=685702&rev=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/config/OptionConverter.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java Wed Aug 13 15:14:46 2008
@@ -1,4 +1,4 @@
-package org.apache.jcs.config;
+package org.apache.jcs.utils.config;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -25,15 +25,13 @@
import org.apache.commons.logging.LogFactory;
/**
- * This class is based on the log4j class
- * org.apache.log4j.helpers.OptionConverter that was made by Ceki
- * Gülcü Simon Kitching; Avy Sharell (sharell@online.fr) Anders
- * Kristensen Matthieu Verbert (mve@zurich.ibm.com) A convenience class to
- * convert property values to specific types.
- *
+ * This class is based on the log4j class org.apache.log4j.helpers.OptionConverter that was made by
+ * Ceki Gülcü Simon Kitching; Avy Sharell (sharell@online.fr) Anders Kristensen Matthieu
+ * Verbert (mve@zurich.ibm.com) A convenience class to convert property values to specific types.
*/
public class OptionConverter
{
+ /** The logger */
private final static Log log = LogFactory.getLog( OptionConverter.class );
static String DELIM_START = "${";
@@ -54,7 +52,6 @@
/**
* Combines two arrays.
- *
* @param l
* @param r
* @return String[]
@@ -72,9 +69,8 @@
/**
* Escapes special cahracters/
- *
* @param s
- * @return String
+ * @return String
*/
public static String convertSpecialChars( String s )
{
@@ -128,15 +124,12 @@
}
/**
- * Very similar to <code>System.getProperty</code> except that the {@link
- * SecurityException} is hidden.
- *
- * @param key
- * The key to search for.
- * @param def
- * The default value to return.
- * @return the string value of the system property, or the default value if
- * there is no property with that key.
+ * Very similar to <code>System.getProperty</code> except that the {@link SecurityException} is
+ * hidden.
+ * @param key The key to search for.
+ * @param def The default value to return.
+ * @return the string value of the system property, or the default value if there is no property
+ * with that key.
* @since 1.1
*/
@@ -156,7 +149,6 @@
/**
* Creates an object for the className value of the key.
- *
* @param props
* @param key
* @param superClass
@@ -181,15 +173,13 @@
}
/**
- * If <code>value</code> is "true", then <code>true</code> is returned.
- * If <code>value</code> is "false", then <code>true</code> is returned.
- * Otherwise, <code>default</code> is returned.
+ * If <code>value</code> is "true", then <code>true</code> is returned. If <code>value</code> is
+ * "false", then <code>true</code> is returned. Otherwise, <code>default</code> is returned.
* <p>
- *
* Case of value is unimportant.
* @param value
* @param dEfault
- * @return Object
+ * @return Object
*/
public static boolean toBoolean( String value, boolean dEfault )
@@ -210,10 +200,12 @@
return dEfault;
}
- /** Description of the Method
+ /**
+ * Converts to int.
+ * <p>
* @param value
* @param dEfault
- * @return
+ * @return int
*/
public static int toInt( String value, int dEfault )
{
@@ -236,7 +228,7 @@
/**
* @param value
* @param dEfault
- * @return
+ * @return long
*/
public static long toFileSize( String value, long dEfault )
{
@@ -280,11 +272,12 @@
}
/**
- * Find the value corresponding to <code>key</code> in <code>props</code>.
- * Then perform variable substitution on the found value.
+ * Find the value corresponding to <code>key</code> in <code>props</code>. Then perform variable
+ * substitution on the found value.
+ * <p>
* @param key
* @param props
- * @return
+ * @return substituted string
*/
public static String findAndSubst( String key, Properties props )
@@ -307,18 +300,14 @@
}
/**
- * Instantiate an object given a class name. Check that the
- * <code>className</code> is a subclass of <code>superClass</code>. If
- * that test fails or the object could not be instantiated, then
+ * Instantiate an object given a class name. Check that the <code>className</code> is a subclass
+ * of <code>superClass</code>. If that test fails or the object could not be instantiated, then
* <code>defaultValue</code> is returned.
- *
- * @param className
- * The fully qualified class name of the object to instantiate.
- * @param superClass
- * The class to which the new object should belong.
- * @param defaultValue
- * The object to return in case of non-fulfillment
- * @return
+ * <p>
+ * @param className The fully qualified class name of the object to instantiate.
+ * @param superClass The class to which the new object should belong.
+ * @param defaultValue The object to return in case of non-fulfillment
+ * @return instantiated object
*/
public static Object instantiateByClassName( String className, Class superClass, Object defaultValue )
@@ -345,52 +334,41 @@
}
/**
- * Perform variable substitution in string <code>val</code> from the
- * values of keys found in the system propeties.
+ * Perform variable substitution in string <code>val</code> from the values of keys found in the
+ * system properties.
* <p>
- *
* The variable substitution delimeters are <b>${ </b> and <b>} </b>.
* <p>
- *
* For example, if the System properties contains "key=value", then the call
- *
+ *
* <pre>
* String s = OptionConverter.substituteVars( "Value of key is ${key}." );
* </pre>
- *
+ *
* will set the variable <code>s</code> to "Value of key is value.".
* <p>
- *
- * If no value could be found for the specified key, then the
- * <code>props</code> parameter is searched, if the value could not be
- * found there, then substitution defaults to the empty string.
+ * If no value could be found for the specified key, then the <code>props</code> parameter is
+ * searched, if the value could not be found there, then substitution defaults to the empty
+ * string.
* <p>
- *
- * For example, if system propeties contains no value for the key
- * "inexistentKey", then the call
- *
+ * For example, if system propeties contains no value for the key "inexistentKey", then the call
+ *
* <pre>
* String s = OptionConverter.subsVars( "Value of inexistentKey is [${inexistentKey}]" );
* </pre>
- *
+ *
* will set <code>s</code> to "Value of inexistentKey is []"
* <p>
- *
- * An {@link java.lang.IllegalArgumentException}is thrown if
- * <code>val</code> contains a start delimeter "${" which is not balanced
- * by a stop delimeter "}".
+ * An {@link java.lang.IllegalArgumentException}is thrown if <code>val</code> contains a start
+ * delimeter "${" which is not balanced by a stop delimeter "}".
* </p>
* <p>
- *
* <b>Author </b> Avy Sharell </a>
* </p>
- *
- * @param val
- * The string on which variable substitution is performed.
+ * @param val The string on which variable substitution is performed.
* @param props
* @return String
- * @throws IllegalArgumentException
- * if <code>val</code> is malformed.
+ * @throws IllegalArgumentException if <code>val</code> is malformed.
*/
public static String substVars( String val, Properties props )
@@ -438,6 +416,4 @@
i = k + DELIM_STOP_LEN;
}
}
-
}
-// end class
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java
------------------------------------------------------------------------------
cvs2svn:cvs-rev = 1.5
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java (from r682483, jakarta/jcs/trunk/src/java/org/apache/jcs/config/PropertySetter.java)
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java?p2=jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java&p1=jakarta/jcs/trunk/src/java/org/apache/jcs/config/PropertySetter.java&r1=682483&r2=685702&rev=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/config/PropertySetter.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java Wed Aug 13 15:14:46 2008
@@ -1,4 +1,4 @@
-package org.apache.jcs.config;
+package org.apache.jcs.utils.config;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -29,8 +29,8 @@
import java.util.Enumeration;
import java.util.Properties;
-import org.apache.jcs.config.OptionConverter;
-import org.apache.jcs.config.PropertySetterException;
+import org.apache.jcs.utils.config.OptionConverter;
+import org.apache.jcs.utils.config.PropertySetterException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
------------------------------------------------------------------------------
cvs2svn:cvs-rev = 1.4
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java (from r682483, jakarta/jcs/trunk/src/java/org/apache/jcs/config/PropertySetterException.java)
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java?p2=jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java&p1=jakarta/jcs/trunk/src/java/org/apache/jcs/config/PropertySetterException.java&r1=682483&r2=685702&rev=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/config/PropertySetterException.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java Wed Aug 13 15:14:46 2008
@@ -1,4 +1,4 @@
-package org.apache.jcs.config;
+package org.apache.jcs.utils.config;
/*
* Licensed to the Apache Software Foundation (ASF) under one
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java
------------------------------------------------------------------------------
cvs2svn:cvs-rev = 1.4
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/package.html
------------------------------------------------------------------------------
cvs2svn:cvs-rev = 1.1
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/package.html
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/package.html
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java Wed Aug 13 15:14:46 2008
@@ -38,7 +38,11 @@
implements IElementSerializer
{
/**
- * Serializes an object using default serilaization.
+ * Serializes an object using default serialization.
+ * <p>
+ * @param obj
+ * @return byte[]
+ * @throws IOException
*/
public byte[] serialize( Serializable obj )
throws IOException
@@ -57,8 +61,13 @@
}
/**
- * Uses default de-serialization to turn a byte array into an object. All
- * exceptions are converted into IOExceptions.
+ * Uses default de-serialization to turn a byte array into an object. All exceptions are
+ * converted into IOExceptions.
+ * <p>
+ * @param data
+ * @return Object
+ * @throws IOException
+ * @throws ClassNotFoundException
*/
public Object deSerialize( byte[] data )
throws IOException, ClassNotFoundException
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java Wed Aug 13 15:14:46 2008
@@ -49,14 +49,15 @@
* <p>
* Locking is done on the instance.
* <p>
- * @author aaronsm
+ * @author aaron smuts
*/
public class LRUMap
implements Map
{
+ /** The logger */
private final static Log log = LogFactory.getLog( LRUMap.class );
- // double linked list for lru
+ /** double linked list for lru */
private DoubleLinkedList list;
/** Map where items are stored by key. */
@@ -68,10 +69,10 @@
int putCnt = 0;
- // if the max is less than 0, there is no limit!
+ /** if the max is less than 0, there is no limit! */
int maxObjects = -1;
- // make configurable
+ /** make configurable */
private int chunkSize = 1;
/**
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java Wed Aug 13 15:14:46 2008
@@ -30,10 +30,13 @@
public class LRUMapEntry
implements Entry, Serializable
{
+ /** Don't change */
private static final long serialVersionUID = -8176116317739129331L;
+ /** key */
private Object key;
+ /** value */
private Object value;
/**
@@ -47,27 +50,25 @@
this.value = value;
}
- /*
- * (non-Javadoc)
- * @see java.util.Map$Entry#getKey()
+ /**
+ * @return key
*/
public Object getKey()
{
return this.key;
}
- /*
- * (non-Javadoc)
- * @see java.util.Map$Entry#getValue()
+ /**
+ * @return value
*/
public Object getValue()
{
return this.value;
}
- /*
- * (non-Javadoc)
- * @see java.util.Map$Entry#setValue(java.lang.Object)
+ /**
+ * @param valueArg
+ * @return the old value
*/
public Object setValue( Object valueArg )
{
Copied: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java (from r682483, 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/MockAuxiliaryCache.java?p2=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java&p1=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheMockImpl.java&r1=682483&r2=685702&rev=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheMockImpl.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java Wed Aug 13 15:14:46 2008
@@ -28,6 +28,8 @@
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.ICacheEventLogger;
+import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.stats.behavior.IStats;
/**
@@ -35,7 +37,7 @@
* <p>
* @author Aaron Smuts
*/
-public class AuxiliaryCacheMockImpl
+public class MockAuxiliaryCache
implements AuxiliaryCache
{
private static final long serialVersionUID = 1L;
@@ -46,9 +48,9 @@
/** Can setup status */
public int status = CacheConstants.STATUS_ALIVE;
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.AuxiliaryCache#update(org.apache.jcs.engine.behavior.ICacheElement)
+ /**
+ * @param ce
+ * @throws IOException
*/
public void update( ICacheElement ce )
throws IOException
@@ -57,9 +59,10 @@
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.AuxiliaryCache#get(java.io.Serializable)
+ /**
+ * @param key
+ * @return ICacheElement
+ * @throws IOException
*/
public ICacheElement get( Serializable key )
throws IOException
@@ -72,16 +75,18 @@
* Gets multiple items from the cache based on the given set of keys.
* <p>
* @param keys
- * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
*/
public Map getMultiple( Set keys )
{
return new HashMap();
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.AuxiliaryCache#remove(java.io.Serializable)
+ /**
+ * @param key
+ * @return boolean
+ * @throws IOException
*/
public boolean remove( Serializable key )
throws IOException
@@ -90,9 +95,8 @@
return false;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.AuxiliaryCache#removeAll()
+ /**
+ * @throws IOException
*/
public void removeAll()
throws IOException
@@ -101,9 +105,8 @@
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.AuxiliaryCache#dispose()
+ /**
+ * @throws IOException
*/
public void dispose()
throws IOException
@@ -112,9 +115,8 @@
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.AuxiliaryCache#getSize()
+ /**
+ * @return int
*/
public int getSize()
{
@@ -189,4 +191,16 @@
{
return null;
}
+
+ public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setElementSerializer( IElementSerializer elementSerializer )
+ {
+ // TODO Auto-generated method stub
+
+ }
}
Propchange: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockAuxiliaryCache.java
------------------------------------------------------------------------------
svn:mergeinfo =
Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java?rev=685702&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java (added)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/MockCacheEventLogger.java Wed Aug 13 15:14:46 2008
@@ -0,0 +1,135 @@
+package org.apache.jcs.auxiliary;
+
+import java.io.Serializable;
+
+import org.apache.jcs.engine.behavior.ICacheElement;
+import org.apache.jcs.engine.behavior.ICacheEventLogger;
+
+/**
+ * For testing auxiliary event logging. Improve later so we can test the details. This is very
+ * crude.
+ */
+public class MockCacheEventLogger
+ implements ICacheEventLogger
+{
+ /** times called */
+ public int applicationEventCalls = 0;
+
+ /** times called */
+ public int startICacheEventCalls = 0;
+
+ /** times called */
+ public int endICacheEventCalls = 0;
+
+ /** times called */
+ public int errorEventCalls = 0;
+
+ /**
+ * @param source
+ * @param eventName
+ * @param optionalDetails
+ */
+ public void logApplicationEvent( String source, String eventName, String optionalDetails )
+ {
+ applicationEventCalls++;
+ }
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param optionalDetails
+ * @param key
+ */
+ public void logEndICacheEvent( String source, String region, String eventName, String optionalDetails,
+ Serializable key )
+ {
+ endICacheEventCalls++;
+ }
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param optionalDetails
+ * @param item
+ */
+ public void logEndICacheEvent( String source, String region, String eventName, String optionalDetails,
+ ICacheElement item )
+ {
+ endICacheEventCalls++;
+ }
+
+ /**
+ * @param source
+ * @param eventName
+ * @param errorMessage
+ */
+ public void logError( String source, String eventName, String errorMessage )
+ {
+ errorEventCalls++;
+ }
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param errorMessage
+ */
+ public void logError( String source, String region, String eventName, String errorMessage )
+ {
+ errorEventCalls++;
+ }
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param errorMessage
+ * @param item
+ */
+ public void logError( String source, String region, String eventName, String errorMessage, ICacheElement item )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param errorMessage
+ * @param key
+ */
+ public void logError( String source, String region, String eventName, String errorMessage, Serializable key )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param optionalDetails
+ * @param key
+ */
+ public void logStartICacheEvent( String source, String region, String eventName, String optionalDetails,
+ Serializable key )
+ {
+ startICacheEventCalls++;
+ }
+
+ /**
+ * @param source
+ * @param region
+ * @param eventName
+ * @param optionalDetails
+ * @param item
+ */
+ public void logStartICacheEvent( String source, String region, String eventName, String optionalDetails,
+ ICacheElement item )
+ {
+ startICacheEventCalls++;
+ }
+}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/lateral/socket/tcp/TestTCPLateralUnitTest.java Wed Aug 13 15:14:46 2008
@@ -28,7 +28,7 @@
import org.apache.jcs.engine.behavior.ICacheElement;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.control.CompositeCacheManager;
-import org.apache.jcs.engine.control.CompositeCacheManagerMockImpl;
+import org.apache.jcs.engine.control.MockCompositeCacheManager;
import org.apache.jcs.utils.timing.SleepUtil;
/**
@@ -104,7 +104,7 @@
TCPLateralCacheAttributes lattr = new TCPLateralCacheAttributes();
lattr.setTcpListenerPort( 1101 );
lattr.setTransmissionTypeName( "TCP" );
- CompositeCacheManagerMockImpl cacheMgr = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager cacheMgr = new MockCompositeCacheManager();
System.out.println( "mock cache = " + cacheMgr.getCache( "test" ) );
// force initialization
@@ -152,7 +152,7 @@
// setup a listener
TCPLateralCacheAttributes lattr = new TCPLateralCacheAttributes();
lattr.setTcpListenerPort( 1103 );
- CompositeCacheManagerMockImpl cacheMgr = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager cacheMgr = new MockCompositeCacheManager();
System.out.println( "mock cache = " + cacheMgr.getCache( "test" ) );
// get the listener started
@@ -194,7 +194,7 @@
TCPLateralCacheAttributes lattr = new TCPLateralCacheAttributes();
lattr.setTcpListenerPort( 1105 );
lattr.setTransmissionTypeName( "TCP" );
- CompositeCacheManagerMockImpl cacheMgr = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager cacheMgr = new MockCompositeCacheManager();
System.out.println( "mock cache = " + cacheMgr.getCache( "test" ) );
// get the listener started
@@ -237,7 +237,7 @@
// setup a listener
TCPLateralCacheAttributes lattr = new TCPLateralCacheAttributes();
lattr.setTcpListenerPort( 1107 );
- CompositeCacheManagerMockImpl cacheMgr = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager cacheMgr = new MockCompositeCacheManager();
System.out.println( "mock cache = " + cacheMgr.getCache( "test" ) );
// get the listener started
Copied: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java (from r682483, 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/MockRemoteCacheClient.java?p2=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java&p1=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientMockImpl.java&r1=682483&r2=685702&rev=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientMockImpl.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java Wed Aug 13 15:14:46 2008
@@ -34,6 +34,8 @@
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.behavior.ICacheEventLogger;
+import org.apache.jcs.engine.behavior.IElementSerializer;
import org.apache.jcs.engine.stats.behavior.IStats;
/**
@@ -41,14 +43,14 @@
* <p>
* @author Aaron Smuts
*/
-public class RemoteCacheClientMockImpl
+public class MockRemoteCacheClient
implements IRemoteCacheClient
{
/** For serialization. Don't change. */
private static final long serialVersionUID = 1L;
/** log instance */
- private final static Log log = LogFactory.getLog( RemoteCacheClientMockImpl.class );
+ private final static Log log = LogFactory.getLog( MockRemoteCacheClient.class );
/** List of ICacheElement objects passed into update. */
public List updateList = new LinkedList();
@@ -82,18 +84,16 @@
fixed = remote;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient#getListenerId()
+ /**
+ * @return long
*/
public long getListenerId()
{
return 0;
}
- /*
- * (non-Javadoc)
- * @see org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheClient#getListener()
+ /**
+ * @return null
*/
public IRemoteCacheListener getListener()
{
@@ -127,7 +127,8 @@
* Gets multiple items from the cache based on the given set of keys.
* <p>
* @param keys
- * @return a map of Serializable key to ICacheElement element, or an empty map if there is no data in cache for any of these keys
+ * @return a map of Serializable key to ICacheElement element, or an empty map if there is no
+ * data in cache for any of these keys
*/
public Map getMultiple( Set keys )
{
@@ -238,4 +239,14 @@
{
return 0;
}
+
+ public void setCacheEventLogger( ICacheEventLogger cacheEventLogger )
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public void setElementSerializer( IElementSerializer elementSerializer )
+ {
+ // TODO Auto-generated method stub
+ }
}
Propchange: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheClient.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java (from r682483, jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerMockImpl.java)
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java?p2=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java&p1=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerMockImpl.java&r1=682483&r2=685702&rev=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerMockImpl.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java Wed Aug 13 15:14:46 2008
@@ -33,12 +33,15 @@
* <p>
* @author Aaron Smuts
*/
-public class RemoteCacheListenerMockImpl
+public class MockRemoteCacheListener
implements IRemoteCacheListener
{
/** Setup the listener id that this will return. */
private long listenerId;
+ /** Setup the listener ip that this will return. */
+ public String localAddress;
+
/** Number of times handlePut was called. */
public int putCount;
@@ -72,8 +75,7 @@
public String getLocalHostAddress()
throws IOException
{
- // TODO Auto-generated method stub
- return null;
+ return localAddress;
}
/**
Propchange: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheListener.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java (from r682483, jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheServiceMockImpl.java)
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java?p2=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java&p1=jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheServiceMockImpl.java&r1=682483&r2=685702&rev=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheServiceMockImpl.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java Wed Aug 13 15:14:46 2008
@@ -34,7 +34,7 @@
* <p>
* @author admin
*/
-public class RemoteCacheServiceMockImpl
+public class MockRemoteCacheService
implements IRemoteCacheService
{
/** The object that was last passed to update. */
Propchange: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/MockRemoteCacheService.java
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheClientTester.java Wed Aug 13 15:14:46 2008
@@ -38,10 +38,7 @@
import org.apache.jcs.engine.behavior.ICacheService;
/**
- * Description of the Class
- *
- * @author asmuts
- * @created January 15, 2002
+ * Manual tester.
*/
public class RemoteCacheClientTester
implements IRemoteCacheListener, IRemoteCacheConstants
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java Wed Aug 13 15:14:46 2008
@@ -29,7 +29,7 @@
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.jcs.engine.behavior.IElementAttributes;
import org.apache.jcs.engine.behavior.IElementSerializer;
-import org.apache.jcs.engine.control.CompositeCacheManagerMockImpl;
+import org.apache.jcs.engine.control.MockCompositeCacheManager;
import org.apache.jcs.utils.serialization.StandardSerializer;
/**
@@ -53,7 +53,7 @@
{
IRemoteCacheAttributes irca = new RemoteCacheAttributes();
irca.setRemoveUponRemotePut( false );
- ICompositeCacheManager cacheMgr = new CompositeCacheManagerMockImpl();
+ ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr );
String cacheName = "testName";
@@ -90,7 +90,7 @@
{
IRemoteCacheAttributes irca = new RemoteCacheAttributes();
irca.setRemoveUponRemotePut( true );
- ICompositeCacheManager cacheMgr = new CompositeCacheManagerMockImpl();
+ ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr );
String cacheName = "testName";
Modified: 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=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheNoWaitUnitTest.java Wed Aug 13 15:14:46 2008
@@ -39,7 +39,7 @@
*/
public class RemoteCacheNoWaitUnitTest
extends TestCase
-{
+{
/**
* Simply verify that the client gets updated via the no wait.
* <p>
@@ -49,7 +49,7 @@
throws Exception
{
// SETUP
- RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+ MockRemoteCacheClient client = new MockRemoteCacheClient();
RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
ICacheElement element = new CacheElement( "testUpdate", "key", "value" );
@@ -73,7 +73,7 @@
throws Exception
{
// SETUP
- RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+ MockRemoteCacheClient client = new MockRemoteCacheClient();
RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
ICacheElement input = new CacheElement( "testUpdate", "key", "value" );
@@ -95,7 +95,7 @@
throws Exception
{
// SETUP
- RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+ MockRemoteCacheClient client = new MockRemoteCacheClient();
RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
ICacheElement inputElement = new CacheElement( "testUpdate", "key", "value" );
@@ -123,7 +123,7 @@
throws Exception
{
// SETUP
- RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+ MockRemoteCacheClient client = new MockRemoteCacheClient();
RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
String input = "MyKey";
@@ -147,7 +147,7 @@
throws Exception
{
// SETUP
- RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+ MockRemoteCacheClient client = new MockRemoteCacheClient();
client.status = CacheConstants.STATUS_ALIVE;
RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
@@ -167,7 +167,7 @@
throws Exception
{
// SETUP
- RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+ MockRemoteCacheClient client = new MockRemoteCacheClient();
client.status = CacheConstants.STATUS_ERROR;
RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
@@ -188,11 +188,11 @@
throws Exception
{
// SETUP
- RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
+ MockRemoteCacheClient client = new MockRemoteCacheClient();
client.status = CacheConstants.STATUS_ALIVE;
RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );
- RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
+ MockRemoteCacheService service = new MockRemoteCacheService();
ICacheElement element = new CacheElement( "testUpdate", "key", "value" );
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteCacheUnitTest.java Wed Aug 13 15:14:46 2008
@@ -19,8 +19,11 @@
* under the License.
*/
+import java.util.HashSet;
+
import junit.framework.TestCase;
+import org.apache.jcs.auxiliary.MockCacheEventLogger;
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.jcs.engine.CacheElement;
import org.apache.jcs.engine.behavior.ICacheElement;
@@ -29,8 +32,6 @@
/**
* Unit Tests for the Remote Cache.
- * <p>
- * @author admin
*/
public class RemoteCacheUnitTest
extends TestCase
@@ -46,8 +47,8 @@
{
// SETUP
IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
- RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
- RemoteCacheListenerMockImpl listener = new RemoteCacheListenerMockImpl();
+ MockRemoteCacheService service = new MockRemoteCacheService();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
RemoteCache remoteCache = new RemoteCache( cattr, service, listener );
@@ -77,8 +78,8 @@
// SETUP
IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
ZombieRemoteCacheService zombie = new ZombieRemoteCacheService( 10 );
- RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
- RemoteCacheListenerMockImpl listener = new RemoteCacheListenerMockImpl();
+ MockRemoteCacheService service = new MockRemoteCacheService();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
// set the zombir
RemoteCache remoteCache = new RemoteCache( cattr, zombie, listener );
@@ -99,4 +100,136 @@
.getElementSerializer() );
assertEquals( "Wrong element updated.", element.getVal(), result.getVal() );
}
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testUpdate_simple()
+ throws Exception
+ {
+ // SETUP
+ IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
+ MockRemoteCacheService service = new MockRemoteCacheService();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
+
+ RemoteCache remoteCache = new RemoteCache( cattr, service, listener );
+
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+ remoteCache.setCacheEventLogger( cacheEventLogger );
+
+ ICacheElement item = new CacheElement( "region", "key", "value" );
+
+ // DO WORK
+ remoteCache.update( item );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testGet_simple()
+ throws Exception
+ {
+ // SETUP
+ IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
+ MockRemoteCacheService service = new MockRemoteCacheService();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
+
+ RemoteCache remoteCache = new RemoteCache( cattr, service, listener );
+
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+ remoteCache.setCacheEventLogger( cacheEventLogger );
+
+ // DO WORK
+ remoteCache.get( "key" );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testGetMultiple_simple()
+ throws Exception
+ {
+ // SETUP
+ IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
+ MockRemoteCacheService service = new MockRemoteCacheService();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
+
+ RemoteCache remoteCache = new RemoteCache( cattr, service, listener );
+
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+ remoteCache.setCacheEventLogger( cacheEventLogger );
+
+ // DO WORK
+ remoteCache.getMultiple( new HashSet() );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testRemove_simple()
+ throws Exception
+ {
+ // SETUP
+ IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
+ MockRemoteCacheService service = new MockRemoteCacheService();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
+
+ RemoteCache remoteCache = new RemoteCache( cattr, service, listener );
+
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+ remoteCache.setCacheEventLogger( cacheEventLogger );
+
+ // DO WORK
+ remoteCache.remove( "key" );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
+
+ /**
+ * Verify event log calls.
+ * <p>
+ * @throws Exception
+ */
+ public void testRemoveAll_simple()
+ throws Exception
+ {
+ // SETUP
+ IRemoteCacheAttributes cattr = new RemoteCacheAttributes();
+ MockRemoteCacheService service = new MockRemoteCacheService();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
+
+ RemoteCache remoteCache = new RemoteCache( cattr, service, listener );
+
+ MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+ remoteCache.setCacheEventLogger( cacheEventLogger );
+
+ // DO WORK
+ remoteCache.remove( "key" );
+
+ // VERIFY
+ assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+ assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+ }
}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteUtilsUnitTest.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteUtilsUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/RemoteUtilsUnitTest.java Wed Aug 13 15:14:46 2008
@@ -24,21 +24,17 @@
import junit.framework.TestCase;
/**
- * Simple tests for remote utils. It is difficult to verify most of the things is does.
- *
+ * Simple tests for remote utils. It is difficult to verify most of the things is does.
+ *<p>
* @author Aaron Smuts
- *
*/
public class RemoteUtilsUnitTest
extends TestCase
{
-
/**
* Call create registry twice.
- *
* <p>
* The exception is in the security manager setting.
- *
*/
public void testCreateRegistryTwice()
{
@@ -63,6 +59,4 @@
}
}
-
-
}
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/TestRemoteCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/TestRemoteCache.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/TestRemoteCache.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/TestRemoteCache.java Wed Aug 13 15:14:46 2008
@@ -25,10 +25,12 @@
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.JCS;
import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.MockCacheEventLogger;
import org.apache.jcs.auxiliary.remote.server.RemoteCacheServerFactory;
import org.apache.jcs.engine.CacheElement;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
-import org.apache.jcs.engine.control.CompositeCacheManagerMockImpl;
+import org.apache.jcs.engine.control.MockCompositeCacheManager;
+import org.apache.jcs.engine.control.MockElementSerializer;
/**
* @author asmuts
@@ -100,13 +102,13 @@
Thread.sleep( 100 );
- ICompositeCacheManager cacheMgr = new CompositeCacheManagerMockImpl();
+ ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
RemoteCacheAttributes rca = new RemoteCacheAttributes();
rca.setRemoteHost( "localhost" );
rca.setRemotePort( 1101 );
- RemoteCacheManager mgr = RemoteCacheManager.getInstance( rca, cacheMgr );
+ RemoteCacheManager mgr = RemoteCacheManager.getInstance( rca, cacheMgr, new MockCacheEventLogger(), new MockElementSerializer() );
AuxiliaryCache cache = mgr.getCache( "testCache" );
int numMes = 100;
Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java?rev=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/ZombieRemoteCacheServiceUnitTest.java Wed Aug 13 15:14:46 2008
@@ -39,7 +39,7 @@
throws Exception
{
// SETUP
- RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
+ MockRemoteCacheService service = new MockRemoteCacheService();
ZombieRemoteCacheService zombie = new ZombieRemoteCacheService( 10 );
@@ -63,7 +63,7 @@
throws Exception
{
// SETUP
- RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
+ MockRemoteCacheService service = new MockRemoteCacheService();
ZombieRemoteCacheService zombie = new ZombieRemoteCacheService( 0 );
@@ -87,7 +87,7 @@
throws Exception
{
// SETUP
- RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
+ MockRemoteCacheService service = new MockRemoteCacheService();
ZombieRemoteCacheService zombie = new ZombieRemoteCacheService( 10 );
@@ -111,7 +111,7 @@
throws Exception
{
// SETUP
- RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();
+ MockRemoteCacheService service = new MockRemoteCacheService();
ZombieRemoteCacheService zombie = new ZombieRemoteCacheService( 10 );
Modified: 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=685702&r1=685701&r2=685702&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java (original)
+++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/remote/server/BasicRemoteCacheClientServerUnitTest.java Wed Aug 13 15:14:46 2008
@@ -22,12 +22,14 @@
import junit.framework.TestCase;
import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.MockCacheEventLogger;
import org.apache.jcs.auxiliary.remote.RemoteCacheAttributes;
-import org.apache.jcs.auxiliary.remote.RemoteCacheListenerMockImpl;
+import org.apache.jcs.auxiliary.remote.MockRemoteCacheListener;
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.engine.control.MockCompositeCacheManager;
+import org.apache.jcs.engine.control.MockElementSerializer;
import org.apache.jcs.utils.timing.SleepUtil;
/**
@@ -66,14 +68,14 @@
throws Exception
{
// SETUP
- CompositeCacheManagerMockImpl compositeCacheManager = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager compositeCacheManager = new MockCompositeCacheManager();
RemoteCacheAttributes attributes = new RemoteCacheAttributes();
attributes.setRemoteHost( "localhost" );
attributes.setLocalPort( 1202 );
attributes.setRemotePort( 1101 );
- RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager );
+ RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer() );
String regionName = "testSinglePut";
AuxiliaryCache cache = remoteCacheManager.getCache( regionName );
@@ -81,7 +83,7 @@
int numPutsPrior = server.getPutCount();
ICacheElement element = new CacheElement( regionName, "key", "value" );
cache.update( element );
- SleepUtil.sleepAtLeast( 50 );
+ SleepUtil.sleepAtLeast( 200 );
// VERIFY
System.out.println( server.getStats() );
@@ -93,7 +95,7 @@
// VERIFY
assertEquals( "Wrong element.", element.getVal(), result.getVal() );
}
-
+
/**
* Verify that we can remove an item via the remote server.
* <p>
@@ -103,14 +105,14 @@
throws Exception
{
// SETUP
- CompositeCacheManagerMockImpl compositeCacheManager = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager compositeCacheManager = new MockCompositeCacheManager();
RemoteCacheAttributes attributes = new RemoteCacheAttributes();
attributes.setRemoteHost( "localhost" );
attributes.setLocalPort( 1202 );
attributes.setRemotePort( 1101 );
- RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager );
+ RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, new MockCacheEventLogger(), null );
String regionName = "testPutRemove";
AuxiliaryCache cache = remoteCacheManager.getCache( regionName );
@@ -132,7 +134,7 @@
// DO WORK
cache.remove( "key" );
- SleepUtil.sleepAtLeast( 50 );
+ SleepUtil.sleepAtLeast( 200 );
ICacheElement resultAfterRemote = cache.get( "key" );
// VERIFY
@@ -147,18 +149,18 @@
throws Exception
{
// SETUP
- CompositeCacheManagerMockImpl compositeCacheManager = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager compositeCacheManager = new MockCompositeCacheManager();
RemoteCacheAttributes attributes = new RemoteCacheAttributes();
attributes.setRemoteHost( "localhost" );
attributes.setLocalPort( 1202 );
attributes.setRemotePort( 1101 );
- RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager );
+ RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer() );
String regionName = "testPutAndListen";
AuxiliaryCache cache = remoteCacheManager.getCache( regionName );
- RemoteCacheListenerMockImpl listener = new RemoteCacheListenerMockImpl();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
server.addCacheListener( regionName, listener );
// DO WORK
@@ -189,18 +191,18 @@
throws Exception
{
// SETUP
- CompositeCacheManagerMockImpl compositeCacheManager = new CompositeCacheManagerMockImpl();
+ MockCompositeCacheManager compositeCacheManager = new MockCompositeCacheManager();
RemoteCacheAttributes attributes = new RemoteCacheAttributes();
attributes.setRemoteHost( "localhost" );
attributes.setLocalPort( 1202 );
attributes.setRemotePort( 1101 );
- RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager );
+ RemoteCacheManager remoteCacheManager = RemoteCacheManager.getInstance( attributes, compositeCacheManager, new MockCacheEventLogger(), new MockElementSerializer() );
String regionName = "testPutAndListen";
AuxiliaryCache cache = remoteCacheManager.getCache( regionName );
- RemoteCacheListenerMockImpl listener = new RemoteCacheListenerMockImpl();
+ MockRemoteCacheListener listener = new MockRemoteCacheListener();
server.addCacheListener( regionName, listener );
// DO WORK
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org