Compare commits

..

116 Commits
2.6.1 ... 2.7.1

Author SHA1 Message Date
Marcus Da Coregio
ec6fd8a902 Release 2.7.1 2023-03-21 09:58:55 -03:00
Marcus Da Coregio
0320e60cf0 Update spring-security-bom to 5.7.7
Closes gh-2264
2023-03-21 09:55:04 -03:00
Marcus Da Coregio
90d0c1d778 Update spring-data-bom to 2021.2.9
Closes gh-2263
2023-03-21 09:55:04 -03:00
Marcus Da Coregio
058ae80419 Update spring-framework-bom to 5.3.26
Closes gh-2262
2023-03-21 09:55:04 -03:00
Marcus Da Coregio
89fb210f18 Update reactor-bom to 2020.0.30
Closes gh-2260
2023-03-21 09:55:04 -03:00
Marcus Da Coregio
d48aa09b9c Update to mariadb-java-client 2.7.8
Closes gh-2255
2023-03-06 13:58:02 -03:00
Marcus Da Coregio
02a6dbc08a Revert "Update to mariadb-java-client 3.0.10"
This reverts commit acb59258
2023-03-06 13:55:08 -03:00
Marcus Da Coregio
e4a023fa64 Revert "Update Antora Plugin to 1.0.0"
This reverts commit 280f311677.
2023-03-06 13:52:52 -03:00
Rob Winch
e8837c83e9 Next Development Version 2023-02-21 17:21:56 -06:00
Rob Winch
b4b9ea8112 Release 2.7.1 2023-02-21 17:21:18 -06:00
Rob Winch
c571f7479c Update to org.postgresql:postgresql:42.3.8
Closes gh-2250
2023-02-21 17:13:06 -06:00
Rob Winch
63d7580a69 Update to MongoDB 4.6.1
Closes gh-2249
2023-02-21 17:12:19 -06:00
Rob Winch
c466aa5dd3 Update to Mockito 4.5.1
Closes gh-2248
2023-02-21 17:11:33 -06:00
Rob Winch
acb59258c3 Update to mariadb-java-client 3.0.10
Closes gh-2247
2023-02-21 17:10:44 -06:00
Rob Winch
e5022757a9 Update to mysql-connector-java 8.0.32
Closes gh-2246
2023-02-21 17:09:49 -06:00
Rob Winch
ddad8010eb Update to lettuce 6.1.10.RELEASE
Closes gh-2245
2023-02-21 17:09:01 -06:00
Rob Winch
fc3e2e1c64 Update to HikariCP:4.0.3
Closes gh-2244
2023-02-21 17:08:18 -06:00
Rob Winch
eb169f8186 Update to com.ibm.db2:jcc:11.5.8.0
Closes gh-2243
2023-02-21 17:07:23 -06:00
Rob Winch
5fd7c9ddcf Update to testcontainers 1.17.6
Closes gh-2242
2023-02-21 17:06:13 -06:00
Rob Winch
8898ceb4a7 Update to Spring Security 5.7.6
Closes gh-2241
2023-02-21 17:05:25 -06:00
Rob Winch
c4e9a93d02 Update to Spring Data 20201.2.7
Closes gh-2240
2023-02-21 17:04:17 -06:00
Rob Winch
d8ab39eba7 Update to Spring Framework 5.3.25
Closes gh-2239
2023-02-21 17:03:19 -06:00
Rob Winch
6a5f101656 Update to Jackson 2.13.4.20221013
Closes gh-2238
2023-02-21 17:02:26 -06:00
Rob Winch
88d34035a6 Update to Reactor 2020.0.27
Closes gh-2237
2023-02-21 17:01:26 -06:00
Rob Winch
81ef425b1b Spring to Boot 2.7.8
Closes gh-2236
2023-02-21 16:59:46 -06:00
Marcus Da Coregio
280f311677 Update Antora Plugin to 1.0.0
Issue gh-2234
2023-02-16 09:41:50 -03:00
Kaoru Muta
fab1f7b38e docs: fix broken links in hazelcast documents 2023-01-23 13:57:39 -03:00
Eddú Meléndez
0dfc97289f Polish related to testcontainers
* Use getHost instead of getContainerIpAddress
* Rely on OracleContainer and it's improvements which involve the log
wait strategy
2023-01-23 13:47:59 -03:00
Marcus Da Coregio
7c927c7f38 Setup forward merge
Closes gh-2228
2023-01-23 11:52:06 -03:00
Rob Winch
cbd1c66c13 Merge branch '2.6.x' into 2.7.x 2022-11-15 14:20:00 -06:00
Rob Winch
9f7a969a6e Fix Snapshot Deploy
This commit merges a workaround to an issue in JFrog's Gradle plugin
which causes SNAPSHOTs to be out of sync and thus prevents downloading.

Closes gh-2177
2022-11-15 14:17:26 -06:00
Rob Winch
5f2523e211 Merge branch '2.6.x' into 2.7.x 2022-11-15 13:44:56 -06:00
Bakul Kakadiya
26986a6b7d Corrected documentation Reference Link 2022-11-15 11:49:05 -06:00
Rob Winch
58813e9d5a Next Development Version 2022-05-18 11:06:59 -05:00
Rob Winch
c66ee750f9 Release 2.7.0 2022-05-18 11:02:54 -05:00
Rob Winch
9062db3f55 Update to spring-security-bom:5.7.0
Closes gh-2084
2022-05-18 09:29:51 -05:00
Rob Winch
4bf15cda3b Update to spring-data-bom:2021.2.0
Closes gh-2085
2022-05-18 09:29:51 -05:00
Rob Winch
7f8c0387a7 Update to spring-framework-bom:5.3.20
Closes gh-2086
2022-05-18 09:29:51 -05:00
Rob Winch
3bc15c4259 Update to reactor-bom:2020.0.19
Closes gh-2087
2022-05-18 09:29:50 -05:00
Rob Winch
c9add24c77 Add .sdkmanrc
Closes gh-2088
2022-05-18 09:29:44 -05:00
Eleftheria Stein
aaed973d27 Add Caffeine community extension
Closes gh-2039
2022-04-27 09:50:11 +02:00
Eleftheria Stein
55c4fcfd3f Fix link to Infinispan cache 2022-04-27 09:49:41 +02:00
Eleftheria Stein
2a5d6b4d2e Next development version 2022-04-19 18:39:03 +02:00
Eleftheria Stein
42aa10bfe8 Release 2.7.0-RC1 2022-04-19 18:20:16 +02:00
Eleftheria Stein
2ce570cbdc Next development version 2022-04-19 18:06:26 +02:00
Eleftheria Stein
221b48094a Upgrade test dependencies 2022-04-19 17:59:17 +02:00
Eleftheria Stein
d43b48bbb0 Revert "Upgrade test dependencies"
This reverts commit 2369b2cfb3.
2022-04-19 17:57:52 +02:00
Eleftheria Stein
840907993b Release 2.6.3 2022-04-19 17:37:41 +02:00
Eleftheria Stein
e1dea5e0a8 Revise Redis test mocks based on new Data implementation
Issue gh-2070
2022-04-19 15:53:23 +02:00
Eleftheria Stein
4db41c1caf Upgrade Spring Data to 2021.1.4
Closes gh-2058
2022-04-19 15:41:20 +02:00
Eleftheria Stein
23a32acd56 Upgrade Spring Data to 2021.2.0-RC1
Closes gh-2059
2022-04-19 15:18:55 +02:00
Eleftheria Stein
dc8cca5351 Upgrade Spring Security to 5.7.0-RC1
Closes gh-2070
2022-04-19 13:19:15 +02:00
Eleftheria Stein
2369b2cfb3 Upgrade test dependencies 2022-04-19 13:19:10 +02:00
Eleftheria Stein
e6ce56ec8b Upgrade Reactor to 2020.0.18
Closes gh-2071
2022-04-19 13:17:57 +02:00
Eleftheria Stein
36939c1b02 Upgrade Jackson to 2.13.2.20220328
Closes gh-2068
2022-04-19 13:17:25 +02:00
Eleftheria Stein
0a84f9d544 Upgrade Spring Framework to 5.3.19
Closes gh-2069
2022-04-19 13:15:32 +02:00
Eleftheria Stein
f4840e98a2 Upgrade test dependencies 2022-04-19 12:27:09 +02:00
Eleftheria Stein
8c99c9f904 Upgrade Spring Security to 5.6.3
Closes gh-2064
2022-04-19 12:26:40 +02:00
Eleftheria Stein
f70f1f20f9 Upgrade Reactor to 2020.0.18
Closes gh-2065
2022-04-19 12:25:20 +02:00
Eleftheria Stein
ac1a77e5fe Upgrade Jackson to 2.13.2.20220328
Closes gh-2066
2022-04-19 12:21:58 +02:00
Eleftheria Stein
214a556dd4 Upgrade Spring Framework to 5.3.19
Closes gh-2063
2022-04-19 12:21:22 +02:00
Eleftheria Stein
cace484fbe Upgrade samples to Spring Boot 2.6.6
Closes gh-2067
2022-04-19 12:20:16 +02:00
Eleftheria Stein
a5ec1ccf1f Fix formatting 2022-04-19 11:13:49 +02:00
Greg L. Turnquist
7fc0ae47d5 Switch back to unicode for the DOT substitute character.
MongoDB doesn't support "." in field names, so a Private Use Area character was used. This was originally stored in unicode format, but delomboking the code caused it to get transformed into another encoding. This causes issues on certain systems when building the software, so we are converting it back to its unicode representation. The character has been the same throughout, ensuring binary compatilibity.

