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));
}
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);
}
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);
}
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);
}
use of org.forgerock.openam.tokens.TokenType in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method getMinimumOperationsPerPeriodForSpecificTokenTypeShouldReturnZeroIfTokenTypeNotSet.
@Test
public void getMinimumOperationsPerPeriodForSpecificTokenTypeShouldReturnZeroIfTokenTypeNotSet() {
//Given
TokenType tokenType = TokenType.OAUTH;
CTSOperation operation = CTSOperation.CREATE;
//When
long result = tokenOperationsStore.getMinimumOperationsPerPeriod(tokenType, operation);
//Then
assertEquals(result, 0L);
}
Aggregations