DATAREDIS-479 - Upgrade to jedis to 2.8.1.
Update jedis driver to 2.8.1. Use binary method for SSCAN and implement ZSCAN and HSCAN methods. Move ScanOptions to ScanParams conversion to JedisConverters. Original Pull Request: #178
This commit is contained in:
committed by
Christoph Strobl
parent
069954ee7a
commit
77de777da8
@@ -20,6 +20,7 @@ import static org.hamcrest.collection.IsIterableContainingInOrder.*;
|
||||
import static org.hamcrest.number.IsCloseTo.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.data.redis.connection.ClusterTestVariables.*;
|
||||
import static org.springframework.data.redis.core.ScanOptions.scanOptions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
@@ -1769,6 +1770,33 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
public void zInterStoreShouldThrowExceptionWhenKeysDoNotMapToSameSlots() {
|
||||
clusterConnection.zInterStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-479
|
||||
*/
|
||||
@Test
|
||||
public void zScanShouldReadEntireValueRange() {
|
||||
|
||||
nativeConnection.zadd(KEY_1_BYTES, 2, VALUE_1_BYTES);
|
||||
nativeConnection.zadd(KEY_1_BYTES, 1, VALUE_2_BYTES);
|
||||
nativeConnection.zadd(KEY_1_BYTES, 4, VALUE_3_BYTES);
|
||||
|
||||
Cursor<Tuple> tuples = clusterConnection.zScan(KEY_1_BYTES, ScanOptions.NONE);
|
||||
|
||||
int count = 0;
|
||||
while (tuples.hasNext()) {
|
||||
|
||||
Tuple tuple = tuples.next();
|
||||
|
||||
assertThat(tuple.getValue(), anyOf(equalTo(VALUE_1_BYTES), equalTo(VALUE_2_BYTES), equalTo(VALUE_3_BYTES)));
|
||||
assertThat(tuple.getScore(), anyOf(equalTo(1D), equalTo(2D), equalTo(4D)));
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
assertThat(count, equalTo(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-315
|
||||
@@ -1952,6 +1980,32 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(hGetAll.containsKey(KEY_2_BYTES), is(true));
|
||||
assertThat(hGetAll.containsKey(KEY_3_BYTES), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-479
|
||||
*/
|
||||
@Test
|
||||
public void hScanShouldReadEntireValueRange() {
|
||||
|
||||
clusterConnection.hSet(KEY_1_BYTES, KEY_1_BYTES, VALUE_1_BYTES);
|
||||
clusterConnection.hSet(KEY_1_BYTES, KEY_2_BYTES, VALUE_2_BYTES);
|
||||
clusterConnection.hSet(KEY_1_BYTES, KEY_3_BYTES, VALUE_3_BYTES);
|
||||
|
||||
Cursor<Map.Entry<byte[], byte[]>> cursor = clusterConnection
|
||||
.hScan(KEY_1_BYTES, scanOptions().match("key*").build());
|
||||
|
||||
int i = 0;
|
||||
while (cursor.hasNext()) {
|
||||
|
||||
byte[] key = cursor.next().getKey();
|
||||
|
||||
assertThat(key, anyOf(equalTo(KEY_1_BYTES), equalTo(KEY_2_BYTES), equalTo(KEY_3_BYTES)));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
assertThat(i, is(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-315
|
||||
|
||||
Reference in New Issue
Block a user