use of org.forgerock.openam.shared.monitoring.RateTimer in project OpenAM by OpenRock.
the class OperationMonitorTest method setUp.
@BeforeMethod
public void setUp() {
RateTimer timer = mock(RateTimer.class);
rateWindow = mock(RateWindow.class);
operationMonitor = new OperationMonitor(timer, rateWindow);
}
use of org.forgerock.openam.shared.monitoring.RateTimer 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.shared.monitoring.RateTimer in project OpenAM by OpenRock.
the class ConnectionsMonitorTest method setUp.
@BeforeMethod
public void setUp() {
RateTimer timer = mock(RateTimer.class);
rateWindow = mock(RateWindow.class);
connectionMonitor = new ConnectionMonitor(timer, rateWindow);
}
use of org.forgerock.openam.shared.monitoring.RateTimer 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