use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class DynamicConfigTest method testReplicatedMapConfig_withListenerByImplementation.
@Test
public void testReplicatedMapConfig_withListenerByImplementation() {
ReplicatedMapConfig config = new ReplicatedMapConfig(name).setStatisticsEnabled(true).setInMemoryFormat(InMemoryFormat.NATIVE).addEntryListenerConfig(new EntryListenerConfig(new SampleEntryListener(), false, true));
config.getMergePolicyConfig().setPolicy("com.hazelcast.SomeMergePolicy");
config.setAsyncFillup(true);
driver.getConfig().addReplicatedMapConfig(config);
assertConfigurationsEqualOnAllMembers(config);
}
use of com.hazelcast.config.ReplicatedMapConfig 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.ReplicatedMapConfig 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);
}
use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class ReplicatedMapMergePolicyTest method newConfig.
private Config newConfig(String mergePolicy, String mapName) {
Config config = new Config();
config.setProperty(ClusterProperty.MERGE_FIRST_RUN_DELAY_SECONDS.getName(), "5");
config.setProperty(ClusterProperty.MERGE_NEXT_RUN_DELAY_SECONDS.getName(), "3");
config.setClusterName(generateRandomString(10));
ReplicatedMapConfig replicatedMapConfig = config.getReplicatedMapConfig(mapName);
replicatedMapConfig.getMergePolicyConfig().setPolicy(mergePolicy);
return config;
}
use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class ReplicatedMapStatsTest method testNoObjectGenerationIfStatsDisabled.
@Test
public void testNoObjectGenerationIfStatsDisabled() {
String name = randomMapName();
ReplicatedMapConfig replicatedMapConfig = new ReplicatedMapConfig();
replicatedMapConfig.setName(name);
replicatedMapConfig.setStatisticsEnabled(false);
getInstance().getConfig().addReplicatedMapConfig(replicatedMapConfig);
ReplicatedMap<Integer, Integer> replicatedMap = getInstance().getReplicatedMap(name);
LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
LocalReplicatedMapStats stats2 = replicatedMap.getReplicatedMapStats();
LocalReplicatedMapStats stats3 = replicatedMap.getReplicatedMapStats();
assertSame(stats, stats2);
assertSame(stats2, stats3);
}
Aggregations