use of org.forgerock.openam.cts.monitoring.TestCurrentMillis in project OpenAM by OpenRock.
the class OperationMonitorTest method recalculatingRateShouldNotBlockGetRateIfNotModifying.
@Test
public void recalculatingRateShouldNotBlockGetRateIfNotModifying() {
//Given
RateTimer timer = new TestCurrentMillis();
RateWindow rateWindow = new RateWindow(timer, 10, 1000L);
final OperationMonitor monitor = new OperationMonitor(timer, rateWindow);
//When
new Thread(new Runnable() {
public void run() {
monitor.increment();
}
}).start();
double rate = monitor.getAverageRate();
//Then
assertEquals(rate, 0D);
}
use of org.forgerock.openam.cts.monitoring.TestCurrentMillis in project OpenAM by OpenRock.
the class ConnectionsMonitorTest method recalculatingRateShouldNotBlockGetRateIfNotModifying.
@Test
public void recalculatingRateShouldNotBlockGetRateIfNotModifying() {
//Given
RateTimer timer = new TestCurrentMillis();
RateWindow rateWindow = new RateWindow(timer, 10, 1000L);
final ConnectionMonitor monitor = new ConnectionMonitor(timer, rateWindow);
//When
new Thread(new Runnable() {
public void run() {
monitor.add();
}
}).start();
double rate = monitor.getAverageRate();
//Then
assertEquals(rate, 0D);
}
Aggregations