Search in sources :

Example 6 with TokenType

use of org.forgerock.openam.tokens.TokenType 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 7 with TokenType

use of org.forgerock.openam.tokens.TokenType in project OpenAM by OpenRock.

the class TokenOperationsStoreTest method shouldAddTokenOperationForSpecificTokenTypeUsingDefaultOperationStoreFactory.

@Test
public void shouldAddTokenOperationForSpecificTokenTypeUsingDefaultOperationStoreFactory() {
    //Given
    TokenOperationsStore.OperationStoreFactory operationStoreFactory = new TokenOperationsStore.OperationStoreFactory();
    TokenOperationsStore localTokenOperationsStore = new TokenOperationsStore(operationStoreFactory, tokenOperations, operationStore, operationFailureStore);
    TokenType tokenType = TokenType.OAUTH;
    CTSOperation operation = CTSOperation.CREATE;
    //When
    localTokenOperationsStore.addTokenOperation(tokenType, operation, true);
    //Then
    assertTrue(tokenOperations.containsKey(TokenType.OAUTH));
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) TokenType(org.forgerock.openam.tokens.TokenType) Test(org.testng.annotations.Test)

Example 8 with TokenType

use of org.forgerock.openam.tokens.TokenType in project OpenAM by OpenRock.

the class CTSMonitoringStoreImplTest method shouldAddTokenOperationForSpecificTokenType.

@Test
public void shouldAddTokenOperationForSpecificTokenType() throws InterruptedException {
    //Given
    Token token = mock(Token.class);
    CTSOperation operation = CTSOperation.READ;
    TokenType tokenType = TokenType.OAUTH;
    boolean successful = true;
    given(token.getType()).willReturn(tokenType);
    //When
    ctsOperationsMonitoringStore.addTokenOperation(token, operation, successful);
    //Then
    verify(tokenOperationsStore).addTokenOperation(tokenType, operation, successful);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) TokenType(org.forgerock.openam.tokens.TokenType) Token(org.forgerock.openam.cts.api.tokens.Token) Test(org.testng.annotations.Test)

Example 9 with TokenType

use of org.forgerock.openam.tokens.TokenType in project OpenAM by OpenRock.

the class CTSMonitoringStoreImplTest method shouldGetMinimumOperationsPerPeriodForSpecificTokenType.

@Test
public void shouldGetMinimumOperationsPerPeriodForSpecificTokenType() {
    //Given
    TokenType tokenType = TokenType.OAUTH;
    CTSOperation operation = CTSOperation.READ;
    given(tokenOperationsStore.getMinimumOperationsPerPeriod(tokenType, operation)).willReturn(1L);
    //When
    long result = ctsOperationsMonitoringStore.getMinimumOperationsPerPeriod(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 10 with TokenType

use of org.forgerock.openam.tokens.TokenType in project OpenAM by OpenRock.

the class CTSMonitoringStoreImplTest method shouldGetMaximumOperationsPerPeriodForSpecificTokenType.

@Test
public void shouldGetMaximumOperationsPerPeriodForSpecificTokenType() {
    //Given
    TokenType tokenType = TokenType.OAUTH;
    CTSOperation operation = CTSOperation.READ;
    given(tokenOperationsStore.getMaximumOperationsPerPeriod(tokenType, operation)).willReturn(1L);
    //When
    long result = ctsOperationsMonitoringStore.getMaximumOperationsPerPeriod(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)

Aggregations

TokenType (org.forgerock.openam.tokens.TokenType)30 Test (org.testng.annotations.Test)22 CTSOperation (org.forgerock.openam.cts.CTSOperation)20 ArrayList (java.util.ArrayList)3 SnmpStatusException (com.sun.management.snmp.SnmpStatusException)2 Token (org.forgerock.openam.cts.api.tokens.Token)2 CoreTokenException (org.forgerock.openam.cts.exceptions.CoreTokenException)2 CoreTokenField (org.forgerock.openam.tokens.CoreTokenField)2 Calendar (java.util.Calendar)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Entry (org.forgerock.opendj.ldap.Entry)1 LinkedHashMapEntry (org.forgerock.opendj.ldap.LinkedHashMapEntry)1