Search in sources :

Example 16 with CacheManager

use of org.cache2k.CacheManager in project cache2k by cache2k.

the class JmxSupportTest method managerClear_noCache.

@Test
public void managerClear_noCache() throws Exception {
    String _name = getClass().getName() + ".managerClear_noCache";
    CacheManager m = CacheManager.getInstance(_name);
    server.invoke(getCacheManagerObjectName(_name), "clear", new Object[0], new String[0]);
    m.close();
}
Also used : CacheManager(org.cache2k.CacheManager) Test(org.junit.Test)

Example 17 with CacheManager

use of org.cache2k.CacheManager in project cache2k by cache2k.

the class JmxSupportTest method emptyCacheManager_healthOkay.

@Test
public void emptyCacheManager_healthOkay() throws Exception {
    String _name = getClass().getName() + ".emptyCacheManager_healthOkay";
    CacheManager m = CacheManager.getInstance(_name);
    MBeanInfo i = getCacheManagerInfo(_name);
    assertEquals(ManagerMXBeanImpl.class.getName(), i.getClassName());
    String _health = (String) server.getAttribute(getCacheManagerObjectName(_name), "HealthStatus");
    assertEquals("ok", _health);
    m.close();
}
Also used : MBeanInfo(javax.management.MBeanInfo) CacheManager(org.cache2k.CacheManager) Test(org.junit.Test)

Example 18 with CacheManager

use of org.cache2k.CacheManager in project cache2k by cache2k.

the class JmxSupportTest method managerAttributes.

@Test
public void managerAttributes() throws Exception {
    String _name = getClass().getName() + ".managerAttributes";
    CacheManager m = CacheManager.getInstance(_name);
    objectName = getCacheManagerObjectName(_name);
    checkAttribute("Version", ((CacheManagerImpl) m).getVersion());
    checkAttribute("BuildNumber", ((CacheManagerImpl) m).getBuildNumber());
    m.close();
}
Also used : CacheManager(org.cache2k.CacheManager) Test(org.junit.Test)

Example 19 with CacheManager

use of org.cache2k.CacheManager in project cache2k by cache2k.

the class LegalNamesTest method testManager.

@Test
public void testManager() throws Exception {
    CacheManager cm = CacheManager.getInstance(LegalNamesTest.class.getName() + "-char-" + aChar);
    MBeanInfo inf = JmxSupportTest.getCacheManagerInfo(cm.getName());
    assertNotNull(inf);
    Cache2kBuilder.forUnknownTypes().manager(cm).name("dummy").build();
    cm.close();
}
Also used : MBeanInfo(javax.management.MBeanInfo) CacheManager(org.cache2k.CacheManager) Test(org.junit.Test)

Example 20 with CacheManager

use of org.cache2k.CacheManager in project cache2k by cache2k.

the class Cache2kBuilderTest method duplicateCacheName.

@Test
public void duplicateCacheName() {
    String _managerName = getClass().getName() + ".duplicateCacheName";
    Log.registerSuppression(CacheManager.class.getName() + ":" + _managerName, new Log.SuppressionCounter());
    CacheManager mgr = CacheManager.getInstance(_managerName);
    try {
        Cache c0 = Cache2kBuilder.forUnknownTypes().manager(mgr).eternal(true).name(this.getClass(), "same").build();
        Cache c1 = Cache2kBuilder.forUnknownTypes().manager(mgr).eternal(true).name(this.getClass(), "same").build();
        fail("exception expected");
    } catch (IllegalStateException ex) {
    }
    mgr.close();
}
Also used : Log(org.cache2k.core.util.Log) CacheManager(org.cache2k.CacheManager) Cache(org.cache2k.Cache) Test(org.junit.Test)

Aggregations

CacheManager (org.cache2k.CacheManager)27 Test (org.junit.Test)24 Cache (org.cache2k.Cache)11 MBeanInfo (javax.management.MBeanInfo)4 URLClassLoader (java.net.URLClassLoader)3 Cache2kBuilder (org.cache2k.Cache2kBuilder)3 Log (org.cache2k.core.util.Log)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 WeakHashMap (java.util.WeakHashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 CacheEntry (org.cache2k.CacheEntry)1 Cache2kConfiguration (org.cache2k.configuration.Cache2kConfiguration)1 CacheEntryCreatedListener (org.cache2k.event.CacheEntryCreatedListener)1