Implemented BLPOP
This commit is contained in:
@@ -102,6 +102,15 @@ public class ProtocolTest extends Assert {
|
||||
expected2.add(sub);
|
||||
|
||||
assertEquals(expected2, response2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void nullMultiBulkReply() throws JedisException {
|
||||
InputStream is = new ByteArrayInputStream("*-1\r\n".getBytes());
|
||||
Protocol protocol = new Protocol();
|
||||
List<String> response = (List<String>) (List<?>) protocol
|
||||
.getMultiBulkReply(is);
|
||||
assertNull(response);
|
||||
}
|
||||
}
|
||||
@@ -220,4 +220,26 @@ public class ListCommandsTest extends Assert {
|
||||
assertEquals(srcExpected, jedis.lrange("foo", 0, 1000));
|
||||
assertEquals(dstExpected, jedis.lrange("dst", 0, 1000));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void blpop() throws JedisException {
|
||||
List<String> result = jedis.blpop(2, "foo");
|
||||
assertNull(result);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Jedis j = new Jedis("localhost");
|
||||
j.connect();
|
||||
List<String> result = j.blpop(0, "foo");
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
assertEquals("bar", result.get(0));
|
||||
} catch (Exception ex) {
|
||||
fail(ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
jedis.lpush("foo", "bar");
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class TransactionCommandsTest extends Assert {
|
||||
|
||||
t.set("mykey", val);
|
||||
List<Object> resp = t.exec();
|
||||
assertEquals(new ArrayList<Object>(), resp);
|
||||
assertEquals(null, resp);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user