Search in sources :

Example 11 with JsonObject

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

the class KubernetesClient method parsePodsList.

private static List<Endpoint> parsePodsList(JsonObject podsListJson) {
    List<Endpoint> addresses = new ArrayList<>();
    for (JsonValue item : toJsonArray(podsListJson.get("items"))) {
        JsonObject status = item.asObject().get("status").asObject();
        String ip = toString(status.get("podIP"));
        if (ip != null) {
            Integer port = extractContainerPort(item);
            addresses.add(new Endpoint(new EndpointAddress(ip, port), isReady(status)));
        }
    }
    return addresses;
}
Also used : ArrayList(java.util.ArrayList) JsonValue(com.hazelcast.internal.json.JsonValue) JsonObject(com.hazelcast.internal.json.JsonObject)

Example 12 with JsonObject

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

the class WanSyncProgressUpdateEvent method toJson.

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

Example 13 with JsonObject

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

the class ClientEndPointDTO method toJson.

@Override
public JsonObject toJson() {
    final JsonObject root = Json.object();
    root.add("uuid", uuid.toString());
    root.add("address", address);
    root.add("clientType", clientType);
    root.add("name", name);
    JsonArray labelsObject = Json.array();
    for (String label : labels) {
        labelsObject.add(label);
    }
    root.add("labels", labelsObject);
    root.add("ipAddress", ipAddress);
    root.add("canonicalHostName", canonicalHostName);
    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 14 with JsonObject

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

the class CustomWanPublisherConfigDTO method toJson.

@Override
@SuppressWarnings({ "checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity" })
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("publisherId", config.getPublisherId());
    root.add("className", config.getClassName());
    if (!isNullOrEmpty(config.getProperties())) {
        root.add("properties", toJsonObject(config.getProperties()));
    }
    return root;
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject) JsonUtil.fromJsonObject(com.hazelcast.internal.util.JsonUtil.fromJsonObject) JsonUtil.toJsonObject(com.hazelcast.internal.util.JsonUtil.toJsonObject)

Example 15 with JsonObject

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

the class WanReplicationConfigDTO method toJson.

@Override
public JsonObject toJson() {
    JsonObject root = new JsonObject();
    if (config.getName() != null) {
        root.add("name", config.getName());
    }
    JsonArray batchPublishers = new JsonArray();
    JsonArray customPublishers = new JsonArray();
    for (WanBatchPublisherConfig publisherConfig : config.getBatchPublisherConfigs()) {
        batchPublishers.add(new WanBatchPublisherConfigDTO(publisherConfig).toJson());
    }
    for (WanCustomPublisherConfig publisherConfig : config.getCustomPublisherConfigs()) {
        customPublishers.add(new CustomWanPublisherConfigDTO(publisherConfig).toJson());
    }
    root.add("batchPublishers", batchPublishers);
    root.add("customPublishers", customPublishers);
    WanConsumerConfig consumerConfig = config.getConsumerConfig();
    if (consumerConfig != null) {
        root.add("consumer", new WanConsumerConfigDTO(consumerConfig).toJson());
    }
    return root;
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) 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