use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_forceDestroyDefaultCPGroup.
@Test
public void test_forceDestroyDefaultCPGroup() throws IOException {
HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
IAtomicLong long1 = instance1.getCPSubsystem().getAtomicLong("long1");
ConnectionResponse response = new HTTPCommunicator(instance1).forceDestroyCPGroup(DEFAULT_GROUP_NAME, clusterName, null);
assertEquals(200, response.responseCode);
exception.expect(CPGroupDestroyedException.class);
long1.set(5);
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_reset_withInvalidCredentials.
@Test
public void test_reset_withInvalidCredentials() throws IOException {
HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config);
HazelcastInstance instance3 = Hazelcast.newHazelcastInstance(config);
for (HazelcastInstance instance : Arrays.asList(instance1, instance2, instance3)) {
ConnectionResponse response = new HTTPCommunicator(instance).restart("x", "x");
assertEquals(403, response.responseCode);
}
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_removeCPMember.
@Test
public void test_removeCPMember() throws IOException {
final HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
final HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config);
final HazelcastInstance instance3 = Hazelcast.newHazelcastInstance(config);
waitUntilCPDiscoveryCompleted(instance1, instance2, instance3);
CPMember crashedCPMember = instance3.getCPSubsystem().getLocalCPMember();
instance3.getLifecycleService().terminate();
assertClusterSizeEventually(2, instance1, instance2);
ConnectionResponse response = new HTTPCommunicator(instance1).removeCPMember(crashedCPMember.getUuid(), clusterName, null);
assertEquals(200, response.responseCode);
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testSetLicenseKey.
@Test
public void testSetLicenseKey() throws Exception {
Config config = createConfigWithRestEnabled();
final HazelcastInstance instance = factory.newHazelcastInstance(config);
HTTPCommunicator communicator = new HTTPCommunicator(instance);
ConnectionResponse response = communicator.setLicense(config.getClusterName(), getPassword(), "whatever");
assertSuccessJson(response);
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testConfigReload.
@Test
public void testConfigReload() throws Exception {
Config config = createConfigWithRestEnabled();
final HazelcastInstance instance = factory.newHazelcastInstance(config);
HTTPCommunicator communicator = new HTTPCommunicator(instance);
ConnectionResponse response = communicator.configReload(config.getClusterName(), getPassword());
// Reload is enterprise feature. Should fail here.
assertJsonContains(response.response, "status", "fail", "message", "Configuration Reload requires Hazelcast Enterprise Edition");
}
Aggregations