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");
}
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");
}
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")));
}
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;
}
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;
}
Aggregations