Search in sources :

Example 11 with CTSOperation

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

Example 12 with CTSOperation

use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.

the class CTSMonitoringStoreImplTest method shouldGetMaximumOperationsPerPeriod.

@Test
public void shouldGetMaximumOperationsPerPeriod() {
    //Given
    CTSOperation operation = CTSOperation.READ;
    given(tokenOperationsStore.getMaximumOperationsPerPeriod(operation)).willReturn(1L);
    //When
    long result = ctsOperationsMonitoringStore.getMaximumOperationsPerPeriod(null, operation);
    //Then
    assertEquals(result, 1);
}
Also used : CTSOperation(org.forgerock.openam.cts.CTSOperation) Test(org.testng.annotations.Test)

Example 13 with CTSOperation

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

Example 14 with CTSOperation

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

Example 15 with CTSOperation

use of org.forgerock.openam.cts.CTSOperation in project OpenAM by OpenRock.

the class CTSMonitoringStoreImplTest method shouldGetAverageOperationsPerPeriod.

@Test
public void shouldGetAverageOperationsPerPeriod() {
    //Given
    CTSOperation operation = CTSOperation.READ;
    given(tokenOperationsStore.getAverageOperationsPerPeriod(operation)).willReturn(1D);
    //When
    double result = ctsOperationsMonitoringStore.getAverageOperationsPerPeriod(null, operation);
    //Then
    assertEquals(result, 1D);
}
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