fix incorrect cast of BulkReply to byte[] in SprConnection
DATAREDIS-114
This commit is contained in:
@@ -147,10 +147,10 @@ abstract class SrpUtils {
|
||||
return tuples;
|
||||
}
|
||||
|
||||
static Map<byte[], byte[]> toMap(Object[] byteArrays) {
|
||||
static Map<byte[], byte[]> toMap(Reply[] byteArrays) {
|
||||
Map<byte[], byte[]> map = new LinkedHashMap<byte[], byte[]>(byteArrays.length / 2);
|
||||
for (int i = 0; i < byteArrays.length; i++) {
|
||||
map.put((byte[]) byteArrays[i++], (byte[]) byteArrays[i]);
|
||||
map.put((byte[]) byteArrays[i++].data(), (byte[]) byteArrays[i].data());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.BlockingDeque;
|
||||
@@ -374,4 +375,18 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
assertArrayEquals(value1.getBytes(), (byte[]) result.get(2));
|
||||
assertArrayEquals(value2.getBytes(), (byte[]) result.get(3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashMethod() throws Exception {
|
||||
String hash = getClass() + ":hashtest";
|
||||
String key1 = UUID.randomUUID().toString();
|
||||
String key2 = UUID.randomUUID().toString();
|
||||
connection.hSet(hash, key1, UUID.randomUUID().toString());
|
||||
connection.hSet(hash, key2, UUID.randomUUID().toString());
|
||||
|
||||
Map<String, String> hashMap = connection.hGetAll(hash);
|
||||
assertTrue(hashMap.size() >= 2);
|
||||
assertTrue(hashMap.containsKey(key1));
|
||||
assertTrue(hashMap.containsKey(key2));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user