use of com.hazelcast.config.ConfigCompatibilityChecker.CPSubsystemConfigChecker in project hazelcast by hazelcast.
the class ConfigXmlGeneratorTest method testCPSubsystemConfig.
@Test
public void testCPSubsystemConfig() {
Config config = new Config();
config.getCPSubsystemConfig().setCPMemberCount(10).setGroupSize(5).setSessionTimeToLiveSeconds(15).setSessionHeartbeatIntervalSeconds(3).setMissingCPMemberAutoRemovalSeconds(120).setFailOnIndeterminateOperationState(true).setPersistenceEnabled(true).setBaseDir(new File("/custom-dir"));
config.getCPSubsystemConfig().getRaftAlgorithmConfig().setLeaderElectionTimeoutInMillis(500).setLeaderHeartbeatPeriodInMillis(100).setMaxMissedLeaderHeartbeatCount(10).setAppendRequestMaxEntryCount(25).setAppendRequestMaxEntryCount(250).setUncommittedEntryCountToRejectNewAppends(75).setAppendRequestBackoffTimeoutInMillis(50);
config.getCPSubsystemConfig().addSemaphoreConfig(new SemaphoreConfig("sem1", true, 1)).addSemaphoreConfig(new SemaphoreConfig("sem2", false, 2));
config.getCPSubsystemConfig().addLockConfig(new FencedLockConfig("lock1", 1)).addLockConfig(new FencedLockConfig("lock1", 2));
CPSubsystemConfig generatedConfig = getNewConfigViaXMLGenerator(config).getCPSubsystemConfig();
assertTrue(generatedConfig + " should be compatible with " + config.getCPSubsystemConfig(), new CPSubsystemConfigChecker().check(config.getCPSubsystemConfig(), generatedConfig));
}
Aggregations