use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method getUntypedCache.
@Test
public void getUntypedCache() {
CacheManager cacheManager = getCacheManager();
// configure an un-typed Cache
MutableConfiguration config = new MutableConfiguration();
cacheManager.createCache("untyped-cache", config);
Cache cache = cacheManager.getCache("untyped-cache");
assertNotNull(cache);
assertEquals(Object.class, cache.getConfiguration(CompleteConfiguration.class).getKeyType());
assertEquals(Object.class, cache.getConfiguration(CompleteConfiguration.class).getValueType());
}
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));
}
use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method createCache_Same.
@Test
public void createCache_Same() {
String name = "c1";
CacheManager cacheManager = getCacheManager();
try {
cacheManager.createCache(name, new MutableConfiguration());
Cache cache1 = cacheManager.getCache(name);
cacheManager.createCache(name, new MutableConfiguration());
Cache cache2 = cacheManager.getCache(name);
fail();
} catch (CacheException exception) {
// expected
}
}
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 getNullTypeCacheRequest.
@Test(expected = NullPointerException.class)
public void getNullTypeCacheRequest() {
CacheManager cacheManager = getCacheManager();
MutableConfiguration config = new MutableConfiguration();
cacheManager.createCache("untyped-cache", config);
Cache cache = cacheManager.getCache("untyped-cache", null, null);
}
Aggregations