use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class TransactionalMapReadQuorumTest method initialize.
@BeforeClass
public static void initialize() throws Exception {
QuorumConfig quorumConfig = new QuorumConfig();
quorumConfig.setEnabled(true);
quorumConfig.setSize(3);
quorumConfig.setName(QUORUM_ID);
quorumConfig.setType(QuorumType.READ);
MapConfig mapConfig = new MapConfig(MAP_NAME_PREFIX + "*");
mapConfig.setQuorumName(QUORUM_ID);
cluster = new PartitionedCluster(new TestHazelcastInstanceFactory()).partitionFiveMembersThreeAndTwo(mapConfig, quorumConfig);
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class BaseQuorumListenerTest method testQuorumEventsFiredWhenNodeCountBelowThenAboveThreshold.
@Test
public void testQuorumEventsFiredWhenNodeCountBelowThenAboveThreshold() {
CountDownLatch quorumNotPresent = new CountDownLatch(1);
CountDownLatch quorumPresent = new CountDownLatch(1);
String distributedObjectName = randomString();
Config config = addQuorum(new Config(), distributedObjectName, quorumListener(quorumPresent, quorumNotPresent));
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(3);
factory.newHazelcastInstance(config);
factory.newHazelcastInstance(config);
assertOpenEventually(quorumNotPresent, 15);
factory.newHazelcastInstance(config);
assertOpenEventually(quorumPresent);
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class BaseQuorumListenerTest method testQuorumFailureEventFiredWhenNodeCountDropsBelowThreshold.
@Test
public void testQuorumFailureEventFiredWhenNodeCountDropsBelowThreshold() {
CountDownLatch quorumNotPresent = new CountDownLatch(1);
String distributedObjectName = randomString();
Config config = addQuorum(new Config(), distributedObjectName, quorumListener(null, quorumNotPresent));
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
factory.newHazelcastInstance(config);
factory.newHazelcastInstance();
factory.newHazelcastInstance().shutdown();
assertOpenEventually(quorumNotPresent, 15);
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class BaseQuorumListenerTest method testCustomResolverFiresQuorumFailureEvent.
@Test
public void testCustomResolverFiresQuorumFailureEvent() {
CountDownLatch quorumNotPresent = new CountDownLatch(1);
QuorumListenerConfig listenerConfig = new QuorumListenerConfig(quorumListener(null, quorumNotPresent));
String distributedObjectName = randomString();
String quorumName = randomString();
QuorumConfig quorumConfig = new QuorumConfig().setName(quorumName).setEnabled(true).addListenerConfig(listenerConfig).setQuorumFunctionImplementation(new QuorumFunction() {
@Override
public boolean apply(Collection<Member> members) {
return false;
}
});
Config config = new Config().addQuorumConfig(quorumConfig);
addQuorumConfig(config, distributedObjectName, quorumName);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
factory.newHazelcastInstance(config);
factory.newHazelcastInstance();
assertOpenEventually(quorumNotPresent, 15);
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class PhoneHomeTest method init.
@Before
public void init() {
factory = new TestHazelcastInstanceFactory(2);
hz1 = factory.newHazelcastInstance();
}
Aggregations