See: https://www.compart.com/en/unicode/U+F607

Related: d601e270fc (diff-57190a47726099e31fdf86b12b80206e2ae24feb28aacaf494b99557583df150L47)
Closes #2053.
2022-04-18 09:49:57 -05:00
Jerome Prinet
ce2e644e04 Update Gradle Enterprise plugin to 3.9 2022-04-14 11:10:54 +02:00
Felix Scheinost
24c198fe98 Fix bug in JDBC SaveMode.ON_GET_ATTRIBUTE 2022-04-08 17:50:51 +02:00
Felix Scheinost
8800fb9816 Fix bug in JDBC SaveMode.ON_GET_ATTRIBUTE 2022-04-08 17:19:54 +02:00
Eleftheria Stein
b8e94948ae Upgrade MongoDB to 4.5.1
Closes gh-2047
2022-03-30 15:24:02 +02:00
Eleftheria Stein
8d2276341f Upgrade samples to Spring Boot 2.7.0-M3
This also makes the necessary changes for the Thymeleaf Layout Dialect 3.0 update.

Closes gh-2046
2022-03-30 15:23:49 +02:00
Eleftheria Stein
2c1b79375d Upgrade samples to Spring Boot 2.6.5
This also makes the necessary changes for the Thymeleaf Layout Dialect 3.0 update.

Closes gh-1980
2022-03-29 15:33:08 +02:00
Eleftheria Stein
63f1c7bf6f Fix reference documentation redirects
Closes gh-2044
2022-03-23 10:03:32 +01:00
Eleftheria Stein
e8e4ee2850 Make RedisSessionRepository.DEFAULT_KEY_NAMESPACE public
Closes gh-2043
2022-03-15 18:23:17 +01:00
Eleftheria Stein
9a643c8866 Update to Antora 3.0.1
Closes gh-2038
2022-03-11 15:46:19 +01:00
Eleftheria Stein
282f774e07 Document release process for 2.7.x
Issue gh-2036
2022-02-24 12:46:05 +01:00
Eleftheria Stein
fba9313c6b Document release process for 2.6.x
Issue gh-2036
2022-02-23 14:22:25 +01:00
Eleftheria Stein
e6ec5765b8 Fix 2.6.2 reference docs
Closes gh-2035
2022-02-22 15:43:37 +01:00
Eleftheria Stein
c2288615bf Update antora to 2.6.3 2022-02-22 14:38:24 +01:00
Eleftheria Stein
ad52fc0297 Next development version 2022-02-22 14:13:29 +01:00
Eleftheria Stein
2516a495af Release 2.6.2 2022-02-22 10:31:00 +01:00
Eleftheria Stein
9be7ac7fa6 Upgrade test dependencies 2022-02-22 10:30:29 +01:00
Eleftheria Stein
c335a49924 Upgrade Hazelcast 4 to 4.2.4
Closes gh-2029
2022-02-22 10:29:20 +01:00
Eleftheria Stein
092e6c6607 Upgrade MongoDB to 4.4.2
Closes gh-2034
2022-02-22 10:28:02 +01:00
Eleftheria Stein
0924c9558a Upgrade Reactor to 2020.0.16
Closes gh-2031
2022-02-22 10:27:20 +01:00
Eleftheria Stein
0484781541 Upgrade Jackson to 2.13.1
Closes gh-2033
2022-02-22 10:26:38 +01:00
Eleftheria Stein
3995f8bf65 Upgrade Spring Framework to 5.3.16
Closes gh-2028
2022-02-22 10:25:32 +01:00
Eleftheria Stein
ad16f17398 Upgrade Spring Data to 2021.1.2
Closes gh-2032
2022-02-22 10:24:56 +01:00
Eleftheria Stein
11aa50e83c Upgrade Spring Security to 5.6.2
Closes gh-2030
2022-02-22 10:24:32 +01:00
Eleftheria Stein
ab5c727846 Update Websocket sample to be compatible with H2 2.0
Closes gh-2013
2022-01-27 14:11:26 +01:00
Eleftheria Stein
a0246a61b6 Update to jakarta.servlet-api dependency
Closes gh-1960
2022-01-25 13:26:47 +01:00
Eleftheria Stein
8f20fa328a Update to jakarta.annotation-api dependency
Closes gh-1956
2022-01-25 12:50:29 +01:00
Eleftheria Stein
44ff959c59 Include 2.6.x branch in Antora docs
Issue gh-2014
2022-01-21 10:13:52 +01:00
Eleftheria Stein
ad67a3775b Add manual trigger to antora generate workflow
Issue gh-2014
2022-01-20 13:52:11 +01:00
Eleftheria Stein
75c60b27bd Exclude 3.0.0-M1 and 2.7.0-M1 tags from antora
Closes gh-2014
2022-01-20 13:22:31 +01:00
Ruslan Molchanov
12ce8de84e Fix memory leak with null principal in Redis
Closes gh-1987
2022-01-20 10:05:05 +01:00
Ruslan Molchanov
81bd6bd261 Fix memory leak with null principal in Redis
Closes gh-1987
2022-01-19 17:31:35 +01:00
Eleftheria Stein
2e8c4292fd Next development version 2022-01-18 13:01:30 +01:00
Eleftheria Stein
315b9c9929 Release 2.7.0-M1 2022-01-18 12:51:40 +01:00
Eleftheria Stein
a70abd90bd Upgrade test dependencies 2022-01-18 11:29:58 +01:00
Eleftheria Stein
f13df5aa2f Revert "Upgrade test dependencies"
This reverts commit bda72c074f.
2022-01-18 11:14:02 +01:00
Eleftheria Stein
6fd68e093f Upgrade Spring Data to 2021.2.0-M2
Closes gh-1996
2022-01-18 10:47:16 +01:00
Eleftheria Stein
653d820290 Update antora tags to include 3.0 2022-01-18 10:35:06 +01:00
Jerome Prinet
950ac50234 Bump up Gradle plugin dependencies 2022-01-17 17:05:36 +01:00
Eleftheria Stein
bda72c074f Upgrade test dependencies 2022-01-17 14:51:48 +01:00
Eleftheria Stein
fb1362aa2c Upgrade Hazelcast 4 to 4.2.4
Closes gh-2001
2022-01-17 14:51:48 +01:00
Eleftheria Stein
d5dac6629d Upgrade Spring Security to 5.7.0-M1
Closes gh-1997
2022-01-17 14:51:45 +01:00
Eleftheria Stein
04b4b9ba17 Upgrade Spring Framework to 5.3.15
Closes gh-1998
2022-01-17 14:51:18 +01:00
Eleftheria Stein
97308bdbf4 Upgrade Jackson to 2.13.1
Closes gh-2002
2022-01-17 14:50:38 +01:00
Eleftheria Stein
4ba62c71dd Upgrade MongoDB to 4.4.1
Closes gh-2000
2022-01-17 14:50:38 +01:00
Eleftheria Stein
265099c586 Upgrade Reactor to 2020.0.15
Closes gh-1999
2022-01-17 09:41:09 +01:00
Eleftheria Stein
2f4a0110ab Update to jakarta.servlet-api dependency
Closes gh-1960
2022-01-14 16:21:35 +01:00
Eleftheria Stein
7a1cb66dae Update to jakarta.annotation-api dependency
Closes gh-1956
2022-01-14 16:19:22 +01:00
Jerome Prinet
9bad2afa14 Bump up Gradle enterprise plugin to 3.7.2 2022-01-05 14:34:51 +01:00
Eleftheria Stein
dba22292a3 Run CI on all branches 2022-01-05 14:29:57 +02:00
Eleftheria Stein
c79173879f Run CI on all branches 2022-01-05 14:29:28 +02:00
Eleftheria Stein
2c065c0241 Next minor development version 2022-01-05 14:28:19 +02:00
Eleftheria Stein
a08c721118 Next development version 2021-12-21 16:31:16 +02:00
88 changed files with 790 additions and 271 deletions

View File

@@ -1,6 +1,7 @@
name: Generate Antora Files and Request Build
on:
workflow_dispatch: # Manual trigger
push:
branches-ignore:
- 'gh-pages'

View File

@@ -2,8 +2,6 @@ name: CI
on:
push:
branches:
- main
schedule:
- cron: '0 10 * * *' # Once per day at 10am UTC
workflow_dispatch: # Manual trigger

6
.sdkmanrc Normal file
View File

