Search in sources :

Example 1 with RedisOperationsSessionRepository

use of org.springframework.session.data.redis.RedisOperationsSessionRepository in project spring-boot by spring-projects.

the class SessionAutoConfigurationRedisTests method redisSessionStoreWithCustomizations.

@Test
public void redisSessionStoreWithCustomizations() {
    load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class), "spring.session.store-type=redis", "spring.session.redis.namespace=foo", "spring.session.redis.flush-mode=immediate");
    RedisOperationsSessionRepository repository = validateSessionRepository(RedisOperationsSessionRepository.class);
    assertThat(repository.getSessionCreatedChannelPrefix()).isEqualTo("spring:session:foo:event:created:");
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("redisFlushMode")).isEqualTo(RedisFlushMode.IMMEDIATE);
}
Also used : DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) RedisOperationsSessionRepository(org.springframework.session.data.redis.RedisOperationsSessionRepository) RedisAutoConfiguration(org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration) Test(org.junit.Test)

Example 2 with RedisOperationsSessionRepository

use of org.springframework.session.data.redis.RedisOperationsSessionRepository in project spring-boot by spring-projects.

the class SessionAutoConfigurationRedisTests method validateSpringSessionUsesRedis.

private void validateSpringSessionUsesRedis() {
    RedisOperationsSessionRepository repository = validateSessionRepository(RedisOperationsSessionRepository.class);
    assertThat(repository.getSessionCreatedChannelPrefix()).isEqualTo("spring:session:event:created:");
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("redisFlushMode")).isEqualTo(RedisFlushMode.ON_SAVE);
}
Also used : DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) RedisOperationsSessionRepository(org.springframework.session.data.redis.RedisOperationsSessionRepository)

Aggregations

DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)2 RedisOperationsSessionRepository (org.springframework.session.data.redis.RedisOperationsSessionRepository)2 Test (org.junit.Test)1 RedisAutoConfiguration (org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration)1