Several changes have been added to this commit:
- Add asking to cluster commands - Make jedis cluster return connection to original pool - Add tests for MOVED and ASK cluster responses - Refactor connection handler to recalculate connections based on slots This commit makes the first usable version of Jedis along with Redis Cluster
This commit is contained in:
@@ -13,6 +13,7 @@ import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisCluster;
|
||||
import redis.clients.jedis.Pipeline;
|
||||
import redis.clients.jedis.exceptions.JedisAskDataException;
|
||||
import redis.clients.jedis.exceptions.JedisClusterException;
|
||||
import redis.clients.jedis.exceptions.JedisMovedDataException;
|
||||
import redis.clients.jedis.tests.utils.JedisClusterCRC16;
|
||||
|
||||
@@ -39,7 +40,7 @@ public class JedisClusterTest extends Assert {
|
||||
node3.connect();
|
||||
node3.flushAll();
|
||||
|
||||
// ---- configure cluster
|
||||
// ---- configure cluster
|
||||
|
||||
// add nodes to cluster
|
||||
node1.clusterMeet("127.0.0.1", nodeInfo1.getPort());
|
||||
@@ -148,6 +149,14 @@ public class JedisClusterTest extends Assert {
|
||||
assertEquals("foo", jc.get("51"));
|
||||
}
|
||||
|
||||
@Test(expected=JedisClusterException.class)
|
||||
public void testThrowExceptionWithoutKey() {
|
||||
Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
|
||||
jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379));
|
||||
JedisCluster jc = new JedisCluster(jedisClusterNode);
|
||||
jc.ping();
|
||||
}
|
||||
|
||||
private String getNodeId(String infoOutput) {
|
||||
for (String infoLine : infoOutput.split("\n")) {
|
||||
if (infoLine.contains("myself")) {
|
||||
|
||||
Reference in New Issue
Block a user