@@ -0,0 +1,6 @@
# Use sdkman to run "sdk env" to initialize with correct JDK version
# Enable auto-env through the sdkman_auto_env config
# See https://sdkman.io/usage#config
# A summary is to add the following to ~/.sdkman/etc/config
# sdkman_auto_env=true
java=8.0.332-zulu

View File

@@ -25,6 +25,13 @@ If you are reporting a bug, please help to speed up problem diagnosis by providi
information as possible. Ideally, that would include a small sample project that
reproduces the problem.
== Create your branch from the oldest maintenance branch
Create your topic branch to be submitted as a pull request from the oldest impacted and supported maintenance branch.
You can find the supported versions by looking at the https://github.com/spring-projects/spring-session/milestones[milestones page].
Switch to a branch named `<major>.<minor>.x` from the smallest milestone in the format of `<major>.<minor>.<patch>(-<prerelease>)`.
The spring team will ensure the code gets merged forward into additional branches.
== Sign the Contributor License Agreement
If you have not previously done so, please fill out and

View File

@@ -25,7 +25,7 @@ Additional Spring Session modules can be found in the https://github.com/spring-
== Getting Started
We recommend you visit the https://docs.spring.io/spring-session/docs/current/reference/html5/#samples[Spring Session Reference] and look through the "Samples and Guides" section to see which one best suits your needs.
We recommend you visit the https://docs.spring.io/spring-session/reference/index.html[Spring Session Reference] and look through the "Samples and Guides" section to see which one best suits your needs.
== Samples

110
RELEASE.adoc Normal file
View File

@@ -0,0 +1,110 @@
== 1. Update Dependencies
Dependencies are declared in `gradle/dependency-management.gradle`.
Update Spring Framework, Spring Security and Spring Data at a minimum.
Run all the checks:
[source,bash]
----
$ ./gradlew check
----
Create separate issues for each dependency update, aside from test dependencies which can be combined into a single commit.
== 2. Check All Issues are Closed
You can manually check at https://github.com/spring-projects/spring-session/milestones
== 3. Update Release Version
Update the version number in `gradle.properties` for the release, for example `2.7.0-M1`, `2.7.0-RC1`, `2.7.3`
== 4. Update Antora Version
You will need to update the antora.yml version.
For milestone / release candidate releases you should follow this format:
----
version: '2.7.0-RC1'
prerelease: 'true'
display_version: '2.7.0-RC1'
----
== 5. Build Locally
Run the build using
[source,bash]
----
$ ./gradlew check
----
== 6. Push the Release Commit
Push the commit and GitHub actions will build and deploy the artifacts.
Wait for the artifact to appear in https://repo1.maven.org/maven2/org/springframework/session/spring-session-core/
== 7. Tag the release
Tag the release and then push the tag
....
git tag 2.7.0-RC1
git push origin 2.7.0-RC1
....
== 8. Update to Next Development Version
Update `gradle.properties` version to next `+SNAPSHOT+` version, update antora.yml and then push
== 9. Update version on project pages
Update the versions on https://spring.io/projects for Spring Session Core, Spring Session Data Redis, Spring Session JDBC, Spring Session Hazelcast, and Spring Session MongoDB.
== 10. Update Release Notes on GitHub
Download
https://github.com/spring-io/github-changelog-generator/releases/latest[the
GitHub release notes generator]
* Generate the release notes
....
java -jar github-changelog-generator.jar \
--changelog.repository=spring-projects/spring-session \
$MILESTONE release-notes
....
Note 1: `+$MILESTONE+` is something like `+2.7.1+` or `+2.7.0-M1+`. +
Note 2: This will create a file on your filesystem
called `+release-notes+`.
* Copy the release notes to your clipboard (your mileage may vary with
the following command)
....
cat release-notes | xclip -selection clipboard
....
* Create the
https://github.com/spring-projects/spring-session/releases[release on
GitHub], associate it with the tag, and paste the generated notes.
== 11. Close / Create Milestone
* In
https://github.com/spring-projects/spring-session/milestones[GitHub
Milestones], create a new milestone for the next release version.
* Move any open issues from the existing milestone you just released to
the new milestone.
* Close the milestone for the release.
Note: Spring Session typically releases only one milestone (M1) and one release candidate (RC1).
== 12. Announce the release
* Announce via Slack on https://pivotal.slack.com/messages/spring-session[#spring-session], and tag any downstream Spring Session projects (e.g Spring Session for Apache Geode).
Note: Do not post on #spring-release or create a blog post. Those steps happen after the Spring Session BOM is released.

View File

