Search in sources :

Example 21 with JsonObject

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());
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 22 with JsonObject

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());
        }
    });
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) AssertTask(com.hazelcast.test.AssertTask) ShutdownClusterRequest(com.hazelcast.internal.management.request.ShutdownClusterRequest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 23 with JsonObject

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));
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) ThreadDumpRequest(com.hazelcast.internal.management.request.ThreadDumpRequest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 24 with JsonObject

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"));
}
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 25 with JsonObject

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"));
}
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)499 Test (org.junit.Test)157 URL (java.net.URL)145 JsonArray (com.eclipsesource.json.JsonArray)96 JsonValue (com.eclipsesource.json.JsonValue)43 ParallelTest (com.hazelcast.test.annotation.ParallelTest)36 QuickTest (com.hazelcast.test.annotation.QuickTest)36 ArrayList (java.util.ArrayList)33 HashMap (java.util.HashMap)28 IOException (java.io.IOException)17 Map (java.util.Map)17 Matchers.containsString (org.hamcrest.Matchers.containsString)17 Date (java.util.Date)13 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)12 MalformedURLException (java.net.MalformedURLException)11 WalletCallException (com.vaklinov.zcashui.ZCashClientCaller.WalletCallException)7 URISyntaxException (java.net.URISyntaxException)6 ExecuteScriptRequest (com.hazelcast.internal.management.request.ExecuteScriptRequest)5 Link (org.eclipse.leshan.Link)5 Jedis (redis.clients.jedis.Jedis)5