use of org.springframework.session.hazelcast.HazelcastIndexedSessionRepository in project spring-boot by spring-projects.
the class SessionAutoConfigurationHazelcastTests method customSaveMode.
@Test
void customSaveMode() {
this.contextRunner.withPropertyValues("spring.session.store-type=hazelcast", "spring.session.hazelcast.save-mode=on-get-attribute").run((context) -> {
HazelcastIndexedSessionRepository repository = validateSessionRepository(context, HazelcastIndexedSessionRepository.class);
assertThat(repository).hasFieldOrPropertyWithValue("saveMode", SaveMode.ON_GET_ATTRIBUTE);
});
}
use of org.springframework.session.hazelcast.HazelcastIndexedSessionRepository in project spring-boot by spring-projects.
the class SessionAutoConfigurationHazelcastTests method customFlushMode.
@Test
void customFlushMode() {
this.contextRunner.withPropertyValues("spring.session.store-type=hazelcast", "spring.session.hazelcast.flush-mode=immediate").run((context) -> {
HazelcastIndexedSessionRepository repository = validateSessionRepository(context, HazelcastIndexedSessionRepository.class);
assertThat(repository).hasFieldOrPropertyWithValue("flushMode", FlushMode.IMMEDIATE);
});
}
use of org.springframework.session.hazelcast.HazelcastIndexedSessionRepository in project spring-boot by spring-projects.
the class SessionAutoConfigurationHazelcastTests method validateDefaultConfig.
private void validateDefaultConfig(AssertableWebApplicationContext context) {
HazelcastIndexedSessionRepository repository = validateSessionRepository(context, HazelcastIndexedSessionRepository.class);
assertThat(repository).hasFieldOrPropertyWithValue("defaultMaxInactiveInterval", (int) new ServerProperties().getServlet().getSession().getTimeout().getSeconds());
HazelcastInstance hazelcastInstance = context.getBean(HazelcastInstance.class);
then(hazelcastInstance).should().getMap("spring:session:sessions");
}
use of org.springframework.session.hazelcast.HazelcastIndexedSessionRepository in project spring-boot by spring-projects.
the class SessionAutoConfigurationHazelcastTests method defaultConfigWithCustomTimeout.
@Test
void defaultConfigWithCustomTimeout() {
this.contextRunner.withPropertyValues("spring.session.store-type=hazelcast", "spring.session.timeout=1m").run((context) -> {
HazelcastIndexedSessionRepository repository = validateSessionRepository(context, HazelcastIndexedSessionRepository.class);
assertThat(repository).hasFieldOrPropertyWithValue("defaultMaxInactiveInterval", 60);
});
}
Aggregations