Search in sources :

Example 21 with JsonObject

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

the class EvictionConfigDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject().add("size", evictionConfig.getSize()).add("maxSizePolicy", evictionConfig.getMaxSizePolicy().toString()).add("evictionPolicy", evictionConfig.getEvictionPolicy().toString());
    String comparatorClassName = evictionConfig.getComparatorClassName();
    if (!isNullOrEmpty(comparatorClassName)) {
        root.add("comparatorClassName", comparatorClassName);
    }
    return root;
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject) JsonUtil.getString(com.hazelcast.internal.util.JsonUtil.getString)

Example 22 with JsonObject

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

the class PermissionConfigDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject object = new JsonObject();
    object.add("permissionType", permissionConfig.getType().getNodeName());
    object.add("name", permissionConfig.getName());
    if (StringUtil.isNullOrEmptyAfterTrim(permissionConfig.getPrincipal())) {
        object.add("principal", "*");
    } else {
        object.add("principal", permissionConfig.getPrincipal());
    }
    Set<String> endpoints = permissionConfig.getEndpoints();
    if (endpoints != null) {
        JsonArray endpointsArray = new JsonArray();
        for (String endpoint : endpoints) {
            endpointsArray.add(endpoint);
        }
        object.add("endpoints", endpointsArray);
    }
    Set<String> actions = permissionConfig.getActions();
    if (actions != null) {
        JsonArray actionsArray = new JsonArray();
        for (String action : actions) {
            actionsArray.add(action);
        }
        object.add("actions", actionsArray);
    }
    return object;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) JsonObject(com.hazelcast.internal.json.JsonObject)

Example 23 with JsonObject

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

the class SlowOperationInvocationDTO method toJson.

public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("id", id);
    root.add("details", operationDetails);
    root.add("startedAt", startedAt);
    root.add("durationMs", durationMs);
    return root;
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject)

Example 24 with JsonObject

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

the class AbstractWanAntiEntropyEventBase method toJson.

@Override
public JsonObject toJson() {
    JsonObject json = super.toJson();
    json.add("wanReplicationName", wanReplicationName);
    json.add("wanPublisherId", wanPublisherId);
    json.add("mapName", mapName);
    return json;
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject)

Example 25 with JsonObject

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

the class ConfigUpdateFailedEvent method toJson.

@Override
public JsonObject toJson() {
    JsonObject json = super.toJson();
    json.add("failureReason", failureReason.toString());
    json.add("exception", exception.getClass().getSimpleName());
    json.add("exceptionMessage", exception.getMessage());
    json.add("configUpdateResult", configUpdateResult.toJson());
    if (namespace != null) {
        json.add("configName", namespace.getConfigName() != null ? namespace.getConfigName() : "null");
        json.add("sectionName", namespace.getSectionName());
    }
    return json;
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject)

Aggregations

JsonObject (com.hazelcast.internal.json.JsonObject)151 Test (org.junit.Test)56 JsonArray (com.hazelcast.internal.json.JsonArray)41 QuickTest (com.hazelcast.test.annotation.QuickTest)38 JsonValue (com.hazelcast.internal.json.JsonValue)34 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)26 HazelcastJsonValue (com.hazelcast.core.HazelcastJsonValue)23 HazelcastInstance (com.hazelcast.core.HazelcastInstance)11 JsonUtil.getString (com.hazelcast.internal.util.JsonUtil.getString)10 SlowTest (com.hazelcast.test.annotation.SlowTest)9 HashMap (java.util.HashMap)8 CPMember (com.hazelcast.cp.CPMember)7 ArrayList (java.util.ArrayList)7 ConnectionResponse (com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse)6 NavigableJsonInputAdapter (com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter)6 JsonUtil.fromJsonObject (com.hazelcast.internal.util.JsonUtil.fromJsonObject)5 JsonUtil.toJsonObject (com.hazelcast.internal.util.JsonUtil.toJsonObject)5 Map (java.util.Map)5 ClusterService (com.hazelcast.internal.cluster.ClusterService)4 Address (com.hazelcast.cluster.Address)3