Implemented BLPOP

This commit is contained in:
Jonathan Leibiusky
2010-08-03 00:32:13 -03:00
parent 3dd7ca6f2a
commit ef5518e581
8 changed files with 63 additions and 9 deletions

View File

@@ -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");
}
}

View File

@@ -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