nodece commented on code in PR #22209:
URL: https://github.com/apache/pulsar/pull/22209#discussion_r1524587657
##########
pulsar-client-tools/src/test/java/org/apache/pulsar/shell/AdminShellTest.java:
##########
@@ -48,25 +48,23 @@ public void test() throws Exception {
final PulsarAdmin admin = mock(PulsarAdmin.class);
when(builder.build()).thenReturn(admin);
when(admin.topics()).thenReturn(mock(Topics.class));
- adminShell.setPulsarAdminSupplier(new PulsarAdminSupplier(builder,
adminShell.getRootParams()));
+ PulsarAdminSupplier pulsarAdminSupplier =
adminShell.getPulsarAdminSupplier();
+ pulsarAdminSupplier.setAdminBuilder(builder);
assertTrue(run(new String[]{"topics", "list", "public/default"}));
- verify(builder).build();
+ verify(builder, times(1)).build();
assertTrue(run(new String[]{"topics", "list", "public/default"}));
- verify(builder).build();
+ verify(builder, times(1)).build();
assertTrue(run(new String[]{"--admin-url", "http://localhost:8081",
"topics", "list", "public/default"}));
+ verify(builder, times(2)).build();
assertTrue(run(new String[]{"topics", "list", "public/default"}));
verify(builder, times(3)).build();
assertTrue(run(new String[]{"--admin-url", "http://localhost:8080",
"topics", "list", "public/default"}));
verify(builder, times(3)).build();
}
- private boolean run(String[] args) throws Exception {
- try {
- return adminShell.runCommand(args);
- } finally {
- adminShell.cleanupState(props);
- }
+ private boolean run(String[] args) {
Review Comment:
Yes, when you use a new cluster config, I will renew the admin/client
commander.
When using picocli, the root parameters sometimes cannot obtain the correct
value.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]