DATAREDIS-1063 - Build against JDK 11+.

This commit is contained in:
Greg Turnquist
2019-11-05 13:21:34 -06:00
committed by Mark Paluch
parent 292c0a3756
commit a3d2ad7ed6
8 changed files with 126 additions and 73 deletions

View File

@@ -1,17 +1,5 @@
language: java
jdk:
- oraclejdk8
env:
matrix:
- PROFILE=spring5-next
addons:
apt:
packages:
- oracle-java8-installer
cache:
directories:
- $HOME/.m2
@@ -20,4 +8,4 @@ sudo: false
install: true
script: travis_wait make test SPRING_PROFILE=${PROFILE}
script: make test SPRING_PROFILE=java11

105
Jenkinsfile vendored
View File

@@ -12,27 +12,87 @@ pipeline {
}
stages {
stage('Publish OpenJDK 8 + Redis 5.0 docker image') {
when {
anyOf {
changeset "ci/Dockerfile"
changeset "Makefile"
}
}
agent { label 'data' }
options { timeout(time: 20, unit: 'MINUTES') }
stage("Docker images") {
parallel {
stage('Publish OpenJDK 8 + Redis 5.0 docker image') {
when {
anyOf {
changeset "ci/openjdk8-redis-5.0/**"
changeset "Makefile"
}
}
agent { label 'data' }
options { timeout(time: 20, unit: 'MINUTES') }
steps {
script {
def image = docker.build("springci/spring-data-openjdk8-with-redis-5.0", "-f ci/Dockerfile .")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
image.push()
steps {
script {
def image = docker.build("springci/spring-data-openjdk8-with-redis-5.0", "-f ci/openjdk8-redis-5.0/Dockerfile .")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
image.push()
}
}
}
}
stage('Publish OpenJDK 11 + Redis 5.0 docker image') {
when {
anyOf {
changeset "ci/openjdk11-redis-5.0/**"
changeset "Makefile"
}
}
agent { label 'data' }
options { timeout(time: 20, unit: 'MINUTES') }
steps {
script {
def image = docker.build("springci/spring-data-openjdk11-with-redis-5.0", "-f ci/openjdk11-redis-5.0/Dockerfile .")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
image.push()
}
}
}
}
}
}
stage("Test") {
stage("test: baseline") {
when {
anyOf {
branch 'master'
not { triggeredBy 'UpstreamCause' }
}
}
agent {
docker {
image 'springci/spring-data-openjdk8-with-redis-5.0:latest'
label 'data'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
options { timeout(time: 30, unit: 'MINUTES') }
steps {
// Create link to directory with Redis binaries
sh 'ln -sf /work'
// Launch Redis in proper configuration
sh 'make start'
// Execute maven test
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean test -DrunLongTests=true -U -B'
// Capture resulting exit code from maven (pass/fail)
sh 'RESULT=\$?'
// Shutdown Redis
sh 'make stop'
// Return maven results
sh 'exit \$RESULT'
}
}
stage("Test other configurations") {
when {
anyOf {
branch 'master'
@@ -40,18 +100,16 @@ pipeline {
}
}
parallel {
stage("test: baseline") {
stage("test: baseline (jdk11)") {
agent {
docker {
image 'springci/spring-data-openjdk8-with-redis-5.0:latest'
image 'springci/spring-data-openjdk11-with-redis-5.0:latest'
label 'data'
args '-v $HOME:/tmp/jenkins-home'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
options { timeout(time: 30, unit: 'MINUTES') }
steps {
sh 'rm -rf ?'
// Create link to directory with Redis binaries
sh 'ln -sf /work'
@@ -59,7 +117,7 @@ pipeline {
sh 'make start'
// Execute maven test
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean test -DrunLongTests=true -U -B'
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean test -DrunLongTests=true -U -B'
// Capture resulting exit code from maven (pass/fail)
sh 'RESULT=\$?'
@@ -86,7 +144,7 @@ pipeline {
docker {
image 'adoptopenjdk/openjdk8:latest'
label 'data'
args '-v $HOME:/tmp/jenkins-home'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
options { timeout(time: 20, unit: 'MINUTES') }
@@ -96,7 +154,6 @@ pipeline {
}
steps {
sh 'rm -rf ?'
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,artifactory ' +
'-Dartifactory.server=https://repo.spring.io ' +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
@@ -116,7 +173,7 @@ pipeline {
docker {
image 'adoptopenjdk/openjdk8:latest'
label 'data'
args '-v $HOME:/tmp/jenkins-home'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
options { timeout(time: 20, unit: 'MINUTES') }

View File

@@ -1,17 +0,0 @@
FROM adoptopenjdk/openjdk8:latest
RUN apt-get update
# Get the tools for building Redis
RUN apt-get install -y build-essential
# Copy Spring Data Redis's Makefile into the container
COPY ./Makefile /
# Build Redis inside the container so we don't have to build it during the job.
RUN make work/redis/bin/redis-cli work/redis/bin/redis-server
RUN chmod -R o+rw work
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -0,0 +1,13 @@
FROM adoptopenjdk/openjdk11:latest
# Copy Spring Data Redis's Makefile into the container
COPY ./Makefile /
RUN set -eux; \
apt-get update ; \
apt-get install -y build-essential ; \
make work/redis/bin/redis-cli work/redis/bin/redis-server; \
chmod -R o+rw work; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;

View File

@@ -0,0 +1,12 @@
FROM adoptopenjdk/openjdk8:latest
# Copy Spring Data Redis's Makefile into the container
COPY ./Makefile /
RUN set -eux; \
apt-get update ; \
apt-get install -y build-essential ; \
make work/redis/bin/redis-cli work/redis/bin/redis-server; \
chmod -R o+rw work; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.data.redis.connection.convert;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.core.convert.converter.Converter;
/**
@@ -49,10 +49,11 @@ public class MapConverter<S, T> implements Converter<Map<S, S>, Map<T, T>> {
@Override
public Map<T, T> convert(Map<S, S> source) {
return source.entrySet().stream()
.collect(Collectors.toMap(e -> itemConverter.convert(e.getKey()), e -> itemConverter.convert(e.getValue()),
(a, b) -> a, source instanceof LinkedHashMap ? LinkedHashMap::new : HashedMap::new));
return source.entrySet().stream() //
.collect(Collectors.toMap( //
e -> itemConverter.convert(e.getKey()), //
e -> itemConverter.convert(e.getValue()), //
(a, b) -> a, source instanceof LinkedHashMap ? LinkedHashMap::new : HashMap::new));
}
}

View File

@@ -142,22 +142,22 @@ public abstract class AbstractTransactionalTestBase {
}
}
@Rollback(true)
@Test // DATAREDIS-73
@Rollback
@Test // DATAREDIS-73, DATAREDIS-1063
public void listOperationLPushShoudBeRolledBackCorrectly() {
for (String key : KEYS) {
template.opsForList().leftPushAll(key, (String[]) KEYS.toArray());
template.opsForList().leftPushAll(key, KEYS.toArray(new String[0]));
}
}
@Rollback(false)
@Test // DATAREDIS-73
@Test // DATAREDIS-73, DATAREDIS-1063
public void listOperationLPushShouldBeCommittedCorrectly() {
this.valuesShouldHaveBeenPersisted = true;
for (String key : KEYS) {
template.opsForList().leftPushAll(key, (String[]) KEYS.toArray());
template.opsForList().leftPushAll(key, KEYS.toArray(new String[0]));
}
}
}

View File

@@ -18,24 +18,23 @@ package org.springframework.data.redis.connection.jedis;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisClusterConnectionHandler;
import redis.clients.jedis.JedisClusterInfoCache;
import redis.clients.jedis.JedisPoolConfig;
import sun.net.www.protocol.https.DefaultHostnameVerifier;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocketFactory;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.junit.Test;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisClusterConnectionHandler;
import redis.clients.jedis.JedisClusterInfoCache;
import redis.clients.jedis.JedisPoolConfig;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisClusterConnection;
import org.springframework.data.redis.connection.RedisPassword;
@@ -237,9 +236,9 @@ public class JedisConnectionFactoryUnitTests {
SSLContext context = SSLContext.getDefault();
SSLSocketFactory socketFactory = context.getSocketFactory();
JedisPoolConfig poolConfig = new JedisPoolConfig();
JedisClientConfiguration configuration = JedisClientConfiguration.builder().useSsl() //
.hostnameVerifier(new DefaultHostnameVerifier()) //
.hostnameVerifier(HttpsURLConnection.getDefaultHostnameVerifier()) //
.sslParameters(sslParameters) //
.sslSocketFactory(socketFactory).and() //
.clientName("my-client") //
@@ -298,7 +297,7 @@ public class JedisConnectionFactoryUnitTests {
SSLContext context = SSLContext.getDefault();
SSLSocketFactory socketFactory = context.getSocketFactory();
JedisPoolConfig poolConfig = new JedisPoolConfig();
HostnameVerifier hostNameVerifier = new DefaultHostnameVerifier();
HostnameVerifier hostNameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
JedisClientConfiguration configuration = JedisClientConfiguration.builder() //
.useSsl() //