RedisServiceImpl extends AbstractConsoleService<RedisTblDao> implements RedisService { @Override public List<RedisTbl> findAllKeeperContainerCountInfo() { return queryHandler.handleQuery(new DalQuery<List<RedisTbl>>() { @Override public List<RedisTbl> doQuery() throws DalException { return dao.countContainerKeeperAndClusterAndShard(RedisTblEntity.READSET_CONTAINER_LOAD); } }); }  @Override RedisTbl find(final long id); @Override List<RedisTbl> findAllRedisWithSameIP(String ip); @Override List<RedisTbl> findAllByDcClusterShard(final long dcClusterShardId); @Override List<RedisTbl> findAllRedisesByDcClusterName(String dcId, String clusterId); @Override List<RedisTbl> findAllByDcClusterShard(String dcId, String clusterId, String shardId); @Override List<RedisTbl> findRedisesByDcClusterShard(String dcId, String clusterId, String shardId); @Override List<RedisTbl> findKeepersByDcClusterShard(String dcId, String clusterId, String shardId); @Override synchronized void insertRedises(String dcId, String clusterId, String shardId,
                                           List<Pair<String, Integer>> redisAddresses); @Override synchronized int insertKeepers(String dcId, String clusterId, String shardId,
                                          List<KeeperBasicInfo> keepers); @Override List<RedisTbl> deleteKeepers(String dcId, String clusterId, String shardId); @Override void deleteRedises(String dcId, String clusterId, String shardId, List<Pair<String, Integer>> redisAddresses); @Override void updateByPK(final RedisTbl redis); @Override void updateBatchMaster(List<RedisTbl> redises); @Override void updateBatchKeeperActive(List<RedisTbl> redises); @Override void updateRedises(String dcName, String clusterName, String shardName, ShardModel shardModel); @Override List<RedisTbl> findAllKeeperContainerCountInfo(); @Override List<Long> findClusterIdsByKeeperContainer(long keeperContainerId); void insertInstancesToDb(long dcClusterShardId, String role, Pair<String, Integer>... addrs);  }
@Test public void testCountContainerKeeperAndClusterAndShard() { List<RedisTbl> redisTbls = redisService.findAllKeeperContainerCountInfo(); Assert.assertEquals(4, redisTbls.size()); RedisTbl redis = redisTbls.get(0); Assert.assertTrue(redis.getKeepercontainerId() > 0); Assert.assertEquals(shardNames.length, redis.getCount()); Assert.assertEquals(1, redis.getDcClusterShardInfo().getClusterCount()); Assert.assertEquals(shardNames.length, redis.getDcClusterShardInfo().getShardCount()); }