Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
remove duplicates from apis specified via CLI (#1131)
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarla authored Mar 19, 2019
1 parent 21fd6ae commit 884274f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ private JsonRpcConfiguration jsonRpcConfiguration() {
jsonRpcConfiguration.setHost(rpcHttpHost);
jsonRpcConfiguration.setPort(rpcHttpPort);
jsonRpcConfiguration.setCorsAllowedDomains(rpcHttpCorsAllowedOrigins);
jsonRpcConfiguration.setRpcApis(rpcHttpApis);
jsonRpcConfiguration.setRpcApis(rpcHttpApis.stream().distinct().collect(Collectors.toList()));
jsonRpcConfiguration.setHostsWhitelist(hostsWhitelist);
jsonRpcConfiguration.setAuthenticationEnabled(isRpcHttpAuthenticationEnabled);
jsonRpcConfiguration.setAuthenticationCredentialsFile(rpcHttpAuthenticationCredentialsFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,20 @@ public void rpcApisPropertyMustBeUsed() {
assertThat(commandErrorOutput.toString()).isEmpty();
}

@Test
public void rpcApisPropertyIgnoresDuplicatesAndMustBeUsed() {
parseCommand("--rpc-http-api", "ETH,NET,NET", "--rpc-http-enabled");

verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();

assertThat(jsonRpcConfigArgumentCaptor.getValue().getRpcApis())
.containsExactlyInAnyOrder(ETH, NET);

assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
}

@Test
public void rpcHttpOptionsRequiresServiceToBeEnabled() {
parseCommand(
Expand Down

0 comments on commit 884274f

Please sign in to comment.