diff --git a/pom.xml b/pom.xml index 71e18539..5a12a46b 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.codemonstur embedded-redis - 1.4.1 + 1.4.2 jar embedded-redis diff --git a/src/main/java/redis/embedded/core/RedisSentinelBuilder.java b/src/main/java/redis/embedded/core/RedisSentinelBuilder.java index 828b26a0..04b6691a 100644 --- a/src/main/java/redis/embedded/core/RedisSentinelBuilder.java +++ b/src/main/java/redis/embedded/core/RedisSentinelBuilder.java @@ -25,6 +25,7 @@ public final class RedisSentinelBuilder { LINE_PORT = "port %d"; private File executable; + private ExecutableProvider executableProvider = newJarResourceProvider(); private String bind = "127.0.0.1"; private Integer port = 26379; @@ -100,13 +101,8 @@ public RedisSentinelBuilder settingIf(final boolean shouldSet, final String conf } public RedisSentinelBuilder setting(final String configLine) { - if (sentinelConf != null) { - throw new IllegalArgumentException("Redis configuration is already set using redis conf file"); - } - - if (redisConfigBuilder == null) { - redisConfigBuilder = new StringBuilder(); - } + if (sentinelConf != null) throw new IllegalArgumentException("Redis configuration is already set using redis conf file"); + if (redisConfigBuilder == null) redisConfigBuilder = new StringBuilder(); redisConfigBuilder.append(configLine).append(LINE_SEPARATOR); return this; diff --git a/src/main/java/redis/embedded/core/RedisServerBuilder.java b/src/main/java/redis/embedded/core/RedisServerBuilder.java index 49d7e2a6..871da5fd 100644 --- a/src/main/java/redis/embedded/core/RedisServerBuilder.java +++ b/src/main/java/redis/embedded/core/RedisServerBuilder.java @@ -21,7 +21,6 @@ public final class RedisServerBuilder { private static final String LINE_SEPARATOR = System.getProperty("line.separator"); - private File executable; private ExecutableProvider provider = newJarResourceProvider(); private String bindAddress = "127.0.0.1"; private int bindPort = DEFAULT_REDIS_PORT; @@ -94,14 +93,7 @@ public RedisServer build() throws IOException { } public void reset() { - this.executable = null; this.slaveOf = null; - this.redisConfigBuilder = new StringBuilder(); - this.provider = newJarResourceProvider(); - this.bindAddress = "127.0.0.1"; - this.bindPort = DEFAULT_REDIS_PORT; - this.soutListener = null; - this.serrListener = null; } public List buildCommandArgs() throws IOException { @@ -110,10 +102,8 @@ public List buildCommandArgs() throws IOException { final Path redisConfigFile = writeNewRedisConfigFile("embedded-redis-server_" + bindPort, redisConfigBuilder.toString()); - executable = provider.get(); - final List args = new ArrayList<>(); - args.add(executable.getAbsolutePath()); + args.add(provider.get().getAbsolutePath()); args.add(redisConfigFile.toAbsolutePath().toString()); args.add("--port"); args.add(Integer.toString(bindPort));