use of javax.cache.configuration.MutableConfiguration in project Payara by payara.
the class PayaraCacheResolverFactory method getExceptionCacheResolver.
@Override
public CacheResolver getExceptionCacheResolver(CacheMethodDetails<CacheResult> cmd) {
CacheResult result = cmd.getCacheAnnotation();
String cacheName = result.exceptionCacheName();
Cache cache = cacheManager.getCache(cacheName);
if ((cache == null)) {
cache = cacheManager.createCache(cacheName, new MutableConfiguration<Object, Object>());
}
return new PayaraCacheResolver(cache);
}
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);
}
use of javax.cache.configuration.MutableConfiguration in project cache2k by cache2k.
the class CacheManagerTest method getOrCreateCache_NameOK.
@Test
public void getOrCreateCache_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 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
}
}
Aggregations