Return-Path: Delivered-To: apmail-jakarta-jcs-dev-archive@www.apache.org Received: (qmail 34185 invoked from network); 8 Sep 2008 19:27:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Sep 2008 19:27:43 -0000 Received: (qmail 41498 invoked by uid 500); 8 Sep 2008 19:27:40 -0000 Delivered-To: apmail-jakarta-jcs-dev-archive@jakarta.apache.org Received: (qmail 41478 invoked by uid 500); 8 Sep 2008 19:27:40 -0000 Mailing-List: contact jcs-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JCS Developers List" Delivered-To: mailing list jcs-dev@jakarta.apache.org Received: (qmail 41467 invoked by uid 500); 8 Sep 2008 19:27:40 -0000 Delivered-To: apmail-jakarta-jcs-commits@jakarta.apache.org Received: (qmail 41464 invoked by uid 500); 8 Sep 2008 19:27:40 -0000 Delivered-To: apmail-jakarta-jcs-cvs@jakarta.apache.org Received: (qmail 41461 invoked by uid 99); 8 Sep 2008 19:27:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2008 12:27:40 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2008 19:26:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 07D1723889BA; Mon, 8 Sep 2008 12:26:43 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r693210 [2/2] - in /jakarta/jcs/trunk: ./ src/conf/ 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... Date: Mon, 08 Sep 2008 19:26:40 -0000 To: jcs-cvs@jakarta.apache.org From: asmuts@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080908192643.07D1723889BA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/behavior/IElementAttributes.java Mon Sep 8 12:26:37 2008 @@ -24,69 +24,49 @@ import org.apache.jcs.engine.control.event.behavior.IElementEventHandler; /** - * Interface for cache element attributes classes. Every item is the cache is - * associated with an element attributes object. It is used to track the life of - * the object as well as to restrict its behavior. By default, elements get a - * clone of the region's attributes. - * + * Interface for cache element attributes classes. Every item is the cache is associated with an + * element attributes object. It is used to track the life of the object as well as to restrict its + * behavior. By default, elements get a clone of the region's attributes. */ public interface IElementAttributes { - - /** - * Sets the version attribute of the IAttributes object - * - * @param version - * The new version value - */ - public void setVersion( long version ); - /** * Sets the maxLife attribute of the IAttributes object. - * - * @param mls - * The new MaxLifeSeconds value + *

+ * @param mls The new MaxLifeSeconds value */ public void setMaxLifeSeconds( long mls ); /** - * Sets the maxLife attribute of the IAttributes object. How many seconds it - * can live after creation. + * Sets the maxLife attribute of the IAttributes object. How many seconds it can live after + * creation. *

- * If this is exceeded the element will not be returned, instead it will be - * removed. It will be removed on retrieval, or removed actively if the - * memory shrinker is turned on. - * - * + * If this is exceeded the element will not be returned, instead it will be removed. It will be + * removed on retrieval, or removed actively if the memory shrinker is turned on. * @return The MaxLifeSeconds value */ public long getMaxLifeSeconds(); /** - * Sets the idleTime attribute of the IAttributes object. This is the - * maximum time the item can be idle in the cache, that is not accessed. + * Sets the idleTime attribute of the IAttributes object. This is the maximum time the item can + * be idle in the cache, that is not accessed. *

- * If this is exceeded the element will not be returned, instead it will be - * removed. It will be removed on retrieval, or removed actively if the - * memory shrinker is turned on. - * - * @param idle - * The new idleTime value + * If this is exceeded the element will not be returned, instead it will be removed. It will be + * removed on retrieval, or removed actively if the memory shrinker is turned on. + * @param idle The new idleTime value */ public void setIdleTime( long idle ); /** - * Size in bytes. This is not used except in the admin pages. It will be -1 - * by default. - * - * @param size - * The new size value + * Size in bytes. This is not used except in the admin pages. It will be -1 by default. + *

+ * @param size The new size value */ public void setSize( int size ); /** * Gets the size attribute of the IAttributes object - * + *

* @return The size value */ public int getSize(); @@ -94,18 +74,17 @@ /** * Gets the createTime attribute of the IAttributes object. *

- * This shoudd be the current time in milliseconds returned by the sysutem - * call when the element is put in the cache. + * This should be the current time in milliseconds returned by the sysutem call when the element + * is put in the cache. *

* Putting an item in the cache overrides any existing items. - * * @return The createTime value */ public long getCreateTime(); /** * Gets the LastAccess attribute of the IAttributes object. - * + *

* @return The LastAccess value. */ public long getLastAccessTime(); @@ -116,15 +95,7 @@ public void setLastAccessTimeNow(); /** - * Gets the version attribute of the IAttributes object - * - * @return The version value - */ - public long getVersion(); - - /** * Gets the idleTime attribute of the IAttributes object - * * @return The idleTime value */ public long getIdleTime(); @@ -133,14 +104,12 @@ * Gets the time left to live of the IAttributes object. *

* This is the (max life + create time) - current time. - * * @return The TimeToLiveSeconds value */ public long getTimeToLiveSeconds(); /** * Returns a copy of the object. - * * @return IElementAttributes */ public IElementAttributes copy(); @@ -149,7 +118,6 @@ * Can this item be spooled to disk *

* By default this is true. - * * @return The spoolable value */ public boolean getIsSpool(); @@ -158,18 +126,14 @@ * Sets the isSpool attribute of the IElementAttributes object *

* By default this is true. - * - * @param val - * The new isSpool value + * @param val The new isSpool value */ public void setIsSpool( boolean val ); /** - * Is this item laterally distributable. Can it be sent to auxiliaries of - * type lateral. + * Is this item laterally distributable. Can it be sent to auxiliaries of type lateral. *

* By default this is true. - * * @return The isLateral value */ public boolean getIsLateral(); @@ -178,9 +142,7 @@ * Sets the isLateral attribute of the IElementAttributes object *

