package org.redisson;

import java.io.File;
import java.io.IOException;
import java.net.URL;

public class RedisRunner {

    private static final String redisFolder = "C:\\Devel\\projects\\redis\\Redis-x64-3.0.500\\";

    public static Process runRedis(String configPath) throws IOException, InterruptedException {
        URL resource = RedisRunner.class.getResource(configPath);

        ProcessBuilder master = new ProcessBuilder(redisFolder + "redis-server.exe", resource.getFile().substring(1));
        master.directory(new File(redisFolder));
        Process p = master.start();
        Thread.sleep(1000);
        return p;
    }


}

@@ -85,16 +85,94 @@
 net.URL;
+%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Optional;
 %0A%0Apublic
@@ -193,16 +193,21 @@
 nner %7B%0A%0A
+    %0A
     priv
@@ -295,16 +295,863 @@
 500%5C%5C%22;%0A
+    private static final String redisBinary = redisFolder + %22redis-server.exe%22;%0A    %0A    private final List%3CString%3E options = new ArrayList%3C%3E();%0A%0A    %7B%0A        options.add(Optional.ofNullable(System.getProperty(%22redisBinary%22)).orElse(redisBinary));%0A    %7D%0A    %0A    /**%0A     * To change the %3Cb%3EredisBinary%3C/b%3E system property for running the test,%0A     * use %3Ci%3EargLine%3C/i%3E option from surefire plugin:%0A     *%0A     * $ mvn -DargLine=%22-DredisBinary=%60which redis-server%60%22 -Punit-test clean %5C%0A     * verify%0A     *%0A     * @param configPath%0A     * @return Process running redis instance%0A     * @throws IOException%0A     * @throws InterruptedException%0A     * @see%0A     * %3Ca href=%22http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#argLine%22%3E%0A     * http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#argLine%3C/a%3E%0A     */
 %0A    pub
@@ -1177,16 +1177,30 @@
 runRedis
+WithConfigFile
 (String 
@@ -1376,41 +1376,116 @@
 der(
-redisFolder + %22redis-server.exe%22,
+%0A                Optional.ofNullable(System.getProperty(%22redisBinary%22)).orElse(redisBinary),%0A               
  res
@@ -1653,11 +1653,413 @@
 %0A    %7D%0A%0A
+    public RedisRunner withPort(int port) %7B%0A        this.options.add(%22--port %22 + port);%0A        return this;%0A    %7D%0A    %0A    public Process run() throws IOException, InterruptedException %7B%0A        ProcessBuilder master = new ProcessBuilder(options);%0A        master.directory(new File(redisBinary).getParentFile());%0A        Process p = master.start();%0A        Thread.sleep(1000);%0A        return p;%0A    %7D%0A
 %0A%7D%0A

Make RedisRunner Accepts redis-server cli options