Search in sources :

Example 16 with JsonObject

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

the class MapConfigDTO method toJson.

public JsonObject toJson() {
    JsonObject root = new JsonObject();
    root.add("name", config.getName());
    root.add("memoryFormat", config.getInMemoryFormat().toString());
    root.add("backupCount", config.getBackupCount());
    root.add("asyncBackupCount", config.getAsyncBackupCount());
    root.add("evictionPercentage", config.getEvictionPercentage());
    root.add("minEvictionCheckMillis", config.getMinEvictionCheckMillis());
    root.add("ttl", config.getTimeToLiveSeconds());
    root.add("maxIdle", config.getMaxIdleSeconds());
    root.add("maxSize", config.getMaxSizeConfig().getSize());
    root.add("maxSizePolicy", config.getMaxSizeConfig().getMaxSizePolicy().toString());
    root.add("readBackupData", config.isReadBackupData());
    root.add("evictionPolicy", config.getEvictionPolicy().name());
    root.add("mergePolicy", config.getMergePolicy());
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 17 with JsonObject

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

the class OperationServiceDTO method toJson.

@Override
public JsonObject toJson() {
    final JsonObject root = new JsonObject();
    root.add("responseQueueSize", responseQueueSize);
    root.add("operationExecutorQueueSize", operationExecutorQueueSize);
    root.add("runningOperationsCount", runningOperationsCount);
    root.add("remoteOperationCount", remoteOperationCount);
    root.add("executedOperationCount", executedOperationCount);
    root.add("operationThreadCount", operationThreadCount);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 18 with JsonObject

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

the class ProxyServiceDTO method toJson.

@Override
public JsonObject toJson() {
    final JsonObject root = new JsonObject();
    root.add("proxyCount", proxyCount);
    return root;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 19 with JsonObject

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

the class MemberPartitionStateImplTest method testSerialization.

@Test
public void testSerialization() {
    JsonObject serialized = memberPartitionState.toJson();
    MemberPartitionStateImpl deserialized = new MemberPartitionStateImpl();
    deserialized.fromJson(serialized);
    assertTrue(deserialized.isMemberStateSafe());
    assertEquals(125342, deserialized.getMigrationQueueSize());
    assertNotNull(deserialized.getPartitions());
    assertEquals(2, deserialized.getPartitions().size());
    assertNotNull(deserialized.toString());
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 20 with JsonObject

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

the class LocalMultiMapStatsImplTest method testSerialization.

@Test
public void testSerialization() {
    JsonObject serialized = localMapStats.toJson();
    LocalMultiMapStatsImpl deserialized = new LocalMultiMapStatsImpl();
    deserialized.fromJson(serialized);
    assertTrue(deserialized.getCreationTime() > 0);
    assertEquals(5, deserialized.getOwnedEntryCount());
    assertEquals(3, deserialized.getBackupEntryCount());
    assertEquals(4, deserialized.getBackupCount());
    assertEquals(1234, deserialized.getOwnedEntryMemoryCost());
    assertEquals(4321, deserialized.getBackupEntryMemoryCost());
    assertEquals(1231241512, deserialized.getLastAccessTime());
    assertEquals(1341412343, deserialized.getLastUpdateTime());
    assertEquals(12314, deserialized.getHits());
    assertEquals(1231, deserialized.getLockedEntryCount());
    assertEquals(4252, deserialized.getDirtyEntryCount());
    assertEquals(11, deserialized.total());
    assertEquals(2, deserialized.getPutOperationCount());
    assertEquals(3, deserialized.getGetOperationCount());
    assertEquals(1, deserialized.getRemoveOperationCount());
    assertEquals(5632, deserialized.getTotalPutLatency());
    assertEquals(1247, deserialized.getTotalGetLatency());
    assertEquals(1238, deserialized.getTotalRemoveLatency());
    assertEquals(5631, deserialized.getMaxPutLatency());
    assertEquals(1233, deserialized.getMaxGetLatency());
    assertEquals(1238, deserialized.getMaxRemoveLatency());
    assertEquals(5, deserialized.getOtherOperationCount());
    assertEquals(2, deserialized.getEventOperationCount());
    assertEquals(7461762, deserialized.getHeapCost());
    assertNotNull(deserialized.getNearCacheStats());
    assertNotNull(deserialized.toString());
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) 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