use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class ConfigValidatorTest method checkCacheConfig_withEntryCountMaxSizePolicy_OBJECT.
@Test
public void checkCacheConfig_withEntryCountMaxSizePolicy_OBJECT() {
EvictionConfig evictionConfig = new EvictionConfig().setMaxSizePolicy(MaxSizePolicy.ENTRY_COUNT);
CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig().setInMemoryFormat(OBJECT).setEvictionConfig(evictionConfig);
checkCacheConfig(cacheSimpleConfig, splitBrainMergePolicyProvider);
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class ConfigSearchTest method testCacheConfig_Dynamic.
@Test
public void testCacheConfig_Dynamic() {
TestCase<CacheSimpleConfig> testCase = new TestCase<CacheSimpleConfig>(new CacheSimpleConfig().setName(STATIC_NAME), new CacheSimpleConfig().setName(DYNAMIC_NAME), true) {
@Override
void addStaticConfig(Config config) {
config.addCacheConfig(this.staticConfig);
}
@Override
void addDynamicConfig(HazelcastInstance hazelcastInstance) {
hazelcastInstance.getConfig().addCacheConfig(this.dynamicConfig);
}
@Override
void asserts() {
CacheSimpleConfig dataConfig = hazelcastInstance.getConfig().findCacheConfig(DYNAMIC_NAME);
assertThat(dataConfig.getName(), equalTo(DYNAMIC_NAME));
}
};
testTemplate(testCase);
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class DynamicConfigSmokeTest method cacheConfig_whenListenerIsRegistered.
@Test
public void cacheConfig_whenListenerIsRegistered() {
String cacheName = randomMapName();
CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig().setName(cacheName).setKeyType(String.class.getName()).setValueType((new String[0]).getClass().getName()).setStatisticsEnabled(false).setManagementEnabled(false);
members(2);
HazelcastInstance driver = driver();
driver.getConfig().addCacheConfig(cacheSimpleConfig);
Cache cache = driver.getCacheManager().getCache(cacheName);
cache.registerCacheEntryListener(new CacheEntryListenerConfig(() -> (CacheEntryCreatedListener & Serializable) System.out::println, null, true, true));
driver.getConfig().addCacheConfig(cacheSimpleConfig);
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method testCacheConfig_withTimedExpiryPolicyFactory.
@Test
public void testCacheConfig_withTimedExpiryPolicyFactory() {
CacheSimpleConfig config = getCacheConfig().setExpiryPolicyFactoryConfig(new ExpiryPolicyFactoryConfig(new TimedExpiryPolicyFactoryConfig(TimedExpiryPolicyFactoryConfig.ExpiryPolicyType.TOUCHED, new ExpiryPolicyFactoryConfig.DurationConfig(130, TimeUnit.SECONDS))));
driver.getConfig().addCacheConfig(config);
assertConfigurationsEqualOnAllMembers(config);
}
use of com.hazelcast.config.CacheSimpleConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method testCacheConfig_withEvictionPolicy_cacheLoaderAndWriter.
@Test
public void testCacheConfig_withEvictionPolicy_cacheLoaderAndWriter() {
CacheSimpleConfig config = getCacheConfig().setEvictionConfig(getEvictionConfigByPolicy()).setCacheLoader("com.hazelcast.CacheLoader").setCacheWriter("com.hazelcast.CacheWriter").setExpiryPolicyFactory("expiryPolicyFactory");
driver.getConfig().addCacheConfig(config);
assertConfigurationsEqualOnAllMembers(config);
}
Aggregations