use of com.hazelcast.internal.management.dto.SlowOperationDTO in project hazelcast by hazelcast.
the class LocalOperationStatsImplTest method testSerialization.
@Test
public void testSerialization() {
Config config = new Config();
config.setProperty(GroupProperty.MC_MAX_VISIBLE_SLOW_OPERATION_COUNT.getName(), "127");
SlowOperationInvocationDTO slowOperationInvocationDTO = new SlowOperationInvocationDTO();
slowOperationInvocationDTO.id = 12345;
slowOperationInvocationDTO.durationMs = 15000;
slowOperationInvocationDTO.startedAt = 12381912;
slowOperationInvocationDTO.operationDetails = "TestOperationDetails";
List<SlowOperationInvocationDTO> invocationList = new ArrayList<SlowOperationInvocationDTO>();
invocationList.add(slowOperationInvocationDTO);
SlowOperationDTO slowOperationDTO = new SlowOperationDTO();
slowOperationDTO.operation = "TestOperation";
slowOperationDTO.stackTrace = "stackTrace";
slowOperationDTO.totalInvocations = 4;
slowOperationDTO.invocations = invocationList;
HazelcastInstance hazelcastInstance = createHazelcastInstance(config);
Node node = getNode(hazelcastInstance);
LocalOperationStatsImpl localOperationStats = new LocalOperationStatsImpl(node);
localOperationStats.getSlowOperations().add(slowOperationDTO);
LocalOperationStatsImpl deserialized = new LocalOperationStatsImpl();
deserialized.fromJson(localOperationStats.toJson());
assertEquals(localOperationStats.getCreationTime(), deserialized.getCreationTime());
assertEquals(localOperationStats.getMaxVisibleSlowOperationCount(), deserialized.getMaxVisibleSlowOperationCount());
assertEqualsSlowOperationDTOs(localOperationStats.getSlowOperations(), deserialized.getSlowOperations());
}
Aggregations