Search in sources :

Example 56 with Pipeline

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());
}
Also used : SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Pipeline(redis.clients.jedis.Pipeline) BasePinpointTest(com.navercorp.pinpoint.test.junit4.BasePinpointTest) Test(org.junit.Test)

Example 57 with Pipeline

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"));
}
Also used : Pipeline(redis.clients.jedis.Pipeline) Test(org.junit.Test)

Example 58 with Pipeline

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();
}
Also used : Jedis(redis.clients.jedis.Jedis) Pipeline(redis.clients.jedis.Pipeline) Test(org.junit.Test)

Example 59 with Pipeline

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));
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Pipeline(redis.clients.jedis.Pipeline) Test(org.junit.Test)

Example 60 with Pipeline

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());
}
Also used : Pipeline(redis.clients.jedis.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (redis.clients.jedis.Pipeline)77 Test (org.junit.Test)72 Jedis (redis.clients.jedis.Jedis)12 ArrayList (java.util.ArrayList)7 List (java.util.List)7 Map (java.util.Map)6 JedisDataException (redis.clients.jedis.exceptions.JedisDataException)6 HashMap (java.util.HashMap)5 Set (java.util.Set)3 Response (redis.clients.jedis.Response)3 LinkedHashMap (java.util.LinkedHashMap)2 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)1 BasePinpointTest (com.navercorp.pinpoint.test.junit4.BasePinpointTest)1 RedisDataTypeDescription (org.apache.storm.redis.common.mapper.RedisDataTypeDescription)1 RedisClusterStateUpdater (org.apache.storm.redis.trident.state.RedisClusterStateUpdater)1 RedisState (org.apache.storm.redis.trident.state.RedisState)1 RedisStateUpdater (org.apache.storm.redis.trident.state.RedisStateUpdater)1 ISqlTridentDataSource (org.apache.storm.sql.runtime.ISqlTridentDataSource)1 StateUpdater (org.apache.storm.trident.state.StateUpdater)1 TridentTuple (org.apache.storm.trident.tuple.TridentTuple)1