Introduce *scan with "string" cursor parameter to support unsigned long
cursor * overload all *scan method to change "int" cursor to "string" cursor * set @Deprecated and leave reason to deprecate and when to remove to current *scan method * modify unit tests to make it work with new *scan method
This commit is contained in:
@@ -10,6 +10,7 @@ import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.exceptions.JedisDataException;
|
||||
import redis.clients.util.SafeEncoder;
|
||||
import static redis.clients.jedis.ScanParams.SCAN_POINTER_START;
|
||||
|
||||
public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
|
||||
final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
|
||||
@@ -510,9 +511,9 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
|
||||
jedis.set("b", "b");
|
||||
jedis.set("a", "a");
|
||||
|
||||
ScanResult<String> result = jedis.scan(0);
|
||||
ScanResult<String> result = jedis.scan(SCAN_POINTER_START);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -524,9 +525,9 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
|
||||
jedis.set("b", "b");
|
||||
jedis.set("a", "a");
|
||||
jedis.set("aa", "aa");
|
||||
ScanResult<String> result = jedis.scan(0, params);
|
||||
ScanResult<String> result = jedis.scan(SCAN_POINTER_START, params);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -539,7 +540,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase {
|
||||
jedis.set("a" + i, "a" + i);
|
||||
}
|
||||
|
||||
ScanResult<String> result = jedis.scan(0, params);
|
||||
ScanResult<String> result = jedis.scan(SCAN_POINTER_START, params);
|
||||
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.junit.Test;
|
||||
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import static redis.clients.jedis.ScanParams.SCAN_POINTER_START;
|
||||
|
||||
public class HashesCommandsTest extends JedisCommandTestBase {
|
||||
final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
|
||||
@@ -295,9 +296,9 @@ public class HashesCommandsTest extends JedisCommandTestBase {
|
||||
jedis.hset("foo", "b", "b");
|
||||
jedis.hset("foo", "a", "a");
|
||||
|
||||
ScanResult<Map.Entry<String, String>> result = jedis.hscan("foo", 0);
|
||||
ScanResult<Map.Entry<String, String>> result = jedis.hscan("foo", SCAN_POINTER_START);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -309,10 +310,10 @@ public class HashesCommandsTest extends JedisCommandTestBase {
|
||||
jedis.hset("foo", "b", "b");
|
||||
jedis.hset("foo", "a", "a");
|
||||
jedis.hset("foo", "aa", "aa");
|
||||
ScanResult<Map.Entry<String, String>> result = jedis.hscan("foo", 0,
|
||||
params);
|
||||
ScanResult<Map.Entry<String, String>> result = jedis.hscan("foo",
|
||||
SCAN_POINTER_START, params);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -325,8 +326,8 @@ public class HashesCommandsTest extends JedisCommandTestBase {
|
||||
jedis.hset("foo", "a" + i, "a" + i);
|
||||
}
|
||||
|
||||
ScanResult<Map.Entry<String, String>> result = jedis.hscan("foo", 0,
|
||||
params);
|
||||
ScanResult<Map.Entry<String, String>> result = jedis.hscan("foo",
|
||||
SCAN_POINTER_START, params);
|
||||
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.junit.Test;
|
||||
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import static redis.clients.jedis.ScanParams.SCAN_POINTER_START;
|
||||
|
||||
public class SetCommandsTest extends JedisCommandTestBase {
|
||||
final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
|
||||
@@ -457,9 +458,9 @@ public class SetCommandsTest extends JedisCommandTestBase {
|
||||
public void sscan() {
|
||||
jedis.sadd("foo", "a", "b");
|
||||
|
||||
ScanResult<String> result = jedis.sscan("foo", 0);
|
||||
ScanResult<String> result = jedis.sscan("foo", SCAN_POINTER_START);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -469,9 +470,9 @@ public class SetCommandsTest extends JedisCommandTestBase {
|
||||
params.match("a*");
|
||||
|
||||
jedis.sadd("foo", "b", "a", "aa");
|
||||
ScanResult<String> result = jedis.sscan("foo", 0, params);
|
||||
ScanResult<String> result = jedis.sscan("foo", SCAN_POINTER_START, params);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ public class SetCommandsTest extends JedisCommandTestBase {
|
||||
|
||||
jedis.sadd("foo", "a1", "a2", "a3", "a4", "a5");
|
||||
|
||||
ScanResult<String> result = jedis.sscan("foo", 0, params);
|
||||
ScanResult<String> result = jedis.sscan("foo", SCAN_POINTER_START, params);
|
||||
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.Tuple;
|
||||
import redis.clients.jedis.ZParams;
|
||||
import redis.clients.util.SafeEncoder;
|
||||
import static redis.clients.jedis.ScanParams.SCAN_POINTER_START;
|
||||
|
||||
public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
|
||||
@@ -894,9 +895,9 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
jedis.zadd("foo", 1, "a");
|
||||
jedis.zadd("foo", 2, "b");
|
||||
|
||||
ScanResult<Tuple> result = jedis.zscan("foo", 0);
|
||||
ScanResult<Tuple> result = jedis.zscan("foo", SCAN_POINTER_START);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -908,9 +909,9 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
jedis.zadd("foo", 2, "b");
|
||||
jedis.zadd("foo", 1, "a");
|
||||
jedis.zadd("foo", 11, "aa");
|
||||
ScanResult<Tuple> result = jedis.zscan("foo", 0, params);
|
||||
ScanResult<Tuple> result = jedis.zscan("foo", SCAN_POINTER_START, params);
|
||||
|
||||
assertEquals(0, result.getCursor());
|
||||
assertEquals(SCAN_POINTER_START, result.getStringCursor());
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
@@ -925,7 +926,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase {
|
||||
jedis.zadd("foo", 4, "a4");
|
||||
jedis.zadd("foo", 5, "a5");
|
||||
|
||||
ScanResult<Tuple> result = jedis.zscan("foo", 0, params);
|
||||
ScanResult<Tuple> result = jedis.zscan("foo", SCAN_POINTER_START, params);
|
||||
|
||||
assertFalse(result.getResult().isEmpty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user