Added watch command

This commit is contained in:
Jonathan Leibiusky
2010-07-07 23:14:25 -03:00
parent 20acb5bc60
commit ce1ebdd022
3 changed files with 29 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
package redis.clients.jedis.tests.commands;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
@@ -72,4 +74,22 @@ public class TransactionCommandsTest extends Assert {
expected.add(2);
assertEquals(expected, response);
}
@Test
public void watch() throws JedisException, UnknownHostException,
IOException {
jedis.watch("mykey");
String val = jedis.get("mykey");
val = "foo";
Transaction t = jedis.multi();
Jedis nj = new Jedis("localhost");
nj.connect();
nj.set("mykey", "bar");
nj.disconnect();
t.set("mykey", val);
List<Object> resp = t.exec();
assertEquals(new ArrayList<Object>(), resp);
}
}