use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testConfigUpdate.
@Test
public void testConfigUpdate() throws Exception {
Config config = createConfigWithRestEnabled();
final HazelcastInstance instance = factory.newHazelcastInstance(config);
HTTPCommunicator communicator = new HTTPCommunicator(instance);
ConnectionResponse response = communicator.configUpdate(config.getClusterName(), getPassword(), "hazelcast:\n");
// Reload is enterprise feature. Should fail here.
assertJsonContains(response.response, "status", "fail", "message", "Configuration Update requires Hazelcast Enterprise Edition");
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testClusterShutdown.
@Test
public void testClusterShutdown() throws Exception {
Config config = createConfigWithRestEnabled();
final HazelcastInstance instance1 = factory.newHazelcastInstance(config);
final HazelcastInstance instance2 = factory.newHazelcastInstance(config);
HTTPCommunicator communicator = new HTTPCommunicator(instance2);
ConnectionResponse response = communicator.shutdownCluster(config.getClusterName(), getPassword());
assertSuccessJson(response);
assertTrueEventually(() -> {
assertFalse(instance1.getLifecycleService().isRunning());
assertFalse(instance2.getLifecycleService().isRunning());
});
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testForceAndPartialStart.
@Test
public void testForceAndPartialStart() throws IOException {
Config config = createConfigWithRestEnabled();
final HazelcastInstance instance = factory.newHazelcastInstance(config);
final HTTPCommunicator communicator = new HTTPCommunicator(instance);
String clusterName = config.getClusterName();
ConnectionResponse resp1 = communicator.forceStart(clusterName, getPassword());
assertEquals(HttpURLConnection.HTTP_OK, resp1.responseCode);
assertJsonContains(resp1.response, "status", "fail");
ConnectionResponse resp2 = communicator.partialStart(clusterName, getPassword());
assertEquals(HttpURLConnection.HTTP_OK, resp2.responseCode);
assertJsonContains(resp2.response, "status", "fail");
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_forceDestroyCPGroup_withInvalidCredentials.
@Test
public void test_forceDestroyCPGroup_withInvalidCredentials() throws IOException {
HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
instance1.getCPSubsystem().getAtomicLong("long1");
ConnectionResponse response = new HTTPCommunicator(instance1).forceDestroyCPGroup(DEFAULT_GROUP_NAME, "x", "x");
assertEquals(403, response.responseCode);
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_forceCloseInvalidCPSession.
@Test
public void test_forceCloseInvalidCPSession() throws IOException {
HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
instance1.getCPSubsystem().getAtomicLong("long1").set(5);
ConnectionResponse response1 = new HTTPCommunicator(instance1).forceCloseCPSession(DEFAULT_GROUP_NAME, 1, clusterName, null);
assertEquals(400, response1.responseCode);
}
Aggregations