ServerComponentHealthResources extends CollectionResourceTemplate<String, ServerComponentHealth> { @Finder("allStatus") public List<ServerComponentHealth> getAllStatus(@PagingContextParam PagingContext context, @QueryParam("type") String componentType, @QueryParam("scope") String componentScope, @QueryParam("content") @Optional String componentInputs) { LOG.info("Restli getAllStatus request with name: {}, type: {} and content: {}.", componentType, componentScope, componentInputs); DiagnosticsAware component = getComponent(componentType, componentScope); if (component != null) { return _aggregator.getResponses(componentType, componentScope, componentInputs, component); } else { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Unknown component name and type"); return Collections.emptyList(); } } ServerComponentHealthResources(DatastreamServer datastreamServer); @Finder("allStatus") List<ServerComponentHealth> getAllStatus(@PagingContextParam PagingContext context,
      @QueryParam("type") String componentType,  // Connector or Transport provider
      @QueryParam("scope") String componentScope,  // Espresso, EspressoBootstrap and etc.
      @QueryParam("content") @Optional String componentInputs); @Finder("status") List<ServerComponentHealth> getStatus(@PagingContextParam PagingContext context,
      @QueryParam("type") String componentType,
      @QueryParam("scope") String componentScope,
      @QueryParam("content") @Optional String componentInputs); static final String CONNECTOR_NAME; }
@Test public void testGetAllStatus() { ServerComponentHealthResources resource = new ServerComponentHealthResources(_datastreamKafkaCluster.getPrimaryDatastreamServer()); String name = "Connector"; String type = "DummyConnector"; String content = "topic=datastream"; String expectedStatus = "DummyStatus"; List<ServerComponentHealth> response = resource.getAllStatus(NO_PAGING, name, type, content); for (ServerComponentHealth sch : response) { Assert.assertEquals(sch.isSucceeded(), Boolean.TRUE); Assert.assertEquals(sch.getStatus(), expectedStatus); Assert.assertEquals(sch.getErrorMessages(), "{}"); } type = "BrokenConnector"; expectedStatus = ""; response = resource.getAllStatus(NO_PAGING, name, type, content); for (ServerComponentHealth sch : response) { Assert.assertEquals(sch.isSucceeded(), Boolean.FALSE); Assert.assertEquals(sch.getStatus(), expectedStatus); } }