Esempio n. 1
0
  @Test
  public void testGetSlaveResource() {
    ShardedJedis shardedJedis = matrixRedisClient.getRedisPool().getSlaveResource();
    Collection<JedisShardInfo> shardInfoList = shardedJedis.getAllShardInfo();

    for (JedisShardInfo shardInfo : shardInfoList) {
      Assert.assertTrue(
          Arrays.asList(Constants.DEFAULT_MASTER1_SLAVES)
                  .contains(shardInfo.getHost() + ":" + shardInfo.getPort())
              || Arrays.asList(Constants.DEFAULT_MASTER2_SLAVES)
                  .contains(shardInfo.getHost() + ":" + shardInfo.getPort()));
    }
  }
Esempio n. 2
0
  @Test
  public void testGetMasterResource() {

    ShardedJedis shardedJedis = matrixRedisClient.getRedisPool().getMasterResource();
    Collection<JedisShardInfo> shardInfoList = shardedJedis.getAllShardInfo();

    for (JedisShardInfo shardInfo : shardInfoList) {
      Assert.assertTrue(
          Constants.DEFAULT_MASTER1_MASTER.equals(shardInfo.getHost() + ":" + shardInfo.getPort())
              || Constants.DEFAULT_MASTER2_MASTER.equals(
                  shardInfo.getHost() + ":" + shardInfo.getPort()));
    }
  }