@@ -4,7 +4,7 @@ buildscript {
snapshotBuild = version.endsWith('SNAPSHOT')
milestoneBuild = !(releaseBuild || snapshotBuild)
springBootVersion = '2.5.6'
springBootVersion = '2.7.8'
}
repositories {

View File

@@ -66,7 +66,7 @@ dependencies {
implementation 'io.spring.nohttp:nohttp-gradle:0.0.9'
implementation 'net.sourceforge.htmlunit:htmlunit:2.55.0'
implementation 'org.hidetake:gradle-ssh-plugin:2.10.1'
implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.24.20'
implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.29.0'
implementation 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'
testImplementation platform('org.junit:junit-bom:5.8.1')

View File

@@ -18,6 +18,7 @@ package io.spring.gradle.convention
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
class ArtifactoryPlugin implements Plugin<Project> {
@@ -37,8 +38,14 @@ class ArtifactoryPlugin implements Plugin<Project> {
password = artifactoryPassword
}
}
defaults {
publications('mavenJava')
}
}
project.plugins.withType(MavenPublishPlugin) {
project.artifactory {
publish {
defaults {
publications('mavenJava')
}
}
}
}

View File

@@ -32,6 +32,7 @@ class RootProjectPlugin implements Plugin<Project> {
pluginManager.apply(SchemaPlugin)
pluginManager.apply(NoHttpPlugin)
pluginManager.apply(SpringNexusPublishPlugin)
pluginManager.apply(ArtifactoryPlugin)
pluginManager.apply("org.sonarqube")
project.repositories.mavenCentral()

View File

@@ -9,7 +9,7 @@ repositories {
}
dependencies {
optional 'javax.servlet:javax.servlet-api:3.1.0'
optional 'jakarta.servlet:jakarta.servlet-api:4.0.4'
testImplementation platform('org.junit:junit-bom:5.8.1')
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'

View File

@@ -4,7 +4,7 @@ plugins {
}
dependencies {
provided 'javax.servlet:javax.servlet-api'
provided 'jakarta.servlet:jakarta.servlet-api:4.0.4'
testImplementation 'commons-io:commons-io:2.11.0'
testImplementation 'org.assertj:assertj-core:3.21.0'
testImplementation platform('org.junit:junit-bom:5.8.1')

135
git/hooks/forward-merge Executable file
View File

@@ -0,0 +1,135 @@
#!/usr/bin/ruby
require 'json'
require 'net/http'
require 'yaml'
require 'logger'
$log = Logger.new(STDOUT)
$log.level = Logger::WARN
class ForwardMerge
attr_reader :issue, :milestone, :message, :line
def initialize(issue, milestone, message, line)
@issue = issue
@milestone = milestone
@message = message
@line = line
end
end
def find_forward_merges(message_file)
$log.debug "Searching for forward merge"
rev=`git rev-parse -q --verify MERGE_HEAD`.strip
$log.debug "Found #{rev} from git rev-parse"
return nil unless rev
message = File.read(message_file)
forward_merges = []
message.each_line do |line|
$log.debug "Checking #{line} for message"
match = /^(?:Fixes|Closes) gh-(\d+) in (\d\.\d\.[\dx](?:[\.\-](?:M|RC)\d)?)$/.match(line)
if match then
issue = match[1]
milestone = match[2]
$log.debug "Matched reference to issue #{issue} in milestone #{milestone}"
forward_merges << ForwardMerge.new(issue, milestone, message, line)
end
end
$log.debug "No match in merge message" unless forward_merges
return forward_merges
end
def get_issue(username, password, repository, number)
$log.debug "Getting issue #{number} from GitHub repository #{repository}"
uri = URI("https://api.github.com/repos/#{repository}/issues/#{number}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl=true
request = Net::HTTP::Get.new(uri.path)
request.basic_auth(username, password)
response = http.request(request)
$log.debug "Get HTTP response #{response.code}"
return JSON.parse(response.body) unless response.code != '200'
puts "Failed to retrieve issue #{number}: #{response.message}"
exit 1
end
def find_milestone(username, password, repository, title)
$log.debug "Finding milestone #{title} from GitHub repository #{repository}"
uri = URI("https://api.github.com/repos/#{repository}/milestones")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl=true
request = Net::HTTP::Get.new(uri.path)
request.basic_auth(username, password)
response = http.request(request)
milestones = JSON.parse(response.body)
if title.end_with?(".x")
prefix = title.delete_suffix('.x')
$log.debug "Finding nearest milestone from candidates starting with #{prefix}"
titles = milestones.map { |milestone| milestone['title'] }
titles = titles.select{ |title| title.start_with?(prefix) unless title.end_with?('.x')}
titles = titles.sort_by { |v| Gem::Version.new(v) }
$log.debug "Considering candidates #{titles}"
if(titles.empty?)
puts "Cannot find nearest milestone for prefix #{title}"
exit 1
end
title = titles.first
$log.debug "Found nearest milestone #{title}"
end
milestones.each do |milestone|
$log.debug "Considering #{milestone['title']}"
return milestone['number'] if milestone['title'] == title
end
puts "Milestone #{title} not found in #{repository}"
exit 1
end
def create_issue(username, password, repository, original, title, labels, milestone, milestone_name, dry_run)
$log.debug "Finding forward-merge issue in GitHub repository #{repository} for '#{title}'"
uri = URI("https://api.github.com/repos/#{repository}/issues")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl=true
request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
request.basic_auth(username, password)
request.body = {
title: title,
labels: labels,
milestone: milestone.to_i,
body: "Forward port of issue ##{original} to #{milestone_name}."
}.to_json
if dry_run then
puts "Dry run"
puts "POSTing to #{uri} with body #{request.body}"
return "dry-run"
end
response = JSON.parse(http.request(request).body)
$log.debug "Created new issue #{response['number']}"
return response['number']
end
$log.debug "Running forward-merge hook script"
message_file=ARGV[0]
forward_merges = find_forward_merges(message_file)
exit 0 unless forward_merges
$log.debug "Loading config from ~/.spring-boot/forward_merge.yml"
config = YAML.load_file(File.join(Dir.home, '.spring-boot', 'forward-merge.yml'))
username = config['github']['credentials']['username']
password = config['github']['credentials']['password']
dry_run = config['dry_run']
repository = 'spring-projects/spring-session'
forward_merges.each do |forward_merge|
existing_issue = get_issue(username, password, repository, forward_merge.issue)
title = existing_issue['title']
labels = existing_issue['labels'].map { |label| label['name'] }
labels << "status: forward-port"
$log.debug "Processing issue '#{title}'"
milestone = find_milestone(username, password, repository, forward_merge.milestone)
new_issue_number = create_issue(username, password, repository, forward_merge.issue, title, labels, milestone, forward_merge.milestone, dry_run)
puts "Created gh-#{new_issue_number} for forward port of gh-#{forward_merge.issue} into #{forward_merge.milestone}"
rewritten_message = forward_merge.message.sub(forward_merge.line, "Closes gh-#{new_issue_number}\n")
File.write(message_file, rewritten_message)
end

71
git/hooks/prepare-forward-merge Executable file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/ruby
require 'json'
require 'net/http'
require 'yaml'
require 'logger'
$main_branch = "3.0.x"
$log = Logger.new(STDOUT)
$log.level = Logger::WARN
def get_fixed_issues()
$log.debug "Searching for for forward merge"
rev=`git rev-parse -q --verify MERGE_HEAD`.strip
$log.debug "Found #{rev} from git rev-parse"
return nil unless rev
fixed = []
message = `git log -1 --pretty=%B #{rev}`
message.each_line do |line|
$log.debug "Checking #{line} for message"
fixed << line.strip if /^(?:Fixes|Closes) gh-(\d+)/.match(line)
end
$log.debug "Found fixed issues #{fixed}"
return fixed;
end
def rewrite_message(message_file, fixed)
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
if current_branch == "main"
current_branch = $main_branch
end
rewritten_message = ""
message = File.read(message_file)
message.each_line do |line|
match = /^Merge.*branch\ '(.*)'(?:\ into\ (.*))?$/.match(line)
if match
from_branch = match[1]
if from_branch.include? "/"
from_branch = from_branch.partition("/").last
end
to_brach = match[2]
$log.debug "Rewriting merge message"
line = "Merge branch '#{from_branch}'" + (to_brach ? " into #{to_brach}\n" : "\n")
end
if fixed and line.start_with?("#")
$log.debug "Adding fixed"
rewritten_message << "\n"
fixed.each do |fixes|
rewritten_message << "#{fixes} in #{current_branch}\n"
end
fixed = nil
end
rewritten_message << line
end
return rewritten_message
end
$log.debug "Running prepare-forward-merge hook script"
message_file=ARGV[0]
message_type=ARGV[1]
if message_type != "merge"
$log.debug "Not a merge commit"
exit 0;
end
$log.debug "Searching for for forward merge"
fixed = get_fixed_issues()
rewritten_message = rewrite_message(message_file, fixed)
File.write(message_file, rewritten_message)

View File

@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
version=2.6.1
version=2.7.1

View File

@@ -1,12 +1,12 @@
dependencyManagement {
imports {
mavenBom 'io.projectreactor:reactor-bom:2020.0.14'
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.0'
mavenBom 'io.projectreactor:reactor-bom:2020.0.30'
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.5'
mavenBom 'org.junit:junit-bom:5.8.2'
mavenBom 'org.springframework:spring-framework-bom:5.3.14'
mavenBom 'org.springframework.data:spring-data-bom:2021.1.0'
mavenBom 'org.springframework.security:spring-security-bom:5.6.1'
mavenBom 'org.testcontainers:testcontainers-bom:1.16.2'
mavenBom 'org.springframework:spring-framework-bom:5.3.26'
mavenBom 'org.springframework.data:spring-data-bom:2021.2.9'
mavenBom 'org.springframework.security:spring-security-bom:5.7.7'
mavenBom 'org.testcontainers:testcontainers-bom:1.17.6'
}
dependencies {
@@ -15,35 +15,35 @@ dependencyManagement {
entry 'hazelcast-client'
}
dependency 'org.aspectj:aspectjweaver:1.9.7'
dependency 'ch.qos.logback:logback-core:1.2.9'
dependency 'org.aspectj:aspectjweaver:1.9.9.1'
dependency 'ch.qos.logback:logback-core:1.2.11'
dependency 'com.google.code.findbugs:jsr305:3.0.2'
dependency 'com.h2database:h2:1.4.200'
dependency 'com.ibm.db2:jcc:11.5.6.0'
dependency 'com.ibm.db2:jcc:11.5.8.0'
dependency 'com.microsoft.sqlserver:mssql-jdbc:9.4.1.jre8'
dependency 'com.oracle.database.jdbc:ojdbc8:21.3.0.0'
dependency 'com.zaxxer:HikariCP:3.4.5'
dependency 'com.oracle.database.jdbc:ojdbc8:21.5.0.0'
dependency 'com.zaxxer:HikariCP:4.0.3'
dependency 'edu.umd.cs.mtc:multithreadedtc:1.01'
dependency 'io.lettuce:lettuce-core:6.1.5.RELEASE'
dependency 'javax.annotation:javax.annotation-api:1.3.2'
dependency 'javax.servlet:javax.servlet-api:4.0.1'
dependency 'mysql:mysql-connector-java:8.0.27'
dependency 'io.lettuce:lettuce-core:6.1.10.RELEASE'
dependency 'jakarta.annotation:jakarta.annotation-api:1.3.5'
dependency 'jakarta.servlet:jakarta.servlet-api:4.0.4'
dependency 'mysql:mysql-connector-java:8.0.32'
dependency 'org.apache.derby:derby:10.14.2.0'
dependency 'org.assertj:assertj-core:3.21.0'
dependency 'org.hamcrest:hamcrest:2.1'
dependency 'org.assertj:assertj-core:3.22.0'
dependency 'org.hamcrest:hamcrest:2.2'
dependency 'org.hsqldb:hsqldb:2.5.2'
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.4'
dependencySet(group: 'org.mockito', version: '4.0.0') {
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.8'
dependencySet(group: 'org.mockito', version: '4.5.1') {
entry 'mockito-core'
entry 'mockito-junit-jupiter'
}
dependencySet(group: 'org.mongodb', version: '4.4.0') {
dependencySet(group: 'org.mongodb', version: '4.6.1') {
entry 'mongodb-driver-core'
entry 'mongodb-driver-sync'
entry 'mongodb-driver-reactivestreams'
}
dependency 'org.postgresql:postgresql:42.3.1'
dependency 'org.postgresql:postgresql:42.3.8'
}
}

View File

@@ -6,7 +6,7 @@ pluginManagement {
}
plugins {
id "com.gradle.enterprise" version "3.5.1"
id "com.gradle.enterprise" version "3.9"
id "io.spring.ge.conventions" version "0.0.7"
}

View File

@@ -6,8 +6,8 @@ dependencies {
api "org.springframework:spring-jcl"
optional "io.projectreactor:reactor-core"
optional "javax.annotation:javax.annotation-api"
optional "javax.servlet:javax.servlet-api"
optional "jakarta.annotation:jakarta.annotation-api"
optional "jakarta.servlet:jakarta.servlet-api"
optional "org.springframework:spring-context"
optional "org.springframework:spring-jdbc"
optional "org.springframework:spring-messaging"

View File

@@ -41,5 +41,5 @@ dependencies {
testImplementation "org.mockito:mockito-core"
testImplementation "org.mockito:mockito-junit-jupiter"
testImplementation "io.projectreactor:reactor-test"
testImplementation "javax.servlet:javax.servlet-api"
testImplementation "jakarta.servlet:jakarta.servlet-api"
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2022 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.
@@ -389,7 +389,7 @@ public abstract class AbstractMongoRepositoryITest extends AbstractITest {
protected static class BaseConfig {
private static final String DOCKER_IMAGE = "mongo:4.0.10";
private static final String DOCKER_IMAGE = "mongo:4.4.1";
@Bean(initMethod = "start", destroyMethod = "stop")
public MongoDBContainer mongoContainer() {
@@ -399,8 +399,8 @@ public abstract class AbstractMongoRepositoryITest extends AbstractITest {
@Bean
public MongoOperations mongoOperations(MongoDBContainer mongoContainer) {
MongoClient mongo = MongoClients.create(
"mongodb://" + mongoContainer.getContainerIpAddress() + ":" + mongoContainer.getFirstMappedPort());
MongoClient mongo = MongoClients
.create("mongodb://" + mongoContainer.getHost() + ":" + mongoContainer.getFirstMappedPort());
return new MongoTemplate(mongo, "test");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -175,7 +175,7 @@ public class MongoDbDeleteJacksonSessionVerificationTest {
@EnableMongoWebSession
static class Config {
private static final String DOCKER_IMAGE = "mongo:4.0.10";
private static final String DOCKER_IMAGE = "mongo:4.4.1";
@Bean(initMethod = "start", destroyMethod = "stop")
MongoDBContainer mongoContainer() {
@@ -185,8 +185,8 @@ public class MongoDbDeleteJacksonSessionVerificationTest {
@Bean
ReactiveMongoOperations mongoOperations(MongoDBContainer mongoContainer) {
MongoClient mongo = MongoClients.create(
"mongodb://" + mongoContainer.getContainerIpAddress() + ":" + mongoContainer.getFirstMappedPort());
MongoClient mongo = MongoClients
.create("mongodb://" + mongoContainer.getHost() + ":" + mongoContainer.getFirstMappedPort());
return new ReactiveMongoTemplate(mongo, "DB_Name_DeleteJacksonSessionVerificationTest");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -170,7 +170,7 @@ public class MongoDbLogoutVerificationTest {
@EnableMongoWebSession
static class Config {
private static final String DOCKER_IMAGE = "mongo:4.0.10";
private static final String DOCKER_IMAGE = "mongo:4.4.1";
@Bean(initMethod = "start", destroyMethod = "stop")
MongoDBContainer mongoContainer() {
@@ -180,8 +180,8 @@ public class MongoDbLogoutVerificationTest {
@Bean
ReactiveMongoOperations mongoOperations(MongoDBContainer mongoContainer) {
MongoClient mongo = MongoClients.create(
"mongodb://" + mongoContainer.getContainerIpAddress() + ":" + mongoContainer.getFirstMappedPort());
MongoClient mongo = MongoClients
.create("mongodb://" + mongoContainer.getHost() + ":" + mongoContainer.getFirstMappedPort());
return new ReactiveMongoTemplate(mongo, "test");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2022 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.
@@ -39,10 +39,17 @@ import org.springframework.session.Session;
public class MongoSession implements Session {
/**
* Mongo doesn't support {@literal dot} in field names. We replace it with a very
* rarely used character
* Mongo doesn't support {@literal dot} in field names. We replace it with a unicode
* character from the Private Use Area.
* <p>
* NOTE: This was originally stored in unicode format. Delomboking the code caused it
* to get converted to another encoding, which isn't supported on all systems, so we
* migrated back to unicode. The same character is being represented ensuring binary
* compatibility.
*
* See https://www.compart.com/en/unicode/U+F607
*/
private static final char DOT_COVER_CHAR = '';
private static final char DOT_COVER_CHAR = '\uF607';
private String id;

View File

@@ -15,7 +15,7 @@ dependencies {
testImplementation "org.mockito:mockito-core"
testImplementation "org.springframework:spring-test"
testImplementation "io.projectreactor:reactor-test"
testImplementation "javax.servlet:javax.servlet-api"
testImplementation "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.springframework:spring-web"
testImplementation "org.springframework.security:spring-security-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -29,7 +29,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
*/
public abstract class AbstractRedisITests {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
protected static class BaseConfig {
@@ -42,8 +42,8 @@ public abstract class AbstractRedisITests {
@Bean
public LettuceConnectionFactory redisConnectionFactory() {
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(
redisContainer().getContainerIpAddress(), redisContainer().getFirstMappedPort());
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(redisContainer().getHost(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(configuration);
}

View File

@@ -527,6 +527,30 @@ class RedisIndexedSessionRepositoryITests extends AbstractRedisITests {
assertThat(findByPrincipalName.keySet()).containsOnly(changeSessionId);
}
@Test // gh-1987
void changeSessionIdWhenPrincipalNameChangesFromNullThenIndexShouldNotBeCreated() {
String principalName = null;
String principalNameChanged = "findByChangedPrincipalName" + UUID.randomUUID();
RedisSession toSave = this.repository.createSession();
toSave.setAttribute(INDEX_NAME, principalName);
this.repository.save(toSave);
RedisSession findById = this.repository.findById(toSave.getId());
String changeSessionId = findById.changeSessionId();
findById.setAttribute(INDEX_NAME, principalNameChanged);
this.repository.save(findById);
Map<String, RedisSession> findByPrincipalName = this.repository.findByIndexNameAndIndexValue(INDEX_NAME,
principalName);
assertThat(findByPrincipalName).isEmpty();
findByPrincipalName = this.repository.findByIndexNameAndIndexValue(INDEX_NAME, principalNameChanged);
assertThat(findByPrincipalName).hasSize(1);
assertThat(findByPrincipalName.keySet()).containsOnly(changeSessionId);
}
@Test
void changeSessionIdWhenOnlyChangeId() {
String attrName = "changeSessionId";

View File

@@ -858,11 +858,13 @@ public class RedisIndexedSessionRepository
catch (NonTransientDataAccessException ex) {
handleErrNoSuchKeyError(ex);
}
String originalPrincipalRedisKey = getPrincipalKey(this.originalPrincipalName);
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
.remove(this.originalSessionId);
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
.add(sessionId);
if (this.originalPrincipalName != null) {
String originalPrincipalRedisKey = getPrincipalKey(this.originalPrincipalName);
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
.remove(this.originalSessionId);
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
.add(sessionId);
}
}
this.originalSessionId = sessionId;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2020 the original author or authors.
* Copyright 2014-2022 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.
@@ -42,7 +42,10 @@ import org.springframework.util.Assert;
*/
public class RedisSessionRepository implements SessionRepository<RedisSessionRepository.RedisSession> {
private static final String DEFAULT_KEY_NAMESPACE = "spring:session";
/**
* The default namespace for each key and channel in Redis used by Spring Session.
*/
public static final String DEFAULT_KEY_NAMESPACE = "spring:session";
private final RedisOperations<String, Object> sessionRedisOperations;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -23,11 +23,14 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -50,6 +53,15 @@ public class RedisHttpSessionConfigurationClassPathXmlApplicationContextTests {
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -21,12 +21,17 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.session.data.redis.config.ConfigureRedisAction;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -52,7 +57,20 @@ class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests {
@Bean
RedisConnectionFactory redisConnectionFactory() {
return mock(RedisConnectionFactory.class);
RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
RedisConnection connection = mock(RedisConnection.class);
given(redisConnectionFactory.getConnection()).willReturn(connection);
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return redisConnectionFactory;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations;
@@ -34,8 +35,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -76,6 +79,15 @@ class RedisHttpSessionConfigurationOverrideDefaultSerializerTests {
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -27,8 +27,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.scheduling.SchedulingAwareRunnable;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
@@ -36,6 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -57,7 +58,7 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
@Test
void overrideSessionTaskExecutor() {
verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(Runnable.class));
}
@EnableRedisHttpSession
@@ -66,7 +67,13 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
@Bean
Executor springSessionRedisTaskExecutor() {
return mock(Executor.class);
Executor executor = mock(Executor.class);
willAnswer((it) -> {
Runnable r = it.getArgument(0);
new Thread(r).start();
return null;
}).given(executor).execute(any());
return executor;
}
@Bean
@@ -76,6 +83,15 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -27,8 +27,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.scheduling.SchedulingAwareRunnable;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
@@ -36,6 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
@@ -62,7 +63,7 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
@Test
void overrideSessionTaskExecutors() {
verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(Runnable.class));
verify(this.springSessionRedisTaskExecutor, never()).execute(any(Runnable.class));
}
@@ -72,12 +73,24 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
@Bean
Executor springSessionRedisTaskExecutor() {
return mock(Executor.class);
Executor executor = mock(Executor.class);
willAnswer((it) -> {
Runnable r = it.getArgument(0);
new Thread(r).start();
return null;
}).given(executor).execute(any());
return executor;
}
@Bean
Executor springSessionRedisSubscriptionExecutor() {
return mock(Executor.class);
Executor executor = mock(Executor.class);
willAnswer((it) -> {
Runnable r = it.getArgument(0);
new Thread(r).start();
return null;
}).given(executor).execute(any());
return executor;
}
@Bean
@@ -87,6 +100,15 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -32,6 +32,7 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.mock.env.MockEnvironment;
@@ -47,8 +48,9 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -264,11 +266,24 @@ class RedisHttpSessionConfigurationTests {
}
private static RedisConnectionFactory mockRedisConnectionFactory() {
RedisConnectionFactory connectionFactory = mock(RedisConnectionFactory.class);
RedisConnection connection = mock(RedisConnection.class);
given(connectionFactory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
return connectionFactory;
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
RedisConnection connectionMock = mock(RedisConnection.class);
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
Properties keyspaceEventsConfig = new Properties();
keyspaceEventsConfig.put("notify-keyspace-events", "KEA");
given(connectionMock.getConfig("notify-keyspace-events")).willReturn(keyspaceEventsConfig);
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connectionMock).pSubscribe(any(), any());
return connectionFactoryMock;
}
@Configuration
@@ -445,7 +460,7 @@ class RedisHttpSessionConfigurationTests {
@Bean
RedisMessageListenerContainer redisMessageListenerContainer() {
return new RedisMessageListenerContainer();
return mock(RedisMessageListenerContainer.class);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -23,12 +23,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
@ExtendWith(SpringExtension.class)
@@ -46,6 +49,15 @@ public class RedisHttpSessionConfigurationXmlCustomExpireTests {
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -23,12 +23,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
@ExtendWith(SpringExtension.class)
@@ -46,6 +49,15 @@ public class RedisHttpSessionConfigurationXmlTests {
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.session.data.redis.RedisIndexedSessionRepository;
import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration;
@@ -33,8 +34,10 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -75,6 +78,14 @@ class Gh109Tests {
RedisConnection connection = mock(RedisConnection.class);
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -9,8 +9,8 @@ content:
- url: https://github.com/spring-io/spring-generated-docs
branches: [spring-projects/spring-session/*]
- url: https://github.com/spring-projects/spring-session
branches: [main,3.0.x]
tags: ['2.6.*','!2.6.0-M*','!2.6.0-RC*']
branches: [main,3.0.x,2.6.x]
tags: [ '3.0.*', '2.7.*', '2.6.*','!2.6.0-M*','!2.6.0-RC*','!2.7.0-M1','!3.0.0-M1']
start_path: spring-session-docs
urls:
latest_version_segment_strategy: redirect:to
@@ -21,7 +21,7 @@ ui:
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
snapshot: true
pipeline:
antora:
extensions:
- require: ./antora/extensions/version-fix.js
- require: ./antora/extensions/major-minor-segment.js
- require: ./antora/extensions/root-component-name.js

View File

@@ -1,2 +1,2 @@
name: ROOT
version: '2.6.1'
version: '2.7.1'

View File

@@ -3,8 +3,8 @@
const { posix: path } = require('path')
module.exports.register = (pipeline, { config }) => {
pipeline.on('contentClassified', ({ contentCatalog }) => {
module.exports.register = function({ config }) {
this.on('contentClassified', ({ contentCatalog }) => {
contentCatalog.getComponents().forEach(component => {
const componentName = component.name;
const generationToVersion = new Map();
@@ -91,6 +91,7 @@ function createSymbolicVersionAlias (component, version, symbolicVersionSegment,
function computeOut (src, family, version, htmlUrlExtensionStyle) {
let { component, module: module_, basename, extname, relative, stem } = src
if (component === 'ROOT') component = ''
if (module_ === 'ROOT') module_ = ''
let indexifyPathSegment = ''
let familyPathSegment = ''
@@ -120,8 +121,11 @@ function computePub (src, out, family, version, htmlUrlExtensionStyle) {
const pub = {}
let url
if (family === 'nav') {
const urlSegments = version ? [src.component, version] : [src.component]
if (src.module && src.module !== 'ROOT') urlSegments.push(src.module)
const component = src.component || 'ROOT'
const urlSegments = component === 'ROOT' ? [] : [component]
if (version) urlSegments.push(version)
const module_ = src.module || 'ROOT'
if (module_ !== 'ROOT') urlSegments.push(module_)
// an artificial URL used for resolving page references in navigation model
url = '/' + urlSegments.join('/') + '/'
pub.moduleRootPath = '.'
@@ -197,4 +201,4 @@ function no_data(key, value) {
return value ? "__data__" : value;
}
return value;
}
}

View File

@@ -1,40 +0,0 @@
// https://gitlab.com/antora/antora/-/issues/132#note_712132072
'use strict'
const { posix: path } = require('path')
module.exports.register = (pipeline, { config }) => {
pipeline.on('contentClassified', ({ contentCatalog }) => {
const rootComponentName = config.rootComponentName || 'ROOT'
const rootComponentNameLength = rootComponentName.length
contentCatalog.findBy({ component: rootComponentName }).forEach((file) => {
if (file.out) {
file.out.dirname = file.out.dirname.substr(rootComponentNameLength)
file.out.path = file.out.path.substr(rootComponentNameLength + 1)
file.out.rootPath = fixPath(file.out.rootPath)
}
if (file.pub) {
file.pub.url = file.pub.url.substr(rootComponentNameLength + 1)
if (file.pub.rootPath) {
file.pub.rootPath = fixPath(file.pub.rootPath)
}
}
if (file.rel) {
if (file.rel.pub) {
file.rel.pub.url = file.rel.pub.url.substr(rootComponentNameLength + 1)
file.rel.pub.rootPath = fixPath(file.rel.pub.rootPath);
}
}
})
const rootComponent = contentCatalog.getComponent(rootComponentName)
rootComponent?.versions?.forEach((version) => {
version.url = version.url.substr(rootComponentName.length + 1)
})
// const siteStartPage = contentCatalog.getById({ component: '', version: '', module: '', family: 'alias', relative: 'index.adoc' })
// if (siteStartPage) delete siteStartPage.out
})
function fixPath(path) {
return path.split('/').slice(1).join('/') || '.'
}
}

View File

@@ -0,0 +1,15 @@
'use strict'
module.exports.register = function({ config }) {
this.on('contentAggregated', ({ contentAggregate }) => {
contentAggregate.forEach(aggregate => {
if (aggregate.version === "2.6.2" &&
aggregate.prerelease == "-SNAPSHOT") {
aggregate.version = "2.6.2"
aggregate.displayVersion = `${aggregate.version}`
delete aggregate.prerelease
}
})
})
}

View File

@@ -20,7 +20,7 @@ ui:
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
snapshot: true
pipeline:
antora:
extensions:
- require: ./antora/extensions/version-fix.js
- require: ./antora/extensions/major-minor-segment.js
- require: ./antora/extensions/root-component-name.js

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -20,7 +20,9 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.session.Session;
import org.springframework.session.web.http.SessionRepositoryFilter;
import org.springframework.test.context.ContextConfiguration;
@@ -28,6 +30,9 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -47,7 +52,20 @@ public class HttpSessionConfigurationNoOpConfigureRedisActionXmlTests {
}
static RedisConnectionFactory connectionFactory() {
return mock(RedisConnectionFactory.class);
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
RedisConnection connectionMock = mock(RedisConnection.class);
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connectionMock).pSubscribe(any(), any());
return connectionFactoryMock;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -21,13 +21,18 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.session.data.redis.config.ConfigureRedisAction;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -55,7 +60,20 @@ class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests {
@Bean
RedisConnectionFactory redisConnectionFactory() {
return mock(RedisConnectionFactory.class);
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
RedisConnection connectionMock = mock(RedisConnection.class);
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connectionMock).pSubscribe(any(), any());
return connectionFactoryMock;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -26,6 +26,7 @@ import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationListener;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.SubscriptionListener;
import org.springframework.security.core.session.SessionDestroyedEvent;
import org.springframework.session.MapSession;
import org.springframework.session.Session;
@@ -33,8 +34,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -67,6 +70,15 @@ public abstract class AbstractHttpSessionListenerTests {
given(factory.getConnection()).willReturn(connection);
given(connection.getConfig(anyString())).willReturn(new Properties());
willAnswer((it) -> {
SubscriptionListener listener = it.getArgument(0);
listener.onPatternSubscribed(it.getArgument(1), 0);
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
return null;
}).given(connection).pSubscribe(any(), any());
return factory;
}

View File

@@ -100,7 +100,7 @@ Spring Session provides `PrincipalNameExtractor` for this purpose.
is not set, Hazelcast will serialize sessions using native Java serialization.
<4> We create a `HazelcastInstance` that connects Spring Session to Hazelcast.
By default, the application starts and connects to an embedded instance of Hazelcast.
For more information on configuring Hazelcast, see the https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#hazelcast-configuration[reference documentation].
For more information on configuring Hazelcast, see the https://docs.hazelcast.com/hazelcast/latest/[reference documentation].
====
NOTE: If `HazelcastSessionSerializer` is preferred, it needs to be configured for all Hazelcast cluster members before they start.
@@ -161,7 +161,7 @@ $ ./gradlew :spring-session-sample-javaconfig-hazelcast:tomcatRun
====
NOTE: By default, Hazelcast runs in embedded mode with your application.
However, if you want to connect to a standalone instance instead, you can configure it by following the instructions in the https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#hazelcast-configuration[reference documentation].
However, if you want to connect to a standalone instance instead, you can configure it by following the instructions in the https://docs.hazelcast.com/hazelcast/latest/getting-started/get-started-cli[reference documentation].
You should now be able to access the application at http://localhost:8080/
@@ -188,9 +188,9 @@ You can view the cookies (with https://developers.google.com/web/tools/chrome-de
=== Interacting with the Data Store
You can remove the session by using https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#hazelcast-java-client[a Java client],
https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#other-client-implementations[one of the other clients], or the
https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#management-center[management center].
You can remove the session by using https://docs.hazelcast.com/hazelcast/latest/clients/java[a Java client],
https://hazelcast.com/clients/[one of the other clients], or the
https://docs.hazelcast.com/management-center/latest/getting-started/overview[management center].
==== Using the Console
@@ -203,7 +203,7 @@ For example, to remove the session by using the management center console after
----
====
TIP: The Hazelcast documentation has instructions for https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#executing-console-commands[the console].
TIP: The Hazelcast documentation has instructions for https://docs.hazelcast.com/hazelcast/latest/clients/clc[the console].
Alternatively, you can also delete the explicit key. Enter the following into the console, being sure to replace `7e8383a4-082c-4ffe-a4bc-c40fd3363c5e` with the value of your `SESSION` cookie:
@@ -218,7 +218,7 @@ Now visit the application at http://localhost:8080/ and observe that we are no l
==== Using the REST API
As described in the section of the documentation that cover other clients, there is a
https://docs.hazelcast.org/docs/{hazelcast-version}/manual/html-single/index.html#rest-client[REST API]
https://docs.hazelcast.com/hazelcast/latest/clients/rest[REST API]
provided by the Hazelcast node(s).
For example, you could delete an individual key as follows (being sure to replace `7e8383a4-082c-4ffe-a4bc-c40fd3363c5e` with the value of your SESSION cookie):

View File

@@ -55,7 +55,10 @@ Spring Session is Open Source software released under the https://www.apache.org
| Name | Location
| Spring Session Infinispan
| https://infinispan.org/infinispan-spring-boot/master/spring_boot_starter.html#_enabling_spring_session_support
| https://infinispan.org/docs/stable/titles/spring/spring.html
| Spring Session Caffeine
| https://github.com/gotson/spring-session-caffeine
|===

View File

@@ -22,13 +22,13 @@ dependencies {
testImplementation 'org.assertj:assertj-core'
testImplementation 'com.hazelcast:hazelcast'
testImplementation 'io.lettuce:lettuce-core'
testImplementation 'javax.servlet:javax.servlet-api'
testImplementation 'jakarta.servlet:jakarta.servlet-api'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
antora {
antoraVersion = "3.0.0-alpha.8"
antoraVersion = "3.0.1"
arguments = ["--fetch"]
}

View File

@@ -21,11 +21,11 @@ artifacts {
dependencies {
api project(':spring-session-core')
optional "com.hazelcast:hazelcast:4.2.3"
optional "com.hazelcast:hazelcast:4.2.4"
api "org.springframework:spring-context"
api "javax.annotation:javax.annotation-api"
api "jakarta.annotation:jakarta.annotation-api"
testImplementation "javax.servlet:javax.servlet-api"
testImplementation "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.mockito:mockito-core"
testImplementation "org.springframework:spring-test"
@@ -35,7 +35,7 @@ dependencies {
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
integrationTestCompile "org.testcontainers:testcontainers"
integrationTestCompile "com.hazelcast:hazelcast:4.2.3"
integrationTestCompile "com.hazelcast:hazelcast:4.2.4"
integrationTestCompile project(":spring-session-hazelcast")
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2022 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.
@@ -45,7 +45,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
@WebAppConfiguration
class ClientServerHazelcast4IndexedSessionRepositoryITests extends AbstractHazelcast4IndexedSessionRepositoryITests {
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:4.2.2")
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:4.2.4")
.withExposedPorts(5701).withCopyFileToContainer(MountableFile.forClasspathResource("/hazelcast-server.xml"),
"/opt/hazelcast/hazelcast.xml");
@@ -66,8 +66,7 @@ class ClientServerHazelcast4IndexedSessionRepositoryITests extends AbstractHazel
@Bean
HazelcastInstance hazelcastInstance() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig()
.addAddress(container.getContainerIpAddress() + ":" + container.getFirstMappedPort());
clientConfig.getNetworkConfig().addAddress(container.getHost() + ":" + container.getFirstMappedPort());
clientConfig.getUserCodeDeploymentConfig().setEnabled(true).addClass(Session.class)
.addClass(MapSession.class).addClass(Hazelcast4SessionUpdateEntryProcessor.class);
return HazelcastClient.newHazelcastClient(clientConfig);

View File

@@ -7,13 +7,13 @@ configurations {
dependencies {
api project(':spring-session-core')
api "com.hazelcast:hazelcast"
api "javax.annotation:javax.annotation-api"
api "jakarta.annotation:jakarta.annotation-api"
api "org.springframework:spring-context"
hazelcast4(project(path: ":hazelcast4", configuration: 'classesOnlyElements'))
compileOnly(project(":hazelcast4"))
testImplementation "javax.servlet:javax.servlet-api"
testImplementation "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.mockito:mockito-core"
testImplementation "org.springframework:spring-test"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -67,8 +67,7 @@ class ClientServerHazelcastIndexedSessionRepositoryITests extends AbstractHazelc
@Bean
HazelcastInstance hazelcastInstance() {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig()
.addAddress(container.getContainerIpAddress() + ":" + container.getFirstMappedPort());
clientConfig.getNetworkConfig().addAddress(container.getHost() + ":" + container.getFirstMappedPort());
clientConfig.getUserCodeDeploymentConfig().setEnabled(true).addClass(Session.class)
.addClass(MapSession.class).addClass(SessionUpdateEntryProcessor.class);
return HazelcastClient.newHazelcastClient(clientConfig);

View File

@@ -7,7 +7,7 @@ dependencies {
api "org.springframework:spring-context"
api "org.springframework:spring-jdbc"
testImplementation "javax.servlet:javax.servlet-api"
testImplementation "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.mockito:mockito-core"
testImplementation "org.springframework:spring-test"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2022 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.
@@ -16,8 +16,6 @@
package org.springframework.session.jdbc;
import java.time.Duration;
import org.testcontainers.containers.Db2Container;
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.MSSQLServerContainer;
@@ -25,7 +23,6 @@ import org.testcontainers.containers.MariaDBContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.OracleContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
/**
* Factories for various {@link JdbcDatabaseContainer}s.
@@ -42,33 +39,19 @@ final class DatabaseContainers {
}
static MariaDBContainer<?> mariaDb() {
return new MariaDBContainer<>("mariadb:10.6.4");
return new MariaDBContainer<>("mariadb:10.7.3");
}
static MySQLContainer<?> mySql() {
return new MySQLContainer<>("mysql:8.0.27");
return new MySQLContainer<>("mysql:8.0.28");
}
static OracleContainer oracle() {
return new OracleContainer() {
@Override
protected void configure() {
this.waitStrategy = new LogMessageWaitStrategy().withRegEx(".*DATABASE IS READY TO USE!.*\\s")
.withStartupTimeout(Duration.ofMinutes(10));
addEnv("ORACLE_PWD", getPassword());
}
@Override
protected void waitUntilContainerStarted() {
getWaitStrategy().waitUntilReady(this);
}
};
return new OracleContainer("gvenzl/oracle-xe:18.4.0-slim");
}
static PostgreSQLContainer<?> postgreSql() {
return new PostgreSQLContainer<>("postgres:14.0");
return new PostgreSQLContainer<>("postgres:14.2");
}
static MSSQLServerContainer<?> sqlServer() {

View File

@@ -728,7 +728,8 @@ public class JdbcIndexedSessionRepository
T attributeValue = supplier.get();
if (attributeValue != null
&& JdbcIndexedSessionRepository.this.saveMode.equals(SaveMode.ON_GET_ATTRIBUTE)) {
this.delta.put(attributeName, DeltaValue.UPDATED);
this.delta.merge(attributeName, DeltaValue.UPDATED, (oldDeltaValue,
deltaValue) -> (oldDeltaValue == DeltaValue.ADDED) ? oldDeltaValue : deltaValue);
}
return attributeValue;
}

View File

@@ -655,6 +655,20 @@ class JdbcIndexedSessionRepositoryTests {
verifyNoMoreInteractions(this.jdbcOperations);
}
@Test
void saveWithSaveModeOnGetAttributeAndNewAttributeSetAndGet() {
this.repository.setSaveMode(SaveMode.ON_GET_ATTRIBUTE);
MapSession delegate = new MapSession();
delegate.setAttribute("attribute1", (Supplier<String>) () -> "value1");
JdbcSession session = this.repository.new JdbcSession(delegate, UUID.randomUUID().toString(), false);
session.setAttribute("attribute2", "value2");
session.getAttribute("attribute2");
this.repository.save(session);
verify(this.jdbcOperations, times(1)).update(startsWith("INSERT INTO SPRING_SESSION_ATTRIBUTES ("),
isA(PreparedStatementSetter.class));
verifyNoMoreInteractions(this.jdbcOperations);
}
@Test
void saveWithSaveModeAlways() {
this.repository.setSaveMode(SaveMode.ALWAYS);

View File

@@ -1,17 +1,17 @@
dependencyManagement {
imports {
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.0'
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.2.20220328'
}
dependencies {
dependency 'ch.qos.logback:logback-classic:1.2.9'
dependency 'com.maxmind.geoip2:geoip2:2.15.0'
dependency 'ch.qos.logback:logback-classic:1.2.11'
dependency 'com.maxmind.geoip2:geoip2:2.16.1'
dependency 'javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.2'
dependency 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.3'
dependency 'org.apache.taglibs:taglibs-standard-jstlel:1.2.5'
dependency 'org.seleniumhq.selenium:htmlunit-driver:2.52.0'
dependency 'org.slf4j:jcl-over-slf4j:1.7.32'
dependency 'org.slf4j:log4j-over-slf4j:1.7.32'
dependency 'org.seleniumhq.selenium:htmlunit-driver:3.61.0'
dependency 'org.slf4j:jcl-over-slf4j:1.7.36'
dependency 'org.slf4j:log4j-over-slf4j:1.7.36'
dependency 'org.webjars:bootstrap:2.3.2'
dependency 'org.webjars:html5shiv:3.7.3-1'
dependency 'org.webjars:jquery:3.6.0'

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -46,7 +46,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
class FindByUsernameTests {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Autowired
private MockMvc mockMvc;
@@ -115,8 +115,7 @@ class FindByUsernameTests {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -7,7 +7,7 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
implementation "org.springframework.boot:spring-boot-starter-security"
implementation "com.hazelcast:hazelcast:4.2.3"
implementation "com.hazelcast:hazelcast:4.2.4"
implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
implementation "org.webjars:bootstrap"
implementation "org.webjars:html5shiv"

View File

@@ -2,3 +2,7 @@ logging:
level:
org.springframework.data.mongodb: DEBUG
org.springframework.session: DEBUG
spring:
mongodb:
embedded:
version: 3.4.3

View File

@@ -1,3 +1,4 @@
spring.thymeleaf.cache=false
spring.template.cache=false
spring.data.mongodb.port=0
spring.mongodb.embedded.version=3.4.3

View File

@@ -1,4 +1,4 @@
<html xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect" layout:decorator="layout">
<html xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect" layout:decorate="layout">
<head>
<title>Secured Content</title>
</head>

View File

@@ -3,7 +3,7 @@
xmlns:th="https://www.thymeleaf.org"
xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect">
<head>
<title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE">Spring Session Sample</title>
<title layout:title-pattern="$LAYOUT_TITLE - $CONTENT_TITLE">Spring Session Sample</title>
<link rel="icon" type="image/x-icon" th:href="@{/resources/img/favicon.ico}" href="../static/img/favicon.ico"/>
<link th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet"></link>
<style type="text/css">

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@AutoConfigureMockMvc
class HttpRedisJsonTest {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Autowired
private MockMvc mockMvc;
@@ -115,8 +115,7 @@ class HttpRedisJsonTest {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
class RedisSerializerTest {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@SpringSessionRedisOperations
private RedisTemplate<Object, Object> sessionRedisTemplate;
@@ -64,8 +64,7 @@ class RedisSerializerTest {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -41,7 +41,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
class BootTests {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Autowired
private MockMvc mockMvc;
@@ -93,8 +93,7 @@ class BootTests {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -45,7 +45,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
class BootTests {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Autowired
private MockMvc mockMvc;
@@ -97,8 +97,7 @@ class BootTests {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2020 the original author or authors.
* Copyright 2014-2022 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.
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
class AttributeTests {
private static final String DOCKER_IMAGE = "redis:5.0.9";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@LocalServerPort
private int port;
@@ -103,8 +103,7 @@ class AttributeTests {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
class AttributeTests {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@LocalServerPort
private int port;
@@ -105,8 +105,7 @@ class AttributeTests {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
class ApplicationTests {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Value("${local.server.port}")
private String port;
@@ -86,8 +86,7 @@ class ApplicationTests {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -38,7 +38,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
*
* @author Rob Winch
*/
@Entity
@Entity(name = "custom_user")
public class User implements Serializable {
@Id

View File

@@ -1,5 +1,5 @@
insert into user(id,email,password,first_name,last_name) values (0,'rob','password','Rob','Winch');
insert into user(id,email,password,first_name,last_name) values (1,'luke','password','Luke','Taylor');
insert into user(id,email,password,first_name,last_name) values (2,'eve','password','Luke','Taylor');
insert into custom_user(id,email,password,first_name,last_name) values (0,'rob','password','Rob','Winch');
insert into custom_user(id,email,password,first_name,last_name) values (1,'luke','password','Luke','Taylor');
insert into custom_user(id,email,password,first_name,last_name) values (2,'eve','password','Luke','Taylor');
update user set password = '$2a$10$FBAKClV1zBIOOC9XMXf3AO8RoGXYVYsfvUdoLxGkd/BnXEn4tqT3u';
update custom_user set password = '$2a$10$FBAKClV1zBIOOC9XMXf3AO8RoGXYVYsfvUdoLxGkd/BnXEn4tqT3u';

View File

@@ -17,7 +17,7 @@ dependencies {
implementation "ch.qos.logback:logback-classic"
implementation "org.testcontainers:testcontainers"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
@Profile("embedded-redis")
public class EmbeddedRedisConfig {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Bean
public GenericContainer redisContainer() {
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
@Bean
@Primary
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -19,7 +19,7 @@ dependencies {
implementation "org.slf4j:log4j-over-slf4j"
implementation "ch.qos.logback:logback-classic"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api"
testImplementation "org.assertj:assertj-core"

View File

@@ -16,7 +16,7 @@ dependencies {
implementation "org.slf4j:log4j-over-slf4j"
implementation "ch.qos.logback:logback-classic"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"

View File

@@ -17,7 +17,7 @@ dependencies {
implementation "ch.qos.logback:logback-classic"
implementation "org.testcontainers:testcontainers"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
@Profile("embedded-redis")
public class EmbeddedRedisConfig {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Bean
public GenericContainer redisContainer() {
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
@Bean
@Primary
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -18,7 +18,7 @@ dependencies {
implementation "ch.qos.logback:logback-classic"
implementation "org.testcontainers:testcontainers"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.springframework.security:spring-security-test"
testImplementation "org.assertj:assertj-core"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -53,7 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@WebAppConfiguration
class RestMockMvcTests {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Autowired
private SessionRepositoryFilter<? extends Session> sessionRepositoryFilter;
@@ -99,8 +99,7 @@ class RestMockMvcTests {
@Bean
LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
@Profile("embedded-redis")
public class EmbeddedRedisConfig {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Bean
public GenericContainer redisContainer() {
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
@Bean
@Primary
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -19,7 +19,7 @@ dependencies {
implementation "ch.qos.logback:logback-classic"
implementation "org.testcontainers:testcontainers"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api"
testImplementation "org.assertj:assertj-core"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
@Profile("embedded-redis")
public class EmbeddedRedisConfig {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Bean
public GenericContainer redisContainer() {
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
@Bean
@Primary
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}

View File

@@ -15,7 +15,7 @@ dependencies {
implementation "org.slf4j:log4j-over-slf4j"
implementation "ch.qos.logback:logback-classic"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"

View File

@@ -16,7 +16,7 @@ dependencies {
implementation "org.slf4j:log4j-over-slf4j"
implementation "ch.qos.logback:logback-classic"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"

View File

@@ -17,7 +17,7 @@ dependencies {
implementation "ch.qos.logback:logback-classic"
implementation "org.testcontainers:testcontainers"
providedCompile "javax.servlet:javax.servlet-api"
providedCompile "jakarta.servlet:jakarta.servlet-api"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2022 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.
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
@Profile("embedded-redis")
public class EmbeddedRedisConfig {
private static final String DOCKER_IMAGE = "redis:5.0.10";
private static final String DOCKER_IMAGE = "redis:5.0.14";
@Bean
public GenericContainer redisContainer() {
@@ -40,8 +40,7 @@ public class EmbeddedRedisConfig {
@Bean
@Primary
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
return new LettuceConnectionFactory(redisContainer().getHost(), redisContainer().getFirstMappedPort());
}
}