use of com.hazelcast.cp.CPMember in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_promoteAPMemberToCPMember.
@Test
public void test_promoteAPMemberToCPMember() throws ExecutionException, InterruptedException {
final HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
final HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config);
final HazelcastInstance instance3 = Hazelcast.newHazelcastInstance(config);
final HazelcastInstance instance4 = Hazelcast.newHazelcastInstance(config);
waitUntilCPDiscoveryCompleted(instance1, instance2, instance3, instance4);
assertTrueEventually(() -> {
ConnectionResponse response = new HTTPCommunicator(instance4).promoteCPMember(clusterName, null);
assertEquals(200, response.responseCode);
});
Collection<CPMember> cpMembers = instance1.getCPSubsystem().getCPSubsystemManagementService().getCPMembers().toCompletableFuture().get();
assertEquals(4, cpMembers.size());
assertNotNull(instance4.getCPSubsystem().getLocalCPMember());
}
use of com.hazelcast.cp.CPMember in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_removeCPMemberFromNonMaster.
@Test
public void test_removeCPMemberFromNonMaster() throws IOException {
Hazelcast.newHazelcastInstance(config);
HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config);
HazelcastInstance instance3 = Hazelcast.newHazelcastInstance(config);
waitUntilCPDiscoveryCompleted(instance2, instance3);
CPMember crashedCPMember = instance2.getCPSubsystem().getLocalCPMember();
instance2.getLifecycleService().terminate();
ConnectionResponse response = new HTTPCommunicator(instance3).removeCPMember(crashedCPMember.getUuid(), clusterName, null);
assertEquals(200, response.responseCode);
}
Aggregations