use of org.forgerock.openam.cts.CTSOperation 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.cts.CTSOperation in project OpenAM by OpenRock.
the class TokenOperationsStoreTest method shouldNotUpdateFailureCountOnSuccess.
@Test
public void shouldNotUpdateFailureCountOnSuccess() {
// Given
CTSOperation operation = CTSOperation.READ;
long originalFailureCount = tokenOperationsStore.getOperationFailuresCumulativeCount(operation);
// When
tokenOperationsStore.addTokenOperation(operation, true);
// Then
assertEquals(originalFailureCount, tokenOperationsStore.getOperationFailuresCumulativeCount(operation));
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class CTSMonitoringStoreImplTest method shouldGetOperationsCumulativeCount.
@Test
public void shouldGetOperationsCumulativeCount() {
//Given
CTSOperation operation = CTSOperation.READ;
given(tokenOperationsStore.getOperationsCumulativeCount(operation)).willReturn(1L);
//When
long result = ctsOperationsMonitoringStore.getOperationsCumulativeCount(null, operation);
//Then
assertEquals(result, 1);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class CTSMonitoringStoreImplTest method shouldAddTokenOperation.
@Test
public void shouldAddTokenOperation() throws InterruptedException {
//Given
CTSOperation operation = CTSOperation.READ;
boolean successful = true;
//When
ctsOperationsMonitoringStore.addTokenOperation(null, operation, successful);
//Then
verify(tokenOperationsStore).addTokenOperation(operation, successful);
}
use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.
the class CTSMonitoringStoreImplTest method shouldGetMinimumOperationsPerPeriod.
@Test
public void shouldGetMinimumOperationsPerPeriod() {
//Given
CTSOperation operation = CTSOperation.READ;
given(tokenOperationsStore.getMinimumOperationsPerPeriod(operation)).willReturn(1L);
//When
long result = ctsOperationsMonitoringStore.getMinimumOperationsPerPeriod(null, operation);
//Then
assertEquals(result, 1);
}
Aggregations