use of javax.cache.configuration.MutableConfiguration in project hazelcast by hazelcast.
the class CacheFromDifferentNodesTest method testCachesDestroy.
@Test
public void testCachesDestroy() {
CacheManager cacheManager = cachingProvider1.getCacheManager();
CacheManager cacheManager2 = cachingProvider2.getCacheManager();
MutableConfiguration configuration = new MutableConfiguration();
final Cache c1 = cacheManager.createCache("c1", configuration);
final Cache c2 = cacheManager2.getCache("c1");
c1.put("key", "value");
cacheManager.destroyCache("c1");
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
try {
c2.get("key");
throw new AssertionError("get should throw IllegalStateException");
} catch (IllegalStateException e) {
//ignored as expected
}
}
});
}
use of javax.cache.configuration.MutableConfiguration in project hazelcast by hazelcast.
the class CacheListenerTest method testGetAndReplaceWithSyncListener_whenEntryNotExists.
@Test(timeout = 30000)
public void testGetAndReplaceWithSyncListener_whenEntryNotExists() {
CachingProvider cachingProvider = getCachingProvider();
CacheManager cacheManager = cachingProvider.getCacheManager();
CompleteConfiguration<String, String> config = new MutableConfiguration<String, String>().setTypes(String.class, String.class).addCacheEntryListenerConfiguration(new MutableCacheEntryListenerConfiguration<String, String>(FactoryBuilder.factoryOf(new TestListener(new AtomicInteger())), null, true, true));
Cache<String, String> cache = cacheManager.createCache(randomString(), config);
// there should not be any hanging due to sync listener
cache.getAndReplace(randomString(), randomString());
}
use of javax.cache.configuration.MutableConfiguration in project hazelcast by hazelcast.
the class CacheListenerTest method testRemoveIfSameWithSyncListener_whenValueIsNotSame.
@Test(timeout = 30000)
public void testRemoveIfSameWithSyncListener_whenValueIsNotSame() {
CachingProvider cachingProvider = getCachingProvider();
CacheManager cacheManager = cachingProvider.getCacheManager();
CompleteConfiguration<String, String> config = new MutableConfiguration<String, String>().setTypes(String.class, String.class).addCacheEntryListenerConfiguration(new MutableCacheEntryListenerConfiguration<String, String>(FactoryBuilder.factoryOf(new TestListener(new AtomicInteger())), null, true, true));
Cache<String, String> cache = cacheManager.createCache(randomString(), config);
String key = randomString();
cache.put(key, randomString());
// there should not be any hanging due to sync listener
cache.remove(key, randomString());
}
use of javax.cache.configuration.MutableConfiguration in project hazelcast by hazelcast.
the class CacheListenerTest method testReplaceWithSyncListener_whenEntryNotExists.
@Test(timeout = 30000)
public void testReplaceWithSyncListener_whenEntryNotExists() {
CachingProvider cachingProvider = getCachingProvider();
CacheManager cacheManager = cachingProvider.getCacheManager();
CompleteConfiguration<String, String> config = new MutableConfiguration<String, String>().setTypes(String.class, String.class).addCacheEntryListenerConfiguration(new MutableCacheEntryListenerConfiguration<String, String>(FactoryBuilder.factoryOf(new TestListener(new AtomicInteger())), null, true, true));
Cache<String, String> cache = cacheManager.createCache(randomString(), config);
// there should not be any hanging due to sync listener
cache.replace(randomString(), randomString());
}
use of javax.cache.configuration.MutableConfiguration in project hazelcast by hazelcast.
the class CacheListenerTest method testReplaceIfSameWithSyncListener_whenValueIsNotSame.
@Test(timeout = 30000)
public void testReplaceIfSameWithSyncListener_whenValueIsNotSame() {
CachingProvider cachingProvider = getCachingProvider();
CacheManager cacheManager = cachingProvider.getCacheManager();
CompleteConfiguration<String, String> config = new MutableConfiguration<String, String>().setTypes(String.class, String.class).addCacheEntryListenerConfiguration(new MutableCacheEntryListenerConfiguration<String, String>(FactoryBuilder.factoryOf(new TestListener(new AtomicInteger())), null, true, true));
Cache<String, String> cache = cacheManager.createCache(randomString(), config);
String key = randomString();
cache.put(key, randomString());
// there should not be any hanging due to sync listener
cache.replace(key, randomString(), randomString());
}
Aggregations