Skip to content

Commit

Permalink
move index forward when value has neen extracted from unmatched option.
Browse files Browse the repository at this point in the history
  • Loading branch information
melowe committed Dec 20, 2019
1 parent 075505b commit 8bd8b94
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ private Config getConfigFromCLI(CommandLine.ParseResult parseResult) throws Exce
if(nextIndex > (unmatched.size() -1)) {
break;
}
i = nextIndex;
final String value = unmatched.get(nextIndex);
try {
OverrideUtil.setValue(config, name, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,4 +489,23 @@ public void withValidConfigAndUnmatchableDynamicOptionWithValue() throws Excepti
assertThat(result.isSuppressStartup()).isFalse();

}

@Test
public void withValidConfigAndJdbcOverides() throws Exception {

Path configFile = createAndPopulatePaths(getClass().getResource("/sample-config.json"));
CliResult result = cliDelegate.execute("-configfile", configFile.toString(), "-jdbc.autoCreateTables", "true", "-jdbc.url", "someurl");

assertThat(result).isNotNull();
assertThat(result.getConfig()).isPresent();
assertThat(result.getConfig()).isPresent();
assertThat(result.getStatus()).isEqualTo(0);

assertThat(result.isSuppressStartup()).isFalse();

Config config = result.getConfig().get();
assertThat(config.getJdbcConfig()).isNotNull();
assertThat(config.getJdbcConfig().isAutoCreateTables()).isTrue();
assertThat(config.getJdbcConfig().getUrl()).isEqualTo("someurl");
}
}

0 comments on commit 8bd8b94

Please sign in to comment.