use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class OperationStoreTest method shouldAddOperationToExistingOperationStore.
@Test
public void shouldAddOperationToExistingOperationStore() {
//Given
CTSOperation operation = CTSOperation.CREATE;
OperationMonitor opRate = mock(OperationMonitor.class);
operationRate.put(CTSOperation.CREATE, opRate);
//When
operationStore.add(operation);
//Then
verifyZeroInteractions(operationRateFactory);
verify(opRate).increment();
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class OperationStoreTest method shouldAddOperation.
@Test
public void shouldAddOperation() {
//Given
CTSOperation operation = CTSOperation.CREATE;
OperationMonitor opRate = mock(OperationMonitor.class);
given(operationRateFactory.createOperationRate()).willReturn(opRate);
//When
operationStore.add(operation);
//Then
assertTrue(operationRate.containsKey(CTSOperation.CREATE));
verify(opRate).increment();
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldGetOperationsCumulativeCountForSpecificTokenType.
@Test
public void shouldGetOperationsCumulativeCountForSpecificTokenType() {
//Given
TokenType tokenType = TokenType.OAUTH;
CTSOperation operation = CTSOperation.CREATE;
OperationStore typeOperationStore = mock(OperationStore.class);
tokenOperations.put(TokenType.OAUTH, typeOperationStore);
given(typeOperationStore.getCount(operation)).willReturn(1L);
//When
long result = tokenOperationsStore.getOperationsCumulativeCount(tokenType, operation);
//Then
assertEquals(result, 1L);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldAddTokenOperation.
@Test
public void shouldAddTokenOperation() {
//Given
CTSOperation operation = CTSOperation.CREATE;
//When
tokenOperationsStore.addTokenOperation(operation, true);
//Then
verify(operationStore).add(operation);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldUpdateFailureCountOnFailure.
@Test
public void shouldUpdateFailureCountOnFailure() {
// Given
CTSOperation operation = CTSOperation.READ;
long originalFailureCount = tokenOperationsStore.getOperationFailuresCumulativeCount(operation);
// When
tokenOperationsStore.addTokenOperation(operation, false);
// Then
assertEquals(originalFailureCount + 1, tokenOperationsStore.getOperationFailuresCumulativeCount(operation));
}
Aggregations