All Downloads are FREE. Search and download functionalities are using the official Maven repository.

redis.embedded.RedisServer Maven / Gradle / Ivy

Go to download

Redis embedded server for Java integration testing. Project forked from https://github.com/kstyrc/embedded-redis

The newest version!
package redis.embedded;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class RedisServer extends AbstractRedisInstance {
    private static final String REDIS_READY_PATTERN = ".*(R|r)eady to accept connections.*";
    private static final int DEFAULT_REDIS_PORT = 6379;

    public RedisServer() {
        this(DEFAULT_REDIS_PORT);
    }

    public RedisServer(int port) {
        super(port);
        this.args = builder().port(port).build().args;
	}

    public RedisServer(File executable, int port) {
        super(port);
        this.args = Arrays.asList(
                executable.getAbsolutePath(),
                "--port", Integer.toString(port)
        );
    }

    public RedisServer(RedisExecProvider redisExecProvider, int port) throws IOException {
        super(port);
        this.args = Arrays.asList(
                redisExecProvider.get().getAbsolutePath(),
                "--port", Integer.toString(port)
        );
    }

    RedisServer(List args, int port) {
        super(port);
        this.args = new ArrayList(args);
    }

    public static RedisServerBuilder builder() {
        return new RedisServerBuilder();
    }

    @Override
    protected String redisReadyPattern() {
        return REDIS_READY_PATTERN;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy