use of org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository in project spring-session by spring-projects.
the class IndexDocTests method newReactiveRedisOperationsSessionRepository.
@Test
@SuppressWarnings("unused")
public void newReactiveRedisOperationsSessionRepository() {
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory();
RedisSerializationContext<String, Object> serializationContext = RedisSerializationContext.<String, Object>newSerializationContext(new JdkSerializationRedisSerializer()).build();
// tag::new-reactiveredisoperationssessionrepository[]
// ... create and configure connectionFactory and serializationContext ...
ReactiveRedisTemplate<String, Object> redisTemplate = new ReactiveRedisTemplate<>(connectionFactory, serializationContext);
ReactiveSessionRepository<? extends Session> repository = new ReactiveRedisOperationsSessionRepository(redisTemplate);
// end::new-reactiveredisoperationssessionrepository[]
}
use of org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository in project spring-session by spring-projects.
the class RedisWebSessionConfigurationTests method qualifiedAndPrimaryConnectionFactoryRedisConfig.
@Test
public void qualifiedAndPrimaryConnectionFactoryRedisConfig() {
registerAndRefresh(RedisConfig.class, QualifiedAndPrimaryConnectionFactoryRedisConfig.class);
ReactiveRedisOperationsSessionRepository repository = this.context.getBean(ReactiveRedisOperationsSessionRepository.class);
ReactiveRedisConnectionFactory redisConnectionFactory = this.context.getBean("qualifiedRedisConnectionFactory", ReactiveRedisConnectionFactory.class);
assertThat(repository).isNotNull();
assertThat(redisConnectionFactory).isNotNull();
ReactiveRedisOperations redisOperations = (ReactiveRedisOperations) ReflectionTestUtils.getField(repository, "sessionRedisOperations");
assertThat(redisOperations).isNotNull();
assertThat(ReflectionTestUtils.getField(redisOperations, "connectionFactory")).isEqualTo(redisConnectionFactory);
}
use of org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository in project spring-session by spring-projects.
the class RedisWebSessionConfigurationTests method defaultConfiguration.
@Test
public void defaultConfiguration() {
registerAndRefresh(RedisConfig.class, DefaultConfig.class);
ReactiveRedisOperationsSessionRepository repository = this.context.getBean(ReactiveRedisOperationsSessionRepository.class);
assertThat(repository).isNotNull();
}
use of org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository in project spring-session by spring-projects.
the class RedisWebSessionConfigurationTests method namedConnectionFactoryRedisConfig.
@Test
public void namedConnectionFactoryRedisConfig() {
registerAndRefresh(RedisConfig.class, NamedConnectionFactoryRedisConfig.class);
ReactiveRedisOperationsSessionRepository repository = this.context.getBean(ReactiveRedisOperationsSessionRepository.class);
ReactiveRedisConnectionFactory redisConnectionFactory = this.context.getBean("redisConnectionFactory", ReactiveRedisConnectionFactory.class);
assertThat(repository).isNotNull();
assertThat(redisConnectionFactory).isNotNull();
ReactiveRedisOperations redisOperations = (ReactiveRedisOperations) ReflectionTestUtils.getField(repository, "sessionRedisOperations");
assertThat(redisOperations).isNotNull();
assertThat(ReflectionTestUtils.getField(redisOperations, "connectionFactory")).isEqualTo(redisConnectionFactory);
}
use of org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository in project spring-session by spring-projects.
the class RedisWebSessionConfigurationTests method customFlushMode.
@Test
public void customFlushMode() {
registerAndRefresh(RedisConfig.class, CustomFlushModeConfig.class);
ReactiveRedisOperationsSessionRepository repository = this.context.getBean(ReactiveRedisOperationsSessionRepository.class);
assertThat(repository).isNotNull();
assertThat(ReflectionTestUtils.getField(repository, "redisFlushMode")).isEqualTo(RedisFlushMode.IMMEDIATE);
}
Aggregations