ConsoleServiceManager { public List<HEALTH_STATE> allHealthStatus(String ip, int port){ Map<String, ConsoleService> consoleServiceMap = loadAllConsoleServices(); List<HEALTH_STATE> result = new LinkedList<>(); for(ConsoleService consoleService : consoleServiceMap.values()){ try{ HEALTH_STATE instanceStatus = consoleService.getInstanceStatus(ip, port); result.add(instanceStatus); logger.info("[allHealthStatus]{}, {}:{}, {}", consoleService, ip, port, instanceStatus); }catch (Exception e){ logger.error("[allHealthStatus]" + consoleService + "," + ip + ":" + port, e); } } return result; } @Autowired  ConsoleServiceManager(ConsoleConfig consoleConfig); List<HEALTH_STATE> allHealthStatus(String ip, int port); long getDelay(String ip, int port, String activeIdc); Map<String, Pair<HostPort, Long>> getCrossMasterDelay(String sourceIdc, String clusterId, String shardId); Map<HostPort, Long> getAllDelay(String activeIdc); UnhealthyInfoModel getUnhealthyInstanceByIdc(String activeIdc); long getDelayFromParallelService(String ip, int port); Map<String, Pair<HostPort, Long>> getCrossMasterDelayFromParallelService(String sourceDcId, String clusterId, String shardId); UnhealthyInfoModel getAllUnhealthyInstanceFromParallelService(); List<Boolean> allPingStatus(String host, int port); boolean quorumSatisfy(List<T> results, Function<T, Boolean> predicate);  }
@Test public void testMulti(){ when(consoleConfig.getAllConsoles()).thenReturn("127.0.0.1:8080, 127.0.0.1:8081"); when(consoleConfig.getQuorum()).thenReturn(1); ConsoleServiceManager manager = new ConsoleServiceManager(consoleConfig); List<HEALTH_STATE> health_states = manager.allHealthStatus("127.0.0.1", 6379); logger.info("{}", health_states); }