Search in sources :

Example 1 with ReplicatedMapConfig

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);
}
Also used : ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) CacheSimpleEntryListenerConfig(com.hazelcast.config.CacheSimpleEntryListenerConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with ReplicatedMapConfig

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);
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) ListConfig(com.hazelcast.config.ListConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) AwsConfig(com.hazelcast.config.AwsConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) PredicateConfig(com.hazelcast.config.PredicateConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) PartitioningStrategyConfig(com.hazelcast.config.PartitioningStrategyConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) DiskTierConfig(com.hazelcast.config.DiskTierConfig) IndexConfig(com.hazelcast.config.IndexConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) ItemListenerConfig(com.hazelcast.config.ItemListenerConfig) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) CacheSimpleEntryListenerConfig(com.hazelcast.config.CacheSimpleEntryListenerConfig) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) AttributeConfig(com.hazelcast.config.AttributeConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) TieredStoreConfig(com.hazelcast.config.TieredStoreConfig) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) CachePartitionLostListenerConfig(com.hazelcast.config.CachePartitionLostListenerConfig) DataPersistenceConfig(com.hazelcast.config.DataPersistenceConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) MapPartitionLostListenerConfig(com.hazelcast.config.MapPartitionLostListenerConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) MerkleTreeConfig(com.hazelcast.config.MerkleTreeConfig) MemoryTierConfig(com.hazelcast.config.MemoryTierConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) CacheSimpleEntryListenerConfig(com.hazelcast.config.CacheSimpleEntryListenerConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) Test(org.junit.Test)

Example 3 with ReplicatedMapConfig

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);
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 4 with ReplicatedMapConfig

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;
}
Also used : Config(com.hazelcast.config.Config) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig)

Example 5 with ReplicatedMapConfig

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);
}
Also used : ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)36 Test (org.junit.Test)16 QuickTest (com.hazelcast.test.annotation.QuickTest)15 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)13 Config (com.hazelcast.config.Config)9 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)8 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)7 ListenerConfig (com.hazelcast.config.ListenerConfig)6 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)5 CacheSimpleEntryListenerConfig (com.hazelcast.config.CacheSimpleEntryListenerConfig)5 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)5 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)5 ExecutorConfig (com.hazelcast.config.ExecutorConfig)5 FlakeIdGeneratorConfig (com.hazelcast.config.FlakeIdGeneratorConfig)5 ListConfig (com.hazelcast.config.ListConfig)5 MapConfig (com.hazelcast.config.MapConfig)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)5 PNCounterConfig (com.hazelcast.config.PNCounterConfig)5 QueueConfig (com.hazelcast.config.QueueConfig)5 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)5