Search in sources :

Example 36 with JsonArray

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

the class ConfigUpdateResult method toJson.

public JsonObject toJson() {
    JsonObject json = new JsonObject();
    JsonArray addedConfigsAsJson = toJsonArray(addedConfigs);
    JsonArray ignoredConfigsAsJson = toJsonArray(ignoredConfigs);
    json.add("addedConfigs", addedConfigsAsJson);
    json.add("ignoredConfigs", ignoredConfigsAsJson);
    return json;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) JsonObject(com.hazelcast.internal.json.JsonObject)

Example 37 with JsonArray

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

the class ConfigUpdateResult method toJsonArray.

private JsonArray toJsonArray(Set<ConfigNamespace> configs) {
    JsonArray configsAsJson = new JsonArray();
    for (ConfigNamespace ns : configs) {
        JsonObject namespaceAsJson = new JsonObject();
        namespaceAsJson.add("sectionName", ns.getSectionName());
        namespaceAsJson.add("configName", ns.getConfigName());
        configsAsJson.add(namespaceAsJson);
    }
    return configsAsJson;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) ConfigNamespace(com.hazelcast.internal.config.ConfigNamespace) JsonObject(com.hazelcast.internal.json.JsonObject)

Example 38 with JsonArray

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

the class SlowOperationDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("operation", operation);
    root.add("stackTrace", stackTrace);
    root.add("totalInvocations", totalInvocations);
    JsonArray invocationArray = new JsonArray();
    for (SlowOperationInvocationDTO invocation : invocations) {
        JsonObject json = invocation.toJson();
        if (json != null) {
            invocationArray.add(json);
        }
    }
    root.add("invocations", invocationArray);
    return root;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) JsonObject(com.hazelcast.internal.json.JsonObject)

Example 39 with JsonArray

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

the class TimedMemberState method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("master", master);
    root.add("time", time);
    root.add("clusterName", clusterName);
    if (memberList != null) {
        JsonArray members = new JsonArray();
        for (String member : memberList) {
            members.add(member);
        }
        root.add("memberList", members);
    }
    root.add("memberState", memberState.toJson());
    root.add("sslEnabled", sslEnabled);
    root.add("lite", lite);
    root.add("socketInterceptorEnabled", socketInterceptorEnabled);
    root.add("scriptingEnabled", scriptingEnabled);
    root.add("consoleEnabled", consoleEnabled);
    root.add("mcDataAccessEnabled", mcDataAccessEnabled);
    return root;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) JsonObject(com.hazelcast.internal.json.JsonObject) JsonUtil.getString(com.hazelcast.internal.util.JsonUtil.getString)

Example 40 with JsonArray

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

the class TimedMemberState method fromJson.

@Override
public void fromJson(JsonObject json) {
    time = getLong(json, "time");
    master = getBoolean(json, "master");
    clusterName = getString(json, "clusterName");
    JsonArray jsonMemberList = getArray(json, "memberList");
    memberList = new ArrayList<String>(jsonMemberList.size());
    for (JsonValue member : jsonMemberList.values()) {
        memberList.add(member.asString());
    }
    JsonObject jsonMemberState = getObject(json, "memberState");
    memberState = new MemberStateImpl();
    memberState.fromJson(jsonMemberState);
    sslEnabled = getBoolean(json, "sslEnabled", false);
    lite = getBoolean(json, "lite");
    socketInterceptorEnabled = getBoolean(json, "socketInterceptorEnabled");
    scriptingEnabled = getBoolean(json, "scriptingEnabled");
    consoleEnabled = getBoolean(json, "consoleEnabled");
    mcDataAccessEnabled = getBoolean(json, "mcDataAccessEnabled");
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) MemberStateImpl(com.hazelcast.internal.monitor.impl.MemberStateImpl) JsonValue(com.hazelcast.internal.json.JsonValue) JsonObject(com.hazelcast.internal.json.JsonObject) JsonUtil.getString(com.hazelcast.internal.util.JsonUtil.getString)

Aggregations

JsonArray (com.hazelcast.internal.json.JsonArray)74 JsonObject (com.hazelcast.internal.json.JsonObject)42 Test (org.junit.Test)39 QuickTest (com.hazelcast.test.annotation.QuickTest)31 JsonValue (com.hazelcast.internal.json.JsonValue)28 HazelcastJsonValue (com.hazelcast.core.HazelcastJsonValue)10 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)10 CPMember (com.hazelcast.cp.CPMember)7 JsonUtil.getString (com.hazelcast.internal.util.JsonUtil.getString)7 SlowTest (com.hazelcast.test.annotation.SlowTest)7 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 ConnectionResponse (com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)4 Address (com.hazelcast.cluster.Address)3 JetException (com.hazelcast.jet.JetException)3 InputStreamReader (java.io.InputStreamReader)3 Collection (java.util.Collection)3 Map (java.util.Map)3 Request (org.elasticsearch.client.Request)3