HealthController extends AbstractConsoleController { @RequestMapping(value = "/health/check/instance/{ip}/{port}", method = RequestMethod.GET) public String getHealthCheckInstance(@PathVariable String ip, @PathVariable int port) { RedisHealthCheckInstance instance = instanceManager.findRedisHealthCheckInstance(new HostPort(ip, port)); if(instance == null) { return "Not found"; } RedisHealthCheckInstanceModel model = new RedisHealthCheckInstanceModel(instance.toString()); for(HealthCheckAction action : instance.getHealthCheckActions()) { HealthCheckActionModel actionModel = new HealthCheckActionModel(action.toString()); for(Object listener : ((AbstractHealthCheckAction) action).getListeners()) { actionModel.addListener(listener.toString()); } for(Object controller : ((AbstractHealthCheckAction) action).getControllers()) { actionModel.addController(controller.toString()); } model.addAction(actionModel); } return Codec.DEFAULT.encode(model); }  @RequestMapping(value = "/health/{ip}/{port}", method = RequestMethod.GET) HEALTH_STATE getHealthState(@PathVariable String ip, @PathVariable int port); @RequestMapping(value = "/redis/delay/{redisIp}/{redisPort}", method = RequestMethod.GET) Long getReplDelayMillis(@PathVariable String redisIp, @PathVariable int redisPort); @RequestMapping(value = "/redis/inner/delay/{redisIp}/{redisPort}", method = RequestMethod.GET) Long getInnerReplDelayMillis(@PathVariable String redisIp, @PathVariable int redisPort); @RequestMapping(value = "/redis/inner/delay/all", method = RequestMethod.GET) Map<HostPort, Long> getAllInnerReplDelayMills(); @RequestMapping(value = "/redis/inner/unhealthy", method = RequestMethod.GET) UnhealthyInfoModel getActiveClusterUnhealthyRedis(); @RequestMapping(value = "/redis/inner/unhealthy/all", method = RequestMethod.GET) UnhealthyInfoModel getAllUnhealthyRedis(); @RequestMapping(value = "/cross-master/delay/{dcId}/" + CLUSTER_ID_PATH_VARIABLE + "/" + SHARD_ID_PATH_VARIABLE, method = RequestMethod.GET) Map<String, Pair<HostPort, Long>> getCrossMasterDelay(@PathVariable String dcId, @PathVariable String clusterId, @PathVariable String shardId); @RequestMapping(value = "/cross-master/inner/delay/" + CLUSTER_ID_PATH_VARIABLE + "/" + SHARD_ID_PATH_VARIABLE, method = RequestMethod.GET) Map<String, Pair<HostPort, Long>> getInnerCrossMasterDelay(@PathVariable String clusterId, @PathVariable String shardId); @RequestMapping(value = "/health/check/instance/{ip}/{port}", method = RequestMethod.GET) String getHealthCheckInstance(@PathVariable String ip, @PathVariable int port);  }
@Test public void getHealthCheckInstanceTest() { String raw = healthController.getHealthCheckInstance("127.0.0.1", 6379); Assert.assertEquals(expectedResult, raw); }