Search in sources :

Example 1 with CoreTokenConfig

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

the class TokenStrategyFactoryTest method shouldReturnAttributeCompression.

@Test
public void shouldReturnAttributeCompression() {
    // Given
    CoreTokenConfig config = mock(CoreTokenConfig.class);
    given(config.isAttributeNamesCompressed()).willReturn(true);
    // When
    Collection<BlobStrategy> strategies = factory.getStrategies(config);
    // Then
    assertThat(strategies).contains(attributeCompression);
}
Also used : CoreTokenConfig(org.forgerock.openam.cts.CoreTokenConfig) Test(org.testng.annotations.Test)

Example 2 with CoreTokenConfig

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

the class TokenStrategyFactoryTest method shouldReturnAttributeCompressionBeforeGzipCompression.

@Test
public void shouldReturnAttributeCompressionBeforeGzipCompression() {
    // Given
    CoreTokenConfig config = mock(CoreTokenConfig.class);
    given(config.isAttributeNamesCompressed()).willReturn(true);
    given(config.isTokenCompressed()).willReturn(true);
    // When
    List<BlobStrategy> strategies = new ArrayList<BlobStrategy>(factory.getStrategies(config));
    // Then
    assertThat(strategies.get(0)).isEqualTo(attributeCompression);
    assertThat(strategies.get(1)).isEqualTo(compression);
}
Also used : CoreTokenConfig(org.forgerock.openam.cts.CoreTokenConfig) ArrayList(java.util.ArrayList) Test(org.testng.annotations.Test)

Example 3 with CoreTokenConfig

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

the class SessionAdapterTest method setup.

@BeforeMethod
public void setup() {
    tokenIdFactory = mock(TokenIdFactory.class);
    coreTokenConfig = mock(CoreTokenConfig.class);
    jsonSerialisation = mock(JSONSerialisation.class);
    blobUtils = new TokenBlobUtils();
    adapter = new SessionAdapter(tokenIdFactory, coreTokenConfig, jsonSerialisation, blobUtils);
}
Also used : CoreTokenConfig(org.forgerock.openam.cts.CoreTokenConfig) JSONSerialisation(org.forgerock.openam.cts.utils.JSONSerialisation) TokenIdFactory(org.forgerock.openam.cts.api.tokens.TokenIdFactory) TokenBlobUtils(org.forgerock.openam.cts.utils.blob.TokenBlobUtils) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with CoreTokenConfig

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

the class TokenStrategyFactoryTest method shouldReturnMultipleStrategies.

@Test
public void shouldReturnMultipleStrategies() {
    // Given
    CoreTokenConfig config = mock(CoreTokenConfig.class);
    given(config.isTokenEncrypted()).willReturn(true);
    given(config.isTokenCompressed()).willReturn(true);
    // When
    Collection<BlobStrategy> strategies = factory.getStrategies(config);
    // Then
    assertThat(strategies).contains(compression, encryption);
}
Also used : CoreTokenConfig(org.forgerock.openam.cts.CoreTokenConfig) Test(org.testng.annotations.Test)

Example 5 with CoreTokenConfig

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

the class TokenStrategyFactoryTest method shouldReturnEncryption.

@Test
public void shouldReturnEncryption() {
    // Given
    CoreTokenConfig config = mock(CoreTokenConfig.class);
    given(config.isTokenEncrypted()).willReturn(true);
    // When
    Collection<BlobStrategy> strategies = factory.getStrategies(config);
    // Then
    assertThat(strategies).contains(encryption);
}
Also used : CoreTokenConfig(org.forgerock.openam.cts.CoreTokenConfig) Test(org.testng.annotations.Test)

Aggregations

CoreTokenConfig (org.forgerock.openam.cts.CoreTokenConfig)6 Test (org.testng.annotations.Test)5 ArrayList (java.util.ArrayList)1 TokenIdFactory (org.forgerock.openam.cts.api.tokens.TokenIdFactory)1 JSONSerialisation (org.forgerock.openam.cts.utils.JSONSerialisation)1 TokenBlobUtils (org.forgerock.openam.cts.utils.blob.TokenBlobUtils)1 BeforeMethod (org.testng.annotations.BeforeMethod)1