Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan Liu <[email protected]>
  • Loading branch information
nodece committed Apr 16, 2024
1 parent 8bf364b commit 3290f2a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,7 @@ public CompletableFuture<org.apache.pulsar.client.api.Producer> createAsync() {
brokerService.pulsar().getPulsarResources().getClusterResources()
.getCluster(remoteCluster))));
replicatorMap.put(remoteReplicatorName, replicator);
String cursorName = PersistentReplicator.getReplicatorName(topic.getReplicatorPrefix(), remoteReplicatorName);

// step-1 remove replicator : it will disconnect the producer but it will wait for callback to be completed
Method removeMethod = PersistentTopic.class.getDeclaredMethod("removeReplicator", String.class);
Expand All @@ -1757,7 +1758,7 @@ public CompletableFuture<org.apache.pulsar.client.api.Producer> createAsync() {

// step-3 : complete the callback to remove replicator from the list
ArgumentCaptor<DeleteCursorCallback> captor = ArgumentCaptor.forClass(DeleteCursorCallback.class);
Mockito.verify(ledgerMock).asyncDeleteCursor(any(), captor.capture(), any());
Mockito.verify(ledgerMock).asyncDeleteCursor(eq(cursorName), captor.capture(), any());
DeleteCursorCallback callback = captor.getValue();
callback.deleteCursorComplete(null);
}
Expand Down

0 comments on commit 3290f2a

Please sign in to comment.