divijvaidya commented on code in PR #13284: URL: https://github.com/apache/kafka/pull/13284#discussion_r1248163268
########## connect/mirror/src/test/java/org/apache/kafka/connect/mirror/integration/DedicatedMirrorIntegrationTest.java: ########## @@ -288,4 +327,28 @@ private void awaitTopicContent(EmbeddedKafkaCluster cluster, String clusterName, } } + /** + * Validates that the underlying connector are running for the given MirrorMaker. + */ + private boolean isConnectorRunningForMirrorMaker(final Class<?> connectorClazz, final MirrorMaker mm, final SourceAndTarget sourceAndTarget) { + final String connName = connectorClazz.getSimpleName(); + final ConnectorStateInfo connectorStatus = mm.connectorStatus(sourceAndTarget, connName); + return connectorStatus != null + // verify that connector state is set to running + && connectorStatus.connector().state().equals(AbstractStatus.State.RUNNING.toString()); + } + + /** + * Validates that the tasks are associated with the connector and they are running for the given MirrorMaker. + */ + private <T extends SourceConnector> boolean isTaskRunningForMirrorMakerConnector(final Class<T> connectorClazz, final MirrorMaker mm, final String source, final String target) { + final SourceAndTarget sourceAndTarget = new SourceAndTarget(source, target); + final String connName = connectorClazz.getSimpleName(); + final ConnectorStateInfo connectorStatus = mm.connectorStatus(sourceAndTarget, connName); + return isConnectorRunningForMirrorMaker(connectorClazz, mm, sourceAndTarget) + // verify that at least one task exists + && !connectorStatus.tasks().isEmpty() + // verify that tasks are set to running + && connectorStatus.tasks().stream().allMatch(s -> s.state().equals(AbstractStatus.State.RUNNING.toString())); Review Comment: Done in latest revision. -- 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