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);
}
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();
}
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();
}
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();
}
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());
}
Aggregations