* By default this is true. - * - * @param val - * The new isLateral value + * @param val The new isLateral value */ public void setIsLateral( boolean val ); @@ -188,7 +150,6 @@ * Can this item be sent to the remote cache. *

* By default this is true. - * * @return The isRemote value */ public boolean getIsRemote(); @@ -197,51 +158,41 @@ * Sets the isRemote attribute of the IElementAttributes object. *

* By default this is true. - * - * @param val - * The new isRemote value + * @param val The new isRemote value */ public void setIsRemote( boolean val ); /** * This turns off expiration if it is true. - * * @return The IsEternal value */ public boolean getIsEternal(); /** * Sets the isEternal attribute of the IElementAttributes object - * - * @param val - * The new isEternal value + * @param val The new isEternal value */ public void setIsEternal( boolean val ); /** - * Adds a ElementEventHandler. Handler's can be registered for multiple - * events. A registered handler will be called at every recognized event. - * - * @param eventHandler - * The feature to be added to the ElementEventHandler + * Adds a ElementEventHandler. Handler's can be registered for multiple events. A registered + * handler will be called at every recognized event. + * @param eventHandler The feature to be added to the ElementEventHandler */ public void addElementEventHandler( IElementEventHandler eventHandler ); /** * Gets the elementEventHandlers. *

- * Event handlers are transient. The only events defined are in memory - * events. All handlers are lost if the item goes to disk. - * + * Event handlers are transient. The only events defined are in memory events. All handlers are + * lost if the item goes to disk. * @return The elementEventHandlers value, null if there are none */ public ArrayList getElementEventHandlers(); /** * Sets the eventHandlers of the IElementAttributes object - * - * @param eventHandlers - * value + * @param eventHandlers value */ public void addElementEventHandlers( ArrayList eventHandlers ); Copied: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java (from r686881, jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java) URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java?p2=jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java&p1=jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java&r1=686881&r2=693210&rev=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerImpl.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java Mon Sep 8 12:26:37 2008 @@ -11,11 +11,11 @@ * This implementation simple logs to a commons logger at debug level, for all events. It's mainly * for testing. It isn't very useful otherwise. */ -public class CacheEventLoggerDebugLoggerImpl +public class CacheEventLoggerDebugLogger implements ICacheEventLogger { /** This is the name of the category. */ - private String logCategoryName = CacheEventLoggerDebugLoggerImpl.class.getName(); + private String logCategoryName = CacheEventLoggerDebugLogger.class.getName(); /** The logger. This is recreated on set logCategoryName */ private Log log = LogFactory.getLog( logCategoryName ); Propchange: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/CacheEventLoggerDebugLogger.java ------------------------------------------------------------------------------ svn:mergeinfo = Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/logging/behavior/ICacheEventLogger.java Mon Sep 8 12:26:37 2008 @@ -64,7 +64,6 @@ * Logs an error. *

* @param source - e.g. RemoteCacheServer - * @param region - the name of the region * @param eventName - e.g. update, get, put, remove * @param errorMessage - any error message */ 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=693210&r1=693209&r2=693210&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 Mon Sep 8 12:26:37 2008 @@ -28,6 +28,7 @@ public abstract class AbstractJCSWorkerHelper implements JCSWorkerHelper { + /** finished flag. Can't we use wait notify? */ private boolean finished = false; /** Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java Mon Sep 8 12:26:37 2008 @@ -83,7 +83,7 @@ * * *

- * But has the added benifit of the work-load sharing; under normal + * But has the added benefit of the work-load sharing; under normal * circumstances if multiple threads all tried to do the same query at the same * time, the same query would happen multiple times on the database, and the * resulting object would get put into JCS multiple times. @@ -92,8 +92,10 @@ */ public class JCSWorker { + /** The logger */ private static final Log logger = LogFactory.getLog( JCSWorker.class ); + /** The cache we are working with */ private JCS cache; /** Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java Mon Sep 8 12:26:37 2008 @@ -45,10 +45,13 @@ */ final static class Config { + /** The logger */ private final static Log log = LogFactory.getLog( Config.class ); + /** username */ private final static String ADMIN_USERID; + /** password */ private final static String ADMIN_PASSWORD; static Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/OptionConverter.java Mon Sep 8 12:26:37 2008 @@ -34,14 +34,19 @@ /** The logger */ private final static Log log = LogFactory.getLog( OptionConverter.class ); + /** System property delimter */ static String DELIM_START = "${"; + /** System property delimter */ static char DELIM_STOP = '}'; + /** System property delimter start length */ static int DELIM_START_LEN = 2; + /** System property delimter end length */ static int DELIM_STOP_LEN = 1; + /** working buffer */ static StringBuffer sbuf = new StringBuffer(); /** No instances please. */ @@ -68,7 +73,8 @@ } /** - * Escapes special cahracters/ + * Escapes special characters. + *

* @param s * @return String */ Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetter.java Mon Sep 8 12:26:37 2008 @@ -23,48 +23,37 @@ import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; - import java.lang.reflect.Method; - import java.util.Enumeration; import java.util.Properties; -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; /** - * This class is based on the log4j class org.apache.log4j.config.PropertySetter - * that was made by Anders Kristensen - * - */ - -/** - * General purpose Object property setter. Clients repeatedly invokes {@link - * #setProperty setProperty(name,value)} in order to invoke setters on the - * Object specified in the constructor. This class relies on the JavaBeans - * {@link Introspector}to analyze the given Object Class using reflection. + * This class is based on the log4j class org.apache.log4j.config.PropertySetter that was made by + * Anders Kristensen + *

+ * General purpose Object property setter. Clients repeatedly invokes {@link #setProperty + * setProperty(name,value)} in order to invoke setters on the Object specified in the constructor. + * This class relies on the JavaBeans {@link Introspector}to analyze the given Object Class using + * reflection. *

- * * Usage: - * + * *

  * PropertySetter ps = new PropertySetter( anObject );
  * ps.set( "name", "Joe" );
  * ps.set( "age", "32" );
  * ps.set( "isMale", "true" );
  * 
- * - * will cause the invocations anObject.setName("Joe"), anObject.setAge(32), and - * setMale(true) if such methods exist with those signatures. Otherwise an - * {@link IntrospectionException}are thrown. - * - * @since 1.1 + * + * will cause the invocations anObject.setName("Joe"), anObject.setAge(32), and setMale(true) if + * such methods exist with those signatures. Otherwise an {@link IntrospectionException}are thrown. */ public class PropertySetter { + /** Logger */ private final static Log log = LogFactory.getLog( OptionConverter.class ); /** Description of the Field */ @@ -74,11 +63,9 @@ protected PropertyDescriptor[] props; /** - * Create a new PropertySetter for the specified Object. This is done in - * prepartion for invoking {@link #setProperty}one or more times. - * - * @param obj - * the object for which to set properties + * Create a new PropertySetter for the specified Object. This is done in prepartion for invoking + * {@link #setProperty}one or more times. + * @param obj the object for which to set properties */ public PropertySetter( Object obj ) { @@ -86,8 +73,7 @@ } /** - * Uses JavaBeans {@link Introspector}to computer setters of object to be - * configured. + * Uses JavaBeans {@link Introspector}to computer setters of object to be configured. */ protected void introspect() { @@ -104,15 +90,12 @@ } /** - * Set the properties of an object passed as a parameter in one go. The - * properties are parsed relative to a prefix. - * - * @param obj - * The object to configure. - * @param properties - * A java.util.Properties containing keys and values. - * @param prefix - * Only keys having the specified prefix will be set. + * Set the properties of an object passed as a parameter in one go. The properties + * are parsed relative to a prefix. + *

+ * @param obj The object to configure. + * @param properties A java.util.Properties containing keys and values. + * @param prefix Only keys having the specified prefix will be set. */ public static void setProperties( Object obj, Properties properties, String prefix ) { @@ -120,13 +103,10 @@ } /** - * Set the properites for the object that match the prefix - * passed as parameter. - * - * @param properties - * The new properties value - * @param prefix - * The new properties value + * Set the properties for the object that match the prefix passed as parameter. + *

+ * @param properties The new properties value + * @param prefix The new properties value */ public void setProperties( Properties properties, String prefix ) { @@ -158,22 +138,16 @@ } /** - * Set a property on this PropertySetter's Object. If successful, this - * method will invoke a setter method on the underlying Object. The setter - * is the one for the specified property name and the value is determined - * partly from the setter argument type and partly from the value specified - * in the call to this method. + * Set a property on this PropertySetter's Object. If successful, this method will invoke a + * setter method on the underlying Object. The setter is the one for the specified property name + * and the value is determined partly from the setter argument type and partly from the value + * specified in the call to this method. *

- * - * If the setter expects a String no conversion is necessary. If it expects - * an int, then an attempt is made to convert 'value' to an int using new - * Integer(value). If the setter expects a boolean, the conversion is by new - * Boolean(value). - * - * @param name - * name of the property - * @param value - * String value of the property + * If the setter expects a String no conversion is necessary. If it expects an int, then an + * attempt is made to convert 'value' to an int using new Integer(value). If the setter expects + * a boolean, the conversion is by new Boolean(value). + * @param name name of the property + * @param value String value of the property */ public void setProperty( String name, String value ) @@ -207,14 +181,9 @@ /** * Set the named property given a {@link PropertyDescriptor}. - * - * @param prop - * A PropertyDescriptor describing the characteristics of the - * property to set. - * @param name - * The named of the property to set. - * @param value - * The value of the property. + * @param prop A PropertyDescriptor describing the characteristics of the property to set. + * @param name The named of the property to set. + * @param value The value of the property. * @throws PropertySetterException */ @@ -257,8 +226,7 @@ } /** - * Convert val a String parameter to an object of a given - * type. + * Convert val a String parameter to an object of a given type. * @param val * @param type * @return Object @@ -300,7 +268,6 @@ /** * Gets the propertyDescriptor attribute of the PropertySetter object * @param name - * * @return The propertyDescriptor value */ protected PropertyDescriptor getPropertyDescriptor( String name ) Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/PropertySetterException.java Mon Sep 8 12:26:37 2008 @@ -20,20 +20,16 @@ */ /** - * This class is based on the log4j class org.apache.log4j.config.PropertySetter - * that was made by Anders Kristensen - * - */ - -/** - * Thrown when an error is encountered whilst attempting to set a property using - * the {@link PropertySetter}utility class. - * - * @since 1.1 + * This class is based on the log4j class org.apache.log4j.config.PropertySetter that was made by + * Anders Kristensen + *

+ * Thrown when an error is encountered whilst attempting to set a property using the + * {@link PropertySetter}utility class. */ public class PropertySetterException extends Exception { + /** DOn't change */ private static final long serialVersionUID = -210271658004609028L; /** Description of the Field */ @@ -41,7 +37,7 @@ /** * Constructor for the PropertySetterException object - * + *

* @param msg */ public PropertySetterException( String msg ) @@ -51,7 +47,7 @@ /** * Constructor for the PropertySetterException object - * + *

* @param rootCause */ public PropertySetterException( Throwable rootCause ) @@ -62,10 +58,9 @@ /** * Returns descriptive text on the cause of this exception. - * + *

* @return The message value */ - public String getMessage() { String msg = super.getMessage(); Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java Mon Sep 8 12:26:37 2008 @@ -34,6 +34,7 @@ */ public class HostNameUtil { + /** The logger. */ private final static Log log = LogFactory.getLog( HostNameUtil.class ); /** @@ -83,6 +84,7 @@ *

* JIR ISSUE JCS-40 *

+ * @return InetAddress * @throws UnknownHostException If the LAN address of the machine cannot be found. */ private static InetAddress getLocalHostLANAddress() Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java Mon Sep 8 12:26:37 2008 @@ -37,10 +37,13 @@ */ public abstract class PropertyLoader { + /** throw an error if we can load the file */ private static final boolean THROW_ON_LOAD_FAILURE = true; + /** File suffix. */ private static final String SUFFIX = ".ccf"; + /** property suffix */ private static final String SUFFIX_PROPERTIES = ".properties"; /** Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java Mon Sep 8 12:26:37 2008 @@ -30,12 +30,13 @@ import org.apache.jcs.engine.behavior.IElementSerializer; /** - * This uses a supplied Serialer to convert to and from cache elements. + * This uses a supplied Serializer to convert to and from cache elements. *

* @author Aaron Smuts */ public class SerializationConversionUtil { + /** The logger */ private final static Log log = LogFactory.getLog( SerializationConversionUtil.class ); /** Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/JCSServletContextListener.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/JCSServletContextListener.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/JCSServletContextListener.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/JCSServletContextListener.java Mon Sep 8 12:26:37 2008 @@ -31,7 +31,7 @@ * gracefully. *

* Add the following to the top of your web.xml file. - * + * *

  *  <listener>
  *  <listener-class>
@@ -39,12 +39,12 @@
  *  </listener-class>
  *  </listener>
  * 
- * * @author Aaron Smuts */ public class JCSServletContextListener implements ServletContextListener { + /** The logger */ private static final Log log = LogFactory.getLog( JCSServletContextListener.class ); /** @@ -75,5 +75,4 @@ } CompositeCacheManager.getInstance().shutDown(); } - } Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java Mon Sep 8 12:26:37 2008 @@ -32,8 +32,10 @@ public class DoubleLinkedListNode implements Serializable { + /** Dont' change. */ private static final long serialVersionUID = -1114934407695836097L; + /** The object in the node. */ private Object payload; /** Double Linked list references */ Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java Mon Sep 8 12:26:37 2008 @@ -20,19 +20,16 @@ */ /** - * This is a node in the double linked list. It is stored as the value in the - * underlying map used by the LRUMap class. - *

- * @author aaronsm + * This is a node in the double linked list. It is stored as the value in the underlying map used by + * the LRUMap class. */ public class LRUElementDescriptor extends DoubleLinkedListNode { + /** Don't change. */ private static final long serialVersionUID = 8249555756363020156L; - /** - * key - */ + /** The key value */ private Object key; /** @@ -46,8 +43,7 @@ } /** - * @param key - * The key to set. + * @param key The key to set. */ public void setKey( Object key ) { @@ -61,5 +57,4 @@ { return key; } - } 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=693210&r1=693209&r2=693210&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 Mon Sep 8 12:26:37 2008 @@ -63,10 +63,13 @@ /** Map where items are stored by key. */ protected Map map; + /** stats */ int hitCnt = 0; + /** stats */ int missCnt = 0; + /** stats */ int putCnt = 0; /** if the max is less than 0, there is no limit! */ @@ -78,8 +81,6 @@ /** * This creates an unbounded version. Setting the max objects will result in spooling on * subsequent puts. - *

- * @param maxObjects */ public LRUMap() { Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SingleLinkedList.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SingleLinkedList.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SingleLinkedList.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SingleLinkedList.java Mon Sep 8 12:26:37 2008 @@ -30,16 +30,19 @@ */ public class SingleLinkedList { + /** The logger */ private static final Log log = LogFactory.getLog( SingleLinkedList.class ); + /** for sync */ private Object lock = new Object(); - // the head of the queue + /** the head of the queue */ private Node head = new Node(); - // the end of the queue + /** the end of the queue */ private Node tail = head; + /** The size of the list */ private int size = 0; /** @@ -115,8 +118,10 @@ */ private static class Node { + /** next int he list */ Node next = null; + /** The data in this node */ Object payload; } Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/ConcurrentRemovalLoadTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/ConcurrentRemovalLoadTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/ConcurrentRemovalLoadTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/ConcurrentRemovalLoadTest.java Mon Sep 8 12:26:37 2008 @@ -31,7 +31,6 @@ { /** * Constructor for the TestDiskCache object. - * * @param testName */ public ConcurrentRemovalLoadTest( String testName ) @@ -41,7 +40,6 @@ /** * Main method passes this test to the text test runner. - * * @param args */ public static void main( String args[] ) @@ -51,9 +49,8 @@ } /** - * A unit test suite for JUnit. This verfies that we can remove - * hierarchically while the region is active. - * + * A unit test suite for JUnit. This verfies that we can remove hierarchically while the region + * is active. * @return The test suite */ public static Test suite() @@ -125,11 +122,12 @@ } } ); return suite; - } /** * Test setup + *

+ * @throws Exception */ public void setUp() throws Exception @@ -137,5 +135,4 @@ JCS.setConfigFilename( "/TestRemoval.ccf" ); JCS.getInstance( "testCache1" ); } - } Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/AuxiliaryCacheConfiguratorUnitTest.java Mon Sep 8 12:26:37 2008 @@ -4,8 +4,10 @@ import junit.framework.TestCase; +import org.apache.jcs.engine.behavior.IElementSerializer; import org.apache.jcs.engine.control.MockElementSerializer; import org.apache.jcs.engine.logging.MockCacheEventLogger; +import org.apache.jcs.utils.serialization.StandardSerializer; /** Unit tests for the auxiliary cache configurator. */ public class AuxiliaryCacheConfiguratorUnitTest @@ -87,7 +89,7 @@ .parseElementSerializer( props, auxPrefix ); // VERIFY - assertNotNull( "Should have a logger.", result ); + assertNotNull( "Should have a Serializer.", result ); assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() ); } @@ -100,10 +102,10 @@ Properties props = new Properties(); // DO WORK - MockElementSerializer result = (MockElementSerializer) AuxiliaryCacheConfigurator + IElementSerializer result = AuxiliaryCacheConfigurator .parseElementSerializer( props, "junk" ); // VERIFY - assertNull( "Should not have a logger.", result ); + assertTrue( "Should have the default Serializer.", result instanceof StandardSerializer ); } } Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java?rev=693210&view=auto ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java (added) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java Mon Sep 8 12:26:37 2008 @@ -0,0 +1,35 @@ +package org.apache.jcs.auxiliary.disk.block; + +import junit.framework.TestCase; + +import org.apache.jcs.auxiliary.MockCacheEventLogger; +import org.apache.jcs.engine.behavior.IElementSerializer; +import org.apache.jcs.engine.control.MockElementSerializer; +import org.apache.jcs.engine.logging.behavior.ICacheEventLogger; + +/** Unit tests for the manager */ +public class BlockDiskCacheManagerUnitTest + extends TestCase +{ + /** Verify that the disk cache has the event logger */ + public void testGetCache_normal() + { + // SETUP + String cacheName = "testGetCache_normal"; + BlockDiskCacheAttributes defaultCacheAttributes = new BlockDiskCacheAttributes(); + defaultCacheAttributes.setDiskPath( "target/BlockDiskCacheManagerUnitTest" ); + + ICacheEventLogger cacheEventLogger = new MockCacheEventLogger(); + IElementSerializer elementSerializer = new MockElementSerializer(); + + BlockDiskCacheManager manager = BlockDiskCacheManager.getInstance( defaultCacheAttributes, cacheEventLogger, + elementSerializer ); + + // DO WORK + BlockDiskCache cache = (BlockDiskCache) manager.getCache( cacheName ); + + // VERIFY + assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger() ); + assertEquals( "wrong elementSerializer", elementSerializer, cache.getElementSerializer() ); + } +} Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskElementDescriptorUnitTest.java Mon Sep 8 12:26:37 2008 @@ -75,7 +75,7 @@ /** * Measure memory used by the VM. - * @return + * @return long * @throws InterruptedException */ protected long measureMemoryUse() Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java Mon Sep 8 12:26:37 2008 @@ -23,14 +23,17 @@ import junit.framework.TestCase; +import org.apache.jcs.utils.serialization.StandardSerializer; + /** - * Test for the disk acces layer of the Block Disk Cache. + * Test for the disk access layer of the Block Disk Cache. *

* @author Aaron Smuts */ public class BlockDiskUnitTest extends TestCase { + /** data file. */ private File rafDir; /** @@ -55,7 +58,7 @@ String fileName = "testWriteSingleBlockElement"; File file = new File( rafDir, fileName + ".data" ); file.delete(); - BlockDisk disk = new BlockDisk( file ); + BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK int bytes = 1 * 1024; @@ -80,7 +83,7 @@ String fileName = "testWriteAndReadSingleBlockElement"; File file = new File( rafDir, fileName + ".data" ); file.delete(); - BlockDisk disk = new BlockDisk( file ); + BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK int bytes = 1 * 1024; @@ -104,7 +107,7 @@ String fileName = "testWriteSingleBlockElement"; File file = new File( rafDir, fileName + ".data" ); file.delete(); - BlockDisk disk = new BlockDisk( file ); + BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK int bytes = 1 * 1024; @@ -131,7 +134,7 @@ String fileName = "testCalculateBlocksNeededDouble"; File file = new File( rafDir, fileName + ".data" ); file.delete(); - BlockDisk disk = new BlockDisk( file ); + BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK int result = disk.calculateTheNumberOfBlocksNeeded( new byte[disk.getBlockSizeBytes() * 2 @@ -152,7 +155,7 @@ // SETUP String fileName = "testWriteDoubleBlockElement"; File file = new File( rafDir, fileName + ".data" ); - BlockDisk disk = new BlockDisk( file ); + BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK // byte arrays encur 27 bytes of serialization overhead. @@ -178,7 +181,7 @@ String fileName = "testWriteAndReadSingleBlockElement"; File file = new File( rafDir, fileName + ".data" ); file.delete(); - BlockDisk disk = new BlockDisk( file ); + BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK int numBlocksPerElement = 4; Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/HugeQuantityBlockDiskCacheLoadTest.java Mon Sep 8 12:26:37 2008 @@ -26,10 +26,8 @@ import org.apache.jcs.utils.timing.SleepUtil; /** - * Put a few hundred thousand entries in the block disk cache. - * + * @exception Exception If an error occurs */ public void testLargeNumberOfItems() throws Exception @@ -91,7 +85,8 @@ { SleepUtil.sleepAtLeast( 3000 ); System.out.println( "--------------------------" ); - System.out.println( "After sleep. " + timer.getElapsedTimeString() + " memory used = " + measureMemoryUse() ); + System.out.println( "After sleep. " + timer.getElapsedTimeString() + " memory used = " + + measureMemoryUse() ); System.out.println( jcs.getStats() ); } @@ -102,15 +97,15 @@ { //System.out.print( "\033[s" ); String value = (String) jcs.get( i + ":key" ); - if( i % 1000 == 0 ) + if ( i % 1000 == 0 ) { //System.out.print( "\033[r" ); - System.out.println( i + " "); + System.out.println( i + " " ); } assertEquals( "Wrong value returned.", region + " data " + i, value ); } long aftetGet = measureMemoryUse(); - System.out.println( "After get: " + aftetGet + " diff = " + (aftetGet - initialMemory)); + System.out.println( "After get: " + aftetGet + " diff = " + ( aftetGet - initialMemory ) ); } finally @@ -119,14 +114,13 @@ System.out.println( jcs.getStats() ); System.out.println( "--------------------------" ); long endMemory = measureMemoryUse(); - System.out.println( "End: " + endMemory + " diff = " + (endMemory - initialMemory) ); + System.out.println( "End: " + endMemory + " diff = " + ( endMemory - initialMemory ) ); } } /** * Measure memory used by the VM. - * - * @return + * @return long * @throws InterruptedException */ protected long measureMemoryUse() Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java?rev=693210&view=auto ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java (added) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheManagerUnitTest.java Mon Sep 8 12:26:37 2008 @@ -0,0 +1,34 @@ +package org.apache.jcs.auxiliary.disk.indexed; + +import org.apache.jcs.auxiliary.MockCacheEventLogger; +import org.apache.jcs.engine.behavior.IElementSerializer; +import org.apache.jcs.engine.control.MockElementSerializer; +import org.apache.jcs.engine.logging.behavior.ICacheEventLogger; + +import junit.framework.TestCase; + +/** Unit tests for the manager */ +public class IndexedDiskCacheManagerUnitTest + extends TestCase +{ + /** Verify that the disk cache has the event logger */ + public void testGetCache_normal() + { + // SETUP + String cacheName = "testGetCache_normal"; + IndexedDiskCacheAttributes defaultCacheAttributes = new IndexedDiskCacheAttributes(); + defaultCacheAttributes.setDiskPath( "target/IndexedDiskCacheManagerUnitTest" ); + + ICacheEventLogger cacheEventLogger = new MockCacheEventLogger(); + IElementSerializer elementSerializer = new MockElementSerializer(); + + IndexedDiskCacheManager manager = IndexedDiskCacheManager.getInstance( defaultCacheAttributes, cacheEventLogger, elementSerializer ); + + // DO WORK + IndexedDiskCache cache = (IndexedDiskCache)manager.getCache( cacheName ); + + // VERIFY + assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger()); + assertEquals( "wrong elementSerializer", elementSerializer, cache.getElementSerializer()); + } +} Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheSteadyLoadTest.java Mon Sep 8 12:26:37 2008 @@ -37,10 +37,13 @@ public class IndexedDiskCacheSteadyLoadTest extends TestCase { + /** For display */ private static final String LOG_DIVIDER = "---------------------------"; + /** For getting memory info */ private static Runtime rt = Runtime.getRuntime(); + /** For display */ private static DecimalFormat format = new DecimalFormat( "#,###" ); /** Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java?rev=693210&view=auto ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java (added) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManagerUnitTest.java Mon Sep 8 12:26:37 2008 @@ -0,0 +1,35 @@ +package org.apache.jcs.auxiliary.disk.jdbc; + +import junit.framework.TestCase; + +import org.apache.jcs.auxiliary.MockCacheEventLogger; +import org.apache.jcs.engine.behavior.IElementSerializer; +import org.apache.jcs.engine.control.MockElementSerializer; +import org.apache.jcs.engine.logging.behavior.ICacheEventLogger; + +/** Unit tests for the manager */ +public class JDBCDiskCacheManagerUnitTest + extends TestCase +{ + /** Verify that the disk cache has the event logger */ + public void testGetCache_normal() + { + // SETUP + String cacheName = "testGetCache_normal"; + JDBCDiskCacheAttributes defaultCacheAttributes = new JDBCDiskCacheAttributes(); + defaultCacheAttributes.setDiskPath( "target/JDBCDiskCacheManagerUnitTest" ); + + ICacheEventLogger cacheEventLogger = new MockCacheEventLogger(); + IElementSerializer elementSerializer = new MockElementSerializer(); + + JDBCDiskCacheManager manager = JDBCDiskCacheManager.getInstance( defaultCacheAttributes, cacheEventLogger, + elementSerializer ); + + // DO WORK + JDBCDiskCache cache = (JDBCDiskCache) manager.getCache( cacheName ); + + // VERIFY + assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger() ); + assertEquals( "wrong elementSerializer", elementSerializer, cache.getElementSerializer() ); + } +} Added: jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java?rev=693210&view=auto ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java (added) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManagerUnitTest.java Mon Sep 8 12:26:37 2008 @@ -0,0 +1,35 @@ +package org.apache.jcs.auxiliary.disk.jdbc.mysql; + +import junit.framework.TestCase; + +import org.apache.jcs.auxiliary.MockCacheEventLogger; +import org.apache.jcs.engine.behavior.IElementSerializer; +import org.apache.jcs.engine.control.MockElementSerializer; +import org.apache.jcs.engine.logging.behavior.ICacheEventLogger; + +/** Unit tests for the manager */ +public class MySQLDiskCacheManagerUnitTest + extends TestCase +{ + /** Verify that the disk cache has the event logger */ + public void testGetCache_normal() + { + // SETUP + String cacheName = "testGetCache_normal"; + MySQLDiskCacheAttributes defaultCacheAttributes = new MySQLDiskCacheAttributes(); + defaultCacheAttributes.setDiskPath( "target/JDBCDiskCacheManagerUnitTest" ); + + ICacheEventLogger cacheEventLogger = new MockCacheEventLogger(); + IElementSerializer elementSerializer = new MockElementSerializer(); + + MySQLDiskCacheManager manager = MySQLDiskCacheManager.getInstance( defaultCacheAttributes, cacheEventLogger, + elementSerializer ); + + // DO WORK + MySQLDiskCache cache = (MySQLDiskCache) manager.getCache( cacheName ); + + // VERIFY + assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger() ); + assertEquals( "wrong elementSerializer", elementSerializer, cache.getElementSerializer() ); + } +} Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/engine/control/MockElementSerializer.java Mon Sep 8 12:26:37 2008 @@ -13,6 +13,7 @@ /** test property */ private String testProperty; + /** What's used in the background */ private StandardSerializer serializer = new StandardSerializer(); /** Added: jakarta/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java?rev=693210&view=auto ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java (added) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/engine/logging/CacheEventLoggerDebugLoggerUnitTest.java Mon Sep 8 12:26:37 2008 @@ -0,0 +1,125 @@ +package org.apache.jcs.engine.logging; + +import java.io.StringWriter; + +import junit.framework.TestCase; + +import org.apache.jcs.engine.logging.behavior.ICacheEvent; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; +import org.apache.log4j.WriterAppender; + +/** Unit tests for the debug implementation */ +public class CacheEventLoggerDebugLoggerUnitTest + extends TestCase +{ + + /** verify that we can log */ + public void testLogICacheEvent_normal() + { + // SETUP + String logCategoryName = "testLogEvent_normal"; + + String source = "mySource"; + String region = "my region"; + String eventName = "MyEventName"; + String optionalDetails = "SomeExtraData"; + String key = "my key"; + + StringWriter stringWriter = new StringWriter(); + configureLogger( stringWriter, logCategoryName ); + + CacheEventLoggerDebugLogger logger = new CacheEventLoggerDebugLogger(); + logger.setLogCategoryName( logCategoryName ); + + ICacheEvent event = logger.createICacheEvent( source, region, eventName, optionalDetails, key ); + + // DO WORK + logger.logICacheEvent( event ); + + // VERIFY + String result = stringWriter.toString(); + assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 ); + assertTrue( "An event with the region should have been logged:" + result, result.indexOf( region ) != -1 ); + assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 ); + assertTrue( "An event with the optionalDetails should have been logged:" + result, result.indexOf( optionalDetails ) != -1 ); + assertTrue( "An event with the key should have been logged:" + result, result.indexOf( key ) != -1 ); + } + + /** verify that we can log */ + public void testLogApplicationEvent_normal() + { + // SETUP + String logCategoryName = "testLogApplicationEvent_normal"; + + String source = "mySource"; + String eventName = "MyEventName"; + String optionalDetails = "SomeExtraData"; + + StringWriter stringWriter = new StringWriter(); + configureLogger( stringWriter, logCategoryName ); + + CacheEventLoggerDebugLogger logger = new CacheEventLoggerDebugLogger(); + logger.setLogCategoryName( logCategoryName ); + + // DO WORK + logger.logApplicationEvent( source, eventName, optionalDetails ); + + // VERIFY + String result = stringWriter.toString(); + assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 ); + assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 ); + assertTrue( "An event with the optionalDetails should have been logged:" + result, result.indexOf( optionalDetails ) != -1 ); + } + + /** verify that we can log */ + public void testLogError_normal() + { + // SETUP + String logCategoryName = "testLogApplicationEvent_normal"; + + String source = "mySource"; + String eventName = "MyEventName"; + String errorMessage = "SomeExtraData"; + + StringWriter stringWriter = new StringWriter(); + configureLogger( stringWriter, logCategoryName ); + + CacheEventLoggerDebugLogger logger = new CacheEventLoggerDebugLogger(); + logger.setLogCategoryName( logCategoryName ); + + // DO WORK + logger.logError( source, eventName, errorMessage ); + + // VERIFY + String result = stringWriter.toString(); + assertTrue( "An event with the source should have been logged:" + result, result.indexOf( source ) != -1 ); + assertTrue( "An event with the event name should have been logged:" + result, result.indexOf( eventName ) != -1 ); + assertTrue( "An event with the errorMessage should have been logged:" + result, result.indexOf( errorMessage ) != -1 ); + } + + /** + * Configures a logger for the given name. This allows us to check the log output. + *

+ * @param stringWriter + * @param loggerName + */ + private void configureLogger( StringWriter stringWriter, String loggerName ) + { + Logger logger = Logger.getLogger( loggerName ); + WriterAppender appender = null; + + try + { + appender = new WriterAppender( new PatternLayout(), stringWriter ); + } + catch ( Exception e ) + { + // NOOP + } + + logger.addAppender( appender ); + logger.setLevel( Level.DEBUG ); + } +} Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/SerializationConversionUtilUnitTest.java Mon Sep 8 12:26:37 2008 @@ -81,8 +81,6 @@ /** * Verify that we get an IOException for a null serializer. - *

- * @throws Exception */ public void testNullSerializerConversion() { Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentTest.java Mon Sep 8 12:26:37 2008 @@ -25,25 +25,18 @@ import junit.framework.TestCase; import junit.framework.TestSuite; -import org.apache.jcs.utils.struct.LRUMap; - /** * Tests the LRUMap - * - * @author aaronsm - * */ public class LRUMapConcurrentTest extends TestCase { - + /** the number of items to use in a test */ private static int items = 20000; /** * Constructor for the TestSimpleLoad object - * - * @param testName - * Description of the Parameter + * @param testName Description of the Parameter */ public LRUMapConcurrentTest( String testName ) { @@ -52,9 +45,7 @@ /** * Description of the Method - * - * @param args - * Description of the Parameter + * @param args Description of the Parameter */ public static void main( String args[] ) { @@ -64,7 +55,6 @@ /** * A unit test suite for JUnit - * * @return The test suite */ public static Test suite() @@ -124,9 +114,7 @@ /** * Just test that we can put, get and remove as expected. - * - * @exception Exception - * Description of the Exception + * @exception Exception Description of the Exception */ public void testSimpleLoad() throws Exception @@ -155,9 +143,7 @@ /** * Just make sure that the LRU functions int he most simple case. - * - * @exception Exception - * Description of the Exception + * @exception Exception Description of the Exception */ public void testLRURemoval() throws Exception @@ -237,7 +223,6 @@ /** * Just make sure that we can put and get concurrently - * * @param map * @param items * @throws Exception @@ -262,9 +247,8 @@ } /** - * Put, get, and remove from a range. This should occur at a range that is - * not touched by other tests. - * + * Put, get, and remove from a range. This should occur at a range that is not touched by other + * tests. * @param map * @param start * @param end @@ -292,5 +276,4 @@ assertNull( map.get( start + ":key" ) ); } - } Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentUnitTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentUnitTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/struct/LRUMapConcurrentUnitTest.java Mon Sep 8 12:26:37 2008 @@ -29,8 +29,6 @@ /** * Tests the LRUMap - *

- * @author aaron smuts * */ public class LRUMapConcurrentUnitTest Modified: jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java (original) +++ jakarta/jcs/trunk/src/test/org/apache/jcs/utils/threadpool/ThreadPoolUnitTest.java Mon Sep 8 12:26:37 2008 @@ -22,24 +22,21 @@ import junit.framework.TestCase; /** - * This test is experiemental. I'm trying to find out if the max size setting - * will result in the removal of threads. - * + * This test is experiemental. I'm trying to find out if the max size setting will result in the + * removal of threads. + *

* @author Aaron Smuts - * */ public class ThreadPoolUnitTest extends TestCase { - /** - * Make sure that the max size setting takes effect before the idle - * time is reached. - * + * Make sure that the max size setting takes effect before the idle time is reached. + *

* We just want to ensure that we can adjust the max size of an active pool. - * - * http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.html#setMaximumPoolSize(int) - * + *

+ * http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.html# + * setMaximumPoolSize(int) p> * @throws Exception */ public void testMaxReduction() @@ -48,12 +45,9 @@ //ThreadPoolManager.setPropsFileName( "thread_pool_test.properties" ); ThreadPool pool = ThreadPoolManager.getInstance().getPool( "maxtest" ); - System.out.println( "pool = " + pool ); - + //System.out.println( "pool = " + pool ); pool.getPool().setMaximumPoolSize( 5 ); - - System.out.println( "current size before execute = " + pool.getPool().getPoolSize() ); - + //System.out.println( "current size before execute = " + pool.getPool().getPoolSize() ); // add 6 for ( int i = 1; i < 30; i++ ) @@ -68,9 +62,9 @@ try { //System.out.println( cnt ); - System.out.println( "count = " + cnt + " before sleep current size = " + myPool.getPool().getPoolSize() ); + //System.out.println( "count = " + cnt + " before sleep current size = " + myPool.getPool().getPoolSize() ); Thread.sleep( 200 / cnt ); - System.out.println( "count = " + cnt + " after sleep current size = " + myPool.getPool().getPoolSize() ); + //System.out.println( "count = " + cnt + " after sleep current size = " + myPool.getPool().getPoolSize() ); } catch ( InterruptedException e ) { @@ -78,23 +72,15 @@ e.printStackTrace(); } } - } ); - } - System.out.println( "current size = " + pool.getPool().getPoolSize() ); - + //System.out.println( "current size = " + pool.getPool().getPoolSize() ); pool.getPool().setMaximumPoolSize( 4 ); - //Thread.sleep( 200 ); - - System.out.println( "current size after set size to 4= " + pool.getPool().getPoolSize() ); - + //System.out.println( "current size after set size to 4= " + pool.getPool().getPoolSize() ); Thread.sleep( 200 ); - - System.out.println( "current size again after sleep = " + pool.getPool().getPoolSize() ); - + //System.out.println( "current size again after sleep = " + pool.getPool().getPoolSize() ); assertEquals( "Pool size should have been reduced.", 4, pool.getPool().getPoolSize() ); } Modified: jakarta/jcs/trunk/xdocs/CacheEventLogging.xml URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/CacheEventLogging.xml?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/xdocs/CacheEventLogging.xml (original) +++ jakarta/jcs/trunk/xdocs/CacheEventLogging.xml Mon Sep 8 12:26:37 2008 @@ -49,7 +49,7 @@ jcs.auxiliary.RC.attributes.GetTimeoutMillis=500 jcs.auxiliary.RC.attributes.ThreadPoolName=remote_cache_client jcs.auxiliary.RC.attributes.GetOnly=false -jcs.auxiliary.RC.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLoggerImpl +jcs.auxiliary.RC.cacheeventlogger=org.apache.jcs.engine.logging.CacheEventLoggerDebugLogger jcs.auxiliary.RC.cacheeventlogger.attributes.logCategoryName=test.RCCEventLogCategory . . . ]]> Modified: jakarta/jcs/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/changes.xml?rev=693210&r1=693209&r2=693210&view=diff ============================================================================== --- jakarta/jcs/trunk/xdocs/changes.xml (original) +++ jakarta/jcs/trunk/xdocs/changes.xml Mon Sep 8 12:26:37 2008 @@ -21,6 +21,10 @@ + + Made all disk cache managers + handle custom event loggers. + Added eventLogging to major auxiliaries and to the auxiliary factory interface. This allows you @@ -45,8 +49,8 @@ shutdown hook from disk cache to composite cache manager. - Added getMultiple() method to - ICache + Added getMultiple() + method to ICache Updated/added license headers in all --------------------------------------------------------------------- To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: jcs-dev-help@jakarta.apache.org