Search in sources :

Example 1 with CTSOperation

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());
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) TokenType(org.forgerock.openam.tokens.TokenType)

Example 2 with CTSOperation

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());
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) TokenType(org.forgerock.openam.tokens.TokenType)

Example 3 with CTSOperation

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());
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) TokenType(org.forgerock.openam.tokens.TokenType)

Example 4 with CTSOperation

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);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Test(org.testng.annotations.Test)

Example 5 with CTSOperation

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);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Test(org.testng.annotations.Test)

Aggregations

CTSOperation (org.forgerock.openam.cts.CTSOperation)47 Test (org.testng.annotations.Test)43 TokenType (org.forgerock.openam.tokens.TokenType)20 Token (org.forgerock.openam.cts.api.tokens.Token)2