Search in sources :

Example 26 with CacheManager

use of javax.cache.CacheManager in project cache2k by cache2k.

the class CacheManagerTest method removeCache_Stopped.

@Test
public void removeCache_Stopped() {
    CacheManager cacheManager = getCacheManager();
    cacheManager.close();
    try {
        cacheManager.destroyCache("c1");
        fail();
    } catch (IllegalStateException e) {
    // ok
    }
}
Also used : CacheManager(javax.cache.CacheManager) Test(org.junit.Test)

Example 27 with CacheManager

use of javax.cache.CacheManager in project cache2k by cache2k.

the class CacheManagerTest method getCache_Missing.

@Test
public void getCache_Missing() {
    CacheManager cacheManager = getCacheManager();
    assertNull(cacheManager.getCache("notThere"));
}
Also used : CacheManager(javax.cache.CacheManager) Test(org.junit.Test)

Example 28 with CacheManager

use of javax.cache.CacheManager in project cache2k by cache2k.

the class CacheManagerTest method testUnwrap.

@Test
public void testUnwrap() {
    // Assumes rule will exclude this test when no unwrapClass is specified
    final Class<?> unwrapClass = getUnwrapClass(CacheManager.class);
    final CacheManager cacheManager = getCacheManager();
    final Object unwrappedCacheManager = cacheManager.unwrap(unwrapClass);
    assertTrue(unwrapClass.isAssignableFrom(unwrappedCacheManager.getClass()));
}
Also used : CacheManager(javax.cache.CacheManager) Test(org.junit.Test)

Example 29 with CacheManager

use of javax.cache.CacheManager in project cache2k by cache2k.

the class CacheManagerTest method removeCache_CacheStopped.

@Test
public void removeCache_CacheStopped() {
    CacheManager cacheManager = getCacheManager();
    String name1 = "c1";
    cacheManager.createCache(name1, new MutableConfiguration());
    Cache cache1 = cacheManager.getCache(name1);
    cacheManager.destroyCache(name1);
    ensureClosed(cache1);
}
Also used : CacheManager(javax.cache.CacheManager) MutableConfiguration(javax.cache.configuration.MutableConfiguration) Cache(javax.cache.Cache) Test(org.junit.Test)

Example 30 with CacheManager

use of javax.cache.CacheManager in project cache2k by cache2k.

the class CacheManagerTest method getOrCreateCache_Same.

@Test
public void getOrCreateCache_Same() {
    String name = "c1";
    CacheManager cacheManager = getCacheManager();
    cacheManager.createCache(name, new MutableConfiguration());
    Cache cache = cacheManager.getCache(name);
    assertSame(cache, cacheManager.getCache(name));
}
Also used : CacheManager(javax.cache.CacheManager) MutableConfiguration(javax.cache.configuration.MutableConfiguration) Cache(javax.cache.Cache) Test(org.junit.Test)

Aggregations

CacheManager (javax.cache.CacheManager)284 Test (org.junit.Test)182 CachingProvider (javax.cache.spi.CachingProvider)113 QuickTest (com.hazelcast.test.annotation.QuickTest)78 HazelcastInstance (com.hazelcast.core.HazelcastInstance)69 MutableConfiguration (javax.cache.configuration.MutableConfiguration)56 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)55 CacheConfig (com.hazelcast.config.CacheConfig)54 CacheTestSupport.createServerCachingProvider (com.hazelcast.cache.CacheTestSupport.createServerCachingProvider)50 Cache (javax.cache.Cache)41 URI (java.net.URI)31 AssertTask (com.hazelcast.test.AssertTask)26 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)25 Config (com.hazelcast.config.Config)20 ClientConfig (com.hazelcast.client.config.ClientConfig)17 SlowTest (com.hazelcast.test.annotation.SlowTest)17 Before (org.junit.Before)17 CacheTestSupport.createClientCachingProvider (com.hazelcast.cache.CacheTestSupport.createClientCachingProvider)16 HazelcastCacheManager (com.hazelcast.cache.HazelcastCacheManager)16 HazelcastServerCachingProvider (com.hazelcast.cache.impl.HazelcastServerCachingProvider)16