tisonkun commented on code in PR #19836:
URL: https://github.com/apache/pulsar/pull/19836#discussion_r1247512257
##########
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java:
##########
@@ -449,6 +449,8 @@ void processArguments() throws Exception {
if (sourceType != null) {
sourceConfig.setArchive(validateSourceType(sourceType));
+ } else if (sourceConfig.getSourceType() != null) {
+ sourceConfig.setArchive(validateSourceType(sourceType));
Review Comment:
Updated.
##########
pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java:
##########
@@ -412,6 +412,15 @@ public void
testBatchSourceConfigMissingDiscoveryTriggererClassName() throws Exc
expectedSourceConfig.setBatchSourceConfig(batchSourceConfig);
testCmdSourceConfigFile(testSourceConfig, expectedSourceConfig);
}
+
+ @Test(expectedExceptions = ParameterException.class,
expectedExceptionsMessageRegExp = "Invalid source type 'foo' " +
Review Comment:
I tried it:
```java
@Test
public void testCmdSourceConfigFileSourceType() throws Exception {
ConnectorDefinition mockDefinition = new ConnectorDefinition();
mockDefinition.setName("builtin");
when(source.getBuiltInSources()).thenReturn(List.of(mockDefinition));
SourceConfig sourceConfig = getSourceConfig();
sourceConfig.setSourceType("builtin");
SourceConfig exceptedConfig = getSourceConfig();
exceptedConfig.setSourceType("builtin");
exceptedConfig.setArchive("builtin://builtin");
testCmdSourceConfigFile(sourceConfig, exceptedConfig);
}
```
... while due to some dirty code inherit local run from cmd source the tests
are hard to tune. That said, `validateSourceType` is inherited by
`LocalSourceRunner` with total different manner.
--
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]