ConflictMetricListener extends AbstractMetricListener<CrdtConflictCheckContext> implements ConflictCheckListener, BiDirectionSupport { @Override public void onAction(CrdtConflictCheckContext context) { CrdtConflictStats conflictStats = context.getResult(); long recvTimeMilli = context.getRecvTimeMilli(); RedisInstanceInfo info = context.instance().getRedisInstanceInfo(); doConflictMetric(METRIC_TYPE_CONFLICT, conflictStats.getTypeConflict(), recvTimeMilli, info); doConflictMetric(METRIC_NON_TYPE_CONFLICT, conflictStats.getNonTypeConflict(), recvTimeMilli, info); doConflictMetric(METRIC_MODIFY_CONFLICT, conflictStats.getModifyConflict(), recvTimeMilli, info); doConflictMetric(METRIC_MERGE_CONFLICT, conflictStats.getMergeConflict(), recvTimeMilli, info); doConflictMetric(METRIC_SET_CONFLICT, conflictStats.getSetConflict(), recvTimeMilli, info); doConflictMetric(METRIC_DEL_CONFLICT, conflictStats.getDelConflict(), recvTimeMilli, info); doConflictMetric(METRIC_SET_DEL_CONFLICT, conflictStats.getSetDelConflict(), recvTimeMilli, info); }  @Override void onAction(CrdtConflictCheckContext context);  }
@Test public void testOnActionWithOldStats() throws Exception { listener.onAction(context); Assert.assertTrue(listener.worksfor(context)); Mockito.verify(proxy, Mockito.times(4)).writeBinMultiDataPoint(Mockito.any()); }
@Test public void testOnAction() throws Exception { stats = new CrdtConflictStats(Math.abs(randomInt()), Math.abs(randomInt()), Math.abs(randomInt()), Math.abs(randomInt()), Math.abs(randomInt()), Math.abs(randomInt())); context = new CrdtConflictCheckContext(instance, stats); listener.onAction(context); Assert.assertTrue(listener.worksfor(context)); Mockito.verify(proxy, Mockito.times(7)).writeBinMultiDataPoint(Mockito.any()); }