Examples of HostAndPort


Examples of redis.clients.jedis.HostAndPort

    }

    @Test(expected = JedisClusterException.class)
    public void testThrowExceptionWithoutKey() {
  Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
  jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379));
  JedisCluster jc = new JedisCluster(jedisClusterNode);
  jc.ping();
    }
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    }

    @Test(expected = JedisClusterMaxRedirectionsException.class)
    public void testRedisClusterMaxRedirections() {
  Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
  jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379));
  JedisCluster jc = new JedisCluster(jedisClusterNode);
  int slot51 = JedisClusterCRC16.getSlot("51");
  // This will cause an infinite redirection loop
  node2.clusterSetSlotMigrating(slot51,
    JedisClusterTestUtil.getNodeId(node3.clusterNodes()));
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    }

    @Test
    public void testClusterCountKeysInSlot() {
  Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
  jedisClusterNode.add(new HostAndPort(nodeInfo1.getHost(), nodeInfo1
    .getPort()));
  JedisCluster jc = new JedisCluster(jedisClusterNode);

  for (int index = 0; index < 5; index++) {
      jc.set("foo{bar}" + index, "hello");
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    @Test
    public void testStableSlotWhenMigratingNodeOrImportingNodeIsNotSpecified()
      throws InterruptedException {
  Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
  jedisClusterNode.add(new HostAndPort(nodeInfo1.getHost(), nodeInfo1
    .getPort()));
  JedisCluster jc = new JedisCluster(jedisClusterNode);

  int slot51 = JedisClusterCRC16.getSlot("51");
  jc.set("51", "foo");
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    public void testIfPoolConfigAppliesToClusterPools() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(0);
  config.setMaxWaitMillis(2000);
  Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
  jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379));
  JedisCluster jc = new JedisCluster(jedisClusterNode, config);
  jc.set("52", "poolTestValue");
    }
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    }

    @Test
    public void testCloseable() {
  Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
  jedisClusterNode.add(new HostAndPort(nodeInfo1.getHost(), nodeInfo1
    .getPort()));

  JedisCluster jc = null;
  try {
      jc = new JedisCluster(jedisClusterNode);
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    @Test
    public void testJedisClusterRunsWithMultithreaded()
      throws InterruptedException, ExecutionException {
  Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
  jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379));
  final JedisCluster jc = new JedisCluster(jedisClusterNode);
  jc.set("foo", "bar");

  ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 100, 0,
    TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10));
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    }

    @Test(expected = JedisConnectionException.class)
    public void initializeWithNotAvailableSentinelsShouldThrowException() {
  Set<String> wrongSentinels = new HashSet<String>();
  wrongSentinels.add(new HostAndPort("localhost", 65432).toString());
  wrongSentinels.add(new HostAndPort("localhost", 65431).toString());

  JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME,
    wrongSentinels);
  pool.destroy();
    }
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

  pool.destroy();
    }

    private void forceFailover(JedisSentinelPool pool)
      throws InterruptedException {
  HostAndPort oldMaster = pool.getCurrentHostMaster();

  // jedis connection should be master
  Jedis beforeFailoverJedis = pool.getResource();
  assertEquals("PONG", beforeFailoverJedis.ping());
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

  afterFailoverJedis.close();
    }

    private void waitForFailover(JedisSentinelPool pool, HostAndPort oldMaster)
      throws InterruptedException {
  HostAndPort newMaster = JedisSentinelTestUtil.waitForNewPromotedMaster(
    MASTER_NAME, sentinelJedis1, sentinelJedis2);

  waitForJedisSentinelPoolRecognizeNewMaster(pool, newMaster);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.