Search in sources :

Example 31 with JsonObject

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

the class ForceStartNodeRequestTest method testForceStart_fails_withNoEnterprise.

@Test
public void testForceStart_fails_withNoEnterprise() throws Exception {
    ForceStartNodeRequest request = new ForceStartNodeRequest();
    JsonObject jsonObject = new JsonObject();
    request.writeResponse(managementCenterService, jsonObject);
    JsonObject result = (JsonObject) jsonObject.get("result");
    assertEquals(ForceStartNodeRequest.FAILED_RESULT, request.readResponse(result));
}
Also used : ForceStartNodeRequest(com.hazelcast.internal.management.request.ForceStartNodeRequest) JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 32 with JsonObject

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

the class MemberStateImpl method fromJson.

//CHECKSTYLE:OFF
@Override
public void fromJson(JsonObject json) {
    address = getString(json, "address");
    for (JsonObject.Member next : getObject(json, "mapStats")) {
        LocalMapStatsImpl stats = new LocalMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        mapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "multiMapStats")) {
        LocalMultiMapStatsImpl stats = new LocalMultiMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        multiMapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "replicatedMapStats", new JsonObject())) {
        LocalReplicatedMapStats stats = new LocalReplicatedMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        replicatedMapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "queueStats")) {
        LocalQueueStatsImpl stats = new LocalQueueStatsImpl();
        stats.fromJson(next.getValue().asObject());
        queueStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "topicStats")) {
        LocalTopicStatsImpl stats = new LocalTopicStatsImpl();
        stats.fromJson(next.getValue().asObject());
        topicStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "executorStats")) {
        LocalExecutorStatsImpl stats = new LocalExecutorStatsImpl();
        stats.fromJson(next.getValue().asObject());
        executorStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "cacheStats", new JsonObject())) {
        LocalCacheStats stats = new LocalCacheStatsImpl();
        stats.fromJson(next.getValue().asObject());
        cacheStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "wanStats", new JsonObject())) {
        LocalWanStats stats = new LocalWanStatsImpl();
        stats.fromJson(next.getValue().asObject());
        wanStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "runtimeProps")) {
        runtimeProps.put(next.getName(), next.getValue().asLong());
    }
    final JsonArray jsonClients = getArray(json, "clients");
    for (JsonValue jsonClient : jsonClients) {
        final ClientEndPointDTO client = new ClientEndPointDTO();
        client.fromJson(jsonClient.asObject());
        clients.add(client);
    }
    beans = new MXBeansDTO();
    beans.fromJson(getObject(json, "beans"));
    JsonObject jsonMemoryStats = getObject(json, "memoryStats", null);
    if (jsonMemoryStats != null) {
        memoryStats.fromJson(jsonMemoryStats);
    }
    JsonObject jsonOperationStats = getObject(json, "operationStats", null);
    if (jsonOperationStats != null) {
        operationStats.fromJson(jsonOperationStats);
    }
    JsonObject jsonMemberPartitionState = getObject(json, "memberPartitionState", null);
    if (jsonMemberPartitionState != null) {
        memberPartitionState = new MemberPartitionStateImpl();
        memberPartitionState.fromJson(jsonMemberPartitionState);
    }
    JsonObject jsonNodeState = getObject(json, "nodeState", null);
    if (jsonNodeState != null) {
        nodeState = new NodeStateImpl();
        nodeState.fromJson(jsonNodeState);
    }
    JsonObject jsonHotRestartState = getObject(json, "hotRestartState", null);
    if (jsonHotRestartState != null) {
        hotRestartState = new HotRestartStateImpl();
        hotRestartState.fromJson(jsonHotRestartState);
    }
    JsonObject jsonClusterHotRestartStatus = getObject(json, "clusterHotRestartStatus", null);
    if (jsonClusterHotRestartStatus != null) {
        clusterHotRestartStatus = new ClusterHotRestartStatusDTO();
        clusterHotRestartStatus.fromJson(jsonClusterHotRestartStatus);
    }
    JsonObject jsonWanSyncState = getObject(json, "wanSyncState", null);
    if (jsonWanSyncState != null) {
        wanSyncState = new WanSyncStateImpl();
        wanSyncState.fromJson(jsonWanSyncState);
    }
}
Also used : LocalCacheStats(com.hazelcast.monitor.LocalCacheStats) ClientEndPointDTO(com.hazelcast.internal.management.dto.ClientEndPointDTO) JsonValue(com.eclipsesource.json.JsonValue) JsonObject(com.eclipsesource.json.JsonObject) MXBeansDTO(com.hazelcast.internal.management.dto.MXBeansDTO) JsonArray(com.eclipsesource.json.JsonArray) LocalWanStats(com.hazelcast.monitor.LocalWanStats) ClusterHotRestartStatusDTO(com.hazelcast.internal.management.dto.ClusterHotRestartStatusDTO) LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats)

Example 33 with JsonObject

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

the class NearCacheStatsImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("ownedEntryCount", ownedEntryCount);
    root.add("ownedEntryMemoryCost", ownedEntryMemoryCost);
    root.add("creationTime", creationTime);
    root.add("hits", hits);
    root.add("misses", misses);
    root.add("evictions", evictions);
    root.add("expirations", expirations);
    root.add("persistenceCount", persistenceCount);
    root.add("lastPersistenceTime", lastPersistenceTime);
    root.add("lastPersistenceDuration", lastPersistenceDuration);
    root.add("lastPersistenceWrittenBytes", lastPersistenceWrittenBytes);
    root.add("lastPersistenceKeyCount", lastPersistenceKeyCount);
    root.add("lastPersistenceFailure", lastPersistenceFailure);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 34 with JsonObject

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

the class NodeStateImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("clusterState", clusterState.name());
    root.add("nodeState", nodeState.name());
    root.add("clusterVersion", clusterVersion.toString());
    root.add("memberVersion", memberVersion.toString());
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 35 with JsonObject

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

the class WanSyncStateImpl method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("creationTime", creationTime);
    root.add("status", status.getStatus());
    root.add("syncedPartitionCount", syncedPartitionCount);
    if (activeWanConfigName != null) {
        root.add("activeWanConfigName", activeWanConfigName);
    }
    if (activePublisherName != null) {
        root.add("activePublisherName", activePublisherName);
    }
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

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