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 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 testPutIfAbsentWithSyncListener_whenEntryExists.
@Test(timeout = 30000)
public void testPutIfAbsentWithSyncListener_whenEntryExists() {
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.putIfAbsent(key, randomString());
}
use of javax.cache.configuration.MutableConfiguration in project hazelcast by hazelcast.
the class CacheManagerManagementTest method testMBeansLeftoversAreDetected.
@Test
public void testMBeansLeftoversAreDetected() throws Exception {
CacheManager cacheManager = getCacheManager();
MutableConfiguration<Integer, Integer> cacheConfig = new MutableConfiguration<>();
cacheConfig.setManagementEnabled(true);
Cache<Integer, Integer> cache = cacheManager.createCache("int-cache", cacheConfig);
assertThrows(AssertionError.class, JsrTestUtil::assertNoMBeanLeftovers);
cache.close();
}
use of javax.cache.configuration.MutableConfiguration in project hazelcast by hazelcast.
the class ClientCacheCreationTest method createSingleCache_whenMemberDown_throwsOperationTimeoutException.
@Test(expected = OperationTimeoutException.class)
public void createSingleCache_whenMemberDown_throwsOperationTimeoutException() {
HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance();
ClientConfig clientConfig = new ClientConfig();
clientConfig.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(Long.MAX_VALUE);
clientConfig.setProperty(ClientProperty.INVOCATION_TIMEOUT_SECONDS.getName(), "2");
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
HazelcastClientCachingProvider cachingProvider = createClientCachingProvider(client);
CacheManager cacheManager = cachingProvider.getCacheManager();
hazelcastInstance.shutdown();
MutableConfiguration configuration = new MutableConfiguration();
cacheManager.createCache("xmlCache", configuration);
}
Aggregations