Search in sources :

Example 1 with QuorumConfig

use of com.hazelcast.config.QuorumConfig in project hazelcast by hazelcast.

the class ClientCacheReadQuorumTest method initialize.

@BeforeClass
public static void initialize() throws Exception {
    QuorumConfig quorumConfig = new QuorumConfig();
    quorumConfig.setName(QUORUM_ID);
    quorumConfig.setType(QuorumType.READ);
    quorumConfig.setEnabled(true);
    quorumConfig.setSize(3);
    CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
    cacheConfig.setName(CACHE_NAME_PREFIX + "*");
    cacheConfig.setQuorumName(QUORUM_ID);
    factory = new TestHazelcastFactory();
    cluster = new PartitionedCluster(factory).createFiveMemberCluster(cacheConfig, quorumConfig);
    initializeClients();
    initializeCaches();
    cluster.splitFiveMembersThreeAndTwo();
    verifyClients();
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) TestHazelcastFactory(com.hazelcast.client.test.TestHazelcastFactory) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) BeforeClass(org.junit.BeforeClass)

Example 2 with QuorumConfig

use of com.hazelcast.config.QuorumConfig in project hazelcast by hazelcast.

the class ClientCacheReadWriteQuorumTest method initialize.

@BeforeClass
public static void initialize() throws Exception {
    QuorumConfig quorumConfig = new QuorumConfig();
    quorumConfig.setName(QUORUM_ID);
    quorumConfig.setType(QuorumType.READ_WRITE);
    quorumConfig.setEnabled(true);
    quorumConfig.setSize(3);
    CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
    cacheConfig.setName(CACHE_NAME_PREFIX + "*");
    cacheConfig.setQuorumName(QUORUM_ID);
    factory = new TestHazelcastFactory();
    cluster = new PartitionedCluster(factory).createFiveMemberCluster(cacheConfig, quorumConfig);
    initializeClients();
    initializeCaches();
    cluster.splitFiveMembersThreeAndTwo();
    verifyClients();
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) TestHazelcastFactory(com.hazelcast.client.test.TestHazelcastFactory) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) BeforeClass(org.junit.BeforeClass)

Example 3 with QuorumConfig

use of com.hazelcast.config.QuorumConfig in project hazelcast by hazelcast.

the class ClientMapWriteQuorumTest method initialize.

@BeforeClass
public static void initialize() throws Exception {
    QuorumConfig quorumConfig = new QuorumConfig();
    quorumConfig.setName(QUORUM_ID);
    quorumConfig.setEnabled(true);
    quorumConfig.setSize(3);
    quorumConfig.setType(QuorumType.WRITE);
    MapConfig mapConfig = new MapConfig(MAP_NAME_PREFIX + "*");
    mapConfig.setQuorumName(QUORUM_ID);
    factory = new TestHazelcastFactory();
    cluster = new PartitionedCluster(factory).partitionFiveMembersThreeAndTwo(mapConfig, quorumConfig);
    initializeClients();
    verifyClients();
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) TestHazelcastFactory(com.hazelcast.client.test.TestHazelcastFactory) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) MapConfig(com.hazelcast.config.MapConfig) BeforeClass(org.junit.BeforeClass)

Example 4 with QuorumConfig

use of com.hazelcast.config.QuorumConfig in project hazelcast by hazelcast.

the class TestFullApplicationContext method testQuorumConfig.

@Test
public void testQuorumConfig() {
    assertNotNull(config);
    assertEquals(1, config.getQuorumConfigs().size());
    QuorumConfig quorumConfig = config.getQuorumConfig("my-quorum");
    assertNotNull(quorumConfig);
    assertEquals("my-quorum", quorumConfig.getName());
    assertEquals("com.hazelcast.spring.DummyQuorumFunction", quorumConfig.getQuorumFunctionClassName());
    assertEquals(true, quorumConfig.isEnabled());
    assertEquals(2, quorumConfig.getSize());
    assertEquals(2, quorumConfig.getListenerConfigs().size());
    assertEquals(QuorumType.READ, quorumConfig.getType());
    assertEquals("com.hazelcast.spring.DummyQuorumListener", quorumConfig.getListenerConfigs().get(0).getClassName());
    assertNotNull(quorumConfig.getListenerConfigs().get(1).getImplementation());
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 5 with QuorumConfig

use of com.hazelcast.config.QuorumConfig in project hazelcast by hazelcast.

the class QuorumServiceImpl method initializeQuorums.

private void initializeQuorums() {
    for (QuorumConfig quorumConfig : nodeEngine.getConfig().getQuorumConfigs().values()) {
        QuorumImpl quorum = new QuorumImpl(quorumConfig, nodeEngine);
        quorums.put(quorumConfig.getName(), quorum);
    }
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig)

Aggregations

QuorumConfig (com.hazelcast.config.QuorumConfig)52 MapConfig (com.hazelcast.config.MapConfig)31 Config (com.hazelcast.config.Config)29 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)25 QuickTest (com.hazelcast.test.annotation.QuickTest)25 Test (org.junit.Test)25 ParallelTest (com.hazelcast.test.annotation.ParallelTest)23 PartitionedCluster (com.hazelcast.quorum.PartitionedCluster)18 HazelcastInstance (com.hazelcast.core.HazelcastInstance)17 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)16 BeforeClass (org.junit.BeforeClass)16 QuorumListenerConfig (com.hazelcast.config.QuorumListenerConfig)15 CountDownLatch (java.util.concurrent.CountDownLatch)13 QuorumEvent (com.hazelcast.quorum.QuorumEvent)11 QuorumListener (com.hazelcast.quorum.QuorumListener)11 Member (com.hazelcast.core.Member)10 TestHazelcastFactory (com.hazelcast.client.test.TestHazelcastFactory)7 HazelcastServerCachingProvider (com.hazelcast.cache.impl.HazelcastServerCachingProvider)5 LockConfig (com.hazelcast.config.LockConfig)5 QueueConfig (com.hazelcast.config.QueueConfig)5