Search in sources :

Example 6 with WanReplicationRef

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

the class PhoneHomeTest method testCacheWithWANReplication.

@Test
public void testCacheWithWANReplication() {
    Map<String, String> parameters;
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.CACHE_COUNT_WITH_WAN_REPLICATION.getRequestParameterName()), "0");
    CachingProvider cachingProvider = createServerCachingProvider(node.hazelcastInstance);
    CacheManager cacheManager = cachingProvider.getCacheManager();
    CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig();
    cacheSimpleConfig.setName("hazelcast");
    cacheSimpleConfig.setWanReplicationRef(new WanReplicationRef());
    cacheManager.createCache("hazelcast", new CacheConfig<>("hazelcast"));
    node.getConfig().addCacheConfig(cacheSimpleConfig);
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.CACHE_COUNT_WITH_WAN_REPLICATION.getRequestParameterName()), "1");
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) CacheManager(javax.cache.CacheManager) CacheTestSupport.createServerCachingProvider(com.hazelcast.cache.CacheTestSupport.createServerCachingProvider) CachingProvider(javax.cache.spi.CachingProvider) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with WanReplicationRef

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

the class PhoneHomeTest method testMapCountWithWANReplication.

@Test
public void testMapCountWithWANReplication() {
    Map<String, String> parameters;
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.MAP_COUNT_WITH_WAN_REPLICATION.getRequestParameterName()), "0");
    Map<String, String> map1 = node.hazelcastInstance.getMap("hazelcast");
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.MAP_COUNT_WITH_WAN_REPLICATION.getRequestParameterName()), "0");
    node.getConfig().getMapConfig("hazelcast").setWanReplicationRef(new WanReplicationRef());
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.MAP_COUNT_WITH_WAN_REPLICATION.getRequestParameterName()), "1");
}
Also used : WanReplicationRef(com.hazelcast.config.WanReplicationRef) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with WanReplicationRef

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

the class PhoneHomeIntegrationTest method testMapMetrics.

@Test
public void testMapMetrics() {
    node.hazelcastInstance.getMap("hazelcast");
    node.hazelcastInstance.getMap("phonehome");
    MapConfig config = node.getConfig().getMapConfig("hazelcast");
    config.setReadBackupData(true);
    config.getMapStoreConfig().setClassName(DelayMapStore.class.getName()).setEnabled(true);
    config.addQueryCacheConfig(new QueryCacheConfig("queryconfig"));
    config.getHotRestartConfig().setEnabled(true);
    config.getIndexConfigs().add(new IndexConfig().setName("index"));
    config.setWanReplicationRef(new WanReplicationRef().setName("wan"));
    config.getAttributeConfigs().add(new AttributeConfig("hz", AttributeExtractor.class.getName()));
    config.getEvictionConfig().setEvictionPolicy(EvictionPolicy.LRU);
    config.setInMemoryFormat(InMemoryFormat.NATIVE);
    phoneHome.phoneHome(false);
    verify(1, postRequestedFor(urlPathEqualTo("/ping")).withRequestBody(containingParam("mpct", "2")).withRequestBody(containingParam("mpbrct", "1")).withRequestBody(containingParam("mpmsct", "1")).withRequestBody(containingParam("mpaoqcct", "1")).withRequestBody(containingParam("mpaoict", "1")).withRequestBody(containingParam("mphect", "1")).withRequestBody(containingParam("mpwact", "1")).withRequestBody(containingParam("mpaocct", "1")).withRequestBody(containingParam("mpevct", "1")).withRequestBody(containingParam("mpnmct", "1")));
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) MapConfig(com.hazelcast.config.MapConfig) AttributeConfig(com.hazelcast.config.AttributeConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with WanReplicationRef

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

the class AbstractCacheRecordStore method canPersistWanReplicatedData.

private boolean canPersistWanReplicatedData(CacheConfig cacheConfig, NodeEngine nodeEngine) {
    boolean persistWanReplicatedData = false;
    WanReplicationRef wanReplicationRef = cacheConfig.getWanReplicationRef();
    if (wanReplicationRef != null) {
        String wanReplicationRefName = wanReplicationRef.getName();
        Config config = nodeEngine.getConfig();
        WanReplicationConfig wanReplicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
        if (wanReplicationConfig != null) {
            WanConsumerConfig wanConsumerConfig = wanReplicationConfig.getConsumerConfig();
            if (wanConsumerConfig != null) {
                persistWanReplicatedData = wanConsumerConfig.isPersistWanReplicatedData();
            }
        }
    }
    return persistWanReplicatedData;
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheConfig(com.hazelcast.config.CacheConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) ConfigValidator.checkCacheEvictionConfig(com.hazelcast.internal.config.ConfigValidator.checkCacheEvictionConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) Config(com.hazelcast.config.Config) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig)

Example 10 with WanReplicationRef

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

the class ClientMapWANExceptionTest method getConfig.

@Override
protected Config getConfig() {
    Config config = super.getConfig();
    WanReplicationConfig wanReplicationConfig = new WanReplicationConfig();
    wanReplicationConfig.setName("dummyWan");
    wanReplicationConfig.addCustomPublisherConfig(getWanPublisherConfig());
    WanReplicationRef wanRef = new WanReplicationRef();
    wanRef.setName("dummyWan");
    wanRef.setMergePolicyClassName(PassThroughMergePolicy.class.getName());
    config.addWanReplicationConfig(wanReplicationConfig);
    config.getMapConfig("default").setWanReplicationRef(wanRef);
    return config;
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) PassThroughMergePolicy(com.hazelcast.spi.merge.PassThroughMergePolicy) WanReplicationRef(com.hazelcast.config.WanReplicationRef) Config(com.hazelcast.config.Config) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig)

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