Search in sources :

Example 71 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class GetMapEntryRequestTest method testGetMapEntry.

@Test
public void testGetMapEntry() throws Exception {
    GetMapEntryRequest request = new GetMapEntryRequest("string", "map", "key");
    IMap<String, String> map = hz.getMap("map");
    map.put("key", "value");
    JsonObject jsonObject = new JsonObject();
    request.writeResponse(managementCenterService, jsonObject);
    JsonObject result = (JsonObject) jsonObject.get("result");
    assertEquals("value", result.get("browse_value").asString());
    assertEquals("java.lang.String", result.get("browse_class").asString());
}
Also used : GetMapEntryRequest(com.hazelcast.internal.management.request.GetMapEntryRequest) JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 72 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class MapConfigRequestTest method testUpdateMapConfig.

@Test
public void testUpdateMapConfig() {
    MapConfigRequest request = new MapConfigRequest(mapName, dto, true);
    JsonObject jsonObject = new JsonObject();
    request.writeResponse(managementCenterService, jsonObject);
    JsonObject result = (JsonObject) jsonObject.get("result");
    assertEquals("success", request.readResponse(result));
}
Also used : MapConfigRequest(com.hazelcast.internal.management.request.MapConfigRequest) JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 73 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class LocalWanPublisherStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("isConnected", connected);
    root.add("totalPublishLatencies", totalPublishLatency);
    root.add("totalPublishedEventCount", totalPublishedEventCount);
    root.add("outboundQueueSize", outboundQueueSize);
    root.add("paused", paused);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 74 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class LocalWanStatsImpl method fromJson.

@Override
public void fromJson(JsonObject json) {
    for (JsonObject.Member next : json) {
        LocalWanPublisherStats localPublisherStats = new LocalWanPublisherStatsImpl();
        localPublisherStats.fromJson(next.getValue().asObject());
        localPublisherStatsMap.put(next.getName(), localPublisherStats);
    }
}
Also used : LocalWanPublisherStats(com.hazelcast.monitor.LocalWanPublisherStats) JsonObject(com.eclipsesource.json.JsonObject)

Example 75 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class MemberPartitionStateImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    JsonArray partitionsArray = new JsonArray();
    for (Integer lsPartition : partitions) {
        partitionsArray.add(lsPartition);
    }
    root.add("partitions", partitionsArray);
    root.add("memberStateSafe", memberStateSafe);
    root.add("migrationQueueSize", migrationQueueSize);
    return root;
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonObject(com.eclipsesource.json.JsonObject)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)126 Test (org.junit.Test)41 ParallelTest (com.hazelcast.test.annotation.ParallelTest)38 QuickTest (com.hazelcast.test.annotation.QuickTest)38 JsonArray (com.eclipsesource.json.JsonArray)14 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)12 HashMap (java.util.HashMap)12 Map (java.util.Map)9 JsonValue (com.eclipsesource.json.JsonValue)5 ExecuteScriptRequest (com.hazelcast.internal.management.request.ExecuteScriptRequest)5 BoxSharedLink (com.box.androidsdk.content.models.BoxSharedLink)4 WanPublisherConfig (com.hazelcast.config.WanPublisherConfig)4 ChangeClusterStateRequest (com.hazelcast.internal.management.request.ChangeClusterStateRequest)3 ChangeWanStateRequest (com.hazelcast.internal.management.request.ChangeWanStateRequest)3 ILogger (com.hazelcast.logging.ILogger)3 IOException (java.io.IOException)3 BoxEntity (com.box.androidsdk.content.models.BoxEntity)2 ParseException (com.eclipsesource.json.ParseException)2 ClusterState (com.hazelcast.cluster.ClusterState)2 MapConfig (com.hazelcast.config.MapConfig)2