redis.embedded.RedisServer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of embedded-redis Show documentation
Show all versions of embedded-redis Show documentation
Redis embedded server for Java integration testing
package redis.embedded;
import redis.embedded.util.JarUtil;
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 = ".*The server is now ready to accept connections on port.*";
private static final int DEFAULT_REDIS_PORT = 6379;
public RedisServer() throws IOException {
this(DEFAULT_REDIS_PORT);
}
public RedisServer(Integer port) throws IOException {
super(port);
File executable = JarUtil.extractExecutableFromJar(RedisRunScriptEnum.getRedisRunScript());
this.args = Arrays.asList(
executable.getAbsolutePath(),
"--port", Integer.toString(port)
);
}
public RedisServer(File executable, Integer port) {
super(port);
this.args = Arrays.asList(
executable.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