use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method createCache_NameOK.
@Test
public void createCache_NameOK() {
String name = "c1";
getCacheManager().createCache(name, new MutableConfiguration());
Cache cache = getCacheManager().getCache(name);
assertEquals(name, cache.getName());
}
use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method getCaches_MutateReturn.
@Test
public void getCaches_MutateReturn() {
CacheManager cacheManager = getCacheManager();
cacheManager.createCache("c1", new MutableConfiguration());
Cache cache1 = cacheManager.getCache("c1");
try {
Iterator iterator = cacheManager.getCacheNames().iterator();
iterator.next();
iterator.remove();
fail();
} catch (UnsupportedOperationException e) {
// immutable
}
}
use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method close_cachesClosed.
@Test
public void close_cachesClosed() {
CacheManager cacheManager = getCacheManager();
cacheManager.createCache("c1", new MutableConfiguration());
Cache cache1 = cacheManager.getCache("c1");
cacheManager.createCache("c2", new MutableConfiguration());
Cache cache2 = cacheManager.getCache("c2");
cacheManager.close();
ensureClosed(cache1);
ensureClosed(cache2);
}
use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method testReuseCacheManager.
@Test
public void testReuseCacheManager() throws Exception {
CachingProvider provider = Caching.getCachingProvider();
URI uri = provider.getDefaultURI();
CacheManager cacheManager = provider.getCacheManager(uri, provider.getDefaultClassLoader());
assertFalse(cacheManager.isClosed());
cacheManager.close();
assertTrue(cacheManager.isClosed());
try {
cacheManager.createCache("Dog", new MutableConfiguration());
fail();
} catch (IllegalStateException e) {
// expected
}
CacheManager otherCacheManager = provider.getCacheManager(uri, provider.getDefaultClassLoader());
assertFalse(otherCacheManager.isClosed());
assertNotSame(cacheManager, otherCacheManager);
}
use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method getCache_There.
@Test
public void getCache_There() {
String name = this.toString();
CacheManager cacheManager = getCacheManager();
cacheManager.createCache(name, new MutableConfiguration());
Cache cache = cacheManager.getCache(name);
assertSame(cache, cacheManager.getCache(name));
}
Aggregations