use of javax.cache.CacheManager in project cache2k by cache2k.
the class CacheManagerTest method removeCache_Stopped.
@Test
public void removeCache_Stopped() {
CacheManager cacheManager = getCacheManager();
cacheManager.close();
try {
cacheManager.destroyCache("c1");
fail();
} catch (IllegalStateException e) {
// ok
}
}
use of javax.cache.CacheManager in project cache2k by cache2k.
the class CacheManagerTest method getCache_Missing.
@Test
public void getCache_Missing() {
CacheManager cacheManager = getCacheManager();
assertNull(cacheManager.getCache("notThere"));
}
use of javax.cache.CacheManager in project cache2k by cache2k.
the class CacheManagerTest method testUnwrap.
@Test
public void testUnwrap() {
// Assumes rule will exclude this test when no unwrapClass is specified
final Class<?> unwrapClass = getUnwrapClass(CacheManager.class);
final CacheManager cacheManager = getCacheManager();
final Object unwrappedCacheManager = cacheManager.unwrap(unwrapClass);
assertTrue(unwrapClass.isAssignableFrom(unwrappedCacheManager.getClass()));
}
use of javax.cache.CacheManager in project cache2k by cache2k.
the class CacheManagerTest method removeCache_CacheStopped.
@Test
public void removeCache_CacheStopped() {
CacheManager cacheManager = getCacheManager();
String name1 = "c1";
cacheManager.createCache(name1, new MutableConfiguration());
Cache cache1 = cacheManager.getCache(name1);
cacheManager.destroyCache(name1);
ensureClosed(cache1);
}
use of javax.cache.CacheManager in project cache2k by cache2k.
the class CacheManagerTest method getOrCreateCache_Same.
@Test
public void getOrCreateCache_Same() {
String name = "c1";
CacheManager cacheManager = getCacheManager();
cacheManager.createCache(name, new MutableConfiguration());
Cache cache = cacheManager.getCache(name);
assertSame(cache, cacheManager.getCache(name));
}
Aggregations