use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class GetCacheEntryRequestTest method testGetCacheEntry.
@Test
public void testGetCacheEntry() throws Exception {
GetCacheEntryRequest request = new GetCacheEntryRequest("string", "test", "1");
ICacheManager hazelcastCacheManager = hz.getCacheManager();
ICache<String, String> cache = hazelcastCacheManager.getCache("test");
cache.put("1", "one");
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
assertEquals("one", result.get("cacheBrowse_value").asString());
}
use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class GetClusterStateRequestTest method testGetClusterState.
@Test
public void testGetClusterState() throws Exception {
GetClusterStateRequest request = new GetClusterStateRequest();
ClusterState clusterState = cluster.getClusterState();
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
assertEquals(clusterState.name(), request.readResponse(result));
}
use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class ThreadDumpRequestTest method testThreadDumpRequest.
@Test
public void testThreadDumpRequest() throws Exception {
ThreadDumpRequest request = new ThreadDumpRequest(false);
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
assertNotNull(request.readResponse(result));
}
use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class TriggerPartialStartRequestTest method triggerPartialStart.
public static String triggerPartialStart(HazelcastInstance hz) throws Exception {
ManagementCenterService managementCenterService = getNode(hz).getManagementCenterService();
ConsoleRequest request = new TriggerPartialStartRequest();
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
return String.valueOf(request.readResponse(jsonObject));
}
use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.
the class WanPublisherConfigDTOTest method testSerialization.
@Test
public void testSerialization() {
Map<String, Comparable> properties = new HashMap<String, Comparable>();
properties.put("key1", "value1");
properties.put("key2", "value2");
WanPublisherConfig expected = new WanPublisherConfig().setGroupName("myGroupName").setQueueCapacity(23).setClassName("myClassName").setQueueFullBehavior(WANQueueFullBehavior.THROW_EXCEPTION).setProperties(properties);
WanPublisherConfigDTO dto = new WanPublisherConfigDTO(expected);
JsonObject json = dto.toJson();
WanPublisherConfigDTO deserialized = new WanPublisherConfigDTO(null);
deserialized.fromJson(json);
WanPublisherConfig actual = deserialized.getConfig();
assertEquals(expected.getGroupName(), actual.getGroupName());
assertEquals(expected.getQueueCapacity(), actual.getQueueCapacity());
assertEquals(expected.getClassName(), actual.getClassName());
assertEquals(expected.getQueueFullBehavior(), actual.getQueueFullBehavior());
assertEquals(expected.getProperties(), actual.getProperties());
}
Aggregations