org.apache.jcs.engine.control
Class CompositeCacheDiskUsageUnitTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.jcs.engine.control.CompositeCacheDiskUsageUnitTest
All Implemented Interfaces:
junit.framework.Test

public class CompositeCacheDiskUsageUnitTest
extends junit.framework.TestCase

Tests of the disk usage settings for the CompositeCache.

Author:
Aaron Smuts

Nested Class Summary
static class CompositeCacheDiskUsageUnitTest.MockAuxCache<K extends Serializable,V extends Serializable>
          Used to test the disk cache functionality.
 
Constructor Summary
CompositeCacheDiskUsageUnitTest()
           
 
Method Summary
 void setUp()
          Test setup
 void testSpoolAllowed()
          Setup a disk cache.
 void testSpoolNotAllowed()
          Setup a disk cache.
 void testSwapConfig()
          Verify that the swap region is set to the correct pattern.
 void testUpdateAllowed_localFalse()
          Setup a disk cache.
 void testUpdateAllowed_withOtherCaches()
          Setup a disk cache.
 void testUpdateAllowed()
          Setup a disk cache.
 void testUpdateConfig()
          Verify that the swap region is set to the correct pattern.
 void testUpdateNotAllowed()
          Setup a disk cache.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeCacheDiskUsageUnitTest

public CompositeCacheDiskUsageUnitTest()
Method Detail

setUp

public void setUp()
Test setup

Overrides:
setUp in class junit.framework.TestCase

testSwapConfig

public void testSwapConfig()
                    throws CacheException
Verify that the swap region is set to the correct pattern.

Throws:
CacheException

testUpdateConfig

public void testUpdateConfig()
                      throws CacheException
Verify that the swap region is set to the correct pattern.

Throws:
CacheException

testSpoolAllowed

public void testSpoolAllowed()
Setup a disk cache. Configure the disk usage pattern to swap. Call spool. Verify that the item is put to disk.


testSpoolNotAllowed

public void testSpoolNotAllowed()
Setup a disk cache. Configure the disk usage pattern to not swap. Call spool. Verify that the item is not put to disk.


testUpdateAllowed

public void testUpdateAllowed()
                       throws IOException
Setup a disk cache. Configure the disk usage pattern to UPDATE. Call updateAuxiliaries. Verify that the item is put to disk.

This tests that the items are put to disk on a normal put when the usage pattern is set appropriately.

Throws:
IOException

testUpdateAllowed_localFalse

public void testUpdateAllowed_localFalse()
                                  throws IOException
Setup a disk cache. Configure the disk usage pattern to UPDATE. Call updateAuxiliaries with local only set to false. Verify that the item is put to disk.

This tests that the items are put to disk on a normal put when the usage pattern is set appropriately. The local setting should have no impact on whether the item goes to disk.

Throws:
IOException

testUpdateNotAllowed

public void testUpdateNotAllowed()
                          throws IOException
Setup a disk cache. Configure the disk usage pattern to SWAP. Call updateAuxiliaries. Verify that the item is not put to disk.

This tests that the items are not put to disk on a normal put when the usage pattern is set to SWAP.

Throws:
IOException

testUpdateAllowed_withOtherCaches

public void testUpdateAllowed_withOtherCaches()
                                       throws IOException
Setup a disk cache. Configure the disk usage pattern to UPDATE. Call updateAuxiliaries. Verify that the item is put to disk.

This tests that the items are put to disk on a normal put when the usage pattern is set appropriately.

Throws:
IOException


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.