Search in sources :

Example 26 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 27 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 28 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 29 with CTSOperation

use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.

the class CTSMonitoringStoreImplTest method shouldGetOperationsCumulativeCountForSpecificTokenType.

@Test
public void shouldGetOperationsCumulativeCountForSpecificTokenType() {
    //Given
    TokenType tokenType = TokenType.OAUTH;
    CTSOperation operation = CTSOperation.READ;
    given(tokenOperationsStore.getOperationsCumulativeCount(tokenType, operation)).willReturn(1L);
    //When
    long result = ctsOperationsMonitoringStore.getOperationsCumulativeCount(tokenType, operation);
    //Then
    assertEquals(result, 1);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) TokenType(org.forgerock.openam.tokens.TokenType) Test(org.testng.annotations.Test)

Example 30 with CTSOperation

use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.

the class CTSMonitoringStoreImplTest method shouldNotAddTokenOperationForSpecificTokenTypeIfTokenIsNull.

@Test
public void shouldNotAddTokenOperationForSpecificTokenTypeIfTokenIsNull() throws InterruptedException {
    //Given
    Token token = null;
    CTSOperation operation = CTSOperation.READ;
    boolean successful = true;
    //When
    ctsOperationsMonitoringStore.addTokenOperation(token, operation, successful);
    //Then
    verify(tokenOperationsStore, never()).addTokenOperation(Matchers.<TokenType>anyObject(), eq(operation), eq(successful));
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Token(org.forgerock.openam.cts.api.tokens.Token) 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