From ce5b57c62811565811e77e109525cebcf1910370 Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Mon, 20 Feb 2017 23:47:28 +0100 Subject: [PATCH 01/16] Dependencies updates --- .travis.yml | 24 ++++++- README.md | 41 ++++++----- appveyor.yml | 27 ------- pom.xml | 199 ++++++++++++++++++++++++++++++++++++++------------- release.sh | 58 +++++++++++++++ 5 files changed, 249 insertions(+), 100 deletions(-) delete mode 100644 appveyor.yml create mode 100755 release.sh diff --git a/.travis.yml b/.travis.yml index dd9ad8e0..54dff226 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,24 @@ language: java + +sudo: false # faster builds + jdk: - oraclejdk8 -cache: - directories: - - $HOME/.m2 + +install: + true + +before_script: + - pip install --user codecov + - curl http://www.jpm4j.org/install/script | sh + +script: + - mvn -U -B -V test --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true + +after_success: + - mvn clean test jacoco:report + - codecov --build "$TRAVIS_JOB_NUMBER-jdk8" + +notifications: + email: + on_failure: change \ No newline at end of file diff --git a/README.md b/README.md index fbfac964..9587d293 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,26 @@ embedded-redis ============== -[![Build Status](https://ci.appveyor.com/api/projects/status/github/kstyrc/embedded-redis?branch=master&svg=true)](https://ci.appveyor.com/project/kstyrc/embedded-redis) Windows +Redis embedded server for Java integration testing + +Fork Notes +============== +This repository clones from [kstyrc](https://github.com/kstyrc/embedded-redis) original repository. +The aim is to release some long waiting fixes. -[![Build Status](https://travis-ci.org/kstyrc/embedded-redis.png?branch=master)](https://travis-ci.org/kstyrc/embedded-redis) Linux -Redis embedded server for Java integration testing +**Source Website:** *[github.com/ozimov/embedded-redis](http://github.com/ozimov/embedded-redis/)*
+ +**Latest Release:** *0.7.0*
+**Latest Artifact:** *it.ozimov:embedded-redis*
+**Continuous Integration:**
+[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ com.github.ozimov/spring-boot-email-core) +
+[![Build Status](https://travis-ci.org/ozimov/embedded-redis.svg?branch=master)](https://travis-ci.org/ozimov/embedded-redis) +[![codecov.io](https://codecov.io/github/ozimov/embedded-redis/coverage.svg?branch=master)](https://codecov.io/github/ozimov/embedded-redis?branch=master) +[![Codacy Badge](https://api.codacy.com/project/badge/grade/7a4364b93df6473fb18a597e900edceb)](https://www.codacy.com/app/roberto-trunfio/embedded-redis) + +![codecov.io](https://codecov.io/github/ozimov/embedded-redis/branch.svg?branch=master) Maven dependency ============== @@ -13,25 +28,9 @@ Maven dependency Maven Central: ```xml - com.github.kstyrc - embedded-redis - 0.6 - -``` - -Previous releases (before 0.6): -```xml - - clojars.org - http://clojars.org/repo - - -... - - - redis.embedded + it.ozimov embedded-redis - 0.5 + 0.7.0 ``` diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 5ade0ed8..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '{build}' -os: Windows Server 2012 -environment: - JAVA_HOME: C:\Program Files\Java\jdk1.8.0 -install: - - ps: | - Add-Type -AssemblyName System.IO.Compression.FileSystem - if (!(Test-Path -Path "C:\maven" )) { - (new-object System.Net.WebClient).DownloadFile( - 'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip', - 'C:\maven-bin.zip' - ) - [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven") - } - - cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;%JAVA_HOME%\bin;%PATH% - - cmd: SET MAVEN_OPTS=-XX:MaxPermSize=2g -Xmx4g - - cmd: SET JAVA_OPTS=-XX:MaxPermSize=2g -Xmx4g - - cmd: mvn --version - - cmd: java -version -build_script: - - mvn clean package -B -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -test_script: - - mvn clean install --batch-mode -Pqulice -cache: - - C:\maven\ - - C:\Users\appveyor\.m2 - diff --git a/pom.xml b/pom.xml index 4d738924..6787f49a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,14 @@ 4.0.0 - com.github.kstyrc + it.ozimov embedded-redis jar - 0.7-SNAPSHOT + 0.7.0-SNAPSHOT embedded-redis - Redis embedded server for Java integration testing - https://github.com/kstyrc/embedded-redis + Redis embedded server for Java integration testing. + Project forked from https://github.com/kstyrc/embedded-redis + https://github.com/ozimov/embedded-redis @@ -18,10 +19,10 @@ - https://github.com/kstyrc/embedded-redis - scm:git:https://github.com/kstyrc/embedded-redis.git - scm:git:https://github.com/kstyrc/embedded-redis.git - embedded-redis-0.5 + https://github.com/ozimov/embedded-redis + scm:git:https://github.com/ozimov/embedded-redis.git + scm:git:https://github.com/ozimov/embedded-redis.git + embedded-redis-0.7.0 @@ -35,118 +36,175 @@ UTF-8 - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - com.google.guava guava - 18.0 + 21.0 commons-io commons-io - 2.4 + 2.5 commons-logging commons-logging - 1.1.1 + 1.2 test redis.clients jedis - 2.6.0 + 2.9.0 test org.mockito mockito-all - 1.8.5 + 1.10.19 test junit junit - 4.11 + 4.12 test org.springframework.data spring-data-redis - 1.4.1.RELEASE + 1.8.0.RELEASE test + + 3.0.4 + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + ${project.basedir}/src/main/resources + + + ${project.build.directory}/generated-resources + + - + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + - maven-compiler-plugin - 2.3.2 + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + default-prepare-agent + + prepare-agent + + + + report + test + + report + + + + - 1.6 - 1.6 - 1.6 + + **/config/** + **/model/** + **/item/** + + + + org.codehaus.mojo + versions-maven-plugin + 2.3 + + false + + org.apache.maven.plugins - maven-release-plugin - 2.5.1 + maven-scm-plugin + 1.9.5 - true - false - release - deploy + false + ${project.version} - - + + + disable-java8-doclint + + [1.8,) + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + -Xdoclint:none + + + + + release - org.apache.maven.plugins maven-source-plugin - 2.1.2 + 3.0.1 attach-sources - jar + jar-no-fork - org.apache.maven.plugins maven-javadoc-plugin - 2.8.1 + 2.10.3 attach-javadocs @@ -156,11 +214,10 @@ - org.apache.maven.plugins maven-gpg-plugin - 1.5 + 1.6 sign-artifacts @@ -171,11 +228,55 @@ - + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://oss.sonatype.org/ + true + + - + + + + org.codehaus.mojo + versions-maven-plugin + 2.3 + + + + dependency-updates-report + plugin-updates-report + property-updates-report + + + + + + + + + + + + spring-releases + https://repo.spring.io/libs-release + + + + + + spring-releases + https://repo.spring.io/libs-release + + + diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..fe405e07 --- /dev/null +++ b/release.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Deploy maven artifact in current directory into Maven central repository +# using maven-release-plugin goals + + + +########################################################### +########################################################### +cat << "RELEASE" +██████╗ ███████╗██╗ ███████╗ █████╗ ███████╗███████╗ +██╔══██╗██╔════╝██║ ██╔════╝██╔══██╗██╔════╝██╔════╝ +██████╔╝█████╗ ██║ █████╗ ███████║███████╗█████╗ +██╔══██╗██╔══╝ ██║ ██╔══╝ ██╔══██║╚════██║██╔══╝ +██║ ██║███████╗███████╗███████╗██║ ██║███████║███████╗ +╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝ +RELEASE + +set -e + +mvn --settings ~/.m2/settings.xml scm:check-local-modification + +# release +echo "\n----------------------------------------" +echo "When at prompt, type the release version (e.g. from 1.0-SNAPSHOT to 1.0)\n" +mvn --settings ~/.m2/settings.xml versions:set +git commit -am "[Deploy phase] Preparing release" +mvn --settings ~/.m2/settings.xml clean deploy -P release +mvn --settings ~/.m2/settings.xml scm:tag +echo 'Release deployed' + + +########################################################### +########################################################### +# next development version +cat << "NEXT_ITERATION" +███╗ ██╗███████╗██╗ ██╗████████╗ +████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝ +██╔██╗ ██║█████╗ ╚███╔╝ ██║ +██║╚██╗██║██╔══╝ ██╔██╗ ██║ +██║ ╚████║███████╗██╔╝ ██╗ ██║ +╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝ + + ██╗████████╗███████╗██████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗ + ██║╚══██╔══╝██╔════╝██╔══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║ + ██║ ██║ █████╗ ██████╔╝███████║ ██║ ██║██║ ██║██╔██╗ ██║ + ██║ ██║ ██╔══╝ ██╔══██╗██╔══██║ ██║ ██║██║ ██║██║╚██╗██║ + ██║ ██║ ███████╗██║ ██║██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║ + ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ +NEXT_ITERATION + +echo "When at prompt, type the SNAPSHOT version (e.g. from 1.0 to 2.0-SNAPSHOT)\n" +mvn --settings ~/.m2/settings.xml versions:set +git commit -am "[Deploy phase] Preparing for next iteration" + +# updating origin +git push --force --follow-tags + +echo 'Next iteration prepared' From 12039f9033810a9f8b43733caa8b924075f5a1df Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Tue, 21 Feb 2017 00:15:19 +0100 Subject: [PATCH 02/16] [Deploy phase] Preparing release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6787f49a..cdf6b849 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ it.ozimov embedded-redis jar - 0.7.0-SNAPSHOT + 0.7.0 embedded-redis Redis embedded server for Java integration testing. Project forked from https://github.com/kstyrc/embedded-redis From 05ff0cfee40ba9a994259bcc330e061d80d16623 Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Tue, 21 Feb 2017 00:22:11 +0100 Subject: [PATCH 03/16] [Deploy phase] Preparing for next iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cdf6b849..926cca39 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ it.ozimov embedded-redis jar - 0.7.0 + 0.7.1-SNAPSHOT embedded-redis Redis embedded server for Java integration testing. Project forked from https://github.com/kstyrc/embedded-redis From b02e73ca084dfd113c9236f34d1952988a51b0cf Mon Sep 17 00:00:00 2001 From: Johno Crawford Date: Wed, 3 May 2017 16:39:19 +0200 Subject: [PATCH 04/16] Correct maxmemory setting. maxheap works for Windows but fails for OSX, maxmemory works for both. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9587d293..53099797 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ RedisServer redisServer = RedisServer.builder() .slaveOf("locahost", 6378) .setting("daemonize no") .setting("appendonly no") - .setting("maxheap 128M") + .setting("maxmemory 128M") .build(); ``` From 4776155fdb8d42d98a9cfa14db2b83addbeebebb Mon Sep 17 00:00:00 2001 From: Johno Crawford Date: Wed, 3 May 2017 16:53:18 +0200 Subject: [PATCH 05/16] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 53099797..b106b510 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Or even create simple redis.conf file from scratch: RedisServer redisServer = RedisServer.builder() .redisExecProvider(customRedisProvider) .port(6379) + .setting("bind 127.0.0.1") // good for local development on Windows to prevent security popups .slaveOf("locahost", 6378) .setting("daemonize no") .setting("appendonly no") From 8b2206ba3601e201f256edf0e9299e8d7659748b Mon Sep 17 00:00:00 2001 From: AndyWilks79 <33414776+AndyWilks79@users.noreply.github.com> Date: Sat, 18 Nov 2017 19:19:38 +0000 Subject: [PATCH 06/16] Updated REDIS_READY_PATTERN to match more Redis versions Updated REDIS_READY_PATTERN to match more versions of Redis. Since version 4.0.* the final startup statement has changed, embedded Redis loops forever when it does not match the expected pattern. --- src/main/java/redis/embedded/RedisServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/redis/embedded/RedisServer.java b/src/main/java/redis/embedded/RedisServer.java index 10927f31..d6dab7de 100644 --- a/src/main/java/redis/embedded/RedisServer.java +++ b/src/main/java/redis/embedded/RedisServer.java @@ -7,7 +7,7 @@ import java.util.List; public class RedisServer extends AbstractRedisInstance { - private static final String REDIS_READY_PATTERN = ".*The server is now ready to accept connections on port.*"; + private static final String REDIS_READY_PATTERN = ".*(R|r)eady to accept connections.*"; private static final int DEFAULT_REDIS_PORT = 6379; public RedisServer() throws IOException { From 3798e30bae91496b6174354603181f5a22ddaeda Mon Sep 17 00:00:00 2001 From: Michael Sprauer Date: Tue, 15 May 2018 11:41:47 +0200 Subject: [PATCH 07/16] bind to 127.0.0.1 by default to avoid https://github.com/kstyrc/embedded-redis/issues/45 Signed-off-by: Michael Sprauer --- src/main/java/redis/embedded/RedisSentinelBuilder.java | 7 +++++++ src/main/java/redis/embedded/RedisServer.java | 10 +++------- src/main/java/redis/embedded/RedisServerBuilder.java | 7 +++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/redis/embedded/RedisSentinelBuilder.java b/src/main/java/redis/embedded/RedisSentinelBuilder.java index 5e0c8573..49d7f8f5 100644 --- a/src/main/java/redis/embedded/RedisSentinelBuilder.java +++ b/src/main/java/redis/embedded/RedisSentinelBuilder.java @@ -21,6 +21,7 @@ public class RedisSentinelBuilder { private File executable; private RedisExecProvider redisExecProvider = RedisExecProvider.defaultProvider(); + private String bind="127.0.0.1"; private Integer port = 26379; private int masterPort = 6379; private String masterName = "mymaster"; @@ -37,6 +38,11 @@ public RedisSentinelBuilder redisExecProvider(RedisExecProvider redisExecProvide return this; } + public RedisSentinelBuilder bind(String bind) { + this.bind = bind; + return this; + } + public RedisSentinelBuilder port(Integer port) { this.port = port; return this; @@ -127,6 +133,7 @@ private void resolveSentinelConf() throws IOException { if (redisConfigBuilder == null) { addDefaultReplicationGroup(); } + setting("bind "+bind); setting(String.format(PORT_LINE, port)); final String configString = redisConfigBuilder.toString(); diff --git a/src/main/java/redis/embedded/RedisServer.java b/src/main/java/redis/embedded/RedisServer.java index 10927f31..79dc4bee 100644 --- a/src/main/java/redis/embedded/RedisServer.java +++ b/src/main/java/redis/embedded/RedisServer.java @@ -10,17 +10,13 @@ public class RedisServer extends AbstractRedisInstance { private static final String REDIS_READY_PATTERN = ".*The server is now ready to accept connections on port.*"; private static final int DEFAULT_REDIS_PORT = 6379; - public RedisServer() throws IOException { + public RedisServer() { this(DEFAULT_REDIS_PORT); } - public RedisServer(int port) throws IOException { + public RedisServer(int port) { super(port); - File executable = RedisExecProvider.defaultProvider().get(); - this.args = Arrays.asList( - executable.getAbsolutePath(), - "--port", Integer.toString(port) - ); + this.args = builder().port(port).build().args; } public RedisServer(File executable, int port) { diff --git a/src/main/java/redis/embedded/RedisServerBuilder.java b/src/main/java/redis/embedded/RedisServerBuilder.java index affcbbd9..192b9fb6 100644 --- a/src/main/java/redis/embedded/RedisServerBuilder.java +++ b/src/main/java/redis/embedded/RedisServerBuilder.java @@ -17,6 +17,7 @@ public class RedisServerBuilder { private File executable; private RedisExecProvider redisExecProvider = RedisExecProvider.defaultProvider(); + private String bind="127.0.0.1"; private int port = 6379; private InetSocketAddress slaveOf; private String redisConf; @@ -28,6 +29,11 @@ public RedisServerBuilder redisExecProvider(RedisExecProvider redisExecProvider) return this; } + public RedisServerBuilder bind(String bind) { + this.bind = bind; + return this; + } + public RedisServerBuilder port(int port) { this.port = port; return this; @@ -66,6 +72,7 @@ public RedisServerBuilder setting(String configLine) { } public RedisServer build() { + setting("bind "+bind); tryResolveConfAndExec(); List args = buildCommandArgs(); return new RedisServer(args, port); From 8a2af5162907d1f928d374ac1d84dab6819fd7b4 Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Tue, 15 May 2018 13:15:04 +0200 Subject: [PATCH 08/16] Preparing release 1.7.1 --- README.md | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b106b510..df735131 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The aim is to release some long waiting fixes. **Source Website:** *[github.com/ozimov/embedded-redis](http://github.com/ozimov/embedded-redis/)*
-**Latest Release:** *0.7.0*
+**Latest Release:** *0.7.1*
**Latest Artifact:** *it.ozimov:embedded-redis*
**Continuous Integration:**
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ com.github.ozimov/spring-boot-email-core) @@ -30,7 +30,7 @@ Maven Central: it.ozimov embedded-redis - 0.7.0 + 0.7.1 ``` diff --git a/pom.xml b/pom.xml index 926cca39..f37e5eae 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ https://github.com/ozimov/embedded-redis scm:git:https://github.com/ozimov/embedded-redis.git scm:git:https://github.com/ozimov/embedded-redis.git - embedded-redis-0.7.0 + embedded-redis-0.7.1 From aacb7467d317dc43be9436ad328ab050e1b6f3a4 Mon Sep 17 00:00:00 2001 From: Michael Sprauer Date: Tue, 15 May 2018 16:04:20 +0200 Subject: [PATCH 09/16] fix the tests --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f37e5eae..ceb4c966 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ commons-io 2.5 - + commons-logging @@ -59,7 +59,8 @@ redis.clients jedis - 2.9.0 + 2.8.2 + test From ba4f15047f6052d2af95b4c4866db86a6668ad25 Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Tue, 15 May 2018 16:23:14 +0200 Subject: [PATCH 10/16] Preparing release 0.7.2 --- README.md | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index df735131..a7236842 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The aim is to release some long waiting fixes. **Source Website:** *[github.com/ozimov/embedded-redis](http://github.com/ozimov/embedded-redis/)*
-**Latest Release:** *0.7.1*
+**Latest Release:** *0.7.2*
**Latest Artifact:** *it.ozimov:embedded-redis*
**Continuous Integration:**
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ com.github.ozimov/spring-boot-email-core) @@ -30,7 +30,7 @@ Maven Central: it.ozimov embedded-redis - 0.7.1 + 0.7.2 ``` diff --git a/pom.xml b/pom.xml index ceb4c966..db7fb63b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ it.ozimov embedded-redis jar - 0.7.1-SNAPSHOT + 0.7.2-SNAPSHOT embedded-redis Redis embedded server for Java integration testing. Project forked from https://github.com/kstyrc/embedded-redis @@ -22,7 +22,7 @@ https://github.com/ozimov/embedded-redis scm:git:https://github.com/ozimov/embedded-redis.git scm:git:https://github.com/ozimov/embedded-redis.git - embedded-redis-0.7.1 + embedded-redis-0.7.2 From f22310b2a441388e15d1894b5328994376e7f429 Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Tue, 15 May 2018 16:33:06 +0200 Subject: [PATCH 11/16] Preparing release 0.7.2 --- release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.sh b/release.sh index fe405e07..4279ce8c 100755 --- a/release.sh +++ b/release.sh @@ -24,7 +24,7 @@ echo "\n----------------------------------------" echo "When at prompt, type the release version (e.g. from 1.0-SNAPSHOT to 1.0)\n" mvn --settings ~/.m2/settings.xml versions:set git commit -am "[Deploy phase] Preparing release" -mvn --settings ~/.m2/settings.xml clean deploy -P release +mvn --settings ~/.m2/settings.xml clean deploy -DskipTests -P release mvn --settings ~/.m2/settings.xml scm:tag echo 'Release deployed' From 0413468b02d40a204084d3f1918b6f9eb525a98a Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Tue, 15 May 2018 16:33:22 +0200 Subject: [PATCH 12/16] [Deploy phase] Preparing release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index db7fb63b..3a5e8996 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ it.ozimov embedded-redis jar - 0.7.2-SNAPSHOT + 0.7.2 embedded-redis Redis embedded server for Java integration testing. Project forked from https://github.com/kstyrc/embedded-redis From 2f2f38208b6e05b496250d3b27c796f10df446d3 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 15 May 2018 16:33:54 +0200 Subject: [PATCH 13/16] fix maven central link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a7236842..920d6907 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The aim is to release some long waiting fixes. **Latest Release:** *0.7.2*
**Latest Artifact:** *it.ozimov:embedded-redis*
**Continuous Integration:**
-[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ com.github.ozimov/spring-boot-email-core) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis)
[![Build Status](https://travis-ci.org/ozimov/embedded-redis.svg?branch=master)](https://travis-ci.org/ozimov/embedded-redis) [![codecov.io](https://codecov.io/github/ozimov/embedded-redis/coverage.svg?branch=master)](https://codecov.io/github/ozimov/embedded-redis?branch=master) From e520a8be398db1217ffc0f3ab6c7989eb80f8230 Mon Sep 17 00:00:00 2001 From: Roberto Trunfio Date: Tue, 15 May 2018 16:37:28 +0200 Subject: [PATCH 14/16] [Deploy phase] Preparing for next iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3a5e8996..a29a572b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ it.ozimov embedded-redis jar - 0.7.2 + 0.7.3-SNAPSHOT embedded-redis Redis embedded server for Java integration testing. Project forked from https://github.com/kstyrc/embedded-redis From 56ee443e1a78c378bae74038140ce87cbef36224 Mon Sep 17 00:00:00 2001 From: Dmitry Ermolchik Date: Thu, 17 May 2018 11:30:43 +0300 Subject: [PATCH 15/16] Support of Redis 3+ sentinel mode was added --- src/main/java/redis/embedded/RedisSentinel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/redis/embedded/RedisSentinel.java b/src/main/java/redis/embedded/RedisSentinel.java index 6b8c6234..5afae5b5 100644 --- a/src/main/java/redis/embedded/RedisSentinel.java +++ b/src/main/java/redis/embedded/RedisSentinel.java @@ -4,7 +4,7 @@ import java.util.List; public class RedisSentinel extends AbstractRedisInstance { - private static final String REDIS_READY_PATTERN = ".*Sentinel runid is.*"; + private static final String REDIS_READY_PATTERN = ".*Sentinel (runid|ID) is.*"; public RedisSentinel(List args, int port) { super(port); From f215d686d1c174bf083f9d215bb9f250902e9074 Mon Sep 17 00:00:00 2001 From: Dmitry Ermolchik Date: Fri, 18 May 2018 18:31:03 +0300 Subject: [PATCH 16/16] Tests to check REDIS_READY_PATTERN for Redis version 2.x, 3.x, 4.x were added --- .../redis/embedded/RedisSentinelTest.java | 37 +++++++++++- .../java/redis/embedded/RedisServerTest.java | 57 +++++++++++++++---- .../redis-2.x-sentinel-startup-output.txt | 19 +++++++ .../redis-2.x-standalone-startup-output.txt | 20 +++++++ .../redis-3.x-sentinel-startup-output.txt | 19 +++++++ .../redis-3.x-standalone-startup-output.txt | 20 +++++++ .../redis-4.x-sentinel-startup-output.txt | 26 +++++++++ .../redis-4.x-standalone-startup-output.txt | 29 ++++++++++ 8 files changed, 214 insertions(+), 13 deletions(-) create mode 100644 src/test/resources/redis-2.x-sentinel-startup-output.txt create mode 100644 src/test/resources/redis-2.x-standalone-startup-output.txt create mode 100644 src/test/resources/redis-3.x-sentinel-startup-output.txt create mode 100644 src/test/resources/redis-3.x-standalone-startup-output.txt create mode 100644 src/test/resources/redis-4.x-sentinel-startup-output.txt create mode 100644 src/test/resources/redis-4.x-standalone-startup-output.txt diff --git a/src/test/java/redis/embedded/RedisSentinelTest.java b/src/test/java/redis/embedded/RedisSentinelTest.java index 5dbc2204..29bfe0de 100644 --- a/src/test/java/redis/embedded/RedisSentinelTest.java +++ b/src/test/java/redis/embedded/RedisSentinelTest.java @@ -5,9 +5,12 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisSentinelPool; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.concurrent.TimeUnit; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; public class RedisSentinelTest { private RedisSentinel sentinel; @@ -57,7 +60,7 @@ public void testSimpleOperationsAfterRun() throws Exception { //then assertEquals("1", jedis.mget("abc").get(0)); assertEquals("2", jedis.mget("def").get(0)); - assertEquals(null, jedis.mget("xyz").get(0)); + assertNull(jedis.mget("xyz").get(0)); } finally { if (jedis != null) pool.returnResource(jedis); @@ -66,4 +69,34 @@ public void testSimpleOperationsAfterRun() throws Exception { } } + @Test + public void testAwaitRedisSentinelReady() throws Exception { + String readyPattern = RedisSentinel.builder().build().redisReadyPattern(); + + assertReadyPattern(new BufferedReader( + new InputStreamReader(getClass() + .getClassLoader() + .getResourceAsStream("redis-2.x-sentinel-startup-output.txt"))), + readyPattern); + + assertReadyPattern(new BufferedReader( + new InputStreamReader(getClass() + .getClassLoader() + .getResourceAsStream("redis-3.x-sentinel-startup-output.txt"))), + readyPattern); + + assertReadyPattern(new BufferedReader( + new InputStreamReader(getClass() + .getClassLoader() + .getResourceAsStream("redis-4.x-sentinel-startup-output.txt"))), + readyPattern); + } + + private void assertReadyPattern(BufferedReader reader, String readyPattern) throws IOException { + String outputLine; + do { + outputLine = reader.readLine(); + assertNotNull(outputLine); + } while (!outputLine.matches(readyPattern)); + } } \ No newline at end of file diff --git a/src/test/java/redis/embedded/RedisServerTest.java b/src/test/java/redis/embedded/RedisServerTest.java index e85cfaff..5effda49 100644 --- a/src/test/java/redis/embedded/RedisServerTest.java +++ b/src/test/java/redis/embedded/RedisServerTest.java @@ -8,12 +8,16 @@ import redis.embedded.util.Architecture; import redis.embedded.util.OS; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + import static org.junit.Assert.*; public class RedisServerTest { private RedisServer redisServer; - + @Test(timeout = 1500L) public void testSimpleRun() throws Exception { redisServer = new RedisServer(6379); @@ -21,7 +25,7 @@ public void testSimpleRun() throws Exception { Thread.sleep(1000L); redisServer.stop(); } - + @Test(expected = RuntimeException.class) public void shouldNotAllowMultipleRunsWithoutStop() throws Exception { try { @@ -32,35 +36,35 @@ public void shouldNotAllowMultipleRunsWithoutStop() throws Exception { redisServer.stop(); } } - + @Test public void shouldAllowSubsequentRuns() throws Exception { redisServer = new RedisServer(6379); redisServer.start(); redisServer.stop(); - + redisServer.start(); redisServer.stop(); - + redisServer.start(); redisServer.stop(); } - + @Test public void testSimpleOperationsAfterRun() throws Exception { redisServer = new RedisServer(6379); redisServer.start(); - + JedisPool pool = null; Jedis jedis = null; try { pool = new JedisPool("localhost", 6379); jedis = pool.getResource(); jedis.mset("abc", "1", "def", "2"); - + assertEquals("1", jedis.mget("abc").get(0)); assertEquals("2", jedis.mget("def").get(0)); - assertEquals(null, jedis.mget("xyz").get(0)); + assertNull(jedis.mget("xyz").get(0)); } finally { if (jedis != null) pool.returnResource(jedis); @@ -98,7 +102,7 @@ public void shouldOverrideDefaultExecutable() throws Exception { .override(OS.WINDOWS, Architecture.x86, Resources.getResource("redis-server-2.8.19.exe").getFile()) .override(OS.WINDOWS, Architecture.x86_64, Resources.getResource("redis-server-2.8.19.exe").getFile()) .override(OS.MAC_OS_X, Resources.getResource("redis-server-2.8.19").getFile()); - + redisServer = new RedisServerBuilder() .redisExecProvider(customProvider) .build(); @@ -111,9 +115,40 @@ public void shouldFailWhenBadExecutableGiven() throws Exception { .override(OS.WINDOWS, Architecture.x86, "some") .override(OS.WINDOWS, Architecture.x86_64, "some") .override(OS.MAC_OS_X, "some"); - + redisServer = new RedisServerBuilder() .redisExecProvider(buggyProvider) .build(); } + + @Test + public void testAwaitRedisServerReady() throws Exception { + String readyPattern = RedisServer.builder().build().redisReadyPattern(); + + assertReadyPattern(new BufferedReader( + new InputStreamReader(getClass() + .getClassLoader() + .getResourceAsStream("redis-2.x-standalone-startup-output.txt"))), + readyPattern); + + assertReadyPattern(new BufferedReader( + new InputStreamReader(getClass() + .getClassLoader() + .getResourceAsStream("redis-3.x-standalone-startup-output.txt"))), + readyPattern); + + assertReadyPattern(new BufferedReader( + new InputStreamReader(getClass() + .getClassLoader() + .getResourceAsStream("redis-4.x-standalone-startup-output.txt"))), + readyPattern); + } + + private void assertReadyPattern(BufferedReader reader, String readyPattern) throws IOException { + String outputLine; + do { + outputLine = reader.readLine(); + assertNotNull(outputLine); + } while (!outputLine.matches(readyPattern)); + } } diff --git a/src/test/resources/redis-2.x-sentinel-startup-output.txt b/src/test/resources/redis-2.x-sentinel-startup-output.txt new file mode 100644 index 00000000..8c51b452 --- /dev/null +++ b/src/test/resources/redis-2.x-sentinel-startup-output.txt @@ -0,0 +1,19 @@ + _._ + _.-``__ ''-._ + _.-`` `. `_. ''-._ Redis 2.8.19 (00000000/0) 64 bit + .-`` .-```. ```\/ _.,_ ''-._ + ( ' , .-` | `, ) Running in sentinel mode + |`-._`-...-` __...-.``-._|'` _.-'| Port: 26379 + | `-._ `._ / _.-' | PID: 5532 + `-._ `-._ `-./ _.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | http://redis.io + `-._ `-._`-.__.-'_.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | + `-._ `-._`-.__.-'_.-' _.-' + `-._ `-.__.-' _.-' + `-._ _.-' + `-.__.-' + +[5532] 18 May 18:23:19.755 # Sentinel runid is 19036a5984e785f22fbf267af283649226736049 \ No newline at end of file diff --git a/src/test/resources/redis-2.x-standalone-startup-output.txt b/src/test/resources/redis-2.x-standalone-startup-output.txt new file mode 100644 index 00000000..1591e75d --- /dev/null +++ b/src/test/resources/redis-2.x-standalone-startup-output.txt @@ -0,0 +1,20 @@ + _._ + _.-``__ ''-._ + _.-`` `. `_. ''-._ Redis 2.8.19 (00000000/0) 64 bit + .-`` .-```. ```\/ _.,_ ''-._ + ( ' , .-` | `, ) Running in stand alone mode + |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 + | `-._ `._ / _.-' | PID: 6212 + `-._ `-._ `-./ _.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | http://redis.io + `-._ `-._`-.__.-'_.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | + `-._ `-._`-.__.-'_.-' _.-' + `-._ `-.__.-' _.-' + `-._ _.-' + `-.__.-' + +[6212] 18 May 18:23:17.244 # Server started, Redis version 2.8.19 +[6212] 18 May 18:23:17.244 * The server is now ready to accept connections on port 6379 \ No newline at end of file diff --git a/src/test/resources/redis-3.x-sentinel-startup-output.txt b/src/test/resources/redis-3.x-sentinel-startup-output.txt new file mode 100644 index 00000000..151f7fd1 --- /dev/null +++ b/src/test/resources/redis-3.x-sentinel-startup-output.txt @@ -0,0 +1,19 @@ + _._ + _.-``__ ''-._ + _.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit + .-`` .-```. ```\/ _.,_ ''-._ + ( ' , .-` | `, ) Running in sentinel mode + |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 + | `-._ `._ / _.-' | PID: 8332 + `-._ `-._ `-./ _.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | http://redis.io + `-._ `-._`-.__.-'_.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | + `-._ `-._`-.__.-'_.-' _.-' + `-._ `-.__.-' _.-' + `-._ _.-' + `-.__.-' + +[8332] 18 May 12:24:04.651 # Sentinel ID is 4bb1b2d80c74deb14e116664261c47b5a9c4b185 \ No newline at end of file diff --git a/src/test/resources/redis-3.x-standalone-startup-output.txt b/src/test/resources/redis-3.x-standalone-startup-output.txt new file mode 100644 index 00000000..2a6f4d28 --- /dev/null +++ b/src/test/resources/redis-3.x-standalone-startup-output.txt @@ -0,0 +1,20 @@ + _._ + _.-``__ ''-._ + _.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit + .-`` .-```. ```\/ _.,_ ''-._ + ( ' , .-` | `, ) Running in standalone mode + |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 + | `-._ `._ / _.-' | PID: 1592 + `-._ `-._ `-./ _.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | http://redis.io + `-._ `-._`-.__.-'_.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | + `-._ `-._`-.__.-'_.-' _.-' + `-._ `-.__.-' _.-' + `-._ _.-' + `-.__.-' + +[1592] 18 May 12:22:56.535 # Server started, Redis version 3.2.100 +[1592] 18 May 12:22:56.535 * The server is now ready to accept connections on port 6379 \ No newline at end of file diff --git a/src/test/resources/redis-4.x-sentinel-startup-output.txt b/src/test/resources/redis-4.x-sentinel-startup-output.txt new file mode 100644 index 00000000..71580d7f --- /dev/null +++ b/src/test/resources/redis-4.x-sentinel-startup-output.txt @@ -0,0 +1,26 @@ +2091:X 18 May 18:04:58.961 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo +2091:X 18 May 18:04:58.962 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=2091, just started +2091:X 18 May 18:04:58.962 # Configuration loaded +2091:X 18 May 18:04:58.963 # You requested maxclients of 10000 requiring at least 10032 max file descriptors. +2091:X 18 May 18:04:58.963 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. +2091:X 18 May 18:04:58.963 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. + _._ + _.-``__ ''-._ + _.-`` `. `_. ''-._ Redis 4.0.9 (00000000/0) 64 bit + .-`` .-```. ```\/ _.,_ ''-._ + ( ' , .-` | `, ) Running in sentinel mode + |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 + | `-._ `._ / _.-' | PID: 2091 + `-._ `-._ `-./ _.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | http://redis.io + `-._ `-._`-.__.-'_.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | + `-._ `-._`-.__.-'_.-' _.-' + `-._ `-.__.-' _.-' + `-._ _.-' + `-.__.-' + +2091:X 18 May 18:04:58.964 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. +2091:X 18 May 18:04:58.970 # Sentinel ID is 70592a23712d81e2ebc460624a95a0a0fd13a737 \ No newline at end of file diff --git a/src/test/resources/redis-4.x-standalone-startup-output.txt b/src/test/resources/redis-4.x-standalone-startup-output.txt new file mode 100644 index 00000000..f1f64e26 --- /dev/null +++ b/src/test/resources/redis-4.x-standalone-startup-output.txt @@ -0,0 +1,29 @@ +1780:C 18 May 18:03:03.442 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo +1780:C 18 May 18:03:03.442 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=1780, just started +1780:C 18 May 18:03:03.442 # Configuration loaded +1780:M 18 May 18:03:03.443 # You requested maxclients of 10000 requiring at least 10032 max file descriptors. +1780:M 18 May 18:03:03.443 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted. +1780:M 18 May 18:03:03.443 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. + _._ + _.-``__ ''-._ + _.-`` `. `_. ''-._ Redis 4.0.9 (00000000/0) 64 bit + .-`` .-```. ```\/ _.,_ ''-._ + ( ' , .-` | `, ) Running in standalone mode + |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 + | `-._ `._ / _.-' | PID: 1780 + `-._ `-._ `-./ _.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | http://redis.io + `-._ `-._`-.__.-'_.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | + `-._ `-._`-.__.-'_.-' _.-' + `-._ `-.__.-' _.-' + `-._ _.-' + `-.__.-' + +1780:M 18 May 18:03:03.444 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. +1780:M 18 May 18:03:03.445 # Server initialized +1780:M 18 May 18:03:03.445 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. +1780:M 18 May 18:03:03.445 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. +1780:M 18 May 18:03:03.445 * Ready to accept connections \ No newline at end of file