use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldGetMaximumOperationsPerPeriod.
@Test
public void shouldGetMaximumOperationsPerPeriod() {
//Given
CTSOperation operation = CTSOperation.CREATE;
given(operationStore.getMaxRate(operation)).willReturn(1L);
//When
long result = tokenOperationsStore.getMaximumOperationsPerPeriod(operation);
//Then
assertEquals(result, 1L);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldGetMinimumOperationsPerPeriodForSpecificTokenType.
@Test
public void shouldGetMinimumOperationsPerPeriodForSpecificTokenType() {
//Given
TokenType tokenType = TokenType.OAUTH;
CTSOperation operation = CTSOperation.CREATE;
OperationStore typeOperationStore = mock(OperationStore.class);
tokenOperations.put(TokenType.OAUTH, typeOperationStore);
given(typeOperationStore.getMinRate(operation)).willReturn(1L);
//When
long result = tokenOperationsStore.getMinimumOperationsPerPeriod(tokenType, operation);
//Then
assertEquals(result, 1L);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldAddTokenOperationForSpecificTokenTypeToExistingOperationStore.
@Test
public void shouldAddTokenOperationForSpecificTokenTypeToExistingOperationStore() {
//Given
TokenType tokenType = TokenType.OAUTH;
CTSOperation operation = CTSOperation.CREATE;
OperationStore typeOperationStore = mock(OperationStore.class);
tokenOperations.put(TokenType.OAUTH, typeOperationStore);
//When
tokenOperationsStore.addTokenOperation(tokenType, operation, true);
//Then
verifyZeroInteractions(operationStoreFactory);
verify(typeOperationStore).add(operation);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldAddTokenOperationForSpecificTokenType.
@Test
public void shouldAddTokenOperationForSpecificTokenType() {
//Given
TokenType tokenType = TokenType.OAUTH;
CTSOperation operation = CTSOperation.CREATE;
OperationStore typeOperationStore = mock(OperationStore.class);
given(operationStoreFactory.createOperationStore()).willReturn(typeOperationStore);
//When
tokenOperationsStore.addTokenOperation(tokenType, operation, true);
//Then
assertTrue(tokenOperations.containsKey(TokenType.OAUTH));
verify(typeOperationStore).add(operation);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldGetOperationsCumulativeCount.
@Test
public void shouldGetOperationsCumulativeCount() {
//Given
CTSOperation operation = CTSOperation.CREATE;
given(operationStore.getCount(operation)).willReturn(1L);
//When
long result = tokenOperationsStore.getOperationsCumulativeCount(operation);
//Then
assertEquals(result, 1L);
}
Aggregations