Search in sources :

Example 1 with JedisMock

use of com.netflix.conductor.jedis.JedisMock in project conductor by Netflix.

the class MockQueueDAOModule method configureQueueDAO.

@Override
public void configureQueueDAO() {
    DetachedMockFactory detachedMockFactory = new DetachedMockFactory();
    JedisCommands jedisMock = new JedisMock();
    ShardSupplier shardSupplier = new ShardSupplier() {

        @Override
        public Set<String> getQueueShards() {
            return new HashSet<>(Collections.singletonList("a"));
        }

        @Override
        public String getCurrentShard() {
            return "a";
        }

        @Override
        public String getShardForHost(Host host) {
            return "a";
        }
    };
    RedisQueues redisQueues = new RedisQueues(jedisMock, jedisMock, "mockedQueues", shardSupplier, 60000, 120000);
    DynoQueueDAO dynoQueueDAO = new DynoQueueDAO(redisQueues);
    bind(QueueDAO.class).toInstance(detachedMockFactory.Spy(dynoQueueDAO));
    install(new WorkflowExecutorModule());
}
Also used : DynoQueueDAO(com.netflix.conductor.dao.dynomite.queue.DynoQueueDAO) QueueDAO(com.netflix.conductor.dao.QueueDAO) JedisCommands(redis.clients.jedis.commands.JedisCommands) DynoQueueDAO(com.netflix.conductor.dao.dynomite.queue.DynoQueueDAO) WorkflowExecutorModule(com.netflix.conductor.core.execution.WorkflowExecutorModule) JedisMock(com.netflix.conductor.jedis.JedisMock) Host(com.netflix.dyno.connectionpool.Host) RedisQueues(com.netflix.dyno.queues.redis.RedisQueues) DetachedMockFactory(spock.mock.DetachedMockFactory) ShardSupplier(com.netflix.dyno.queues.ShardSupplier) HashSet(java.util.HashSet)

Aggregations

WorkflowExecutorModule (com.netflix.conductor.core.execution.WorkflowExecutorModule)1 QueueDAO (com.netflix.conductor.dao.QueueDAO)1 DynoQueueDAO (com.netflix.conductor.dao.dynomite.queue.DynoQueueDAO)1 JedisMock (com.netflix.conductor.jedis.JedisMock)1 Host (com.netflix.dyno.connectionpool.Host)1 ShardSupplier (com.netflix.dyno.queues.ShardSupplier)1 RedisQueues (com.netflix.dyno.queues.redis.RedisQueues)1 HashSet (java.util.HashSet)1 JedisCommands (redis.clients.jedis.commands.JedisCommands)1 DetachedMockFactory (spock.mock.DetachedMockFactory)1