diff --git a/Jenkinsfile b/Jenkinsfile index 0a8bad20..c6a4fb68 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,6 +27,24 @@ try { } } } + }, + jdk10: { + stage('JDK 10') { + timeout(time: 30, unit: 'MINUTES') { + node('ubuntu1804') { + checkout scm + try { + withEnv(["JAVA_HOME=${tool 'jdk10'}"]) { + sh './gradlew clean test --no-daemon --refresh-dependencies' + } + } + catch (e) { + currentBuild.result = 'FAILED: jdk10' + throw e + } + } + } + } } if (currentBuild.result == 'SUCCESS') { diff --git a/build.gradle b/build.gradle index a755c1ae..bd454555 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,39 @@ buildscript { + ext { + releaseBuild = version.endsWith('RELEASE') + snapshotBuild = version.endsWith('SNAPSHOT') + milestoneBuild = !(releaseBuild || snapshotBuild) + + springBootVersion = '2.1.0.M3' + } + + repositories { + gradlePluginPortal() + maven { url 'https://repo.spring.io/plugins-release/' } + maven { url 'https://repo.spring.io/plugins-snapshot/' } + } + dependencies { - classpath 'io.spring.gradle:spring-build-conventions:0.0.18.RELEASE' + classpath 'io.spring.gradle:spring-build-conventions:0.0.19.BUILD-SNAPSHOT' classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion" } - repositories { - maven { url 'https://repo.spring.io/plugins-release' } - } } + apply plugin: 'io.spring.convention.root' group = 'org.springframework.session' description = 'Spring Session' - -ext.releaseBuild = version.endsWith('RELEASE') -ext.snapshotBuild = version.endsWith('SNAPSHOT') -ext.milestoneBuild = !(releaseBuild || snapshotBuild) - - +gradle.taskGraph.whenReady { graph -> + def jacocoEnabled = graph.allTasks.any { it instanceof JacocoReport } + subprojects { + plugins.withType(JavaPlugin) { + sourceCompatibility = 1.8 + } + plugins.withType(JacocoPlugin) { + tasks.withType(Test) { + jacoco.enabled = jacocoEnabled + } + } + } +} diff --git a/gradle.properties b/gradle.properties index 57a7628c..331739fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1 @@ -springBootVersion=2.1.0.M3 version=2.1.0.BUILD-SNAPSHOT diff --git a/settings.gradle b/settings.gradle index 06090ae9..c1f31e0a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,13 +1,16 @@ -rootProject.name = 'spring-session-build' +rootProject.name = 'spring-session' FileTree buildFiles = fileTree(rootDir) { include '**/*.gradle' - exclude '**/gradle', 'settings.gradle', 'buildSrc', '/build.gradle', '.*' + exclude 'build', '**/gradle', 'settings.gradle', 'buildSrc', '/build.gradle', '.*', 'out' exclude '**/grails3' + gradle.startParameter.projectProperties.get('excludeProjects')?.split(',')?.each { excludeProject -> + exclude excludeProject + } } String rootDirPath = rootDir.absolutePath + File.separator -buildFiles.each { File buildFile -> +buildFiles.each { buildFile -> if (buildFile.name == 'build.gradle') { String buildFilePath = buildFile.parentFile.absolutePath String projectPath = buildFilePath.replace(rootDirPath, '').replace(File.separator, ':') diff --git a/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java b/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java index a9403763..5da80c31 100644 --- a/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java +++ b/spring-session-core/src/test/java/org/springframework/session/security/SpringSessionBackedSessionRegistryTest.java @@ -17,6 +17,7 @@ package org.springframework.session.security; import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; @@ -74,7 +75,9 @@ public class SpringSessionBackedSessionRegistryTest { .getSessionInformation(SESSION_ID); assertThat(sessionInfo.getSessionId()).isEqualTo(SESSION_ID); - assertThat(sessionInfo.getLastRequest().toInstant()).isEqualTo(NOW); + assertThat( + sessionInfo.getLastRequest().toInstant().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(NOW.truncatedTo(ChronoUnit.MILLIS)); assertThat(sessionInfo.getPrincipal()).isEqualTo(USER_NAME); assertThat(sessionInfo.isExpired()).isFalse(); } @@ -90,7 +93,9 @@ public class SpringSessionBackedSessionRegistryTest { .getSessionInformation(SESSION_ID); assertThat(sessionInfo.getSessionId()).isEqualTo(SESSION_ID); - assertThat(sessionInfo.getLastRequest().toInstant()).isEqualTo(NOW); + assertThat( + sessionInfo.getLastRequest().toInstant().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(NOW.truncatedTo(ChronoUnit.MILLIS)); assertThat(sessionInfo.getPrincipal()).isEqualTo(USER_NAME); assertThat(sessionInfo.isExpired()).isTrue(); } diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java index 0530e435..81e87dee 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/ReactiveRedisOperationsSessionRepositoryTests.java @@ -346,12 +346,16 @@ public class ReactiveRedisOperationsSessionRepositoryTests { .isEqualTo(expected.getAttribute(attribute1)); assertThat(session.getAttribute(attribute2)) .isEqualTo(expected.getAttribute(attribute2)); - assertThat(session.getCreationTime()).isEqualTo(expected.getCreationTime()); - assertThat(session.getMaxInactiveInterval()) + assertThat(session.getCreationTime().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(expected.getCreationTime() + .truncatedTo(ChronoUnit.MILLIS)); + assertThat(session.getMaxInactiveInterval()) .isEqualTo(expected.getMaxInactiveInterval()); - assertThat(session.getLastAccessedTime()) - .isEqualTo(expected.getLastAccessedTime()); - }).verifyComplete(); + assertThat( + session.getLastAccessedTime().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(expected.getLastAccessedTime() + .truncatedTo(ChronoUnit.MILLIS)); + }).verifyComplete(); } @Test diff --git a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java index 0bde7976..3ebe344c 100644 --- a/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java +++ b/spring-session-data-redis/src/test/java/org/springframework/session/data/redis/RedisOperationsSessionRepositoryTests.java @@ -432,12 +432,12 @@ public class RedisOperationsSessionRepositoryTests { .isEqualTo(expected.getAttribute(attribute1)); assertThat(session.getAttribute(attribute2)) .isEqualTo(expected.getAttribute(attribute2)); - assertThat(session.getCreationTime()).isEqualTo(expected.getCreationTime()); + assertThat(session.getCreationTime().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(expected.getCreationTime().truncatedTo(ChronoUnit.MILLIS)); assertThat(session.getMaxInactiveInterval()) .isEqualTo(expected.getMaxInactiveInterval()); - assertThat(session.getLastAccessedTime()) - .isEqualTo(expected.getLastAccessedTime()); - + assertThat(session.getLastAccessedTime().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(expected.getLastAccessedTime().truncatedTo(ChronoUnit.MILLIS)); } @Test @@ -498,9 +498,11 @@ public class RedisOperationsSessionRepositoryTests { RedisSession session = sessionIdToSessions.get(sessionId); assertThat(session).isNotNull(); assertThat(session.getId()).isEqualTo(sessionId); - assertThat(session.getLastAccessedTime()).isEqualTo(lastAccessed); + assertThat(session.getLastAccessedTime().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(lastAccessed.truncatedTo(ChronoUnit.MILLIS)); assertThat(session.getMaxInactiveInterval()).isEqualTo(maxInactive); - assertThat(session.getCreationTime()).isEqualTo(createdTime); + assertThat(session.getCreationTime().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(createdTime.truncatedTo(ChronoUnit.MILLIS)); } @Test diff --git a/spring-session-hazelcast/spring-session-hazelcast.gradle b/spring-session-hazelcast/spring-session-hazelcast.gradle index ae4d5c5f..e0f6aa09 100644 --- a/spring-session-hazelcast/spring-session-hazelcast.gradle +++ b/spring-session-hazelcast/spring-session-hazelcast.gradle @@ -3,6 +3,7 @@ apply plugin: 'io.spring.convention.spring-module' dependencies { compile project(':spring-session-core') compile "com.hazelcast:hazelcast" + compile "javax.annotation:javax.annotation-api" compile "org.springframework:spring-context" testCompile "javax.servlet:javax.servlet-api" diff --git a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java index cf79c1f2..aba4296e 100644 --- a/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java +++ b/spring-session-jdbc/src/integration-test/java/org/springframework/session/jdbc/AbstractJdbcOperationsSessionRepositoryITests.java @@ -172,7 +172,8 @@ public abstract class AbstractJdbcOperationsSessionRepositoryITests { assertThat(session.isChanged()).isFalse(); assertThat(session.getDelta()).isEmpty(); assertThat(session.isExpired()).isFalse(); - assertThat(session.getLastAccessedTime()).isEqualTo(lastAccessedTime); + assertThat(session.getLastAccessedTime().truncatedTo(ChronoUnit.MILLIS)) + .isEqualTo(lastAccessedTime.truncatedTo(ChronoUnit.MILLIS)); } @Test