@Test public void testNormalizedStatusSnapshotDate() throws ParseException { final DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:SS.SSS", Locale.US); final Date date1 = df.parse("2014/01/01 00:00:00.000"); final Date date2 = df.parse("2014/01/01 00:04:59.999"); final Date date3 = df.parse("2014/01/01 00:05:00.000"); final Date date4 = df.parse("2014/01/01 00:05:00.001"); final Date normalized1 = StatusHistoryEndpointMerger.normalizeStatusSnapshotDate(date1, 300000); assertEquals(date1, normalized1); final Date normalized2 = StatusHistoryEndpointMerger.normalizeStatusSnapshotDate(date2, 300000); assertEquals(date1, normalized2); final Date normalized3 = StatusHistoryEndpointMerger.normalizeStatusSnapshotDate(date3, 300000); assertEquals(date3, normalized3); final Date normalized4 = StatusHistoryEndpointMerger.normalizeStatusSnapshotDate(date4, 300000); assertEquals(date3, normalized4); }
public static Date normalizeStatusSnapshotDate(final Date toNormalize, final long numMillis) { final long time = toNormalize.getTime(); return new Date(time - time % numMillis); }
StatusHistoryEndpointMerger implements EndpointResponseMerger { public static Date normalizeStatusSnapshotDate(final Date toNormalize, final long numMillis) { final long time = toNormalize.getTime(); return new Date(time - time % numMillis); } }
StatusHistoryEndpointMerger implements EndpointResponseMerger { public static Date normalizeStatusSnapshotDate(final Date toNormalize, final long numMillis) { final long time = toNormalize.getTime(); return new Date(time - time % numMillis); } StatusHistoryEndpointMerger(final long componentStatusSnapshotMillis); }
StatusHistoryEndpointMerger implements EndpointResponseMerger { public static Date normalizeStatusSnapshotDate(final Date toNormalize, final long numMillis) { final long time = toNormalize.getTime(); return new Date(time - time % numMillis); } StatusHistoryEndpointMerger(final long componentStatusSnapshotMillis); @Override boolean canHandle(URI uri, String method); @Override NodeResponse merge(URI uri, String method, Set<NodeResponse> successfulResponses, Set<NodeResponse> problematicResponses, NodeResponse clientResponse); static Date normalizeStatusSnapshotDate(final Date toNormalize, final long numMillis); }
StatusHistoryEndpointMerger implements EndpointResponseMerger { public static Date normalizeStatusSnapshotDate(final Date toNormalize, final long numMillis) { final long time = toNormalize.getTime(); return new Date(time - time % numMillis); } StatusHistoryEndpointMerger(final long componentStatusSnapshotMillis); @Override boolean canHandle(URI uri, String method); @Override NodeResponse merge(URI uri, String method, Set<NodeResponse> successfulResponses, Set<NodeResponse> problematicResponses, NodeResponse clientResponse); static Date normalizeStatusSnapshotDate(final Date toNormalize, final long numMillis); static final Pattern PROCESSOR_STATUS_HISTORY_URI_PATTERN; static final Pattern PROCESS_GROUP_STATUS_HISTORY_URI_PATTERN; static final Pattern REMOTE_PROCESS_GROUP_STATUS_HISTORY_URI_PATTERN; static final Pattern CONNECTION_STATUS_HISTORY_URI_PATTERN; }