use of com.hazelcast.config.SplitBrainProtectionConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testSplitBrainProtectionConfig.
@Test
public void testSplitBrainProtectionConfig() {
assertNotNull(config);
assertEquals(3, config.getSplitBrainProtectionConfigs().size());
SplitBrainProtectionConfig splitBrainProtectionConfig = config.getSplitBrainProtectionConfig("my-split-brain-protection");
assertNotNull(splitBrainProtectionConfig);
assertEquals("my-split-brain-protection", splitBrainProtectionConfig.getName());
assertEquals("com.hazelcast.spring.DummySplitBrainProtectionFunction", splitBrainProtectionConfig.getFunctionClassName());
assertTrue(splitBrainProtectionConfig.isEnabled());
assertEquals(2, splitBrainProtectionConfig.getMinimumClusterSize());
assertEquals(2, splitBrainProtectionConfig.getListenerConfigs().size());
assertEquals(SplitBrainProtectionOn.READ, splitBrainProtectionConfig.getProtectOn());
assertEquals("com.hazelcast.spring.DummySplitBrainProtectionListener", splitBrainProtectionConfig.getListenerConfigs().get(0).getClassName());
assertNotNull(splitBrainProtectionConfig.getListenerConfigs().get(1).getImplementation());
}
use of com.hazelcast.config.SplitBrainProtectionConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testRecentlyActiveSplitBrainProtectionConfig.
@Test
public void testRecentlyActiveSplitBrainProtectionConfig() {
SplitBrainProtectionConfig recentlyActiveSplitBrainProtectionConfig = config.getSplitBrainProtectionConfig("recently-active-split-brain-protection");
assertNotNull(recentlyActiveSplitBrainProtectionConfig);
assertEquals("recently-active-split-brain-protection", recentlyActiveSplitBrainProtectionConfig.getName());
assertNotNull(recentlyActiveSplitBrainProtectionConfig.getFunctionImplementation());
assertInstanceOf(RecentlyActiveSplitBrainProtectionFunction.class, recentlyActiveSplitBrainProtectionConfig.getFunctionImplementation());
assertTrue(recentlyActiveSplitBrainProtectionConfig.isEnabled());
assertEquals(5, recentlyActiveSplitBrainProtectionConfig.getMinimumClusterSize());
assertEquals(SplitBrainProtectionOn.READ_WRITE, recentlyActiveSplitBrainProtectionConfig.getProtectOn());
RecentlyActiveSplitBrainProtectionFunction splitBrainProtectionFunction = (RecentlyActiveSplitBrainProtectionFunction) recentlyActiveSplitBrainProtectionConfig.getFunctionImplementation();
assertEquals(5123, splitBrainProtectionFunction.getHeartbeatToleranceMillis());
}
use of com.hazelcast.config.SplitBrainProtectionConfig in project hazelcast by hazelcast.
the class YamlMemberDomConfigProcessor method handleSplitBrainProtection.
@Override
protected void handleSplitBrainProtection(Node node) {
for (Node splitBrainProtectionNode : childElements(node)) {
String name = splitBrainProtectionNode.getNodeName();
SplitBrainProtectionConfig splitBrainProtectionConfig = ConfigUtils.getByNameOrNew(config.getSplitBrainProtectionConfigs(), name, SplitBrainProtectionConfig.class);
handleSplitBrainProtectionNode(splitBrainProtectionNode, splitBrainProtectionConfig, name);
}
}
use of com.hazelcast.config.SplitBrainProtectionConfig in project hazelcast by hazelcast.
the class SplitBrainProtectionServiceImpl method initializeListeners.
private void initializeListeners() {
for (Map.Entry<String, SplitBrainProtectionConfig> configEntry : nodeEngine.getConfig().getSplitBrainProtectionConfigs().entrySet()) {
SplitBrainProtectionConfig config = configEntry.getValue();
String instanceName = configEntry.getKey();
for (SplitBrainProtectionListenerConfig listenerConfig : config.getListenerConfigs()) {
initializeListenerInternal(instanceName, listenerConfig);
}
}
}
use of com.hazelcast.config.SplitBrainProtectionConfig in project hazelcast by hazelcast.
the class CacheSplitBrainProtectionConfigTest method cacheConfigXmlTest.
@Test
public void cacheConfigXmlTest() throws IOException {
final String cacheName = "configtestCache" + randomString();
Config config = new XmlConfigBuilder(configUrl).build();
CacheSimpleConfig cacheConfig1 = config.getCacheConfig(cacheName);
final String splitBrainProtectionName = cacheConfig1.getSplitBrainProtectionName();
assertEquals("cache-split-brain-protection", splitBrainProtectionName);
SplitBrainProtectionConfig splitBrainProtectionConfig = config.getSplitBrainProtectionConfig(splitBrainProtectionName);
assertEquals(3, splitBrainProtectionConfig.getMinimumClusterSize());
assertEquals(SplitBrainProtectionOn.READ_WRITE, splitBrainProtectionConfig.getProtectOn());
}
Aggregations