use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class PipeliningTest method piplineWithError.
@Test
public void piplineWithError() {
Pipeline p = jedis.pipelined();
p.set("foo", "bar");
Response<Set<String>> error = p.smembers("foo");
Response<String> r = p.get("foo");
p.sync();
try {
error.get();
fail();
} catch (JedisDataException e) {
// that is fine we should be here
}
assertEquals(r.get(), "bar");
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class PipeliningTest method testJedisThowExceptionWhenInPipeline.
@Test(expected = JedisDataException.class)
public void testJedisThowExceptionWhenInPipeline() {
Pipeline pipeline = jedis.pipelined();
pipeline.set("foo", "3");
jedis.get("somekey");
fail("Can't use jedis instance when in Pipeline");
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class PipeliningTest method pipelineWithPubSub.
@Test
public void pipelineWithPubSub() {
Pipeline pipelined = jedis.pipelined();
Response<Long> p1 = pipelined.publish("foo", "bar");
Response<Long> p2 = pipelined.publish("foo".getBytes(), "bar".getBytes());
pipelined.sync();
assertEquals(0, p1.get().longValue());
assertEquals(0, p2.get().longValue());
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class PipeliningTest method testEvalNestedLists.
@Test
public void testEvalNestedLists() {
String script = "return { {KEYS[1]} , {2} }";
Pipeline p = jedis.pipelined();
Response<Object> result = p.eval(script, 1, "key1");
p.sync();
List<?> results = (List<?>) result.get();
assertThat((List<String>) results.get(0), listWithItem("key1"));
assertThat((List<Long>) results.get(1), listWithItem(2L));
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class PipeliningTest method pipelineSelect.
@Test
public void pipelineSelect() {
Pipeline p = jedis.pipelined();
p.select(1);
p.sync();
}
Aggregations