com.atlassian.cache
Class AbstractCacheTest
java.lang.Object
com.atlassian.cache.AbstractCacheTest
- Direct Known Subclasses:
- AbstractCacheEagerTest, AbstractCacheLazyTest, AbstractLazyReferenceTest
public abstract class AbstractCacheTest
- extends Object
|
Method Summary |
protected static
|
assertEmpty(Cache<K,V> cache)
|
protected static
|
assertSize(Cache<K,V> cache,
int expectedSize)
|
protected Cache<String,Long> |
makeCacheUsingLoader(CacheLoader<String,Long> loader)
|
protected Cache<String,Long> |
makeExceptionalCache()
|
protected Cache<String,Long> |
makeExpiringCache()
|
protected Cache<String,Long> |
makeNullReturningCache()
|
protected Cache<String,Long> |
makeSimpleCache()
|
protected Cache<String,Long> |
makeSizeLimitedCache(int maxEntries)
|
protected Cache<String,Long> |
makeSizeLimitedCache(int maxEntries,
AtomicInteger loadCounter)
|
protected Cache<String,Long> |
makeUnexpiringCache()
|
protected CacheSettingsBuilder |
settingsBuilder()
|
void |
testRemoveFromCacheWhileLoadingCacheValueReturnsLatestValue()
|
void |
testRemoveSpecificValueFromCacheWhileLoadingCacheValueReturnsLatestValue()
Confirms that when a remove of a key with a specific value is called, if there is a loading call which is paused
we wait for that load to finish before starting the remove. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
factory
protected CacheFactory factory
AbstractCacheTest
public AbstractCacheTest()
testRemoveFromCacheWhileLoadingCacheValueReturnsLatestValue
public void testRemoveFromCacheWhileLoadingCacheValueReturnsLatestValue()
throws InterruptedException,
TimeoutException,
ExecutionException
- Throws:
InterruptedException
TimeoutException
ExecutionException
testRemoveSpecificValueFromCacheWhileLoadingCacheValueReturnsLatestValue
public void testRemoveSpecificValueFromCacheWhileLoadingCacheValueReturnsLatestValue()
throws InterruptedException,
TimeoutException,
ExecutionException
- Confirms that when a remove of a key with a specific value is called, if there is a loading call which is paused
we wait for that load to finish before starting the remove.
Note this test will become flakey when the code covering the code path is bad.
- Throws:
InterruptedException
TimeoutException
ExecutionException
makeExceptionalCache
protected Cache<String,Long> makeExceptionalCache()
makeExpiringCache
protected Cache<String,Long> makeExpiringCache()
makeNullReturningCache
protected Cache<String,Long> makeNullReturningCache()
makeSimpleCache
protected Cache<String,Long> makeSimpleCache()
makeSizeLimitedCache
protected Cache<String,Long> makeSizeLimitedCache(int maxEntries)
makeSizeLimitedCache
protected Cache<String,Long> makeSizeLimitedCache(int maxEntries,
AtomicInteger loadCounter)
makeUnexpiringCache
protected Cache<String,Long> makeUnexpiringCache()
settingsBuilder
protected CacheSettingsBuilder settingsBuilder()
assertEmpty
protected static <K,V> void assertEmpty(Cache<K,V> cache)
assertSize
protected static <K,V> void assertSize(Cache<K,V> cache,
int expectedSize)
makeCacheUsingLoader
protected Cache<String,Long> makeCacheUsingLoader(CacheLoader<String,Long> loader)
Copyright © 2015 Atlassian. All rights reserved.