Search in sources :

Example 66 with JsonObject

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

the class Mocking_Test method mockObject.

@Test
public void mockObject() {
    JsonObject jsonObject = Mockito.mock(JsonObject.class);
    assertNotNull(jsonObject);
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 67 with JsonObject

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

the class WanSyncConfigDTOTest method cloneThroughJson.

private WanSyncConfig cloneThroughJson(WanSyncConfig expected) {
    WanSyncConfigDTO dto = new WanSyncConfigDTO(expected);
    JsonObject json = dto.toJson();
    WanSyncConfigDTO deserialized = new WanSyncConfigDTO(null);
    deserialized.fromJson(json);
    return deserialized.getConfig();
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject)

Example 68 with JsonObject

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

the class DiscoveryConfigDTOTest method cloneThroughJson.

private DiscoveryConfig cloneThroughJson(DiscoveryConfig expected) {
    DiscoveryConfigDTO dto = new DiscoveryConfigDTO(expected);
    JsonObject json = dto.toJson();
    DiscoveryConfigDTO deserialized = new DiscoveryConfigDTO(null);
    deserialized.fromJson(json);
    return deserialized.getConfig();
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject)

Example 69 with JsonObject

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

the class WanReplicationConfigDTOTest method cloneThroughJson.

private WanReplicationConfig cloneThroughJson(WanReplicationConfig expectedConfig) {
    WanReplicationConfigDTO dto = new WanReplicationConfigDTO(expectedConfig);
    JsonObject json = dto.toJson();
    WanReplicationConfigDTO deserialized = new WanReplicationConfigDTO(null);
    deserialized.fromJson(json);
    return deserialized.getConfig();
}
Also used : JsonObject(com.hazelcast.internal.json.JsonObject)

Example 70 with JsonObject

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

the class LocalWanStatsImplTest method testSerialization.

@Test
public void testSerialization() {
    LocalWanPublisherStatsImpl tokyo = new LocalWanPublisherStatsImpl();
    tokyo.setConnected(true);
    tokyo.incrementPublishedEventCount(10);
    tokyo.setOutboundQueueSize(100);
    tokyo.setState(WanPublisherState.REPLICATING);
    LocalWanPublisherStatsImpl singapore = new LocalWanPublisherStatsImpl();
    singapore.setConnected(true);
    singapore.setOutboundQueueSize(200);
    singapore.incrementPublishedEventCount(20);
    singapore.setState(WanPublisherState.REPLICATING);
    LocalWanStatsImpl localWanStats = new LocalWanStatsImpl();
    Map<String, LocalWanPublisherStats> localWanPublisherStatsMap = new HashMap<String, LocalWanPublisherStats>();
    localWanPublisherStatsMap.put("tokyo", tokyo);
    localWanPublisherStatsMap.put("singapore", singapore);
    localWanStats.setLocalPublisherStatsMap(localWanPublisherStatsMap);
    JsonObject serialized = localWanStats.toJson();
    LocalWanStats deserialized = new LocalWanStatsImpl();
    ((JsonSerializable) deserialized).fromJson(serialized);
    LocalWanPublisherStats deserializedTokyo = deserialized.getLocalWanPublisherStats().get("tokyo");
    LocalWanPublisherStats deserializedSingapore = deserialized.getLocalWanPublisherStats().get("singapore");
    assertEquals(tokyo.isConnected(), deserializedTokyo.isConnected());
    assertEquals(tokyo.getPublisherState(), deserializedTokyo.getPublisherState());
    assertEquals(singapore.isConnected(), deserializedSingapore.isConnected());
    assertEquals(singapore.getPublisherState(), deserializedSingapore.getPublisherState());
}
Also used : LocalWanPublisherStats(com.hazelcast.internal.monitor.LocalWanPublisherStats) HashMap(java.util.HashMap) LocalWanStats(com.hazelcast.internal.monitor.LocalWanStats) JsonSerializable(com.hazelcast.json.internal.JsonSerializable) JsonObject(com.hazelcast.internal.json.JsonObject) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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