Search in sources :

Example 11 with PartitionedCluster

use of com.hazelcast.quorum.PartitionedCluster in project hazelcast by hazelcast.

the class CacheWriteQuorumTest method initialize.

@BeforeClass
public static void initialize() throws Exception {
    CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
    cacheConfig.setName(CACHE_NAME_PREFIX + "*");
    cacheConfig.setQuorumName(QUORUM_ID);
    QuorumConfig quorumConfig = new QuorumConfig();
    quorumConfig.setName(QUORUM_ID);
    quorumConfig.setType(QuorumType.WRITE);
    quorumConfig.setEnabled(true);
    quorumConfig.setSize(3);
    PartitionedCluster cluster = new PartitionedCluster(new TestHazelcastInstanceFactory()).partitionFiveMembersThreeAndTwo(cacheConfig, quorumConfig);
    cachingProvider1 = HazelcastServerCachingProvider.createCachingProvider(cluster.h1);
    cachingProvider2 = HazelcastServerCachingProvider.createCachingProvider(cluster.h2);
    cachingProvider3 = HazelcastServerCachingProvider.createCachingProvider(cluster.h3);
    cachingProvider4 = HazelcastServerCachingProvider.createCachingProvider(cluster.h4);
    cachingProvider5 = HazelcastServerCachingProvider.createCachingProvider(cluster.h5);
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) BeforeClass(org.junit.BeforeClass)

Example 12 with PartitionedCluster

use of com.hazelcast.quorum.PartitionedCluster in project hazelcast by hazelcast.

the class AbstractLockQuorumTest method initializeFiveMemberCluster.

static void initializeFiveMemberCluster(QuorumType type, int quorumSize) {
    QuorumConfig quorumConfig = new QuorumConfig().setName(QUORUM_ID).setType(type).setEnabled(true).setSize(quorumSize);
    LockConfig lockConfig = new LockConfig(LOCK_NAME_PREFIX + "*").setQuorumName(QUORUM_ID);
    cluster = new PartitionedCluster(new TestHazelcastInstanceFactory());
    cluster.createFiveMemberCluster(lockConfig, quorumConfig);
    l1 = getLock(cluster.h1);
    l2 = getLock(cluster.h2);
    l3 = getLock(cluster.h3);
    l4 = getLock(cluster.h4);
    l5 = getLock(cluster.h5);
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) LockConfig(com.hazelcast.config.LockConfig) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory)

Example 13 with PartitionedCluster

use of com.hazelcast.quorum.PartitionedCluster in project hazelcast by hazelcast.

the class MapReadQuorumTest 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);
    MapConfig mapConfig = new MapConfig(MAP_NAME_PREFIX + "*");
    mapConfig.setQuorumName(QUORUM_ID);
    cluster = new PartitionedCluster(new TestHazelcastInstanceFactory()).partitionFiveMembersThreeAndTwo(mapConfig, quorumConfig);
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) MapConfig(com.hazelcast.config.MapConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) BeforeClass(org.junit.BeforeClass)

Example 14 with PartitionedCluster

use of com.hazelcast.quorum.PartitionedCluster 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 15 with PartitionedCluster

use of com.hazelcast.quorum.PartitionedCluster 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)

Aggregations

QuorumConfig (com.hazelcast.config.QuorumConfig)18 PartitionedCluster (com.hazelcast.quorum.PartitionedCluster)18 BeforeClass (org.junit.BeforeClass)16 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)11 MapConfig (com.hazelcast.config.MapConfig)10 TestHazelcastFactory (com.hazelcast.client.test.TestHazelcastFactory)7 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)6 LockConfig (com.hazelcast.config.LockConfig)1 QueueConfig (com.hazelcast.config.QueueConfig)1