Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76279cd9ba | ||
|
|
de1f2fc60e | ||
|
|
f96e05dc47 | ||
|
|
519413d5ae | ||
|
|
2ea90c5aff | ||
|
|
2eb236208a | ||
|
|
106dd9f772 | ||
|
|
86e584e1c5 | ||
|
|
c707c17bea | ||
|
|
7f1a777767 | ||
|
|
24fc8d94c4 | ||
|
|
b6b99e9ffd | ||
|
|
b1b10614ea | ||
|
|
5f7b4266d8 | ||
|
|
8e71132a15 | ||
|
|
c37237ae98 | ||
|
|
12ab0029f5 | ||
|
|
1b4fb13d4d | ||
|
|
21be7aac9c | ||
|
|
67f4850024 | ||
|
|
a92abcb26f | ||
|
|
041fb222f9 | ||
|
|
dc951435d4 | ||
|
|
e9243ceb59 | ||
|
|
8fb54ac1e0 | ||
|
|
b0558c1fd2 | ||
|
|
f570c2065b | ||
|
|
eed2ff195a | ||
|
|
c467a7d656 | ||
|
|
b9618fe6b3 | ||
|
|
625833f1fe | ||
|
|
f1eee1e7a4 | ||
|
|
a2ee77c62e | ||
|
|
3c77d76cee | ||
|
|
6a8d2f4d88 | ||
|
|
4c63faece1 | ||
|
|
e2a7e71ae3 | ||
|
|
66f81daa20 | ||
|
|
829b62bd19 | ||
|
|
b7209f8330 | ||
|
|
645e525b84 | ||
|
|
ba4bb6fcf6 | ||
|
|
f224d571f0 | ||
|
|
3ba76d0375 | ||
|
|
eb29949996 | ||
|
|
02a990d00e | ||
|
|
56809eacb2 | ||
|
|
4ff8f73b84 | ||
|
|
0ad389633e | ||
|
|
5a9046e391 | ||
|
|
690f734307 | ||
|
|
823e323f68 | ||
|
|
444b5ad85a | ||
|
|
b4a8c7e516 |
@@ -1,16 +1,19 @@
|
||||
name: CI
|
||||
name: 2.4.x CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 2.4.x
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # Once per day at 10am UTC
|
||||
- cron: '4 10 * * *' # Once per day at 10:04am UTC
|
||||
workflow_dispatch: # Manual trigger
|
||||
|
||||
env:
|
||||
GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
||||
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
||||
GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
||||
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -22,6 +25,8 @@ jobs:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: '2.4.x'
|
||||
- name: Set up JDK ${{ matrix.jdk }}
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
@@ -37,13 +42,15 @@ jobs:
|
||||
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
||||
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
||||
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
||||
./gradlew clean build --no-daemon --stacktrace
|
||||
./gradlew clean build -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" --no-daemon --stacktrace
|
||||
artifacts:
|
||||
name: Deploy Artifacts
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: '2.4.x'
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
@@ -71,6 +78,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: '2.4.x'
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
@@ -4,7 +4,7 @@ buildscript {
|
||||
snapshotBuild = version.endsWith('SNAPSHOT')
|
||||
milestoneBuild = !(releaseBuild || snapshotBuild)
|
||||
|
||||
springBootVersion = '2.4.0-M4'
|
||||
springBootVersion = '2.4.11'
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -14,7 +14,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.spring.gradle:spring-build-conventions:0.0.34.RELEASE'
|
||||
classpath 'io.spring.gradle:spring-build-conventions:0.0.37'
|
||||
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
version=2.4.2-SNAPSHOT
|
||||
version=2.4.6
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'io.projectreactor:reactor-bom:2020.0.0'
|
||||
mavenBom 'org.junit:junit-bom:5.7.0'
|
||||
mavenBom 'org.springframework:spring-framework-bom:5.3.0'
|
||||
mavenBom 'org.springframework.data:spring-data-bom:2020.0.0'
|
||||
mavenBom 'org.springframework.security:spring-security-bom:5.4.1'
|
||||
mavenBom 'org.testcontainers:testcontainers-bom:1.14.3'
|
||||
mavenBom 'io.projectreactor:reactor-bom:2020.0.12'
|
||||
mavenBom 'org.junit:junit-bom:5.7.2'
|
||||
mavenBom 'org.springframework:spring-framework-bom:5.3.11'
|
||||
mavenBom 'org.springframework.data:spring-data-bom:2020.0.14'
|
||||
mavenBom 'org.springframework.security:spring-security-bom:5.4.9'
|
||||
mavenBom 'org.testcontainers:testcontainers-bom:1.15.3'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
dependencySet(group: 'com.hazelcast', version: '3.12.10') {
|
||||
dependencySet(group: 'com.hazelcast', version: '3.12.12') {
|
||||
entry 'hazelcast'
|
||||
entry 'hazelcast-client'
|
||||
}
|
||||
|
||||
dependency 'org.aspectj:aspectjweaver:1.9.6'
|
||||
dependency 'org.aspectj:aspectjweaver:1.9.7'
|
||||
dependency 'com.h2database:h2:1.4.200'
|
||||
dependency 'com.ibm.db2:jcc:11.5.0.0'
|
||||
dependency 'com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8'
|
||||
dependency 'com.oracle.database.jdbc:ojdbc8:19.8.0.0'
|
||||
dependency 'com.zaxxer:HikariCP:3.4.5'
|
||||
dependency 'edu.umd.cs.mtc:multithreadedtc:1.01'
|
||||
dependency 'io.lettuce:lettuce-core:6.0.1.RELEASE'
|
||||
dependency 'io.lettuce:lettuce-core:6.0.8.RELEASE'
|
||||
dependency 'javax.annotation:javax.annotation-api:1.3.2'
|
||||
dependency 'javax.servlet:javax.servlet-api:4.0.1'
|
||||
dependency 'junit:junit:4.13.1'
|
||||
dependency 'mysql:mysql-connector-java:8.0.22'
|
||||
dependency 'junit:junit:4.13.2'
|
||||
dependency 'mysql:mysql-connector-java:8.0.25'
|
||||
dependency 'org.apache.derby:derby:10.14.2.0'
|
||||
dependency 'org.assertj:assertj-core:3.18.0'
|
||||
dependency 'org.hsqldb:hsqldb:2.5.1'
|
||||
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.0'
|
||||
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.3'
|
||||
dependency 'org.mockito:mockito-core:3.5.15'
|
||||
dependency 'org.postgresql:postgresql:42.2.18'
|
||||
dependency 'org.postgresql:postgresql:42.2.24'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,6 +309,10 @@ public class SessionRepositoryFilter<S extends Session> extends OncePerRequestFi
|
||||
if (!create) {
|
||||
return null;
|
||||
}
|
||||
if (SessionRepositoryFilter.this.httpSessionIdResolver instanceof CookieHttpSessionIdResolver
|
||||
&& this.response.isCommitted()) {
|
||||
throw new IllegalStateException("Cannot create a session after the response has been committed");
|
||||
}
|
||||
if (SESSION_LOGGER.isDebugEnabled()) {
|
||||
SESSION_LOGGER.debug(
|
||||
"A new session was created. To help you troubleshoot where the session was created we provided a StackTrace (this is not an error). You can prevent this from appearing by disabling DEBUG logging for "
|
||||
|
||||
@@ -62,6 +62,7 @@ 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.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
@@ -423,6 +424,18 @@ class SessionRepositoryFilterTests {
|
||||
assertThat(this.response.getCookie("SESSION")).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void doFilterGetSessionNewWhenResponseCommittedThenException() {
|
||||
assertThatIllegalStateException().isThrownBy(() -> doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
wrappedResponse.getWriter().flush();
|
||||
wrappedRequest.getSession();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Test
|
||||
void doFilterGetSessionNew() throws Exception {
|
||||
doFilter(new DoInFilter() {
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
protected static class BaseConfig {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -54,16 +54,13 @@ abstract class AbstractHazelcast4IndexedSessionRepositoryITests {
|
||||
IMap<String, MapSession> hazelcastMap = this.hazelcastInstance
|
||||
.getMap(Hazelcast4IndexedSessionRepository.DEFAULT_SESSION_MAP_NAME);
|
||||
|
||||
assertThat(hazelcastMap.size()).isEqualTo(0);
|
||||
|
||||
this.repository.save(sessionToSave);
|
||||
|
||||
assertThat(hazelcastMap.size()).isEqualTo(1);
|
||||
assertThat(hazelcastMap.get(sessionId)).isEqualTo(sessionToSave);
|
||||
|
||||
this.repository.deleteById(sessionId);
|
||||
|
||||
assertThat(hazelcastMap.size()).isEqualTo(0);
|
||||
assertThat(hazelcastMap.get(sessionId)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -179,6 +176,8 @@ abstract class AbstractHazelcast4IndexedSessionRepositoryITests {
|
||||
this.repository.save(session);
|
||||
|
||||
assertThat(this.repository.findById(sessionId)).isNotNull();
|
||||
|
||||
this.repository.deleteById(sessionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -195,6 +194,8 @@ abstract class AbstractHazelcast4IndexedSessionRepositoryITests {
|
||||
this.repository.save(session);
|
||||
|
||||
assertThat(this.repository.findById(sessionId)).isNotNull();
|
||||
|
||||
this.repository.deleteById(sessionId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -58,16 +58,13 @@ abstract class AbstractHazelcastIndexedSessionRepositoryITests {
|
||||
IMap<String, MapSession> hazelcastMap = this.hazelcastInstance
|
||||
.getMap(HazelcastIndexedSessionRepository.DEFAULT_SESSION_MAP_NAME);
|
||||
|
||||
assertThat(hazelcastMap.size()).isEqualTo(0);
|
||||
|
||||
this.repository.save(sessionToSave);
|
||||
|
||||
assertThat(hazelcastMap.size()).isEqualTo(1);
|
||||
assertThat(hazelcastMap.get(sessionId)).isEqualTo(sessionToSave);
|
||||
|
||||
this.repository.deleteById(sessionId);
|
||||
|
||||
assertThat(hazelcastMap.size()).isEqualTo(0);
|
||||
assertThat(hazelcastMap.get(sessionId)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -183,6 +180,8 @@ abstract class AbstractHazelcastIndexedSessionRepositoryITests {
|
||||
this.repository.save(session);
|
||||
|
||||
assertThat(this.repository.findById(sessionId)).isNotNull();
|
||||
|
||||
this.repository.deleteById(sessionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -199,6 +198,8 @@ abstract class AbstractHazelcastIndexedSessionRepositoryITests {
|
||||
this.repository.save(session);
|
||||
|
||||
assertThat(this.repository.findById(sessionId)).isNotNull();
|
||||
|
||||
this.repository.deleteById(sessionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -220,6 +221,8 @@ abstract class AbstractHazelcastIndexedSessionRepositoryITests {
|
||||
assertThat(this.repository
|
||||
.findByIndexNameAndIndexValue(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, username))
|
||||
.hasSize(1);
|
||||
|
||||
this.repository.deleteById(session.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@WebAppConfiguration
|
||||
class ClientServerHazelcastIndexedSessionRepositoryITests extends AbstractHazelcastIndexedSessionRepositoryITests {
|
||||
|
||||
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:3.12.3")
|
||||
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:3.12.12")
|
||||
.withExposedPorts(5701).withCopyFileToContainer(MountableFile.forClasspathResource("/hazelcast-server.xml"),
|
||||
"/opt/hazelcast/hazelcast.xml");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -30,12 +30,12 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportAware;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.session.FindByIndexNameSessionRepository;
|
||||
import org.springframework.session.FlushMode;
|
||||
import org.springframework.session.IndexResolver;
|
||||
import org.springframework.session.MapSession;
|
||||
import org.springframework.session.SaveMode;
|
||||
import org.springframework.session.Session;
|
||||
import org.springframework.session.SessionRepository;
|
||||
import org.springframework.session.config.SessionRepositoryCustomizer;
|
||||
import org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration;
|
||||
import org.springframework.session.hazelcast.Hazelcast4IndexedSessionRepository;
|
||||
@@ -85,7 +85,7 @@ public class HazelcastHttpSessionConfiguration extends SpringHttpSessionConfigur
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SessionRepository<?> sessionRepository() {
|
||||
public FindByIndexNameSessionRepository<?> sessionRepository() {
|
||||
if (hazelcast4) {
|
||||
return createHazelcast4IndexedSessionRepository();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -118,7 +118,7 @@ final class DatabaseContainers {
|
||||
private static class MySql5Container extends MySQLContainer<MySql5Container> {
|
||||
|
||||
MySql5Container() {
|
||||
super("mysql:5.7.27");
|
||||
super("mysql:5.7.34");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,7 +137,7 @@ final class DatabaseContainers {
|
||||
private static class MySql8Container extends MySQLContainer<MySql8Container> {
|
||||
|
||||
MySql8Container() {
|
||||
super("mysql:8.0.17");
|
||||
super("mysql:8.0.27");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,7 +174,7 @@ final class DatabaseContainers {
|
||||
private static class PostgreSql9Container extends PostgreSQLContainer<PostgreSql9Container> {
|
||||
|
||||
PostgreSql9Container() {
|
||||
super("postgres:9.6.15");
|
||||
super("postgres:9.6.22");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.11.3'
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.11.4'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
dependency 'ch.qos.logback:logback-classic:1.2.3'
|
||||
dependency 'ch.qos.logback:logback-classic:1.2.6'
|
||||
dependency 'com.maxmind.geoip2:geoip2:2.15.0'
|
||||
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.44.0'
|
||||
dependency 'org.slf4j:jcl-over-slf4j:1.7.30'
|
||||
dependency 'org.slf4j:log4j-over-slf4j:1.7.30'
|
||||
dependency 'org.slf4j:jcl-over-slf4j:1.7.31'
|
||||
dependency 'org.slf4j:log4j-over-slf4j:1.7.31'
|
||||
dependency 'org.webjars:bootstrap:2.3.2'
|
||||
dependency 'org.webjars:html5shiv:3.7.3'
|
||||
dependency 'org.webjars:jquery:1.12.4'
|
||||
dependency 'org.webjars:knockout:2.3.0'
|
||||
dependency 'org.webjars:sockjs-client:0.3.4'
|
||||
dependency 'org.webjars:stomp-websocket:2.3.3'
|
||||
dependency 'org.webjars:stomp-websocket:2.3.4'
|
||||
dependency 'org.webjars:webjars-taglib:0.3'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
apply plugin: 'io.spring.convention.spring-sample-boot'
|
||||
|
||||
dependencies {
|
||||
compile project(':spring-session-hazelcast')
|
||||
compile "org.springframework.boot:spring-boot-starter-web"
|
||||
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
|
||||
compile "org.springframework.boot:spring-boot-starter-security"
|
||||
compile "com.hazelcast:hazelcast-client"
|
||||
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
|
||||
compile "org.webjars:bootstrap"
|
||||
compile "org.webjars:html5shiv"
|
||||
compile "org.webjars:webjars-locator-core"
|
||||
compile project(':spring-session-hazelcast')
|
||||
compile "org.springframework.boot:spring-boot-starter-web"
|
||||
compile "org.springframework.boot:spring-boot-starter-actuator"
|
||||
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
|
||||
compile "org.springframework.boot:spring-boot-starter-security"
|
||||
compile "com.hazelcast:hazelcast"
|
||||
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
|
||||
compile "org.webjars:bootstrap"
|
||||
compile "org.webjars:html5shiv"
|
||||
compile "org.webjars:webjars-locator-core"
|
||||
|
||||
testCompile "org.springframework.boot:spring-boot-starter-test"
|
||||
testCompile "org.junit.jupiter:junit-jupiter-api"
|
||||
testRuntime "org.junit.jupiter:junit-jupiter-engine"
|
||||
integrationTestCompile seleniumDependencies
|
||||
integrationTestCompile "org.testcontainers:testcontainers"
|
||||
testCompile "org.springframework.boot:spring-boot-starter-test"
|
||||
testCompile "org.junit.jupiter:junit-jupiter-api"
|
||||
testRuntime "org.junit.jupiter:junit-jupiter-engine"
|
||||
integrationTestCompile seleniumDependencies
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -19,32 +19,29 @@ package sample;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import sample.pages.HomePage;
|
||||
import sample.pages.LoginPage;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.session.SessionsEndpoint;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Ellie Bahadori
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@AutoConfigureMockMvc
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class BootTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "hazelcast/hazelcast:latest";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -60,6 +57,12 @@ class BootTests {
|
||||
this.driver.quit();
|
||||
}
|
||||
|
||||
@Test // gh-1905
|
||||
void contextLoads(ApplicationContext context) {
|
||||
assertThat(context.getBeansOfType(HazelcastIndexedSessionRepository.class)).hasSize(1);
|
||||
assertThat(context.getBeansOfType(SessionsEndpoint.class)).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void home() {
|
||||
LoginPage login = HomePage.go(this.driver);
|
||||
@@ -83,16 +86,4 @@ class BootTests {
|
||||
login.assertAt();
|
||||
}
|
||||
|
||||
@TestConfiguration
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
GenericContainer hazelcastContainer() {
|
||||
GenericContainer hazelcastContainer = new GenericContainer(DOCKER_IMAGE).withExposedPorts(5701);
|
||||
hazelcastContainer.start();
|
||||
return hazelcastContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -34,7 +34,7 @@ import org.springframework.session.hazelcast.PrincipalNameExtractor;
|
||||
public class SessionConfig {
|
||||
|
||||
@Bean
|
||||
public Config clientConfig() {
|
||||
public Config hazelcastConfig() {
|
||||
Config config = new Config();
|
||||
NetworkConfig networkConfig = config.getNetworkConfig();
|
||||
networkConfig.setPort(0);
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
management.endpoints.web.exposure.include=sessions
|
||||
spring.security.user.password=password
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
apply plugin: 'io.spring.convention.spring-sample-boot'
|
||||
|
||||
dependencies {
|
||||
compile project(':spring-session-hazelcast')
|
||||
compile project(':hazelcast4')
|
||||
compile "org.springframework.boot:spring-boot-starter-web"
|
||||
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
|
||||
compile "org.springframework.boot:spring-boot-starter-security"
|
||||
compile "com.hazelcast:hazelcast:4.0.3"
|
||||
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
|
||||
compile "org.webjars:bootstrap"
|
||||
compile "org.webjars:html5shiv"
|
||||
compile "org.webjars:webjars-locator-core"
|
||||
compile project(':spring-session-hazelcast')
|
||||
compile project(':hazelcast4')
|
||||
compile "org.springframework.boot:spring-boot-starter-web"
|
||||
compile "org.springframework.boot:spring-boot-starter-actuator"
|
||||
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
|
||||
compile "org.springframework.boot:spring-boot-starter-security"
|
||||
compile "com.hazelcast:hazelcast:4.0.3"
|
||||
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
|
||||
compile "org.webjars:bootstrap"
|
||||
compile "org.webjars:html5shiv"
|
||||
compile "org.webjars:webjars-locator-core"
|
||||
|
||||
testCompile "org.springframework.boot:spring-boot-starter-test"
|
||||
testCompile "org.junit.jupiter:junit-jupiter-api"
|
||||
testRuntime "org.junit.jupiter:junit-jupiter-engine"
|
||||
integrationTestCompile seleniumDependencies
|
||||
integrationTestCompile "org.testcontainers:testcontainers"
|
||||
testCompile "org.springframework.boot:spring-boot-starter-test"
|
||||
testCompile "org.junit.jupiter:junit-jupiter-api"
|
||||
testRuntime "org.junit.jupiter:junit-jupiter-engine"
|
||||
integrationTestCompile seleniumDependencies
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -19,29 +19,26 @@ package sample;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import sample.pages.HomePage;
|
||||
import sample.pages.LoginPage;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.session.SessionsEndpoint;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.session.hazelcast.Hazelcast4IndexedSessionRepository;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@AutoConfigureMockMvc
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class BootTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "hazelcast/hazelcast:latest";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -57,6 +54,12 @@ class BootTests {
|
||||
this.driver.quit();
|
||||
}
|
||||
|
||||
@Test // gh-1905
|
||||
void contextLoads(ApplicationContext context) {
|
||||
assertThat(context.getBeansOfType(Hazelcast4IndexedSessionRepository.class)).hasSize(1);
|
||||
assertThat(context.getBeansOfType(SessionsEndpoint.class)).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void home() {
|
||||
LoginPage login = HomePage.go(this.driver);
|
||||
@@ -80,16 +83,4 @@ class BootTests {
|
||||
login.assertAt();
|
||||
}
|
||||
|
||||
@TestConfiguration
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
GenericContainer hazelcastContainer() {
|
||||
GenericContainer hazelcastContainer = new GenericContainer(DOCKER_IMAGE).withExposedPorts(5701);
|
||||
hazelcastContainer.start();
|
||||
return hazelcastContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -35,7 +35,7 @@ import org.springframework.session.hazelcast.HazelcastSessionSerializer;
|
||||
public class SessionConfig {
|
||||
|
||||
@Bean
|
||||
public Config clientConfig() {
|
||||
public Config hazelcastConfig() {
|
||||
Config config = new Config();
|
||||
NetworkConfig networkConfig = config.getNetworkConfig();
|
||||
networkConfig.setPort(0);
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
management.endpoints.web.exposure.include=sessions
|
||||
spring.security.user.password=password
|
||||
|
||||
@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@AutoConfigureMockMvc
|
||||
class HttpRedisJsonTest {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest
|
||||
class RedisSerializerTest {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@SpringSessionRedisOperations
|
||||
private RedisTemplate<Object, Object> sessionRedisTemplate;
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Value("${local.server.port}")
|
||||
private String port;
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Autowired
|
||||
private SessionRepositoryFilter<? extends Session> sessionRepositoryFilter;
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -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.6";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
Reference in New Issue
Block a user