Search in sources :

Example 46 with JsonObject

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

the class LocalOperationStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("maxVisibleSlowOperationCount", maxVisibleSlowOperationCount);
    JsonArray slowOperationArray = new JsonArray();
    int logCount = 0;
    for (SlowOperationDTO slowOperation : slowOperations) {
        if (logCount++ < maxVisibleSlowOperationCount) {
            slowOperationArray.add(slowOperation.toJson());
        }
    }
    root.add("slowOperations", slowOperationArray);
    root.add("creationTime", creationTime);
    return root;
}
Also used : JsonArray(com.eclipsesource.json.JsonArray) JsonObject(com.eclipsesource.json.JsonObject) SlowOperationDTO(com.hazelcast.internal.management.dto.SlowOperationDTO)

Example 47 with JsonObject

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

the class LocalQueueStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("ownedItemCount", ownedItemCount);
    root.add("backupItemCount", backupItemCount);
    root.add("minAge", minAge);
    root.add("maxAge", maxAge);
    root.add("aveAge", aveAge);
    root.add("creationTime", creationTime);
    root.add("numberOfOffers", numberOfOffers);
    root.add("numberOfPolls", numberOfPolls);
    root.add("numberOfRejectedOffers", numberOfRejectedOffers);
    root.add("numberOfEmptyPolls", numberOfEmptyPolls);
    root.add("numberOfOtherOperations", numberOfOtherOperations);
    root.add("numberOfEvents", numberOfEvents);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 48 with JsonObject

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

the class LocalTopicStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("creationTime", creationTime);
    root.add("totalPublishes", totalPublishes);
    root.add("totalReceivedMessages", totalReceivedMessages);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 49 with JsonObject

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

the class MancenterServlet method doPost.

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    BufferedReader br = req.getReader();
    StringBuilder sb = new StringBuilder();
    String str;
    while ((str = br.readLine()) != null) {
        sb.append(str);
    }
    final String json = sb.toString();
    final JsonObject object = JsonObject.readFrom(json);
    process(object);
}
Also used : BufferedReader(java.io.BufferedReader) JsonObject(com.eclipsesource.json.JsonObject)

Example 50 with JsonObject

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

the class MapConfigRequestTest method testGetMapConfig.

@Test
public void testGetMapConfig() {
    MapConfigRequest request = new MapConfigRequest(mapName, dto, false);
    JsonObject jsonObject = new JsonObject();
    request.writeResponse(managementCenterService, jsonObject);
    JsonObject result = (JsonObject) jsonObject.get("result");
    MapConfig mapConfig = (MapConfig) request.readResponse(result);
    assertNotNull(mapConfig);
    assertEquals("default", mapConfig.getName());
}
Also used : MapConfigRequest(com.hazelcast.internal.management.request.MapConfigRequest) JsonObject(com.eclipsesource.json.JsonObject) MapConfig(com.hazelcast.config.MapConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

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