Search in sources :

Example 1 with ChangeClusterStateRequest

use of com.hazelcast.internal.management.request.ChangeClusterStateRequest in project hazelcast by hazelcast.

the class ChangeClusterStateRequestTest method testChangeClusterState_withNonExistent.

@Test
public void testChangeClusterState_withNonExistent() throws Exception {
    ChangeClusterStateRequest changeClusterStateRequest = new ChangeClusterStateRequest("MURAT");
    JsonObject jsonObject = new JsonObject();
    changeClusterStateRequest.writeResponse(managementCenterService, jsonObject);
    JsonObject result = (JsonObject) jsonObject.get("result");
    String resultString = (String) changeClusterStateRequest.readResponse(result);
    assertTrue(resultString.startsWith("FAILURE"));
}
Also used : ChangeClusterStateRequest(com.hazelcast.internal.management.request.ChangeClusterStateRequest) JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 2 with ChangeClusterStateRequest

use of com.hazelcast.internal.management.request.ChangeClusterStateRequest in project hazelcast by hazelcast.

the class ChangeClusterStateRequestTest method testChangeClusterState_withInvalidState.

@Test
public void testChangeClusterState_withInvalidState() throws Exception {
    ChangeClusterStateRequest changeClusterStateRequest = new ChangeClusterStateRequest("IN_TRANSITION");
    JsonObject jsonObject = new JsonObject();
    changeClusterStateRequest.writeResponse(managementCenterService, jsonObject);
    JsonObject result = (JsonObject) jsonObject.get("result");
    String resultString = (String) changeClusterStateRequest.readResponse(result);
    assertTrue(resultString.startsWith("FAILURE"));
}
Also used : ChangeClusterStateRequest(com.hazelcast.internal.management.request.ChangeClusterStateRequest) JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 3 with ChangeClusterStateRequest

use of com.hazelcast.internal.management.request.ChangeClusterStateRequest in project hazelcast by hazelcast.

the class ChangeClusterStateRequestTest method testChangeClusterState.

@Test
public void testChangeClusterState() throws Exception {
    ChangeClusterStateRequest changeClusterStateRequest = new ChangeClusterStateRequest("FROZEN");
    JsonObject jsonObject = new JsonObject();
    changeClusterStateRequest.writeResponse(managementCenterService, jsonObject);
    JsonObject result = (JsonObject) jsonObject.get("result");
    assertEquals("SUCCESS", changeClusterStateRequest.readResponse(result));
    assertEquals(ClusterState.valueOf("FROZEN"), cluster.getClusterState());
}
Also used : ChangeClusterStateRequest(com.hazelcast.internal.management.request.ChangeClusterStateRequest) JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)3 ChangeClusterStateRequest (com.hazelcast.internal.management.request.ChangeClusterStateRequest)3 ParallelTest (com.hazelcast.test.annotation.ParallelTest)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 Test (org.junit.Test)3