Add connection integration tests
- Add tests for all Connection methods - Add tests for all Connection methods through pipeline - Clean up DB between Connection test runs - Reduce sleeps in pub/sub tests to improve execution time
This commit is contained in:
@@ -79,4 +79,8 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "DefaultStringTuple[value=" + getValueAsString() + ", score=" + getScore() + "]";
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,10 @@ abstract class SrpUtils {
|
||||
}
|
||||
|
||||
static Set<Tuple> convertTuple(MultiBulkReply zrange) {
|
||||
Reply[] byteArrays = zrange.data();
|
||||
return convertTuple(zrange.data());
|
||||
}
|
||||
|
||||
static Set<Tuple> convertTuple(Reply[] byteArrays) {
|
||||
Set<Tuple> tuples = new LinkedHashSet<Tuple>(byteArrays.length / 2 + 1);
|
||||
|
||||
for (int i = 0; i < byteArrays.length; i++) {
|
||||
|
||||
@@ -17,12 +17,14 @@ package org.springframework.data.redis.serializer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Utility class with various serialization-related methods.
|
||||
* Utility class with various serialization-related methods.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
@@ -65,4 +67,17 @@ public abstract class SerializationUtils {
|
||||
public static <T> Collection<T> deserialize(Collection<byte[]> rawValues, RedisSerializer<T> redisSerializer) {
|
||||
return deserializeValues(rawValues, List.class, redisSerializer);
|
||||
}
|
||||
|
||||
public static <T> Map<T, T> deserialize(Map<byte[], byte[]> rawValues,
|
||||
RedisSerializer<T> redisSerializer) {
|
||||
if (rawValues == null) {
|
||||
return null;
|
||||
}
|
||||
Map<T, T> ret = new LinkedHashMap<T, T>(rawValues.size());
|
||||
for (Map.Entry<byte[], byte[]> entry : rawValues.entrySet()) {
|
||||
ret.put(redisSerializer.deserialize(entry.getKey()),
|
||||
redisSerializer.deserialize(entry.getValue()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user