C0urante commented on code in PR #13424: URL: https://github.com/apache/kafka/pull/13424#discussion_r1146278053
########## connect/runtime/src/test/java/org/apache/kafka/connect/util/clusters/EmbeddedConnectCluster.java: ########## @@ -553,6 +570,54 @@ public ActiveTopicsInfo connectorTopics(String connectorName) { "Could not read connector state. Error response: " + responseToString(response)); } + /** + * Get the info of a connector running in this cluster (retrieved via the <code>GET /connectors/{connector}</code> endpoint). + + * @param connectorName name of the connector + * @return an instance of {@link ConnectorInfo} populated with state information of the connector and its tasks. + */ + public ConnectorInfo connectorInfo(String connectorName) { + ObjectMapper mapper = new ObjectMapper(); + String url = endpointForResource(String.format("connectors/%s", connectorName)); + Response response = requestGet(url); + try { + if (response.getStatus() < Response.Status.BAD_REQUEST.getStatusCode()) { + return mapper.readValue(responseToString(response), ConnectorInfo.class); + } + } catch (IOException e) { + log.error("Could not read connector info from response: {}", + responseToString(response), e); + throw new ConnectException("Could not not parse connector info", e); + } + throw new ConnectRestException(response.getStatus(), + "Could not read connector info. Error response: " + responseToString(response)); + } + + /** + * Get the task configs of a connector running in this cluster. + + * @param connectorName name of the connector + * @return a map from task ID (connector name + "-" + task number) to task config + */ + public Map<String, Map<String, String>> taskConfigs(String connectorName) { + ObjectMapper mapper = new ObjectMapper(); + String url = endpointForResource(String.format("connectors/%s/tasks-config", connectorName)); Review Comment: Good question... I know the `tasks-config` endpoint was introduced in [KIP-661](https://cwiki.apache.org/confluence/display/KAFKA/KIP-661%3A+Expose+task+configurations+in+Connect+REST+API), but now that you mention it, it does seem a little redundant given the `/tasks` endpoint's content. Maybe @mimaison could shed some light here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org