use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class CtsCRUDOperationsPerTokenTypeEntryImpl method getDCumulativeCount.
/**
* Gets the cumulative count for the specified CTS operation, on the specified Token type.
*
* @return The operations cumulative count.
*/
@Override
public Long getDCumulativeCount() throws SnmpStatusException {
final TokenType tokenType = getTokenType();
final CTSOperation operation = getCTSOperation();
if (tokenType == null || operation == null) {
throw new InvalidSNMPQueryException();
}
return monitoringStore.getOperationsCumulativeCount(getTokenType(), getCTSOperation());
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class CtsCRUDOperationsPerTokenTypeEntryImpl method getDMaximum.
/**
* Gets the maximum rate that the specified CTS operation, on the specified Token type has been made on the CTS.
*
* @return The maximum rate.
*/
@Override
public Long getDMaximum() throws SnmpStatusException {
final TokenType tokenType = getTokenType();
final CTSOperation operation = getCTSOperation();
if (tokenType == null || operation == null) {
throw new InvalidSNMPQueryException();
}
return monitoringStore.getMaximumOperationsPerPeriod(getTokenType(), getCTSOperation());
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class CtsCRUDOperationsPerTokenTypeEntryImpl method getDMinimum.
/**
* Gets the minimum rate that the specified CTS operation, on the specified Token type has been made on the CTS.
*
* @return The minimum rate.
*/
@Override
public Long getDMinimum() throws SnmpStatusException {
final TokenType tokenType = getTokenType();
final CTSOperation operation = getCTSOperation();
if (tokenType == null || operation == null) {
throw new InvalidSNMPQueryException();
}
return monitoringStore.getMinimumOperationsPerPeriod(getTokenType(), getCTSOperation());
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class OperationStoreTest method getMinimumRateShouldReturnZeroIfOperationNotSet.
@Test
public void getMinimumRateShouldReturnZeroIfOperationNotSet() {
//Given
CTSOperation operation = CTSOperation.CREATE;
//When
long result = operationStore.getMinRate(operation);
//Then
assertEquals(result, 0L);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class OperationStoreTest method shouldGetCount.
@Test
public void shouldGetCount() {
//Given
CTSOperation operation = CTSOperation.CREATE;
OperationMonitor opRate = mock(OperationMonitor.class);
operationRate.put(operation, opRate);
given(opRate.getCount()).willReturn(1L);
//When
long result = operationStore.getCount(operation);
//Then
assertEquals(result, 1L);
}
Aggregations