From 8ed71b3c510ae2d683b14e18b6e6610f1b610d99 Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Thu, 20 Jun 2019 13:21:01 +0200 Subject: [PATCH] Start building against Spring Session Corn-M3 snapshots See gh-17278 --- .../session/HazelcastSessionConfiguration.java | 2 +- .../session/HazelcastSessionProperties.java | 10 +++++----- .../session/RedisReactiveSessionConfiguration.java | 1 - .../session/RedisSessionConfiguration.java | 2 +- .../session/RedisSessionProperties.java | 8 ++++---- ...ReactiveSessionAutoConfigurationRedisTests.java | 14 +++++--------- .../SessionAutoConfigurationHazelcastTests.java | 5 ++--- .../SessionAutoConfigurationRedisTests.java | 12 ++++++------ .../spring-boot-dependencies/pom.xml | 2 +- 9 files changed, 25 insertions(+), 31 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionConfiguration.java index feecd7b0e1..42dde47bf7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionConfiguration.java @@ -58,7 +58,7 @@ class HazelcastSessionConfiguration { setMaxInactiveIntervalInSeconds((int) timeout.getSeconds()); } setSessionMapName(hazelcastSessionProperties.getMapName()); - setHazelcastFlushMode(hazelcastSessionProperties.getFlushMode()); + setFlushMode(hazelcastSessionProperties.getFlushMode()); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionProperties.java index 43980d790a..2d1bab9820 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/HazelcastSessionProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package org.springframework.boot.autoconfigure.session; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.session.hazelcast.HazelcastFlushMode; +import org.springframework.session.FlushMode; /** * Configuration properties for Hazelcast backed Spring Session. @@ -36,7 +36,7 @@ public class HazelcastSessionProperties { /** * Sessions flush mode. */ - private HazelcastFlushMode flushMode = HazelcastFlushMode.ON_SAVE; + private FlushMode flushMode = FlushMode.ON_SAVE; public String getMapName() { return this.mapName; @@ -46,11 +46,11 @@ public class HazelcastSessionProperties { this.mapName = mapName; } - public HazelcastFlushMode getFlushMode() { + public FlushMode getFlushMode() { return this.flushMode; } - public void setFlushMode(HazelcastFlushMode flushMode) { + public void setFlushMode(FlushMode flushMode) { this.flushMode = flushMode; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisReactiveSessionConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisReactiveSessionConfiguration.java index 95076df2ad..22944defa0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisReactiveSessionConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisReactiveSessionConfiguration.java @@ -53,7 +53,6 @@ class RedisReactiveSessionConfiguration { setMaxInactiveIntervalInSeconds((int) timeout.getSeconds()); } setRedisNamespace(redisSessionProperties.getNamespace()); - setRedisFlushMode(redisSessionProperties.getFlushMode()); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java index 577169ec9f..ff02bd42ae 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration.java @@ -74,7 +74,7 @@ class RedisSessionConfiguration { setMaxInactiveIntervalInSeconds((int) timeout.getSeconds()); } setRedisNamespace(redisSessionProperties.getNamespace()); - setRedisFlushMode(redisSessionProperties.getFlushMode()); + setFlushMode(redisSessionProperties.getFlushMode()); setCleanupCron(redisSessionProperties.getCleanupCron()); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionProperties.java index df08dcf90e..ac75abf358 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/RedisSessionProperties.java @@ -17,7 +17,7 @@ package org.springframework.boot.autoconfigure.session; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.session.data.redis.RedisFlushMode; +import org.springframework.session.FlushMode; /** * Configuration properties for Redis backed Spring Session. @@ -38,7 +38,7 @@ public class RedisSessionProperties { /** * Sessions flush mode. */ - private RedisFlushMode flushMode = RedisFlushMode.ON_SAVE; + private FlushMode flushMode = FlushMode.ON_SAVE; /** * The configure action to apply when no user defined ConfigureRedisAction bean is @@ -59,11 +59,11 @@ public class RedisSessionProperties { this.namespace = namespace; } - public RedisFlushMode getFlushMode() { + public FlushMode getFlushMode() { return this.flushMode; } - public void setFlushMode(RedisFlushMode flushMode) { + public void setFlushMode(FlushMode flushMode) { this.flushMode = flushMode; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java index 767943a84a..6d90ff6e9b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/ReactiveSessionAutoConfigurationRedisTests.java @@ -27,7 +27,6 @@ import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.session.data.mongo.ReactiveMongoOperationsSessionRepository; import org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository; -import org.springframework.session.data.redis.RedisFlushMode; import static org.assertj.core.api.Assertions.assertThat; @@ -48,7 +47,7 @@ class ReactiveSessionAutoConfigurationRedisTests extends AbstractSessionAutoConf this.contextRunner.withPropertyValues("spring.session.store-type=redis") .withConfiguration( AutoConfigurations.of(RedisAutoConfiguration.class, RedisReactiveAutoConfiguration.class)) - .run(validateSpringSessionUsesRedis("spring:session:", RedisFlushMode.ON_SAVE)); + .run(validateSpringSessionUsesRedis("spring:session:")); } @Test @@ -56,7 +55,7 @@ class ReactiveSessionAutoConfigurationRedisTests extends AbstractSessionAutoConf this.contextRunner.withClassLoader(new FilteredClassLoader(ReactiveMongoOperationsSessionRepository.class)) .withConfiguration( AutoConfigurations.of(RedisAutoConfiguration.class, RedisReactiveAutoConfiguration.class)) - .run(validateSpringSessionUsesRedis("spring:session:", RedisFlushMode.ON_SAVE)); + .run(validateSpringSessionUsesRedis("spring:session:")); } @Test @@ -64,18 +63,15 @@ class ReactiveSessionAutoConfigurationRedisTests extends AbstractSessionAutoConf this.contextRunner .withConfiguration( AutoConfigurations.of(RedisAutoConfiguration.class, RedisReactiveAutoConfiguration.class)) - .withPropertyValues("spring.session.store-type=redis", "spring.session.redis.namespace=foo", - "spring.session.redis.flush-mode=immediate") - .run(validateSpringSessionUsesRedis("foo:", RedisFlushMode.IMMEDIATE)); + .withPropertyValues("spring.session.store-type=redis", "spring.session.redis.namespace=foo") + .run(validateSpringSessionUsesRedis("foo:")); } - private ContextConsumer validateSpringSessionUsesRedis(String namespace, - RedisFlushMode flushMode) { + private ContextConsumer validateSpringSessionUsesRedis(String namespace) { return (context) -> { ReactiveRedisOperationsSessionRepository repository = validateSessionRepository(context, ReactiveRedisOperationsSessionRepository.class); assertThat(repository).hasFieldOrPropertyWithValue("namespace", namespace); - assertThat(repository).hasFieldOrPropertyWithValue("redisFlushMode", flushMode); }; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java index 3f8bb15d12..ad2b091322 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationHazelcastTests.java @@ -26,9 +26,9 @@ import org.springframework.boot.test.context.assertj.AssertableWebApplicationCon import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.session.FlushMode; import org.springframework.session.data.mongo.MongoOperationsSessionRepository; import org.springframework.session.data.redis.RedisOperationsSessionRepository; -import org.springframework.session.hazelcast.HazelcastFlushMode; import org.springframework.session.hazelcast.HazelcastSessionRepository; import org.springframework.session.jdbc.JdbcOperationsSessionRepository; @@ -84,8 +84,7 @@ class SessionAutoConfigurationHazelcastTests extends AbstractSessionAutoConfigur "spring.session.hazelcast.flush-mode=immediate").run((context) -> { HazelcastSessionRepository repository = validateSessionRepository(context, HazelcastSessionRepository.class); - assertThat(repository).hasFieldOrPropertyWithValue("hazelcastFlushMode", - HazelcastFlushMode.IMMEDIATE); + assertThat(repository).hasFieldOrPropertyWithValue("flushMode", FlushMode.IMMEDIATE); }); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java index 0f52cdf3e0..0d13cdb818 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationRedisTests.java @@ -32,8 +32,8 @@ import org.springframework.boot.testsupport.testcontainers.DisabledWithoutDocker import org.springframework.boot.testsupport.testcontainers.RedisContainer; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.session.FlushMode; import org.springframework.session.data.mongo.MongoOperationsSessionRepository; -import org.springframework.session.data.redis.RedisFlushMode; import org.springframework.session.data.redis.RedisOperationsSessionRepository; import org.springframework.session.data.redis.config.ConfigureNotifyKeyspaceEventsAction; import org.springframework.session.data.redis.config.ConfigureRedisAction; @@ -64,7 +64,7 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio .withPropertyValues("spring.session.store-type=redis", "spring.redis.port=" + redis.getFirstMappedPort()) .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) - .run(validateSpringSessionUsesRedis("spring:session:event:0:created:", RedisFlushMode.ON_SAVE, + .run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE, "0 * * * * *")); } @@ -75,7 +75,7 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio JdbcOperationsSessionRepository.class, MongoOperationsSessionRepository.class)) .withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class)) .withPropertyValues("spring.redis.port=" + redis.getFirstMappedPort()) - .run(validateSpringSessionUsesRedis("spring:session:event:0:created:", RedisFlushMode.ON_SAVE, + .run(validateSpringSessionUsesRedis("spring:session:event:0:created:", FlushMode.ON_SAVE, "0 * * * * *")); } @@ -85,7 +85,7 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio .withPropertyValues("spring.session.store-type=redis", "spring.session.redis.namespace=foo", "spring.session.redis.flush-mode=immediate", "spring.session.redis.cleanup-cron=0 0 12 * * *", "spring.redis.port=" + redis.getFirstMappedPort()) - .run(validateSpringSessionUsesRedis("foo:event:0:created:", RedisFlushMode.IMMEDIATE, "0 0 12 * * *")); + .run(validateSpringSessionUsesRedis("foo:event:0:created:", FlushMode.IMMEDIATE, "0 0 12 * * *")); } @Test @@ -116,12 +116,12 @@ class SessionAutoConfigurationRedisTests extends AbstractSessionAutoConfiguratio } private ContextConsumer validateSpringSessionUsesRedis( - String sessionCreatedChannelPrefix, RedisFlushMode flushMode, String cleanupCron) { + String sessionCreatedChannelPrefix, FlushMode flushMode, String cleanupCron) { return (context) -> { RedisOperationsSessionRepository repository = validateSessionRepository(context, RedisOperationsSessionRepository.class); assertThat(repository.getSessionCreatedChannelPrefix()).isEqualTo(sessionCreatedChannelPrefix); - assertThat(repository).hasFieldOrPropertyWithValue("redisFlushMode", flushMode); + assertThat(repository).hasFieldOrPropertyWithValue("flushMode", flushMode); SpringBootRedisHttpSessionConfiguration configuration = context .getBean(SpringBootRedisHttpSessionConfiguration.class); assertThat(configuration).hasFieldOrPropertyWithValue("cleanupCron", cleanupCron); diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 129dcd0812..81631dfdd3 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -191,7 +191,7 @@ 2.0.3.RELEASE 1.2.4.RELEASE 5.2.0.BUILD-SNAPSHOT - Corn-M2 + Corn-BUILD-SNAPSHOT 3.0.7.RELEASE 3.27.2 3.1.0