Search in sources :

Example 6 with CTSOperation

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));
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) TokenType(org.forgerock.openam.tokens.TokenType) Test(org.testng.annotations.Test)

Example 7 with CTSOperation

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));
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Test(org.testng.annotations.Test)

Example 8 with CTSOperation

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);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Test(org.testng.annotations.Test)

Example 9 with CTSOperation

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);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Test(org.testng.annotations.Test)

Example 10 with CTSOperation

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);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Test(org.testng.annotations.Test)

Aggregations

CTSOperation (org.forgerock.openam.cts.CTSOperation)47 Test (org.testng.annotations.Test)43 TokenType (org.forgerock.openam.tokens.TokenType)20 Token (org.forgerock.openam.cts.api.tokens.Token)2