use of com.hazelcast.config.MergePolicyConfig in project hazelcast by hazelcast.
the class MergePolicyValidatorReplicatedMapIntegrationTest method testReplicatedMap_withLegacyPutIfAbsentMergePolicy.
@Test
public void testReplicatedMap_withLegacyPutIfAbsentMergePolicy() {
MergePolicyConfig legacyMergePolicyConfig = new MergePolicyConfig().setPolicy(PutIfAbsentMergePolicy.class.getName());
HazelcastInstance hz = getHazelcastInstance("legacyPutIfAbsent", legacyMergePolicyConfig);
hz.getReplicatedMap("legacyPutIfAbsent");
}
use of com.hazelcast.config.MergePolicyConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testRingbuffer.
private void testRingbuffer(RingbufferStoreConfig ringbufferStoreConfig) {
MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy("PassThroughMergePolicy").setBatchSize(1234);
RingbufferConfig expectedConfig = new RingbufferConfig("testRbConfig").setBackupCount(1).setAsyncBackupCount(2).setCapacity(3).setTimeToLiveSeconds(4).setInMemoryFormat(InMemoryFormat.BINARY).setRingbufferStoreConfig(ringbufferStoreConfig).setSplitBrainProtectionName("splitBrainProtection").setMergePolicyConfig(mergePolicyConfig);
Config config = new Config().addRingBufferConfig(expectedConfig);
Config decConfig = getNewConfigViaGenerator(config);
RingbufferConfig actualConfig = decConfig.getRingbufferConfig(expectedConfig.getName());
ConfigCompatibilityChecker.checkRingbufferConfig(expectedConfig, actualConfig);
}
use of com.hazelcast.config.MergePolicyConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testList.
// LIST
@Test
public void testList() {
MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy(HigherHitsMergePolicy.class.getName()).setBatchSize(1234);
ListConfig expectedConfig = new ListConfig("testList").setMaxSize(10).setStatisticsEnabled(true).setBackupCount(2).setAsyncBackupCount(3).setSplitBrainProtectionName("splitBrainProtection").setMergePolicyConfig(mergePolicyConfig).setItemListenerConfigs(singletonList(new ItemListenerConfig("java.Listener", true)));
Config config = new Config().addListConfig(expectedConfig);
Config decConfig = getNewConfigViaGenerator(config);
ListConfig actualConfig = decConfig.getListConfig("testList");
assertEquals(expectedConfig, actualConfig);
}
use of com.hazelcast.config.MergePolicyConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testReplicatedMapConfigGenerator.
// REPLICATED MAP
@Test
public void testReplicatedMapConfigGenerator() {
MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy("PassThroughMergePolicy").setBatchSize(1234);
ReplicatedMapConfig replicatedMapConfig = new ReplicatedMapConfig().setName("replicated-map-name").setStatisticsEnabled(false).setSplitBrainProtectionName("splitBrainProtection").setMergePolicyConfig(mergePolicyConfig).setInMemoryFormat(InMemoryFormat.NATIVE).addEntryListenerConfig(new EntryListenerConfig("com.hazelcast.entrylistener", false, false)).addEntryListenerConfig(new EntryListenerConfig("com.hazelcast.entrylistener2", true, false));
replicatedMapConfig.setAsyncFillup(true);
Config config = new Config().addReplicatedMapConfig(replicatedMapConfig);
Config decConfig = getNewConfigViaGenerator(config);
ReplicatedMapConfig decReplicatedMapConfig = decConfig.getReplicatedMapConfig("replicated-map-name");
MergePolicyConfig actualMergePolicyConfig = decReplicatedMapConfig.getMergePolicyConfig();
assertEquals("replicated-map-name", decReplicatedMapConfig.getName());
assertFalse(decReplicatedMapConfig.isStatisticsEnabled());
assertEquals("com.hazelcast.entrylistener", decReplicatedMapConfig.getListenerConfigs().get(0).getClassName());
assertEquals("splitBrainProtection", decReplicatedMapConfig.getSplitBrainProtectionName());
assertEquals(InMemoryFormat.NATIVE, decReplicatedMapConfig.getInMemoryFormat());
assertTrue(decReplicatedMapConfig.isAsyncFillup());
assertEquals("PassThroughMergePolicy", actualMergePolicyConfig.getPolicy());
assertEquals(1234, actualMergePolicyConfig.getBatchSize());
assertEquals(replicatedMapConfig, decReplicatedMapConfig);
}
use of com.hazelcast.config.MergePolicyConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method testReplicatedMapConfig_withNonDefaultMergePolicy.
@Test
public void testReplicatedMapConfig_withNonDefaultMergePolicy() {
ReplicatedMapConfig config = new ReplicatedMapConfig(name).setMergePolicyConfig(new MergePolicyConfig(NON_DEFAULT_MERGE_POLICY, NON_DEFAULT_MERGE_BATCH_SIZE));
driver.getConfig().addReplicatedMapConfig(config);
assertConfigurationsEqualOnAllMembers(config);
}
Aggregations