Binary scripting API is tested

This commit is contained in:
Ivo Ramirez
2011-12-15 17:56:14 +01:00
committed by ivowiblo
parent 96d405a6e3
commit 9bf19c6237
4 changed files with 30 additions and 5 deletions

View File

@@ -3037,9 +3037,9 @@ public class BinaryJedis implements BinaryJedisCommands {
return client.getBinaryBulkReply();
}
public List<byte[]> scriptExists(byte[]... sha1){
public List<Long> scriptExists(byte[]... sha1){
client.scriptExists(sha1);
return client.getBinaryMultiBulkReply();
return client.getIntegerMultiBulkReply();
}
public byte[] scriptLoad(byte[] script){

View File

@@ -205,6 +205,13 @@ public class Connection {
pipelinedCommands--;
return (List<Object>) protocol.read(inputStream);
}
@SuppressWarnings("unchecked")
public List<Long> getIntegerMultiBulkReply() {
flush();
pipelinedCommands--;
return (List<Long>) protocol.read(inputStream);
}
public List<Object> getAll() {
return getAll(0);

View File

@@ -2749,11 +2749,11 @@ public class Jedis extends BinaryJedis implements JedisCommands {
public List<Boolean> scriptExists(String... sha1){
client.scriptExists(sha1);
List<Object> result = client.getObjectMultiBulkReply();
List<Long> result = client.getIntegerMultiBulkReply();
List<Boolean> exists = new ArrayList<Boolean>();
for(Object value : result)
exists.add(((Long)value) == 1);
for(Long value : result)
exists.add(value == 1);
return exists;
}