ServerComponentHealthRestClient { public ServerComponentHealth getStatus(String type, String scope, String content) { List<ServerComponentHealth> response = getServerComponentHealthStatues(type, scope, content); if (response != null && !response.isEmpty()) { return response.get(0); } else { LOG.error("ServerComponentHealth getStatus {} {} failed with empty response.", type, scope); return null; } } ServerComponentHealthRestClient(RestClient restClient); ServerComponentHealth getStatus(String type, String scope, String content); List<ServerComponentHealth> getServerComponentHealthStatues(String type, String scope, String content); ServerComponentHealth getAllStatus(String type, String scope, String content); List<ServerComponentHealth> getServerComponentHealthAllStatus(String type, String scope, String content);  }
@Test public void testGetStatus() throws Exception { String name = "Connector"; String type = "DummyConnector"; String content = "topic=datastream"; String expectedStatus = "HEALTHY"; ServerComponentHealthRestClient restClient = createRestClient(); ServerComponentHealth response = restClient.getStatus(name, type, content); Assert.assertEquals(response.isSucceeded(), Boolean.TRUE); Assert.assertEquals(response.getStatus(), expectedStatus); Assert.assertTrue(response.getErrorMessages().isEmpty()); name = "NonExistComponent"; response = restClient.getStatus(name, type, content); Assert.assertNull(response); type = "NonExistConnector"; response = restClient.getStatus(name, type, content); Assert.assertNull(response); type = "BrokenConnector"; response = restClient.getStatus(name, type, content); Assert.assertNull(response); }