Continue renaming SessionIdGenerationStrategy to SessionIdGenerator

This commit is contained in:
Yanming Zhou
2023-08-07 13:13:44 +08:00
committed by Marcus Hert Da Coregio
parent b4e9af9ca4
commit f7662b03b3
15 changed files with 71 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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.
@@ -439,7 +439,7 @@ class ReactiveRedisSessionRepositoryTests {
}
@Test
void createSessionWhenSessionIdGenerationStrategyThenUses() {
void createSessionWhenSessionIdGeneratorThenUses() {
this.repository.setSessionIdGenerator(() -> "test");
this.repository.createSession().as(StepVerifier::create).assertNext((redisSession) -> {
@@ -449,14 +449,14 @@ class ReactiveRedisSessionRepositoryTests {
}
@Test
void setSessionIdGenerationStrategyWhenNullThenThrowsException() {
void setSessionIdGeneratorWhenNullThenThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.repository.setSessionIdGenerator(null))
.withMessage("sessionIdGenerator cannot be null");
}
@Test
@SuppressWarnings("unchecked")
void findByIdWhenChangeSessionIdThenUsesSessionIdGenerationStrategy() {
void findByIdWhenChangeSessionIdThenUsesSessionIdGenerator() {
this.repository.setSessionIdGenerator(() -> "changed-session-id");
given(this.redisOperations.opsForHash()).willReturn(this.hashOperations);
String attribute1 = "attribute1";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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.
@@ -911,7 +911,7 @@ class RedisIndexedSessionRepositoryTests {
}
@Test
void createSessionWhenSessionIdGenerationStrategyThenUses() {
void createSessionWhenSessionIdGeneratorThenUses() {
this.redisRepository.setSessionIdGenerator(() -> "test");
RedisSession session = this.redisRepository.createSession();
assertThat(session.getId()).isEqualTo("test");
@@ -919,13 +919,13 @@ class RedisIndexedSessionRepositoryTests {
}
@Test
void setSessionIdGenerationStrategyWhenNullThenThrowsException() {
void setSessionIdGeneratorWhenNullThenThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.redisRepository.setSessionIdGenerator(null))
.withMessage("sessionIdGenerator cannot be null");
}
@Test
void findByIdWhenChangeSessionIdThenUsesSessionIdGenerationStrategy() {
void findByIdWhenChangeSessionIdThenUsesSessionIdGenerator() {
this.redisRepository.setSessionIdGenerator(() -> "test");
String attribute1 = "attribute1";
String attribute2 = "attribute2";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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.
@@ -374,7 +374,7 @@ class RedisSessionRepositoryTests {
}
@Test
void createSessionWhenSessionIdGenerationStrategyThenUses() {
void createSessionWhenSessionIdGeneratorThenUses() {
this.sessionRepository.setSessionIdGenerator(() -> "test");
RedisSessionRepository.RedisSession session = this.sessionRepository.createSession();
assertThat(session.getId()).isEqualTo("test");
@@ -382,13 +382,13 @@ class RedisSessionRepositoryTests {
}
@Test
void setSessionIdGenerationStrategyWhenNullThenThrowsException() {
void setSessionIdGeneratorWhenNullThenThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.sessionRepository.setSessionIdGenerator(null))
.withMessage("sessionIdGenerator cannot be null");
}
@Test
void findByIdWhenChangeSessionIdThenUsesSessionIdGenerationStrategy() {
void findByIdWhenChangeSessionIdThenUsesSessionIdGenerator() {
this.sessionRepository.setSessionIdGenerator(() -> "test");
Instant now = Instant.now().truncatedTo(ChronoUnit.MILLIS);
given(this.sessionHashOperations.entries(eq(TEST_SESSION_KEY)))

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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.
@@ -209,14 +209,14 @@ class RedisHttpsSessionConfigurationTests {
}
@Test
void registerWhenSessionIdGenerationStrategyBeanThenUses() {
registerAndRefresh(RedisConfig.class, SessionIdGenerationStrategyConfiguration.class);
void registerWhenSessionIdGeneratorBeanThenUses() {
registerAndRefresh(RedisConfig.class, SessionIdGeneratorConfiguration.class);
RedisSessionRepository sessionRepository = this.context.getBean(RedisSessionRepository.class);
assertThat(sessionRepository).extracting("sessionIdGenerator").isInstanceOf(TestSessionIdGenerator.class);
}
@Test
void registerWhenNoSessionIdGenerationStrategyBeanThenDefault() {
void registerWhenNoSessionIdGeneratorBeanThenDefault() {
registerAndRefresh(RedisConfig.class, DefaultConfiguration.class);
RedisSessionRepository sessionRepository = this.context.getBean(RedisSessionRepository.class);
assertThat(sessionRepository).extracting("sessionIdGenerator").isInstanceOf(UuidSessionIdGenerator.class);
@@ -399,10 +399,10 @@ class RedisHttpsSessionConfigurationTests {
@Configuration(proxyBeanMethods = false)
@EnableRedisHttpSession
static class SessionIdGenerationStrategyConfiguration {
static class SessionIdGeneratorConfiguration {
@Bean
SessionIdGenerator sessionIdGenerationStrategy() {
SessionIdGenerator sessionIdGenerator() {
return new TestSessionIdGenerator();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 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.
@@ -243,14 +243,14 @@ class RedisIndexedHttpSessionConfigurationTests {
}
@Test
void registerWhenSessionIdGenerationStrategyBeanThenUses() {
registerAndRefresh(RedisConfig.class, SessionIdGenerationStrategyConfiguration.class);
void registerWhenSessionIdGeneratorBeanThenUses() {
registerAndRefresh(RedisConfig.class, SessionIdGeneratorConfiguration.class);
RedisIndexedSessionRepository sessionRepository = this.context.getBean(RedisIndexedSessionRepository.class);
assertThat(sessionRepository).extracting("sessionIdGenerator").isInstanceOf(TestSessionIdGenerator.class);
}
@Test
void registerWhenNoSessionIdGenerationStrategyBeanThenDefault() {
void registerWhenNoSessionIdGeneratorBeanThenDefault() {
registerAndRefresh(RedisConfig.class, DefaultConfiguration.class);
RedisIndexedSessionRepository sessionRepository = this.context.getBean(RedisIndexedSessionRepository.class);
assertThat(sessionRepository).extracting("sessionIdGenerator").isInstanceOf(UuidSessionIdGenerator.class);
@@ -462,10 +462,10 @@ class RedisIndexedHttpSessionConfigurationTests {
@Configuration(proxyBeanMethods = false)
@EnableRedisIndexedHttpSession
static class SessionIdGenerationStrategyConfiguration {
static class SessionIdGeneratorConfiguration {
@Bean
SessionIdGenerator sessionIdGenerationStrategy() {
SessionIdGenerator sessionIdGenerator() {
return new TestSessionIdGenerator();
}