Search in sources :

Example 66 with Pipeline

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

Example 67 with Pipeline

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

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

Example 69 with Pipeline

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

Example 70 with Pipeline

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();
}
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