#146 - Add example to demonstrate Redis Cluster support.
Example demonstrating the basic usage of Spring Data Redis in a clustered environment using Jedis.
This commit is contained in:
committed by
Oliver Gierke
parent
9cb44b3166
commit
dfc1bf0390
@@ -18,8 +18,9 @@ package example.springdata.redis.test.util;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
|
||||
import org.junit.internal.AssumptionViolatedException;
|
||||
import org.junit.AssumptionViolatedException;
|
||||
import org.junit.rules.ExternalResource;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Implementation of junit rule {@link ExternalResource} to verify Redis (or at least something on the defined host and
|
||||
@@ -44,6 +45,10 @@ public class RequiresRedisServer extends ExternalResource {
|
||||
return new RequiresRedisServer("localhost", 6379);
|
||||
}
|
||||
|
||||
public static RequiresRedisServer listeningAt(String host, int port) {
|
||||
return new RequiresRedisServer(StringUtils.hasText(host) ? host : "127.0.0.1", port);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.junit.rules.ExternalResource#before()
|
||||
|
||||
Reference in New Issue
Block a user