use of redis.clients.jedis.Pipeline in project pinpoint by naver.
the class RedisPluginTest method pipeline.
@Test
public void pipeline() {
JedisMock jedis = new JedisMock("localhost", 6379);
try {
Pipeline pipeline = jedis.pipelined();
pipeline.get("foo");
} finally {
if (jedis != null) {
jedis.close();
}
}
final List<SpanEventBo> events = getCurrentSpanEvents();
assertEquals(1, events.size());
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class TransactionCommandsTest method testResetStateWhenInMultiWithinPipeline.
@Test
public void testResetStateWhenInMultiWithinPipeline() {
jedis.auth("foobared");
Pipeline p = jedis.pipelined();
p.multi();
p.set("foooo", "barrr");
jedis.resetState();
assertEquals(null, jedis.get("foooo"));
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class PipeliningTest method testCloseable.
@Test
public void testCloseable() throws IOException {
// we need to test with fresh instance of Jedis
Jedis jedis2 = new Jedis(hnp.getHost(), hnp.getPort(), 500);
jedis2.auth("foobared");
Pipeline pipeline = jedis2.pipelined();
Response<String> retFuture1 = pipeline.set("a", "1");
Response<String> retFuture2 = pipeline.set("b", "2");
pipeline.close();
// it shouldn't meet any exception
retFuture1.get();
retFuture2.get();
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class HashesCommandsTest method hgetAllPipeline.
@Test
public void hgetAllPipeline() {
Map<byte[], byte[]> bh = new HashMap<byte[], byte[]>();
bh.put(bbar, bcar);
bh.put(bcar, bbar);
jedis.hmset(bfoo, bh);
Pipeline pipeline = jedis.pipelined();
Response<Map<byte[], byte[]>> bhashResponse = pipeline.hgetAll(bfoo);
pipeline.sync();
Map<byte[], byte[]> bhash = bhashResponse.get();
assertEquals(2, bhash.size());
assertArrayEquals(bcar, bhash.get(bbar));
assertArrayEquals(bbar, bhash.get(bcar));
}
use of redis.clients.jedis.Pipeline in project jedis by xetorthio.
the class PipeliningTest method pipelineResponseWithoutData.
@Test
public void pipelineResponseWithoutData() {
jedis.zadd("zset", 1, "foo");
Pipeline p = jedis.pipelined();
Response<Double> score = p.zscore("zset", "bar");
p.sync();
assertNull(score.get());
}
Aggregations