Search in sources :

Example 41 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 42 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 43 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 44 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 45 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)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