Search in sources :

Example 46 with QuorumConfig

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

the class AbstractQueueQuorumTest method initializeFiveMemberCluster.

protected static void initializeFiveMemberCluster(QuorumType type, int quorumSize) {
    QuorumConfig quorumConfig = new QuorumConfig().setName(QUORUM_ID).setType(type).setEnabled(true).setSize(quorumSize);
    QueueConfig qConfig = new QueueConfig(QUEUE_NAME_PREFIX + "*").setBackupCount(4).setQuorumName(QUORUM_ID);
    cluster = new PartitionedCluster(new TestHazelcastInstanceFactory());
    cluster.createFiveMemberCluster(qConfig, quorumConfig);
    q1 = getQueue(cluster.h1);
    q2 = getQueue(cluster.h2);
    q3 = getQueue(cluster.h3);
    q4 = getQueue(cluster.h4);
    q5 = getQueue(cluster.h5);
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) QueueConfig(com.hazelcast.config.QueueConfig) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory)

Example 47 with QuorumConfig

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

the class CacheQuorumConfigTest 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 quorumName = cacheConfig1.getQuorumName();
    assertEquals("cache-quorum", quorumName);
    QuorumConfig quorumConfig = config.getQuorumConfig(quorumName);
    assertEquals(3, quorumConfig.getSize());
    assertEquals(QuorumType.READ_WRITE, quorumConfig.getType());
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) XmlConfigBuilder(com.hazelcast.config.XmlConfigBuilder) Config(com.hazelcast.config.Config) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) QuorumConfig(com.hazelcast.config.QuorumConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 48 with QuorumConfig

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

the class QuorumServiceImpl method initializeListeners.

private void initializeListeners() {
    for (Map.Entry<String, QuorumConfig> configEntry : nodeEngine.getConfig().getQuorumConfigs().entrySet()) {
        QuorumConfig config = configEntry.getValue();
        String instanceName = configEntry.getKey();
        for (QuorumListenerConfig listenerConfig : config.getListenerConfigs()) {
            initializeListenerInternal(instanceName, listenerConfig);
        }
    }
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) QuorumListenerConfig(com.hazelcast.config.QuorumListenerConfig) HashMap(java.util.HashMap) Map(java.util.Map)

Example 49 with QuorumConfig

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

the class ClientMapReadQuorumTest 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.READ);
    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 50 with QuorumConfig

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

the class ClientMapReadWriteQuorumTest 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.READ_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)

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