use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class CachePartitionLostListenerConfigTest method testCachePartitionLostListener_registeredViaImplementationInConfigObject.
@Test
public void testCachePartitionLostListener_registeredViaImplementationInConfigObject() {
final String cacheName = "myCache";
Config config = new Config();
CacheSimpleConfig cacheConfig = config.getCacheConfig(cacheName);
CachePartitionLostListener listener = mock(CachePartitionLostListener.class);
cacheConfig.addCachePartitionLostListenerConfig(new CachePartitionLostListenerConfig(listener));
cacheConfig.setBackupCount(0);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
HazelcastInstance instance = factory.newHazelcastInstance(config);
HazelcastServerCachingProvider cachingProvider = createServerCachingProvider(instance);
CacheManager cacheManager = cachingProvider.getCacheManager();
cacheManager.getCache(cacheName);
final EventService eventService = getNode(instance).getNodeEngine().getEventService();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
Collection<EventRegistration> registrations = eventService.getRegistrations(CacheService.SERVICE_NAME, cacheName);
assertFalse(registrations.isEmpty());
}
});
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class CacheConfigPropagationTest method getConfig.
@Override
protected Config getConfig() {
Config config = super.getConfig();
config.addCacheConfig(new CacheSimpleConfig().setName("declared-cache*"));
return config;
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class CacheCreateUseDestroyTest method getConfig.
@Override
protected Config getConfig() {
Config config = super.getConfig();
CacheSimpleEntryListenerConfig entryListenerConfig = new CacheSimpleEntryListenerConfig();
entryListenerConfig.setCacheEntryListenerFactory("com.hazelcast.cache.impl.CacheCreateUseDestroyTest$CacheEntryListenerFactory");
entryListenerConfig.setOldValueRequired(true);
entryListenerConfig.setSynchronous(true);
CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig().setName("cache*").setInMemoryFormat(inMemoryFormat).setStatisticsEnabled(true).setManagementEnabled(true).setCacheEntryListeners(Collections.singletonList(entryListenerConfig));
if (inMemoryFormat == NATIVE) {
EvictionConfig evictionConfig = new EvictionConfig().setSize(90).setMaxSizePolicy(USED_NATIVE_MEMORY_PERCENTAGE).setEvictionPolicy(LFU);
cacheSimpleConfig.setEvictionConfig(evictionConfig);
NativeMemoryConfig memoryConfig = new NativeMemoryConfig().setEnabled(true).setSize(NATIVE_MEMORY_SIZE).setAllocatorType(NativeMemoryConfig.MemoryAllocatorType.STANDARD);
config.setNativeMemoryConfig(memoryConfig);
}
config.addCacheConfig(cacheSimpleConfig);
return config;
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class CacheThroughHazelcastInstanceTest method createCacheSimpleConfig.
protected CacheSimpleConfig createCacheSimpleConfig(String cacheName) {
CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig();
cacheSimpleConfig.setName(cacheName);
return cacheSimpleConfig;
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class CacheExpiryPolicyBackupTest method getCacheConfig.
protected CacheSimpleConfig getCacheConfig() {
CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
cacheConfig.setName(cacheName);
cacheConfig.setBackupCount(NINSTANCES - 1);
return cacheConfig;
}
Aggregations