Search in sources :

Example 6 with JedisCommands

use of redis.clients.jedis.commands.JedisCommands in project conductor by Netflix.

the class DynoProxy method hgetAll.

public Map<String, String> hgetAll(String key) {
    Map<String, String> m = new HashMap<>();
    JedisCommands dyno = dynoClient;
    int cursor = 0;
    do {
        ScanResult<Entry<String, String>> scanResult = dyno.hscan(key, "" + cursor);
        cursor = Integer.parseInt(scanResult.getCursor());
        for (Entry<String, String> r : scanResult.getResult()) {
            m.put(r.getKey(), r.getValue());
        }
    } while (cursor > 0);
    return m;
}
Also used : JedisCommands(redis.clients.jedis.commands.JedisCommands) Entry(java.util.Map.Entry) HashMap(java.util.HashMap)

Example 7 with JedisCommands

use of redis.clients.jedis.commands.JedisCommands in project conductor by Netflix.

the class DynoProxy method smembers.

public Set<String> smembers(String key) {
    logger.trace("smembers {}", key);
    JedisCommands client = dynoClient;
    Set<String> r = new HashSet<>();
    int cursor = 0;
    ScanParams sp = new ScanParams();
    sp.count(50);
    do {
        ScanResult<String> scanResult = client.sscan(key, "" + cursor, sp);
        cursor = Integer.parseInt(scanResult.getCursor());
        r.addAll(scanResult.getResult());
    } while (cursor > 0);
    return r;
}
Also used : JedisCommands(redis.clients.jedis.commands.JedisCommands) ScanParams(redis.clients.jedis.ScanParams) HashSet(java.util.HashSet)

Example 8 with JedisCommands

use of redis.clients.jedis.commands.JedisCommands in project conductor by Netflix.

the class DynoProxy method hkeys.

public Set<String> hkeys(String key) {
    logger.trace("hkeys {}", key);
    JedisCommands client = dynoClient;
    Set<String> keys = new HashSet<>();
    int cursor = 0;
    do {
        ScanResult<Entry<String, String>> sr = client.hscan(key, "" + cursor);
        cursor = Integer.parseInt(sr.getCursor());
        List<Entry<String, String>> result = sr.getResult();
        for (Entry<String, String> e : result) {
            keys.add(e.getKey());
        }
    } while (cursor > 0);
    return keys;
}
Also used : JedisCommands(redis.clients.jedis.commands.JedisCommands) Entry(java.util.Map.Entry) HashSet(java.util.HashSet)

Example 9 with JedisCommands

use of redis.clients.jedis.commands.JedisCommands in project conductor by Netflix.

the class RedisEventHandlerDAOTest method init.

@Before
public void init() {
    Configuration config = new TestConfiguration();
    JedisCommands jedisMock = new JedisMock();
    DynoProxy dynoClient = new DynoProxy(jedisMock);
    redisEventHandlerDAO = new RedisEventHandlerDAO(dynoClient, objectMapper, config);
}
Also used : JedisCommands(redis.clients.jedis.commands.JedisCommands) Configuration(com.netflix.conductor.core.config.Configuration) TestConfiguration(com.netflix.conductor.config.TestConfiguration) DynoProxy(com.netflix.conductor.dyno.DynoProxy) TestConfiguration(com.netflix.conductor.config.TestConfiguration) JedisMock(com.netflix.conductor.dao.redis.JedisMock) Before(org.junit.Before)

Example 10 with JedisCommands

use of redis.clients.jedis.commands.JedisCommands in project conductor by Netflix.

the class RedisExecutionDAOTest method init.

@Before
public void init() {
    Configuration config = new TestConfiguration();
    JedisCommands jedisMock = new JedisMock();
    DynoProxy dynoClient = new DynoProxy(jedisMock);
    executionDAO = new RedisExecutionDAO(dynoClient, objectMapper, config);
}
Also used : JedisCommands(redis.clients.jedis.commands.JedisCommands) Configuration(com.netflix.conductor.core.config.Configuration) TestConfiguration(com.netflix.conductor.config.TestConfiguration) DynoProxy(com.netflix.conductor.dyno.DynoProxy) TestConfiguration(com.netflix.conductor.config.TestConfiguration) JedisMock(com.netflix.conductor.dao.redis.JedisMock) Before(org.junit.Before)

Aggregations

JedisCommands (redis.clients.jedis.commands.JedisCommands)10 TestConfiguration (com.netflix.conductor.config.TestConfiguration)6 JedisMock (com.netflix.conductor.dao.redis.JedisMock)6 Before (org.junit.Before)6 Configuration (com.netflix.conductor.core.config.Configuration)5 DynoProxy (com.netflix.conductor.dyno.DynoProxy)5 HashSet (java.util.HashSet)4 DynoQueueDAO (com.netflix.conductor.dao.dynomite.queue.DynoQueueDAO)2 Host (com.netflix.dyno.connectionpool.Host)2 ShardSupplier (com.netflix.dyno.queues.ShardSupplier)2 Entry (java.util.Map.Entry)2 WorkflowExecutorModule (com.netflix.conductor.core.execution.WorkflowExecutorModule)1 QueueDAO (com.netflix.conductor.dao.QueueDAO)1 JedisMock (com.netflix.conductor.jedis.JedisMock)1 RedisQueues (com.netflix.dyno.queues.redis.RedisQueues)1 HashMap (java.util.HashMap)1 ScanParams (redis.clients.jedis.ScanParams)1 DetachedMockFactory (spock.mock.DetachedMockFactory)1