Search in sources :

Example 1 with WanReplicationRef

use of com.hazelcast.config.WanReplicationRef in project hazelcast by hazelcast.

the class WanReplicationTest method getConfig.

@Override
protected Config getConfig() {
    Config config = new Config();
    WanReplicationConfig wanConfig = new WanReplicationConfig();
    wanConfig.setName("dummyWan");
    wanConfig.addWanPublisherConfig(getPublisherConfig());
    WanReplicationRef wanRef = new WanReplicationRef();
    wanRef.setName("dummyWan");
    wanRef.setMergePolicy(PassThroughMergePolicy.class.getName());
    config.addWanReplicationConfig(wanConfig);
    config.getMapConfig("default").setWanReplicationRef(wanRef);
    return config;
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) PassThroughMergePolicy(com.hazelcast.map.merge.PassThroughMergePolicy) WanReplicationRef(com.hazelcast.config.WanReplicationRef) WanPublisherConfig(com.hazelcast.config.WanPublisherConfig) Config(com.hazelcast.config.Config) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig)

Example 2 with WanReplicationRef

use of com.hazelcast.config.WanReplicationRef in project hazelcast by hazelcast.

the class YamlMemberDomConfigProcessor method mapWanReplicationRefHandle.

@Override
protected void mapWanReplicationRefHandle(Node n, MapConfig mapConfig) {
    for (Node mapNode : childElements(n)) {
        WanReplicationRef wanReplicationRef = new WanReplicationRef();
        wanReplicationRef.setName(mapNode.getNodeName());
        handleMapWanReplicationRefNode(mapNode, mapConfig, wanReplicationRef);
    }
}
Also used : WanReplicationRef(com.hazelcast.config.WanReplicationRef) Node(org.w3c.dom.Node) YamlNode(com.hazelcast.internal.yaml.YamlNode)

Example 3 with WanReplicationRef

use of com.hazelcast.config.WanReplicationRef in project hazelcast by hazelcast.

the class WanReplicationConfigurationTest method testWanReplicationAndWanRepublishing.

@Test
public void testWanReplicationAndWanRepublishing() {
    isWanReplicationEnabled = true;
    isWanRepublishingEnabled = true;
    initInstanceAndMapContainer("withWanRepublishing");
    assertTrue(mapContainer.isWanReplicationEnabled());
    assertTrue(mapContainer.isWanRepublishingEnabled());
    assertNotNull(mapContainer.getWanReplicationDelegate());
    assertNotNull(mapContainer.getWanMergePolicy());
    WanReplicationRef wanReplicationRef = mapContainer.getMapConfig().getWanReplicationRef();
    assertNotNull(wanReplicationRef);
    assertEquals(mapContainer.getWanMergePolicy().getClass().getName(), wanReplicationRef.getMergePolicyClassName());
    assertTrue(wanReplicationRef.isRepublishingEnabled());
}
Also used : WanReplicationRef(com.hazelcast.config.WanReplicationRef) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 4 with WanReplicationRef

use of com.hazelcast.config.WanReplicationRef in project hazelcast by hazelcast.

the class WanPublisherMigrationTest method getConfig.

@Override
protected Config getConfig() {
    WanCustomPublisherConfig publisherConfig = new WanCustomPublisherConfig().setPublisherId("dummyPublisherId").setClassName(MigrationCountingWanPublisher.class.getName());
    publisherConfig.getProperties().put("failMigrations", failMigrations);
    WanReplicationConfig wanReplicationConfig = new WanReplicationConfig().setName("dummyWan").addCustomPublisherConfig(publisherConfig);
    WanReplicationRef wanRef = new WanReplicationRef().setName("dummyWan").setMergePolicyClassName(PassThroughMergePolicy.class.getName());
    MapConfig mapConfig = new MapConfig("default").setWanReplicationRef(wanRef);
    return smallInstanceConfig().addWanReplicationConfig(wanReplicationConfig).addMapConfig(mapConfig);
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) PassThroughMergePolicy(com.hazelcast.spi.merge.PassThroughMergePolicy) WanReplicationRef(com.hazelcast.config.WanReplicationRef) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 5 with WanReplicationRef

use of com.hazelcast.config.WanReplicationRef in project hazelcast by hazelcast.

the class DynamicConfigTest method getCacheConfig.

private CacheSimpleConfig getCacheConfig() {
    CacheSimpleEntryListenerConfig entryListenerConfig = new CacheSimpleEntryListenerConfig();
    entryListenerConfig.setCacheEntryListenerFactory("CacheEntryListenerFactory");
    entryListenerConfig.setSynchronous(true);
    entryListenerConfig.setOldValueRequired(true);
    entryListenerConfig.setCacheEntryEventFilterFactory("CacheEntryEventFilterFactory");
    CacheSimpleConfig config = new CacheSimpleConfig().setName(name).setSplitBrainProtectionName("split-brain-protection").setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(3).setAsyncBackupCount(2).addEntryListenerConfig(entryListenerConfig).setStatisticsEnabled(true).setManagementEnabled(true).setKeyType("keyType").setValueType("valueType").setReadThrough(true).setWriteThrough(true).setHotRestartConfig(new HotRestartConfig().setEnabled(true).setFsync(true)).setEventJournalConfig(new EventJournalConfig().setEnabled(true).setCapacity(42).setTimeToLiveSeconds(52));
    config.setWanReplicationRef(new WanReplicationRef(randomName(), "com.hazelcast.MergePolicy", Collections.singletonList("filter"), true));
    config.getMergePolicyConfig().setPolicy("mergePolicy");
    config.setDisablePerEntryInvalidationEvents(true);
    return config;
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) HotRestartConfig(com.hazelcast.config.HotRestartConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheSimpleEntryListenerConfig(com.hazelcast.config.CacheSimpleEntryListenerConfig)

Aggregations

WanReplicationRef (com.hazelcast.config.WanReplicationRef)24 MapConfig (com.hazelcast.config.MapConfig)10 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)6 EventJournalConfig (com.hazelcast.config.EventJournalConfig)6 Config (com.hazelcast.config.Config)5 IndexConfig (com.hazelcast.config.IndexConfig)5 WanCustomPublisherConfig (com.hazelcast.config.WanCustomPublisherConfig)5 AttributeConfig (com.hazelcast.config.AttributeConfig)4 EvictionConfig (com.hazelcast.config.EvictionConfig)4 HotRestartConfig (com.hazelcast.config.HotRestartConfig)4 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)4 WanConsumerConfig (com.hazelcast.config.WanConsumerConfig)4 PassThroughMergePolicy (com.hazelcast.spi.merge.PassThroughMergePolicy)4 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)3 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)3 MapStoreConfig (com.hazelcast.config.MapStoreConfig)3 MultiMapConfig (com.hazelcast.config.MultiMapConfig)3