Package org.apache.fulcrum.cache
Class CacheTest
- java.lang.Object
-
- org.apache.fulcrum.testcontainer.BaseUnit5Test
-
- org.apache.fulcrum.cache.CacheTest
-
- Direct Known Subclasses:
EHCacheTest,JCSCacheTest
public class CacheTest extends org.apache.fulcrum.testcontainer.BaseUnit5Test
CacheTest- Version:
- $Id$
- Author:
- Paul Spencer, Eric Pugh, Peter CourefreshableCachedObjectux
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringcacheKeyprotected static StringcacheKey_2protected GlobalCacheServiceglobalCacheprotected static org.apache.logging.log4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description CacheTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanup()protected StringgetCacheRoleName()Method to configure the role name of the service usedprotected voidsetUp()voidtest2ObjectAddGetCachedObject()Simple test that adds, retrieves, and deletes 2 object.voidtestCacheFlush()Verify the all object will be flushed from the cache.voidtestCacheGetCachedObjects()Test that we can get a list of the keys in the cachevoidtestCacheGetKeyList()Test that we can get a list of the keys in the cachevoidtestCacheModification()Test that the retrieved list is safe from ConcurrentModificationException's being thrown if the cache is updated while we are iterating over the List.voidtestObjectCount()Verify the Cache count is correct.voidtestObjectExpiration()Verify that an object will throw the ObjectExpiredException when it now longer exists in cache.voidtestRefreshableObject()Verify a refreshable object will refreshed in the following cases: o The object is retrieved via getObject an it is stale. o The object is determined to be stale during a cache refresh This test can take several minutes.voidtestRefreshableTimeToLive()Verify a cached object will be delete after it has been untouched beyond it's TimeToLive.voidtestSimpleAddGetCacheObject()Simple test that verify an object can be created and deleted.
-
-
-
Field Detail
-
globalCache
protected GlobalCacheService globalCache
-
cacheKey
protected static final String cacheKey
- See Also:
- Constant Field Values
-
cacheKey_2
protected static final String cacheKey_2
- See Also:
- Constant Field Values
-
log
protected static final org.apache.logging.log4j.Logger log
-
-
Constructor Detail
-
CacheTest
public CacheTest()
-
-
Method Detail
-
getCacheRoleName
protected String getCacheRoleName()
Method to configure the role name of the service used- Returns:
- the role name of the service to lookup
-
cleanup
@AfterEach protected void cleanup()
-
testSimpleAddGetCacheObject
@Test public void testSimpleAddGetCacheObject() throws Exception
Simple test that verify an object can be created and deleted.- Throws:
Exception- if unable to add object
-
test2ObjectAddGetCachedObject
@Test public void test2ObjectAddGetCachedObject() throws Exception
Simple test that adds, retrieves, and deletes 2 object.- Throws:
Exception- if unable to add and retrieve objects
-
testObjectExpiration
@Test public void testObjectExpiration() throws Exception
Verify that an object will throw the ObjectExpiredException when it now longer exists in cache.- Throws:
Exception- if object is not expired
-
testCacheFlush
@Test public void testCacheFlush() throws Exception
Verify the all object will be flushed from the cache. This test can take server minutes.- Throws:
Exception- if flushing the cache fails
-
testObjectCount
@Test public void testObjectCount() throws Exception
Verify the Cache count is correct.- Throws:
Exception- if the cache count does not match expected value
-
testRefreshableObject
@Tag("LongRunning") @Test public void testRefreshableObject() throws ExceptionVerify a refreshable object will refreshed in the following cases: o The object is retrieved via getObject an it is stale. o The object is determined to be stale during a cache refresh This test can take several minutes.- Throws:
Exception- if object is not a refreshable object
-
testRefreshableTimeToLive
@Tag("LongRunning") @Test public void testRefreshableTimeToLive() throws ExceptionVerify a cached object will be delete after it has been untouched beyond it's TimeToLive. This test can take several minutes.- Throws:
Exception- if object is not deleted
-
testCacheGetKeyList
@Test public void testCacheGetKeyList()
Test that we can get a list of the keys in the cache
-
testCacheGetCachedObjects
@Test public void testCacheGetCachedObjects()
Test that we can get a list of the keys in the cache
-
testCacheModification
@Test public void testCacheModification()
Test that the retrieved list is safe from ConcurrentModificationException's being thrown if the cache is updated while we are iterating over the List.
-
-