use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class LocalTopicStatsImplTest method testSerialization.
@Test
public void testSerialization() {
JsonObject serialized = localTopicStats.toJson();
LocalTopicStatsImpl deserialized = new LocalTopicStatsImpl();
deserialized.fromJson(serialized);
assertTrue(deserialized.getCreationTime() > 0);
assertEquals(3, deserialized.getPublishOperationCount());
assertEquals(2, deserialized.getReceiveOperationCount());
assertNotNull(deserialized.toString());
}
use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class ShutdownClusterRequestTest method testShutdownCluster.
@Test
public void testShutdownCluster() throws Exception {
ShutdownClusterRequest request = new ShutdownClusterRequest();
cluster.getClusterState();
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
assertEquals("SUCCESS", request.readResponse(result));
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertFalse(lifecycleService.isRunning());
}
});
}
use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class ThreadDumpRequestTest method testThreadDumpRequest_withDeadlocks.
@Test
public void testThreadDumpRequest_withDeadlocks() throws Exception {
ThreadDumpRequest request = new ThreadDumpRequest(true);
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
assertNotNull(request.readResponse(result));
}
use of com.eclipsesource.json.JsonObject 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"));
}
use of com.eclipsesource.json.JsonObject 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"));
}
Aggregations