use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testChangeClusterVersion.
@Test
public void testChangeClusterVersion() throws IOException {
Config config = createConfigWithRestEnabled();
final HazelcastInstance instance = factory.newHazelcastInstance(config);
final HTTPCommunicator communicator = new HTTPCommunicator(instance);
String clusterName = config.getClusterName();
ConnectionResponse resp = communicator.changeClusterVersion(clusterName, getPassword(), instance.getCluster().getClusterVersion().toString());
assertSuccessJson(resp, "version", instance.getCluster().getClusterVersion().toString());
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testHeadRequest_ClusterHealth.
@Test
public void testHeadRequest_ClusterHealth() throws Exception {
HazelcastInstance instance = factory.newHazelcastInstance(createConfigWithRestEnabled());
factory.newHazelcastInstance(createConfigWithRestEnabled());
HTTPCommunicator communicator = new HTTPCommunicator(instance);
ConnectionResponse response = communicator.headRequestToClusterHealthURI();
assertEquals(HttpURLConnection.HTTP_OK, response.responseCode);
assertEquals(response.responseHeaders.get("Hazelcast-NodeState").size(), 1);
assertContains(response.responseHeaders.get("Hazelcast-NodeState"), "ACTIVE");
assertEquals(response.responseHeaders.get("Hazelcast-ClusterState").size(), 1);
assertContains(response.responseHeaders.get("Hazelcast-ClusterState"), "ACTIVE");
assertEquals(response.responseHeaders.get("Hazelcast-ClusterSize").size(), 1);
assertContains(response.responseHeaders.get("Hazelcast-ClusterSize"), "2");
assertEquals(response.responseHeaders.get("Hazelcast-MigrationQueueSize").size(), 1);
assertContains(response.responseHeaders.get("Hazelcast-MigrationQueueSize"), "0");
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestClusterTest method testListNodes.
@Test
public void testListNodes() throws Exception {
Config config = createConfigWithRestEnabled();
HazelcastInstance instance = factory.newHazelcastInstance(config);
HTTPCommunicator communicator = new HTTPCommunicator(instance);
HazelcastTestSupport.waitInstanceForSafeState(instance);
String clusterName = config.getClusterName();
ConnectionResponse resp = communicator.listClusterNodes(clusterName, getPassword());
assertSuccessJson(resp, "response", String.format("[%s]\n%s\n%s", instance.getCluster().getLocalMember().toString(), BuildInfoProvider.getBuildInfo().getVersion(), System.getProperty("java.version")));
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestTest method testBad_PostRequest.
@Test
public void testBad_PostRequest() throws IOException {
ConnectionResponse resp = communicator.postBadRequestURI();
assertEquals(HTTP_BAD_REQUEST, resp.responseCode);
assertJsonContains(resp.response, "status", "fail", "message", "Missing map name");
}
use of com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse in project hazelcast by hazelcast.
the class RestCPSubsystemTest method test_promoteAPMemberToCPMember_withInvalidCredentials.
@Test
public void test_promoteAPMemberToCPMember_withInvalidCredentials() throws IOException, ExecutionException, InterruptedException {
HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
Hazelcast.newHazelcastInstance(config);
HazelcastInstance instance4 = Hazelcast.newHazelcastInstance(config);
ConnectionResponse response = new HTTPCommunicator(instance4).promoteCPMember("x", "x");
assertEquals(403, response.responseCode);
Collection<CPMember> cpMembers = instance1.getCPSubsystem().getCPSubsystemManagementService().getCPMembers().toCompletableFuture().get();
assertEquals(3, cpMembers.size());
}
Aggregations