Search in sources :

Example 11 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class AbstractProxySessionManagerTest method createConfig.

@Override
protected Config createConfig(int cpNodeCount, int groupSize) {
    Config config = super.createConfig(cpNodeCount, groupSize);
    CPSubsystemConfig cpSubsystemConfig = config.getCPSubsystemConfig();
    cpSubsystemConfig.setSessionHeartbeatIntervalSeconds(1);
    cpSubsystemConfig.setSessionTimeToLiveSeconds(sessionTTLSeconds);
    return config;
}
Also used : CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) Config(com.hazelcast.config.Config) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig)

Example 12 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class ConfigValidatorTest method testValidationFails_whenSessionHeartbeatIntervalGreaterThanSessionTTL.

@Test(expected = IllegalArgumentException.class)
public void testValidationFails_whenSessionHeartbeatIntervalGreaterThanSessionTTL() {
    CPSubsystemConfig config = new CPSubsystemConfig();
    config.setSessionTimeToLiveSeconds(5);
    config.setSessionHeartbeatIntervalSeconds(10);
    checkCPSubsystemConfig(config);
}
Also used : CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) ConfigValidator.checkCPSubsystemConfig(com.hazelcast.internal.config.ConfigValidator.checkCPSubsystemConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 13 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class ConfigValidatorTest method testValidationFails_whenSessionTTLGreaterThanMissingCPMemberAutoRemovalSeconds.

@Test(expected = IllegalArgumentException.class)
public void testValidationFails_whenSessionTTLGreaterThanMissingCPMemberAutoRemovalSeconds() {
    CPSubsystemConfig config = new CPSubsystemConfig();
    config.setMissingCPMemberAutoRemovalSeconds(5);
    config.setSessionTimeToLiveSeconds(10);
    checkCPSubsystemConfig(config);
}
Also used : CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) ConfigValidator.checkCPSubsystemConfig(com.hazelcast.internal.config.ConfigValidator.checkCPSubsystemConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 14 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class PhoneHomeCPSubsystemTest method initialise.

@Before
public void initialise() {
    Config config = getConfig();
    CPSubsystemConfig cpSubsystemConfig = new CPSubsystemConfig().setCPMemberCount(3);
    config.setCPSubsystemConfig(cpSubsystemConfig);
    HazelcastInstance hz = createHazelcastInstances(config, 3)[0];
    node = getNode(hz);
    phoneHome = new PhoneHome(node);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) Before(org.junit.Before)

Example 15 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class TestFullApplicationContext method testCPSubsystemConfig.

@Test
public void testCPSubsystemConfig() {
    CPSubsystemConfig cpSubsystemConfig = config.getCPSubsystemConfig();
    assertEquals(0, cpSubsystemConfig.getCPMemberCount());
    assertEquals(0, cpSubsystemConfig.getGroupSize());
    assertEquals(15, cpSubsystemConfig.getSessionTimeToLiveSeconds());
    assertEquals(3, cpSubsystemConfig.getSessionHeartbeatIntervalSeconds());
    assertEquals(120, cpSubsystemConfig.getMissingCPMemberAutoRemovalSeconds());
    assertEquals(30, cpSubsystemConfig.getDataLoadTimeoutSeconds());
    assertTrue(cpSubsystemConfig.isFailOnIndeterminateOperationState());
    assertFalse(cpSubsystemConfig.isPersistenceEnabled());
    assertEquals(new File("/custom-dir").getAbsolutePath(), cpSubsystemConfig.getBaseDir().getAbsolutePath());
    RaftAlgorithmConfig raftAlgorithmConfig = cpSubsystemConfig.getRaftAlgorithmConfig();
    assertEquals(500, raftAlgorithmConfig.getLeaderElectionTimeoutInMillis());
    assertEquals(100, raftAlgorithmConfig.getLeaderHeartbeatPeriodInMillis());
    assertEquals(3, raftAlgorithmConfig.getMaxMissedLeaderHeartbeatCount());
    assertEquals(25, raftAlgorithmConfig.getAppendRequestMaxEntryCount());
    assertEquals(250, raftAlgorithmConfig.getCommitIndexAdvanceCountToSnapshot());
    assertEquals(75, raftAlgorithmConfig.getUncommittedEntryCountToRejectNewAppends());
    assertEquals(50, raftAlgorithmConfig.getAppendRequestBackoffTimeoutInMillis());
    SemaphoreConfig semaphoreConfig1 = cpSubsystemConfig.findSemaphoreConfig("sem1");
    SemaphoreConfig semaphoreConfig2 = cpSubsystemConfig.findSemaphoreConfig("sem2");
    assertNotNull(semaphoreConfig1);
    assertNotNull(semaphoreConfig2);
    assertTrue(semaphoreConfig1.isJDKCompatible());
    assertFalse(semaphoreConfig2.isJDKCompatible());
    assertEquals(1, semaphoreConfig1.getInitialPermits());
    assertEquals(2, semaphoreConfig2.getInitialPermits());
    FencedLockConfig lockConfig1 = cpSubsystemConfig.findLockConfig("lock1");
    FencedLockConfig lockConfig2 = cpSubsystemConfig.findLockConfig("lock2");
    assertNotNull(lockConfig1);
    assertNotNull(lockConfig2);
    assertEquals(1, lockConfig1.getLockAcquireLimit());
    assertEquals(2, lockConfig2.getLockAcquireLimit());
}
Also used : RaftAlgorithmConfig(com.hazelcast.config.cp.RaftAlgorithmConfig) FencedLockConfig(com.hazelcast.config.cp.FencedLockConfig) SemaphoreConfig(com.hazelcast.config.cp.SemaphoreConfig) File(java.io.File) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Aggregations

CPSubsystemConfig (com.hazelcast.config.cp.CPSubsystemConfig)28 Config (com.hazelcast.config.Config)18 QuickTest (com.hazelcast.test.annotation.QuickTest)16 Test (org.junit.Test)16 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)15 ConfigValidator.checkCPSubsystemConfig (com.hazelcast.internal.config.ConfigValidator.checkCPSubsystemConfig)12 SemaphoreConfig (com.hazelcast.config.cp.SemaphoreConfig)8 FencedLockConfig (com.hazelcast.config.cp.FencedLockConfig)5 RaftAlgorithmConfig (com.hazelcast.config.cp.RaftAlgorithmConfig)4 File (java.io.File)4 KerberosAuthenticationConfig (com.hazelcast.config.security.KerberosAuthenticationConfig)3 KerberosIdentityConfig (com.hazelcast.config.security.KerberosIdentityConfig)3 LdapAuthenticationConfig (com.hazelcast.config.security.LdapAuthenticationConfig)3 RealmConfig (com.hazelcast.config.security.RealmConfig)3 SimpleAuthenticationConfig (com.hazelcast.config.security.SimpleAuthenticationConfig)3 TokenIdentityConfig (com.hazelcast.config.security.TokenIdentityConfig)2 File.createTempFile (java.io.File.createTempFile)2 CPSubsystemConfigChecker (com.hazelcast.config.ConfigCompatibilityChecker.CPSubsystemConfigChecker)1 PersistenceConfig (com.hazelcast.config.PersistenceConfig)1 JaasAuthenticationConfig (com.hazelcast.config.security.JaasAuthenticationConfig)1