Search in sources :

Example 1 with Host

use of com.netflix.dyno.connectionpool.Host in project dynomite-cluster-checker by diegopacheco.

the class SimpleConnectionTest method toHostSupplier.

private static HostSupplier toHostSupplier(List<DynomiteNodeInfo> nodes) {
    final List<Host> hosts = new ArrayList<Host>();
    for (DynomiteNodeInfo node : nodes) {
        hosts.add(buildHost(node));
    }
    final HostSupplier customHostSupplier = new HostSupplier() {

        @Override
        public Collection<Host> getHosts() {
            return hosts;
        }
    };
    return customHostSupplier;
}
Also used : HostSupplier(com.netflix.dyno.connectionpool.HostSupplier) ArrayList(java.util.ArrayList) Host(com.netflix.dyno.connectionpool.Host) DynomiteNodeInfo(com.github.diegopacheco.dynomite.cluster.checker.parser.DynomiteNodeInfo)

Example 2 with Host

use of com.netflix.dyno.connectionpool.Host in project dynomite-cluster-checker by diegopacheco.

the class SimpleConnectionTest method buildHost.

private static Host buildHost(DynomiteNodeInfo node) {
    Host host = new Host(node.getServer(), 8102, node.getDc());
    host.setStatus(Status.Up);
    return host;
}
Also used : Host(com.netflix.dyno.connectionpool.Host)

Example 3 with Host

use of com.netflix.dyno.connectionpool.Host in project dynomite-cluster-checker by diegopacheco.

the class HostSupplierFactory method build.

public static HostSupplier build(List<DynomiteNodeInfo> nodes) {
    final List<Host> hosts = new ArrayList<Host>();
    for (DynomiteNodeInfo node : nodes) {
        hosts.add(node.toHOST());
    }
    final HostSupplier customHostSupplier = new HostSupplier() {

        @Override
        public Collection<Host> getHosts() {
            return hosts;
        }
    };
    return customHostSupplier;
}
Also used : HostSupplier(com.netflix.dyno.connectionpool.HostSupplier) ArrayList(java.util.ArrayList) Host(com.netflix.dyno.connectionpool.Host) DynomiteNodeInfo(com.github.diegopacheco.dynomite.cluster.checker.parser.DynomiteNodeInfo)

Example 4 with Host

use of com.netflix.dyno.connectionpool.Host in project conductor by Netflix.

the class DynoQueueDAOTest method init.

@Before
public void init() {
    JedisCommands jedisMock = new JedisMock();
    queueDAO = new DynoQueueDAO(jedisMock, jedisMock, 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";
        }
    }, new TestConfiguration());
}
Also used : JedisCommands(redis.clients.jedis.commands.JedisCommands) DynoQueueDAO(com.netflix.conductor.dao.dynomite.queue.DynoQueueDAO) TestConfiguration(com.netflix.conductor.config.TestConfiguration) JedisMock(com.netflix.conductor.dao.redis.JedisMock) Host(com.netflix.dyno.connectionpool.Host) ShardSupplier(com.netflix.dyno.queues.ShardSupplier) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 5 with Host

use of com.netflix.dyno.connectionpool.Host 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

Host (com.netflix.dyno.connectionpool.Host)12 ArrayList (java.util.ArrayList)4 HostSupplier (com.netflix.dyno.connectionpool.HostSupplier)3 ShardSupplier (com.netflix.dyno.queues.ShardSupplier)3 Test (org.junit.Test)3 DynomiteNodeInfo (com.github.diegopacheco.dynomite.cluster.checker.parser.DynomiteNodeInfo)2 DynoQueueDAO (com.netflix.conductor.dao.dynomite.queue.DynoQueueDAO)2 HostBuilder (com.netflix.dyno.connectionpool.HostBuilder)2 HostToken (com.netflix.dyno.connectionpool.impl.lb.HostToken)2 RedisQueues (com.netflix.dyno.queues.redis.RedisQueues)2 HashSet (java.util.HashSet)2 JedisCommands (redis.clients.jedis.commands.JedisCommands)2 TestConfiguration (com.netflix.conductor.config.TestConfiguration)1 WorkflowExecutorModule (com.netflix.conductor.core.execution.WorkflowExecutorModule)1 QueueDAO (com.netflix.conductor.dao.QueueDAO)1 JedisMock (com.netflix.conductor.dao.redis.JedisMock)1 DynomiteConfiguration (com.netflix.conductor.dyno.DynomiteConfiguration)1 JedisMock (com.netflix.conductor.jedis.JedisMock)1 TokenMapSupplier (com.netflix.dyno.connectionpool.TokenMapSupplier)1 EurekaHostsSupplier (com.netflix.dyno.contrib.EurekaHostsSupplier)1