|
|
|
@ -63,8 +63,9 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void defaultConfig() {
|
|
|
|
|
this.contextRunner.withPropertyValues("spring.session.store-type=redis",
|
|
|
|
|
"spring.redis.host=" + redis.getContainerIpAddress(), "spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
this.contextRunner
|
|
|
|
|
.withPropertyValues("spring.session.store-type=redis", "spring.redis.host=" + redis.getHost(),
|
|
|
|
|
"spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
|
|
|
|
|
.run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE,
|
|
|
|
|
SaveMode.ON_SET_ATTRIBUTE, "0 * * * * *"));
|
|
|
|
@ -76,7 +77,7 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
|
|
|
|
|
.withClassLoader(new FilteredClassLoader(HazelcastIndexedSessionRepository.class,
|
|
|
|
|
JdbcIndexedSessionRepository.class, MongoIndexedSessionRepository.class))
|
|
|
|
|
.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
|
|
|
|
|
.withPropertyValues("spring.redis.host=" + redis.getContainerIpAddress(),
|
|
|
|
|
.withPropertyValues("spring.redis.host=" + redis.getHost(),
|
|
|
|
|
"spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
.run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE,
|
|
|
|
|
SaveMode.ON_SET_ATTRIBUTE, "0 * * * * *"));
|
|
|
|
@ -87,8 +88,7 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
|
|
|
|
|
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
|
|
|
|
|
.withPropertyValues("spring.session.store-type=redis", "spring.session.redis.namespace=foo",
|
|
|
|
|
"spring.session.redis.flush-mode=immediate", "spring.session.redis.save-mode=on-get-attribute",
|
|
|
|
|
"spring.session.redis.cleanup-cron=0 0 12 * * *",
|
|
|
|
|
"spring.redis.host=" + redis.getContainerIpAddress(),
|
|
|
|
|
"spring.session.redis.cleanup-cron=0 0 12 * * *", "spring.redis.host=" + redis.getHost(),
|
|
|
|
|
"spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
.run(validateSpringSessionUsesRedis("foo:event:0:created:", FlushMode.IMMEDIATE,
|
|
|
|
|
SaveMode.ON_GET_ATTRIBUTE, "0 0 12 * * *"));
|
|
|
|
@ -98,16 +98,14 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
|
|
|
|
|
void redisSessionWithConfigureActionNone() {
|
|
|
|
|
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
|
|
|
|
|
.withPropertyValues("spring.session.store-type=redis", "spring.session.redis.configure-action=none",
|
|
|
|
|
"spring.redis.host=" + redis.getContainerIpAddress(),
|
|
|
|
|
"spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
"spring.redis.host=" + redis.getHost(), "spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
.run(validateStrategy(ConfigureRedisAction.NO_OP.getClass()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void redisSessionWithDefaultConfigureActionNone() {
|
|
|
|
|
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
|
|
|
|
|
.withPropertyValues("spring.session.store-type=redis",
|
|
|
|
|
"spring.redis.host=" + redis.getContainerIpAddress(),
|
|
|
|
|
.withPropertyValues("spring.session.store-type=redis", "spring.redis.host=" + redis.getHost(),
|
|
|
|
|
"spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
.run(validateStrategy(ConfigureNotifyKeyspaceEventsAction.class,
|
|
|
|
|
entry("notify-keyspace-events", "gxE")));
|
|
|
|
@ -117,8 +115,7 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio
|
|
|
|
|
void redisSessionWithCustomConfigureRedisActionBean() {
|
|
|
|
|
this.contextRunner.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class))
|
|
|
|
|
.withUserConfiguration(MaxEntriesRedisAction.class)
|
|
|
|
|
.withPropertyValues("spring.session.store-type=redis",
|
|
|
|
|
"spring.redis.host=" + redis.getContainerIpAddress(),
|
|
|
|
|
.withPropertyValues("spring.session.store-type=redis", "spring.redis.host=" + redis.getHost(),
|
|
|
|
|
"spring.redis.port=" + redis.getFirstMappedPort())
|
|
|
|
|
.run(validateStrategy(MaxEntriesRedisAction.class, entry("set-max-intset-entries", "1024")));
|
|
|
|
|
|
|
|
|
|