commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1570993 [14/24] - in /commons/proper/jcs/trunk/src: assembly/ changes/ conf/ java/org/apache/commons/jcs/access/ java/org/apache/commons/jcs/access/exception/ java/org/apache/commons/jcs/admin/ java/org/apache/commons/jcs/auxiliary/ java/o...
Date Sun, 23 Feb 2014 10:37:52 GMT
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCache.java Sun Feb 23 10:37:48 2014
@@ -1,204 +1,204 @@
-package org.apache.commons.jcs.auxiliary;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.jcs.engine.CacheStatus;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.stats.behavior.IStats;
-
-/**
- * Mock auxiliary for unit tests.
- * <p>
- * @author Aaron Smuts
- */
-public class MockAuxiliaryCache<K extends Serializable, V extends Serializable>
-    extends AbstractAuxiliaryCache<K, V>
-{
-    /** Don't change */
-    private static final long serialVersionUID = 1L;
-
-    /** Can setup the cache type */
-    public CacheType cacheType = CacheType.DISK_CACHE;
-
-    /** Can setup status */
-    public CacheStatus status = CacheStatus.ALIVE;
-
-    /** Times getMatching was Called */
-    public int getMatchingCallCount = 0;
-
-    /**
-     * @param ce
-     * @throws IOException
-     */
-    public void update( ICacheElement<K, V> ce )
-        throws IOException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /**
-     * @param key
-     * @return ICacheElement
-     * @throws IOException
-     */
-    public ICacheElement<K, V> get( K key )
-        throws IOException
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /**
-     * @param pattern
-     * @return Map
-     * @throws IOException
-     */
-    public Map<K, ICacheElement<K, V>> getMatching(String pattern)
-        throws IOException
-    {
-        getMatchingCallCount++;
-        return new HashMap<K, ICacheElement<K, V>>();
-    }
-
-    /**
-     * Gets multiple items from the cache based on the given set of keys.
-     * <p>
-     * @param keys
-     * @return a map of K key to ICacheElement<String, String> element, or an empty map if there is no
-     *         data in cache for any of these keys
-     */
-    public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
-    {
-        return new HashMap<K, ICacheElement<K, V>>();
-    }
-
-    /**
-     * @param key
-     * @return boolean
-     * @throws IOException
-     */
-    public boolean remove( K key )
-        throws IOException
-    {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /**
-     * @throws IOException
-     */
-    public void removeAll()
-        throws IOException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /**
-     * @throws IOException
-     */
-    public void dispose()
-        throws IOException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /**
-     * @return int
-     */
-    public int getSize()
-    {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    /**
-     * @return int
-     */
-    public CacheStatus getStatus()
-    {
-        return status;
-    }
-
-    /**
-     * @return null
-     */
-    public String getCacheName()
-    {
-        return null;
-    }
-
-    /**
-     * Return the keys in this cache.
-     * <p>
-     * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getKeySet()
-     */
-    public Set<K> getKeySet() throws IOException
-    {
-        return null;
-    }
-
-    /**
-     * @return null
-     */
-    public IStats getStatistics()
-    {
-        return null;
-    }
-
-    /**
-     * @return null
-     */
-    public String getStats()
-    {
-        return null;
-    }
-
-    /**
-     * @return cacheType
-     */
-    public CacheType getCacheType()
-    {
-        return cacheType;
-    }
-
-    /**
-     * @return Returns the AuxiliaryCacheAttributes.
-     */
-    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
-    {
-        return null;
-    }
-
-    /** @return null */
-    @Override
-    public String getEventLoggingExtraInfo()
-    {
-        return null;
-    }
-}
+package org.apache.commons.jcs.auxiliary;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.jcs.engine.CacheStatus;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.stats.behavior.IStats;
+
+/**
+ * Mock auxiliary for unit tests.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class MockAuxiliaryCache<K extends Serializable, V extends Serializable>
+    extends AbstractAuxiliaryCache<K, V>
+{
+    /** Don't change */
+    private static final long serialVersionUID = 1L;
+
+    /** Can setup the cache type */
+    public CacheType cacheType = CacheType.DISK_CACHE;
+
+    /** Can setup status */
+    public CacheStatus status = CacheStatus.ALIVE;
+
+    /** Times getMatching was Called */
+    public int getMatchingCallCount = 0;
+
+    /**
+     * @param ce
+     * @throws IOException
+     */
+    public void update( ICacheElement<K, V> ce )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /**
+     * @param key
+     * @return ICacheElement
+     * @throws IOException
+     */
+    public ICacheElement<K, V> get( K key )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * @param pattern
+     * @return Map
+     * @throws IOException
+     */
+    public Map<K, ICacheElement<K, V>> getMatching(String pattern)
+        throws IOException
+    {
+        getMatchingCallCount++;
+        return new HashMap<K, ICacheElement<K, V>>();
+    }
+
+    /**
+     * Gets multiple items from the cache based on the given set of keys.
+     * <p>
+     * @param keys
+     * @return a map of K key to ICacheElement<String, String> element, or an empty map if there is no
+     *         data in cache for any of these keys
+     */
+    public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
+    {
+        return new HashMap<K, ICacheElement<K, V>>();
+    }
+
+    /**
+     * @param key
+     * @return boolean
+     * @throws IOException
+     */
+    public boolean remove( K key )
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /**
+     * @throws IOException
+     */
+    public void removeAll()
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /**
+     * @throws IOException
+     */
+    public void dispose()
+        throws IOException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /**
+     * @return int
+     */
+    public int getSize()
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /**
+     * @return int
+     */
+    public CacheStatus getStatus()
+    {
+        return status;
+    }
+
+    /**
+     * @return null
+     */
+    public String getCacheName()
+    {
+        return null;
+    }
+
+    /**
+     * Return the keys in this cache.
+     * <p>
+     * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getKeySet()
+     */
+    public Set<K> getKeySet() throws IOException
+    {
+        return null;
+    }
+
+    /**
+     * @return null
+     */
+    public IStats getStatistics()
+    {
+        return null;
+    }
+
+    /**
+     * @return null
+     */
+    public String getStats()
+    {
+        return null;
+    }
+
+    /**
+     * @return cacheType
+     */
+    public CacheType getCacheType()
+    {
+        return cacheType;
+    }
+
+    /**
+     * @return Returns the AuxiliaryCacheAttributes.
+     */
+    public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+    {
+        return null;
+    }
+
+    /** @return null */
+    @Override
+    public String getEventLoggingExtraInfo()
+    {
+        return null;
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheAttributes.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheAttributes.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheAttributes.java Sun Feb 23 10:37:48 2014
@@ -1,21 +1,39 @@
-package org.apache.commons.jcs.auxiliary;
-
-
-/** For testing. */
-public class MockAuxiliaryCacheAttributes
-    extends AbstractAuxiliaryCacheAttributes
-{
-    /** Don't change. */
-    private static final long serialVersionUID = 1091238902450504108L;
-
-    /**
-     * Doesn't really copy
-     * <p>
-     * @return this
-     */
-    public AuxiliaryCacheAttributes copy()
-    {
-        return this;
-    }
-
-}
+package org.apache.commons.jcs.auxiliary;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/** For testing. */
+public class MockAuxiliaryCacheAttributes
+    extends AbstractAuxiliaryCacheAttributes
+{
+    /** Don't change. */
+    private static final long serialVersionUID = 1091238902450504108L;
+
+    /**
+     * Doesn't really copy
+     * <p>
+     * @return this
+     */
+    public AuxiliaryCacheAttributes copy()
+    {
+        return this;
+    }
+
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockAuxiliaryCacheFactory.java Sun Feb 23 10:37:48 2014
@@ -1,50 +1,69 @@
-package org.apache.commons.jcs.auxiliary;
-
-import java.io.Serializable;
-
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
-
-/** For testing */
-public class MockAuxiliaryCacheFactory
-    implements AuxiliaryCacheFactory
-{
-    /** the name of the aux */
-    public String name = "MockAuxiliaryCacheFactory";
-
-    /**
-     * Creates a mock aux.
-     * <p>
-     * @param attr
-     * @param cacheMgr
-     * @param cacheEventLogger
-     * @param elementSerializer
-     * @return AuxiliaryCache
-     */
-    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V>
-        createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr,
-           ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
-    {
-        MockAuxiliaryCache<K, V> auxCache = new MockAuxiliaryCache<K, V>();
-        auxCache.setCacheEventLogger( cacheEventLogger );
-        auxCache.setElementSerializer( elementSerializer );
-        return auxCache;
-    }
-
-    /**
-     * @return String
-     */
-    public String getName()
-    {
-        return name;
-    }
-
-    /**
-     * @param s
-     */
-    public void setName( String s )
-    {
-        this.name = s;
-    }
-}
+package org.apache.commons.jcs.auxiliary;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
+
+/** For testing */
+public class MockAuxiliaryCacheFactory
+    implements AuxiliaryCacheFactory
+{
+    /** the name of the aux */
+    public String name = "MockAuxiliaryCacheFactory";
+
+    /**
+     * Creates a mock aux.
+     * <p>
+     * @param attr
+     * @param cacheMgr
+     * @param cacheEventLogger
+     * @param elementSerializer
+     * @return AuxiliaryCache
+     */
+    public <K extends Serializable, V extends Serializable> AuxiliaryCache<K, V>
+        createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr,
+           ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
+    {
+        MockAuxiliaryCache<K, V> auxCache = new MockAuxiliaryCache<K, V>();
+        auxCache.setCacheEventLogger( cacheEventLogger );
+        auxCache.setElementSerializer( elementSerializer );
+        return auxCache;
+    }
+
+    /**
+     * @return String
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param s
+     */
+    public void setName( String s )
+    {
+        this.name = s;
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/MockCacheEventLogger.java Sun Feb 23 10:37:48 2014
@@ -1,76 +1,95 @@
-package org.apache.commons.jcs.auxiliary;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.jcs.engine.logging.CacheEvent;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
-import org.apache.commons.jcs.engine.logging.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;
-
-    /** list of messages */
-    public List<String> errorMessages = new ArrayList<String>();
-
-    /**
-     * @param source
-     * @param eventName
-     * @param optionalDetails
-     */
-    public void logApplicationEvent( String source, String eventName, String optionalDetails )
-    {
-        applicationEventCalls++;
-    }
-
-    /**
-     * @param cacheEvent
-     */
-    public <T extends Serializable> void logICacheEvent( ICacheEvent<T> event )
-    {
-        endICacheEventCalls++;
-    }
-
-    /**
-     * @param source
-     * @param eventName
-     * @param errorMessage
-     */
-    public void logError( String source, String eventName, String errorMessage )
-    {
-        errorEventCalls++;
-        errorMessages.add( errorMessage );
-    }
-
-    /**
-     * @param source
-     * @param region
-     * @param eventName
-     * @param optionalDetails
-     * @param key
-     * @return ICacheEvent
-     */
-    public <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region,
-            String eventName, String optionalDetails, T key )
-    {
-        startICacheEventCalls++;
-        return new CacheEvent<T>();
-    }
-}
+package org.apache.commons.jcs.auxiliary;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.jcs.engine.logging.CacheEvent;
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent;
+import org.apache.commons.jcs.engine.logging.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;
+
+    /** list of messages */
+    public List<String> errorMessages = new ArrayList<String>();
+
+    /**
+     * @param source
+     * @param eventName
+     * @param optionalDetails
+     */
+    public void logApplicationEvent( String source, String eventName, String optionalDetails )
+    {
+        applicationEventCalls++;
+    }
+
+    /**
+     * @param cacheEvent
+     */
+    public <T extends Serializable> void logICacheEvent( ICacheEvent<T> event )
+    {
+        endICacheEventCalls++;
+    }
+
+    /**
+     * @param source
+     * @param eventName
+     * @param errorMessage
+     */
+    public void logError( String source, String eventName, String errorMessage )
+    {
+        errorEventCalls++;
+        errorMessages.add( errorMessage );
+    }
+
+    /**
+     * @param source
+     * @param region
+     * @param eventName
+     * @param optionalDetails
+     * @param key
+     * @return ICacheEvent
+     */
+    public <T extends Serializable> ICacheEvent<T> createICacheEvent( String source, String region,
+            String eventName, String optionalDetails, T key )
+    {
+        startICacheEventCalls++;
+        return new CacheEvent<T>();
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCacheUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,285 +1,304 @@
-package org.apache.commons.jcs.auxiliary.disk;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.TestLogConfigurationUtil;
-import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
-import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes;
-import org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.CacheStatus;
-import org.apache.commons.jcs.engine.ElementAttributes;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.IElementAttributes;
-
-/** Tests for the abstract disk cache. It's largely tested by actual instances. */
-public class AbstractDiskCacheUnitTest
-    extends TestCase
-{
-    /**
-     * Verify that update and get work.
-     * <p>
-     * @throws IOException
-     */
-    public void testUpdateGet_allowed()
-        throws IOException
-    {
-        // SETUP
-        String cacheName = "testUpdateGet_allowed";
-        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
-        diskCacheAttributes.setCacheName( cacheName );
-
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
-
-        String key = "myKey";
-        String value = "myValue";
-        IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-
-        diskCache.update( cacheElement );
-
-        // DO WORK
-        ICacheElement<String, String> result = diskCache.get( key );
-
-        // VERIFY
-        //System.out.println( diskCache.getStats() );
-        assertNotNull( "Item should be in the map.", result );
-    }
-
-    /**
-     * Verify that alive is set to false..
-     * <p>
-     * @throws IOException
-     */
-    public void testDispose()
-        throws IOException
-    {
-        // SETUP
-        String cacheName = "testDispose";
-        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
-        diskCacheAttributes.setCacheName( cacheName );
-
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
-
-        String key = "myKey";
-        String value = "myValue";
-        IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-
-        diskCache.update( cacheElement );
-
-        // DO WORK
-        diskCache.dispose();
-
-        // VERIFY
-        assertFalse( "disk cache should not be alive.", diskCache.alive );
-        assertEquals( "Status should be disposed", CacheStatus.DISPOSED, diskCache.getStatus() );
-    }
-
-    /**
-     * Verify that removeAll is prohibited.
-     * <p>
-     * @throws IOException
-     */
-    public void testRemoveAll_notAllowed()
-        throws IOException
-    {
-        // SETUP
-        StringWriter stringWriter = new StringWriter();
-        TestLogConfigurationUtil.configureLogger( stringWriter, AbstractDiskCache.class.getName() );
-
-        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
-        diskCacheAttributes.setAllowRemoveAll( false );
-
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
-
-        String cacheName = "testRemoveAll_notAllowed";
-        String key = "myKey";
-        String value = "myValue";
-        IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-
-        diskCache.update( cacheElement );
-
-        // DO WORK
-        diskCache.removeAll();
-        String result = stringWriter.toString();
-
-        // VERIFY
-        assertTrue( "Should say not allowed.", result.indexOf( "set to false" ) != -1 );
-        assertNotNull( "Item should be in the map.", diskCache.get( key ) );
-    }
-
-    /**
-     * Verify that removeAll is allowed.
-     * <p>
-     * @throws IOException
-     */
-    public void testRemoveAll_allowed()
-        throws IOException
-    {
-        // SETUP
-        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
-        diskCacheAttributes.setAllowRemoveAll( true );
-
-        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
-
-        String cacheName = "testRemoveAll_allowed";
-        String key = "myKey";
-        String value = "myValue";
-        IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-
-        diskCache.update( cacheElement );
-
-        // DO WORK
-        diskCache.removeAll();
-
-        // VERIFY
-        assertNull( "Item should not be in the map.", diskCache.get( key ) );
-    }
-
-    /** Concrete, testable instance. */
-    protected static class AbstractDiskCacheTestInstance<K extends Serializable, V extends Serializable>
-        extends AbstractDiskCache<K, V>
-    {
-        /** Internal map */
-        protected Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K, V>>();
-
-        /** used by the abstract aux class */
-        protected IDiskCacheAttributes diskCacheAttributes;
-
-        /**
-         * Creates the disk cache.
-         * <p>
-         * @param attr
-         */
-        public AbstractDiskCacheTestInstance( IDiskCacheAttributes attr )
-        {
-            super( attr );
-            diskCacheAttributes = attr;
-            super.alive = true;
-        }
-
-        /** Nothing. */
-        private static final long serialVersionUID = 1L;
-
-        /**
-         * The location on disk
-         * <p>
-         * @return "memory"
-         */
-        @Override
-        protected String getDiskLocation()
-        {
-            return "memory";
-        }
-
-        /**
-         * Return the keys in this cache.
-         * <p>
-         * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getKeySet()
-         */
-        @Override
-        public Set<K> getKeySet() throws IOException
-        {
-            return new HashSet<K>(map.keySet());
-        }
-
-        /**
-         * @return map.size()
-         */
-        @Override
-        public int getSize()
-        {
-            return map.size();
-        }
-
-        /**
-         * @throws IOException
-         */
-        @Override
-        protected void processDispose()
-            throws IOException
-        {
-            //System.out.println( "processDispose" );
-        }
-
-        /**
-         * @param key
-         * @return ICacheElement
-         * @throws IOException
-         */
-        @Override
-        protected ICacheElement<K, V> processGet( K key )
-            throws IOException
-        {
-            //System.out.println( "processGet: " + key );
-            return map.get( key );
-        }
-
-        /**
-         * @param pattern
-         * @return Collections.EMPTY_MAP
-         * @throws IOException
-         */
-        @Override
-        protected Map<K, ICacheElement<K, V>> processGetMatching( String pattern )
-            throws IOException
-        {
-            return Collections.emptyMap();
-        }
-
-        /**
-         * @param key
-         * @return false
-         * @throws IOException
-         */
-        @Override
-        protected boolean processRemove( K key )
-            throws IOException
-        {
-            return map.remove( key ) != null;
-        }
-
-        /**
-         * @throws IOException
-         */
-        @Override
-        protected void processRemoveAll()
-            throws IOException
-        {
-            //System.out.println( "processRemoveAll" );
-            map.clear();
-        }
-
-        /**
-         * @param cacheElement
-         * @throws IOException
-         */
-        @Override
-        protected void processUpdate( ICacheElement<K, V> cacheElement )
-            throws IOException
-        {
-            //System.out.println( "processUpdate: " + cacheElement );
-            map.put( cacheElement.getKey(), cacheElement );
-        }
-
-        /**
-         * @return null
-         */
-        public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
-        {
-            return diskCacheAttributes;
-        }
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.TestLogConfigurationUtil;
+import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.commons.jcs.auxiliary.disk.behavior.IDiskCacheAttributes;
+import org.apache.commons.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.CacheStatus;
+import org.apache.commons.jcs.engine.ElementAttributes;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
+
+/** Tests for the abstract disk cache. It's largely tested by actual instances. */
+public class AbstractDiskCacheUnitTest
+    extends TestCase
+{
+    /**
+     * Verify that update and get work.
+     * <p>
+     * @throws IOException
+     */
+    public void testUpdateGet_allowed()
+        throws IOException
+    {
+        // SETUP
+        String cacheName = "testUpdateGet_allowed";
+        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
+        diskCacheAttributes.setCacheName( cacheName );
+
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+
+        String key = "myKey";
+        String value = "myValue";
+        IElementAttributes elementAttributes = new ElementAttributes();
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+
+        diskCache.update( cacheElement );
+
+        // DO WORK
+        ICacheElement<String, String> result = diskCache.get( key );
+
+        // VERIFY
+        //System.out.println( diskCache.getStats() );
+        assertNotNull( "Item should be in the map.", result );
+    }
+
+    /**
+     * Verify that alive is set to false..
+     * <p>
+     * @throws IOException
+     */
+    public void testDispose()
+        throws IOException
+    {
+        // SETUP
+        String cacheName = "testDispose";
+        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
+        diskCacheAttributes.setCacheName( cacheName );
+
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+
+        String key = "myKey";
+        String value = "myValue";
+        IElementAttributes elementAttributes = new ElementAttributes();
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+
+        diskCache.update( cacheElement );
+
+        // DO WORK
+        diskCache.dispose();
+
+        // VERIFY
+        assertFalse( "disk cache should not be alive.", diskCache.alive );
+        assertEquals( "Status should be disposed", CacheStatus.DISPOSED, diskCache.getStatus() );
+    }
+
+    /**
+     * Verify that removeAll is prohibited.
+     * <p>
+     * @throws IOException
+     */
+    public void testRemoveAll_notAllowed()
+        throws IOException
+    {
+        // SETUP
+        StringWriter stringWriter = new StringWriter();
+        TestLogConfigurationUtil.configureLogger( stringWriter, AbstractDiskCache.class.getName() );
+
+        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
+        diskCacheAttributes.setAllowRemoveAll( false );
+
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+
+        String cacheName = "testRemoveAll_notAllowed";
+        String key = "myKey";
+        String value = "myValue";
+        IElementAttributes elementAttributes = new ElementAttributes();
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+
+        diskCache.update( cacheElement );
+
+        // DO WORK
+        diskCache.removeAll();
+        String result = stringWriter.toString();
+
+        // VERIFY
+        assertTrue( "Should say not allowed.", result.indexOf( "set to false" ) != -1 );
+        assertNotNull( "Item should be in the map.", diskCache.get( key ) );
+    }
+
+    /**
+     * Verify that removeAll is allowed.
+     * <p>
+     * @throws IOException
+     */
+    public void testRemoveAll_allowed()
+        throws IOException
+    {
+        // SETUP
+        IDiskCacheAttributes diskCacheAttributes = new IndexedDiskCacheAttributes();
+        diskCacheAttributes.setAllowRemoveAll( true );
+
+        AbstractDiskCacheTestInstance<String, String> diskCache = new AbstractDiskCacheTestInstance<String, String>( diskCacheAttributes );
+
+        String cacheName = "testRemoveAll_allowed";
+        String key = "myKey";
+        String value = "myValue";
+        IElementAttributes elementAttributes = new ElementAttributes();
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+
+        diskCache.update( cacheElement );
+
+        // DO WORK
+        diskCache.removeAll();
+
+        // VERIFY
+        assertNull( "Item should not be in the map.", diskCache.get( key ) );
+    }
+
+    /** Concrete, testable instance. */
+    protected static class AbstractDiskCacheTestInstance<K extends Serializable, V extends Serializable>
+        extends AbstractDiskCache<K, V>
+    {
+        /** Internal map */
+        protected Map<K, ICacheElement<K, V>> map = new HashMap<K, ICacheElement<K, V>>();
+
+        /** used by the abstract aux class */
+        protected IDiskCacheAttributes diskCacheAttributes;
+
+        /**
+         * Creates the disk cache.
+         * <p>
+         * @param attr
+         */
+        public AbstractDiskCacheTestInstance( IDiskCacheAttributes attr )
+        {
+            super( attr );
+            diskCacheAttributes = attr;
+            super.alive = true;
+        }
+
+        /** Nothing. */
+        private static final long serialVersionUID = 1L;
+
+        /**
+         * The location on disk
+         * <p>
+         * @return "memory"
+         */
+        @Override
+        protected String getDiskLocation()
+        {
+            return "memory";
+        }
+
+        /**
+         * Return the keys in this cache.
+         * <p>
+         * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getKeySet()
+         */
+        @Override
+        public Set<K> getKeySet() throws IOException
+        {
+            return new HashSet<K>(map.keySet());
+        }
+
+        /**
+         * @return map.size()
+         */
+        @Override
+        public int getSize()
+        {
+            return map.size();
+        }
+
+        /**
+         * @throws IOException
+         */
+        @Override
+        protected void processDispose()
+            throws IOException
+        {
+            //System.out.println( "processDispose" );
+        }
+
+        /**
+         * @param key
+         * @return ICacheElement
+         * @throws IOException
+         */
+        @Override
+        protected ICacheElement<K, V> processGet( K key )
+            throws IOException
+        {
+            //System.out.println( "processGet: " + key );
+            return map.get( key );
+        }
+
+        /**
+         * @param pattern
+         * @return Collections.EMPTY_MAP
+         * @throws IOException
+         */
+        @Override
+        protected Map<K, ICacheElement<K, V>> processGetMatching( String pattern )
+            throws IOException
+        {
+            return Collections.emptyMap();
+        }
+
+        /**
+         * @param key
+         * @return false
+         * @throws IOException
+         */
+        @Override
+        protected boolean processRemove( K key )
+            throws IOException
+        {
+            return map.remove( key ) != null;
+        }
+
+        /**
+         * @throws IOException
+         */
+        @Override
+        protected void processRemoveAll()
+            throws IOException
+        {
+            //System.out.println( "processRemoveAll" );
+            map.clear();
+        }
+
+        /**
+         * @param cacheElement
+         * @throws IOException
+         */
+        @Override
+        protected void processUpdate( ICacheElement<K, V> cacheElement )
+            throws IOException
+        {
+            //System.out.println( "processUpdate: " + cacheElement );
+            map.put( cacheElement.getKey(), cacheElement );
+        }
+
+        /**
+         * @return null
+         */
+        public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
+        {
+            return diskCacheAttributes;
+        }
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/LRUMapJCSUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/LRUMapJCSUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/LRUMapJCSUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/LRUMapJCSUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,58 +1,77 @@
-package org.apache.commons.jcs.auxiliary.disk;
-
-import java.io.StringWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.TestLogConfigurationUtil;
-
-/** Unit tests for the LRUMapJCS implementation. */
-public class LRUMapJCSUnitTest
-    extends TestCase
-{
-    /** Verify that we default to unlimited */
-    public void testDefault()
-    {
-        // SETUP
-
-        // DO WORK
-        LRUMapJCS<String, String> map = new LRUMapJCS<String, String>();
-
-        // VERIFY
-        assertEquals( "Should be unlimted", -1, map.getMaxObjects() );
-    }
-
-    /** Verify that we default to unlimited */
-    public void testLimited()
-    {
-        // SETUP
-        int expected = 100;
-
-        // DO WORK
-        LRUMapJCS<String, String> map = new LRUMapJCS<String, String>( expected );
-
-        // VERIFY
-        assertEquals( "Should be expected", expected, map.getMaxObjects() );
-    }
-
-    /** Verify that the log message. */
-    public void testProcessRemovedLRU()
-    {
-        // SETUP
-        StringWriter stringWriter = new StringWriter();
-        TestLogConfigurationUtil.configureLogger( stringWriter, LRUMapJCS.class.getName() );
-
-        LRUMapJCS<String, String> map = new LRUMapJCS<String, String>();
-
-        String key = "myKey";
-        String value = "myValue";
-
-        // DO WORK
-        map.processRemovedLRU( key, value );
-        String result = stringWriter.toString();
-
-        // VERIFY
-        assertTrue( "Debug log should contain the key,", result.indexOf( key ) != -1 );
-        assertTrue( "Debug log should contain the value,", result.indexOf( value ) != -1 );
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.TestLogConfigurationUtil;
+
+/** Unit tests for the LRUMapJCS implementation. */
+public class LRUMapJCSUnitTest
+    extends TestCase
+{
+    /** Verify that we default to unlimited */
+    public void testDefault()
+    {
+        // SETUP
+
+        // DO WORK
+        LRUMapJCS<String, String> map = new LRUMapJCS<String, String>();
+
+        // VERIFY
+        assertEquals( "Should be unlimted", -1, map.getMaxObjects() );
+    }
+
+    /** Verify that we default to unlimited */
+    public void testLimited()
+    {
+        // SETUP
+        int expected = 100;
+
+        // DO WORK
+        LRUMapJCS<String, String> map = new LRUMapJCS<String, String>( expected );
+
+        // VERIFY
+        assertEquals( "Should be expected", expected, map.getMaxObjects() );
+    }
+
+    /** Verify that the log message. */
+    public void testProcessRemovedLRU()
+    {
+        // SETUP
+        StringWriter stringWriter = new StringWriter();
+        TestLogConfigurationUtil.configureLogger( stringWriter, LRUMapJCS.class.getName() );
+
+        LRUMapJCS<String, String> map = new LRUMapJCS<String, String>();
+
+        String key = "myKey";
+        String value = "myValue";
+
+        // DO WORK
+        map.processRemovedLRU( key, value );
+        String result = stringWriter.toString();
+
+        // VERIFY
+        assertTrue( "Debug log should contain the key,", result.indexOf( key ) != -1 );
+        assertTrue( "Debug log should contain the value,", result.indexOf( value ) != -1 );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/PurgatoryElementUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,72 +1,91 @@
-package org.apache.commons.jcs.auxiliary.disk;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.ElementAttributes;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-import org.apache.commons.jcs.engine.behavior.IElementAttributes;
-
-/** Simple unit tests for the Purgatory Element. */
-public class PurgatoryElementUnitTest
-    extends TestCase
-{
-    /** Verify basic data */
-    public void testSpoolable_normal()
-    {
-        // SETUP
-        String cacheName = "myCacheName";
-        String key = "myKey";
-        String value = "myValue";
-        IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
-        purgatoryElement.setSpoolable( false );
-
-        // DO WORK
-        boolean result = purgatoryElement.isSpoolable();
-
-        // VERIFY
-        assertFalse( "Should not be spoolable.", result );
-    }
-
-    /** Verify basic data */
-    public void testElementAttributes_normal()
-    {
-        // SETUP
-        String cacheName = "myCacheName";
-        String key = "myKey";
-        String value = "myValue";
-        IElementAttributes elementAttributes = new ElementAttributes();
-
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value );
-        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
-        purgatoryElement.setElementAttributes( elementAttributes );
-
-        // DO WORK
-        IElementAttributes result = cacheElement.getElementAttributes();
-
-        // VERIFY
-        assertEquals( "Should have set the attributes on the element", elementAttributes, result );
-    }
-
-    /** Verify basic data */
-    public void testToString_normal()
-    {
-        // SETUP
-        String cacheName = "myCacheName";
-        String key = "myKey";
-        String value = "myValue";
-        IElementAttributes elementAttributes = new ElementAttributes();
-        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
-        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
-
-        // DO WORK
-        String result = purgatoryElement.toString();
-
-        // VERIFY
-        assertTrue( "Should have the cacheName.", result.indexOf( cacheName ) != -1 );
-        assertTrue( "Should have the key.", result.indexOf( key ) != -1 );
-        assertTrue( "Should have the value.", result.indexOf( value ) != -1 );
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.ElementAttributes;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
+
+/** Simple unit tests for the Purgatory Element. */
+public class PurgatoryElementUnitTest
+    extends TestCase
+{
+    /** Verify basic data */
+    public void testSpoolable_normal()
+    {
+        // SETUP
+        String cacheName = "myCacheName";
+        String key = "myKey";
+        String value = "myValue";
+        IElementAttributes elementAttributes = new ElementAttributes();
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
+        purgatoryElement.setSpoolable( false );
+
+        // DO WORK
+        boolean result = purgatoryElement.isSpoolable();
+
+        // VERIFY
+        assertFalse( "Should not be spoolable.", result );
+    }
+
+    /** Verify basic data */
+    public void testElementAttributes_normal()
+    {
+        // SETUP
+        String cacheName = "myCacheName";
+        String key = "myKey";
+        String value = "myValue";
+        IElementAttributes elementAttributes = new ElementAttributes();
+
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value );
+        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
+        purgatoryElement.setElementAttributes( elementAttributes );
+
+        // DO WORK
+        IElementAttributes result = cacheElement.getElementAttributes();
+
+        // VERIFY
+        assertEquals( "Should have set the attributes on the element", elementAttributes, result );
+    }
+
+    /** Verify basic data */
+    public void testToString_normal()
+    {
+        // SETUP
+        String cacheName = "myCacheName";
+        String key = "myKey";
+        String value = "myValue";
+        IElementAttributes elementAttributes = new ElementAttributes();
+        ICacheElement<String, String> cacheElement = new CacheElement<String, String>( cacheName, key, value, elementAttributes );
+        PurgatoryElement<String, String> purgatoryElement = new PurgatoryElement<String, String>( cacheElement );
+
+        // DO WORK
+        String result = purgatoryElement.toString();
+
+        // VERIFY
+        assertTrue( "Should have the cacheName.", result.indexOf( cacheName ) != -1 );
+        assertTrue( "Should have the key.", result.indexOf( key ) != -1 );
+        assertTrue( "Should have the value.", result.indexOf( value ) != -1 );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheConcurrentUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,259 +1,259 @@
-package org.apache.commons.jcs.auxiliary.disk.block;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import junit.extensions.ActiveTestSuite;
-import junit.framework.Test;
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.access.CacheAccess;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-
-/**
- * Test which exercises the block disk cache. This one uses three different
- * regions for three threads.
- */
-public class BlockDiskCacheConcurrentUnitTest
-    extends TestCase
-{
-    /**
-     * Number of items to cache, twice the configured maxObjects for the memory
-     * cache regions.
-     */
-    private static int items = 200;
-
-    /**
-     * Constructor for the TestDiskCache object.
-     *
-     * @param testName
-     * @throws Exception
-     */
-    public BlockDiskCacheConcurrentUnitTest( String testName )
-        throws Exception
-    {
-        super( testName );
-    }
-
-    /**
-     * Main method passes this test to the text test runner.
-     *
-     * @param args
-     */
-    public static void main( String args[] )
-    {
-        String[] testCaseName = { BlockDiskCacheConcurrentUnitTest.class.getName() };
-        junit.textui.TestRunner.main( testCaseName );
-    }
-
-    /**
-     * A unit test suite for JUnit
-     *
-     * @return The test suite
-     * @throws Exception
-     */
-    public static Test suite()
-        throws Exception
-    {
-        ActiveTestSuite suite = new ActiveTestSuite();
-
-        JCS.setConfigFilename( "/TestBlockDiskCache.ccf" );
-        JCS.getInstance( "indexedRegion1" ).clear();
-        JCS.getInstance( "indexedRegion2" ).clear();
-        JCS.getInstance( "indexedRegion3" ).clear();
-
-        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache1" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegion( "indexedRegion1" );
-            }
-        } );
-
-        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache2" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegion( "indexedRegion2" );
-            }
-        } );
-
-        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache3" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegion( "indexedRegion3" );
-            }
-        } );
-
-        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache4" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegionInRange( "indexedRegion3", 300, 600 );
-            }
-        } );
-
-        return suite;
-    }
-
-    /**
-     * Test setup
-     */
-    @Override
-    public void setUp()
-    {
-        JCS.setConfigFilename( "/TestBlockDiskCache.ccf" );
-    }
-
-    /**
-     * Adds items to cache, gets them, and removes them. The item count is more
-     * than the size of the memory cache, so items should spool to disk.
-     *
-     * @param region
-     *            Name of the region to access
-     *
-     * @exception Exception
-     *                If an error occurs
-     */
-    public void runTestForRegion( String region )
-        throws Exception
-    {
-        CacheAccess<String, String> jcs = JCS.getInstance( region );
-
-        // Add items to cache
-        for ( int i = 0; i <= items; i++ )
-        {
-            jcs.put( i + ":key", region + " data " + i );
-        }
-
-        // Test that all items are in cache
-        for ( int i = 0; i <= items; i++ )
-        {
-            String value = jcs.get( i + ":key" );
-
-            assertEquals( region + " data " + i, value );
-        }
-
-        // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
-        for ( int i = 0; i <= items; i++ )
-        {
-            keys.add( i + ":key" );
-        }
-
-        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
-        for ( int i = 0; i <= items; i++ )
-        {
-            ICacheElement<String, String> element = elements.get( i + ":key" );
-            assertNotNull( "element " + i + ":key is missing", element );
-            assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() );
-        }
-
-        // Remove all the items
-        for ( int i = 0; i <= items; i++ )
-        {
-            jcs.remove( i + ":key" );
-        }
-
-        // Verify removal
-        // another thread may have inserted since
-        for ( int i = 0; i <= items; i++ )
-        {
-            assertNull( "Removed key should be null: " + i + ":key" + "\n stats " + jcs.getStats(), jcs
-                .get( i + ":key" ) );
-        }
-    }
-
-    /**
-     * Adds items to cache, gets them, and removes them. The item count is more
-     * than the size of the memory cache, so items should spool to disk.
-     *
-     * @param region
-     *            Name of the region to access
-     * @param start
-     * @param end
-     *
-     * @exception Exception
-     *                If an error occurs
-     */
-    public void runTestForRegionInRange( String region, int start, int end )
-        throws Exception
-    {
-        CacheAccess<String, String> jcs = JCS.getInstance( region );
-
-        // Add items to cache
-        for ( int i = start; i <= end; i++ )
-        {
-            jcs.put( i + ":key", region + " data " + i );
-        }
-
-        // Test that all items are in cache
-        for ( int i = start; i <= end; i++ )
-        {
-            String value = jcs.get( i + ":key" );
-
-            assertEquals( region + " data " + i, value );
-        }
-
-        // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
-        for ( int i = start; i <= end; i++ )
-        {
-            keys.add( i + ":key" );
-        }
-
-        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
-        for ( int i = start; i <= end; i++ )
-        {
-            ICacheElement<String, String> element = elements.get( i + ":key" );
-            assertNotNull( "element " + i + ":key is missing", element );
-            assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() );
-        }
-
-        // Remove all the items
-        for ( int i = start; i <= end; i++ )
-        {
-            jcs.remove( i + ":key" );
-        }
-
-        System.out.println( jcs.getStats() );
-
-        // Verify removal
-        // another thread may have inserted since
-        for ( int i = start; i <= end; i++ )
-        {
-            assertNull( "Removed key should be null: " + i + ":key " + "\n stats " + jcs.getStats(), jcs.get( i
-                + ":key" ) );
-        }
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk.block;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import junit.extensions.ActiveTestSuite;
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+
+/**
+ * Test which exercises the block disk cache. This one uses three different
+ * regions for three threads.
+ */
+public class BlockDiskCacheConcurrentUnitTest
+    extends TestCase
+{
+    /**
+     * Number of items to cache, twice the configured maxObjects for the memory
+     * cache regions.
+     */
+    private static int items = 200;
+
+    /**
+     * Constructor for the TestDiskCache object.
+     *
+     * @param testName
+     * @throws Exception
+     */
+    public BlockDiskCacheConcurrentUnitTest( String testName )
+        throws Exception
+    {
+        super( testName );
+    }
+
+    /**
+     * Main method passes this test to the text test runner.
+     *
+     * @param args
+     */
+    public static void main( String args[] )
+    {
+        String[] testCaseName = { BlockDiskCacheConcurrentUnitTest.class.getName() };
+        junit.textui.TestRunner.main( testCaseName );
+    }
+
+    /**
+     * A unit test suite for JUnit
+     *
+     * @return The test suite
+     * @throws Exception
+     */
+    public static Test suite()
+        throws Exception
+    {
+        ActiveTestSuite suite = new ActiveTestSuite();
+
+        JCS.setConfigFilename( "/TestBlockDiskCache.ccf" );
+        JCS.getInstance( "indexedRegion1" ).clear();
+        JCS.getInstance( "indexedRegion2" ).clear();
+        JCS.getInstance( "indexedRegion3" ).clear();
+
+        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache1" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegion( "indexedRegion1" );
+            }
+        } );
+
+        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache2" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegion( "indexedRegion2" );
+            }
+        } );
+
+        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache3" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegion( "indexedRegion3" );
+            }
+        } );
+
+        suite.addTest( new BlockDiskCacheConcurrentUnitTest( "testBlockDiskCache4" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegionInRange( "indexedRegion3", 300, 600 );
+            }
+        } );
+
+        return suite;
+    }
+
+    /**
+     * Test setup
+     */
+    @Override
+    public void setUp()
+    {
+        JCS.setConfigFilename( "/TestBlockDiskCache.ccf" );
+    }
+
+    /**
+     * Adds items to cache, gets them, and removes them. The item count is more
+     * than the size of the memory cache, so items should spool to disk.
+     *
+     * @param region
+     *            Name of the region to access
+     *
+     * @exception Exception
+     *                If an error occurs
+     */
+    public void runTestForRegion( String region )
+        throws Exception
+    {
+        CacheAccess<String, String> jcs = JCS.getInstance( region );
+
+        // Add items to cache
+        for ( int i = 0; i <= items; i++ )
+        {
+            jcs.put( i + ":key", region + " data " + i );
+        }
+
+        // Test that all items are in cache
+        for ( int i = 0; i <= items; i++ )
+        {
+            String value = jcs.get( i + ":key" );
+
+            assertEquals( region + " data " + i, value );
+        }
+
+        // Test that getElements returns all the expected values
+        Set<String> keys = new HashSet<String>();
+        for ( int i = 0; i <= items; i++ )
+        {
+            keys.add( i + ":key" );
+        }
+
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
+        for ( int i = 0; i <= items; i++ )
+        {
+            ICacheElement<String, String> element = elements.get( i + ":key" );
+            assertNotNull( "element " + i + ":key is missing", element );
+            assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() );
+        }
+
+        // Remove all the items
+        for ( int i = 0; i <= items; i++ )
+        {
+            jcs.remove( i + ":key" );
+        }
+
+        // Verify removal
+        // another thread may have inserted since
+        for ( int i = 0; i <= items; i++ )
+        {
+            assertNull( "Removed key should be null: " + i + ":key" + "\n stats " + jcs.getStats(), jcs
+                .get( i + ":key" ) );
+        }
+    }
+
+    /**
+     * Adds items to cache, gets them, and removes them. The item count is more
+     * than the size of the memory cache, so items should spool to disk.
+     *
+     * @param region
+     *            Name of the region to access
+     * @param start
+     * @param end
+     *
+     * @exception Exception
+     *                If an error occurs
+     */
+    public void runTestForRegionInRange( String region, int start, int end )
+        throws Exception
+    {
+        CacheAccess<String, String> jcs = JCS.getInstance( region );
+
+        // Add items to cache
+        for ( int i = start; i <= end; i++ )
+        {
+            jcs.put( i + ":key", region + " data " + i );
+        }
+
+        // Test that all items are in cache
+        for ( int i = start; i <= end; i++ )
+        {
+            String value = jcs.get( i + ":key" );
+
+            assertEquals( region + " data " + i, value );
+        }
+
+        // Test that getElements returns all the expected values
+        Set<String> keys = new HashSet<String>();
+        for ( int i = start; i <= end; i++ )
+        {
+            keys.add( i + ":key" );
+        }
+
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
+        for ( int i = start; i <= end; i++ )
+        {
+            ICacheElement<String, String> element = elements.get( i + ":key" );
+            assertNotNull( "element " + i + ":key is missing", element );
+            assertEquals( "value " + i + ":key", region + " data " + i, element.getVal() );
+        }
+
+        // Remove all the items
+        for ( int i = start; i <= end; i++ )
+        {
+            jcs.remove( i + ":key" );
+        }
+
+        System.out.println( jcs.getStats() );
+
+        // Verify removal
+        // another thread may have inserted since
+        for ( int i = start; i <= end; i++ )
+        {
+            assertNull( "Removed key should be null: " + i + ":key " + "\n stats " + jcs.getStats(), jcs.get( i
+                + ":key" ) );
+        }
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheManagerUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,37 +1,56 @@
-package org.apache.commons.jcs.auxiliary.disk.block;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
-import org.apache.commons.jcs.auxiliary.MockCacheEventLogger;
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.engine.control.MockElementSerializer;
-import org.apache.commons.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
-        AuxiliaryCache<String, String> auxcache = manager.getCache(cacheName);
-        BlockDiskCache<String, String> cache = (BlockDiskCache<String, String>) auxcache;
-
-        // VERIFY
-        assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger() );
-        assertEquals( "wrong elementSerializer", elementSerializer, cache.getElementSerializer() );
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk.block;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
+import org.apache.commons.jcs.auxiliary.MockCacheEventLogger;
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
+import org.apache.commons.jcs.engine.control.MockElementSerializer;
+import org.apache.commons.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
+        AuxiliaryCache<String, String> auxcache = manager.getCache(cacheName);
+        BlockDiskCache<String, String> cache = (BlockDiskCache<String, String>) auxcache;
+
+        // VERIFY
+        assertEquals( "wrong cacheEventLogger", cacheEventLogger, cache.getCacheEventLogger() );
+        assertEquals( "wrong elementSerializer", elementSerializer, cache.getElementSerializer() );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/disk/block/BlockDiskCacheSameRegionConcurrentUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,173 +1,173 @@
-package org.apache.commons.jcs.auxiliary.disk.block;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import junit.extensions.ActiveTestSuite;
-import junit.framework.Test;
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.access.CacheAccess;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-
-/**
- * Test which exercises the block disk cache. Runs three threads against the same region.
- */
-public class BlockDiskCacheSameRegionConcurrentUnitTest
-    extends TestCase
-{
-    /**
-     * Constructor for the TestDiskCache object.
-     * <p>
-     * @param testName
-     */
-    public BlockDiskCacheSameRegionConcurrentUnitTest( String testName )
-    {
-        super( testName );
-    }
-
-    /**
-     * Main method passes this test to the text test runner.
-     * <p>
-     * @param args
-     * @throws InterruptedException
-     */
-    public static void main( String args[] ) throws InterruptedException
-    {
-        String[] testCaseName = { BlockDiskCacheSameRegionConcurrentUnitTest.class.getName() };
-        junit.textui.TestRunner.main( testCaseName );
-
-        // Give test threads some time to finish
-        Thread.sleep(2000);
-    }
-
-    /**
-     * A unit test suite for JUnit
-     * @return The test suite
-     */
-    public static Test suite()
-    {
-        ActiveTestSuite suite = new ActiveTestSuite();
-
-        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache1" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegion( "blockRegion4", 0, 200 );
-            }
-        } );
-
-        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache2" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegion( "blockRegion4", 1000, 1200 );
-            }
-        } );
-
-        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache3" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegion( "blockRegion4", 2000, 2200 );
-            }
-        } );
-
-        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache4" )
-        {
-            @Override
-            public void runTest()
-                throws Exception
-            {
-                this.runTestForRegion( "blockRegion4", 2200, 5200 );
-            }
-        } );
-
-        return suite;
-    }
-
-    /**
-     * Test setup.  Sets the config name and clears the region.
-     * <p>
-     * @throws Exception
-     */
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        JCS.setConfigFilename( "/TestBlockDiskCacheCon.ccf" );
-    }
-
-    /**
-     * Adds items to cache, gets them, and removes them. The item count is more than the size of the
-     * memory cache, so items should spool to disk.
-     * @param region Name of the region to access
-     * @param start
-     * @param end
-     * @exception Exception If an error occurs
-     */
-    public void runTestForRegion( String region, int start, int end )
-        throws Exception
-    {
-        CacheAccess<String, String> jcs = JCS.getInstance( region );
-
-        // Add items to cache
-
-        for ( int i = start; i <= end; i++ )
-        {
-            jcs.put( i + ":key", region + " data " + i + "-" + region );
-        }
-
-        // Test that all items are in cache
-
-        for ( int i = start; i <= end; i++ )
-        {
-            String key = i + ":key";
-            String value = jcs.get( key );
-
-            assertEquals( "Wrong value for key [" + key + "]", region + " data " + i + "-" + region, value );
-        }
-
-        // Test that getElements returns all the expected values
-        Set<String> keys = new HashSet<String>();
-        for ( int i = start; i <= end; i++ )
-        {
-            keys.add( i + ":key" );
-        }
-
-        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
-        for ( int i = start; i <= end; i++ )
-        {
-            ICacheElement<String, String> element = elements.get( i + ":key" );
-            assertNotNull( "element " + i + ":key is missing", element );
-            assertEquals( "value " + i + ":key", region + " data " + i + "-" + region, element.getVal() );
-        }
-    }
-}
+package org.apache.commons.jcs.auxiliary.disk.block;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import junit.extensions.ActiveTestSuite;
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+
+/**
+ * Test which exercises the block disk cache. Runs three threads against the same region.
+ */
+public class BlockDiskCacheSameRegionConcurrentUnitTest
+    extends TestCase
+{
+    /**
+     * Constructor for the TestDiskCache object.
+     * <p>
+     * @param testName
+     */
+    public BlockDiskCacheSameRegionConcurrentUnitTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * Main method passes this test to the text test runner.
+     * <p>
+     * @param args
+     * @throws InterruptedException
+     */
+    public static void main( String args[] ) throws InterruptedException
+    {
+        String[] testCaseName = { BlockDiskCacheSameRegionConcurrentUnitTest.class.getName() };
+        junit.textui.TestRunner.main( testCaseName );
+
+        // Give test threads some time to finish
+        Thread.sleep(2000);
+    }
+
+    /**
+     * A unit test suite for JUnit
+     * @return The test suite
+     */
+    public static Test suite()
+    {
+        ActiveTestSuite suite = new ActiveTestSuite();
+
+        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache1" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegion( "blockRegion4", 0, 200 );
+            }
+        } );
+
+        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache2" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegion( "blockRegion4", 1000, 1200 );
+            }
+        } );
+
+        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache3" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegion( "blockRegion4", 2000, 2200 );
+            }
+        } );
+
+        suite.addTest( new BlockDiskCacheSameRegionConcurrentUnitTest( "testBlockDiskCache4" )
+        {
+            @Override
+            public void runTest()
+                throws Exception
+            {
+                this.runTestForRegion( "blockRegion4", 2200, 5200 );
+            }
+        } );
+
+        return suite;
+    }
+
+    /**
+     * Test setup.  Sets the config name and clears the region.
+     * <p>
+     * @throws Exception
+     */
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        JCS.setConfigFilename( "/TestBlockDiskCacheCon.ccf" );
+    }
+
+    /**
+     * Adds items to cache, gets them, and removes them. The item count is more than the size of the
+     * memory cache, so items should spool to disk.
+     * @param region Name of the region to access
+     * @param start
+     * @param end
+     * @exception Exception If an error occurs
+     */
+    public void runTestForRegion( String region, int start, int end )
+        throws Exception
+    {
+        CacheAccess<String, String> jcs = JCS.getInstance( region );
+
+        // Add items to cache
+
+        for ( int i = start; i <= end; i++ )
+        {
+            jcs.put( i + ":key", region + " data " + i + "-" + region );
+        }
+
+        // Test that all items are in cache
+
+        for ( int i = start; i <= end; i++ )
+        {
+            String key = i + ":key";
+            String value = jcs.get( key );
+
+            assertEquals( "Wrong value for key [" + key + "]", region + " data " + i + "-" + region, value );
+        }
+
+        // Test that getElements returns all the expected values
+        Set<String> keys = new HashSet<String>();
+        for ( int i = start; i <= end; i++ )
+        {
+            keys.add( i + ":key" );
+        }
+
+        Map<String, ICacheElement<String, String>> elements = jcs.getCacheElements( keys );
+        for ( int i = start; i <= end; i++ )
+        {
+            ICacheElement<String, String> element = elements.get( i + ":key" );
+            assertNotNull( "element " + i + ":key is missing", element );
+            assertEquals( "value " + i + ":key", region + " data " + i + "-" + region, element.getVal() );
+        }
+    }
+}



Mime
View raw message