use of org.cache2k.Cache in project cache2k by cache2k.
the class Cache2kBuilderTest method cacheNameInConstructor0.
@Test
public void cacheNameInConstructor0() {
Cache c = new BuildCacheInConstructor0().cache;
assertThat(c.getName(), startsWith("_" + CLASSNAME + "$BuildCacheInConstructor0.INIT"));
c.close();
}
use of org.cache2k.Cache in project cache2k by cache2k.
the class Cache2kBuilderTest method anonymousWithoutTypes.
@Test(expected = IllegalArgumentException.class)
public void anonymousWithoutTypes() {
Cache c = new Cache2kBuilder() {
}.eternal(true).build();
c.clear();
}
use of org.cache2k.Cache in project cache2k by cache2k.
the class Cache2kBuilderTest method legalCharacterInCacheName.
@Test
public void legalCharacterInCacheName() {
String _legalChars = ".~,@ ()";
_legalChars += "$-_abcABC0123";
Cache c = Cache2kBuilder.forUnknownTypes().name(_legalChars).build();
c.close();
}
use of org.cache2k.Cache in project cache2k by cache2k.
the class CacheManagerLifeCycleTest method clearAllCaches.
@Test
public void clearAllCaches() {
String _uniqueName = this.getClass().getName() + ".clearAllCaches";
CacheManager cm = CacheManager.getInstance(_uniqueName);
Cache c = Cache2kBuilder.forUnknownTypes().manager(cm).name("dummy").build();
c.put("hello", "paul");
assertTrue("has some data", c.keys().iterator().hasNext());
c.getCacheManager().clear();
assertFalse("no data", c.keys().iterator().hasNext());
cm.close();
}
use of org.cache2k.Cache in project cache2k by cache2k.
the class CacheNameTest method managerNameInToString.
@Test
public void managerNameInToString() {
final String _MANAGER_NAME = "managerNameInToString123";
CacheManager cm = CacheManager.getInstance(_MANAGER_NAME);
Cache c = Cache2kBuilder.forUnknownTypes().manager(cm).build();
assertThat(c.toString(), containsString(_MANAGER_NAME));
cm.close();
}
Aggregations