@Test public void isRecordStillValidTest() { assertFalse(islStatsService.isRecordStillValid(new LatencyRecord(1, 0))); long expiredTimestamp = Instant.now().minusSeconds(LATENCY_TIMEOUT * 2).toEpochMilli(); assertFalse(islStatsService.isRecordStillValid(new LatencyRecord(1, expiredTimestamp))); assertTrue(islStatsService.isRecordStillValid(new LatencyRecord(1, System.currentTimeMillis()))); long freshTimestamp = Instant.now().plusSeconds(LATENCY_TIMEOUT * 2).toEpochMilli(); assertTrue(islStatsService.isRecordStillValid(new LatencyRecord(1, freshTimestamp))); }
@VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); }
IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } }
IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } IslStatsService(IslStatsCarrier carrier, long latencyTimeout); }
IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } IslStatsService(IslStatsCarrier carrier, long latencyTimeout); void handleRoundTripLatencyMetric(long timestamp, IslRoundTripLatency data, Endpoint destination); void handleOneWayLatencyMetric(long timestamp, IslOneWayLatency data); void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification); }
IslStatsService { @VisibleForTesting boolean isRecordStillValid(LatencyRecord record) { Instant expirationTime = Instant.ofEpochMilli(record.getTimestamp()) .plusSeconds(latencyTimeout); return Instant.now().isBefore(expirationTime); } IslStatsService(IslStatsCarrier carrier, long latencyTimeout); void handleRoundTripLatencyMetric(long timestamp, IslRoundTripLatency data, Endpoint destination); void handleOneWayLatencyMetric(long timestamp, IslOneWayLatency data); void handleIstStatusUpdateNotification(IslStatusUpdateNotification notification);  }