use of com.hazelcast.splitbrainprotection.impl.ProbabilisticSplitBrainProtectionFunction in project hazelcast by hazelcast.
the class XMLConfigBuilderTest method testConfig_whenProbabilisticSplitBrainProtection_withDefaultValues.
@Override
@Test
public void testConfig_whenProbabilisticSplitBrainProtection_withDefaultValues() {
String xml = HAZELCAST_START_TAG + " <split-brain-protection enabled=\"true\" name=\"mySplitBrainProtection\">\n" + " <minimum-cluster-size>3</minimum-cluster-size>\n" + " <probabilistic-split-brain-protection />" + " </split-brain-protection>\n" + HAZELCAST_END_TAG;
Config config = buildConfig(xml);
SplitBrainProtectionConfig splitBrainProtectionConfig = config.getSplitBrainProtectionConfig("mySplitBrainProtection");
assertInstanceOf(ProbabilisticSplitBrainProtectionFunction.class, splitBrainProtectionConfig.getFunctionImplementation());
ProbabilisticSplitBrainProtectionFunction splitBrainProtectionFunction = (ProbabilisticSplitBrainProtectionFunction) splitBrainProtectionConfig.getFunctionImplementation();
assertEquals(ProbabilisticSplitBrainProtectionConfigBuilder.DEFAULT_HEARTBEAT_INTERVAL_MILLIS, splitBrainProtectionFunction.getHeartbeatIntervalMillis());
assertEquals(ProbabilisticSplitBrainProtectionConfigBuilder.DEFAULT_HEARTBEAT_PAUSE_MILLIS, splitBrainProtectionFunction.getAcceptableHeartbeatPauseMillis());
assertEquals(ProbabilisticSplitBrainProtectionConfigBuilder.DEFAULT_MIN_STD_DEVIATION, splitBrainProtectionFunction.getMinStdDeviationMillis());
assertEquals(ProbabilisticSplitBrainProtectionConfigBuilder.DEFAULT_PHI_THRESHOLD, splitBrainProtectionFunction.getSuspicionThreshold(), 0.01);
assertEquals(ProbabilisticSplitBrainProtectionConfigBuilder.DEFAULT_SAMPLE_SIZE, splitBrainProtectionFunction.getMaxSampleSize());
}
use of com.hazelcast.splitbrainprotection.impl.ProbabilisticSplitBrainProtectionFunction in project hazelcast by hazelcast.
the class XMLConfigBuilderTest method testConfig_whenProbabilisticSplitBrainProtection_withCustomValues.
@Override
@Test
public void testConfig_whenProbabilisticSplitBrainProtection_withCustomValues() {
String xml = HAZELCAST_START_TAG + " <split-brain-protection enabled=\"true\" name=\"mySplitBrainProtection\">\n" + " <minimum-cluster-size>3</minimum-cluster-size>\n" + " <probabilistic-split-brain-protection acceptable-heartbeat-pause-millis=\"37400\" suspicion-threshold=\"3.14592\" " + " max-sample-size=\"42\" min-std-deviation-millis=\"1234\"" + " heartbeat-interval-millis=\"4321\" />" + " </split-brain-protection>\n" + HAZELCAST_END_TAG;
Config config = buildConfig(xml);
SplitBrainProtectionConfig splitBrainProtectionConfig = config.getSplitBrainProtectionConfig("mySplitBrainProtection");
assertInstanceOf(ProbabilisticSplitBrainProtectionFunction.class, splitBrainProtectionConfig.getFunctionImplementation());
ProbabilisticSplitBrainProtectionFunction splitBrainProtectionFunction = (ProbabilisticSplitBrainProtectionFunction) splitBrainProtectionConfig.getFunctionImplementation();
assertEquals(4321, splitBrainProtectionFunction.getHeartbeatIntervalMillis());
assertEquals(37400, splitBrainProtectionFunction.getAcceptableHeartbeatPauseMillis());
assertEquals(1234, splitBrainProtectionFunction.getMinStdDeviationMillis());
assertEquals(3.14592d, splitBrainProtectionFunction.getSuspicionThreshold(), 0.001d);
assertEquals(42, splitBrainProtectionFunction.getMaxSampleSize());
}
use of com.hazelcast.splitbrainprotection.impl.ProbabilisticSplitBrainProtectionFunction in project hazelcast by hazelcast.
the class YamlConfigBuilderTest method testConfig_whenProbabilisticSplitBrainProtection_withCustomValues.
@Override
@Test
public void testConfig_whenProbabilisticSplitBrainProtection_withCustomValues() {
String yaml = "" + "hazelcast:\n" + " split-brain-protection:\n" + " mySplitBrainProtection:\n" + " enabled: true\n" + " minimum-cluster-size: 3\n" + " probabilistic-split-brain-protection:\n" + " acceptable-heartbeat-pause-millis: 37400\n" + " suspicion-threshold: 3.14592\n" + " max-sample-size: 42\n" + " min-std-deviation-millis: 1234\n" + " heartbeat-interval-millis: 4321";
Config config = buildConfig(yaml);
SplitBrainProtectionConfig splitBrainProtectionConfig = config.getSplitBrainProtectionConfig("mySplitBrainProtection");
assertInstanceOf(ProbabilisticSplitBrainProtectionFunction.class, splitBrainProtectionConfig.getFunctionImplementation());
ProbabilisticSplitBrainProtectionFunction splitBrainProtectionFunction = (ProbabilisticSplitBrainProtectionFunction) splitBrainProtectionConfig.getFunctionImplementation();
assertEquals(4321, splitBrainProtectionFunction.getHeartbeatIntervalMillis());
assertEquals(37400, splitBrainProtectionFunction.getAcceptableHeartbeatPauseMillis());
assertEquals(1234, splitBrainProtectionFunction.getMinStdDeviationMillis());
assertEquals(3.14592d, splitBrainProtectionFunction.getSuspicionThreshold(), 0.001d);
assertEquals(42, splitBrainProtectionFunction.getMaxSampleSize());
}
Aggregations