From c0291635d05fd0e8a9c04ffe3db5a6fb054e2b31 Mon Sep 17 00:00:00 2001 From: Lucas Saldanha Date: Fri, 15 Feb 2019 09:32:32 +1300 Subject: [PATCH] Renaming authentication config file cli command (#865) Signed-off-by: Adrian Sutton --- .../tech/pegasys/pantheon/cli/PantheonCommand.java | 12 ++++++------ .../pegasys/pantheon/cli/PantheonCommandTest.java | 8 ++++---- pantheon/src/test/resources/everything_config.toml | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java index 86b2eb69fc..21bd6d2a39 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java @@ -463,10 +463,10 @@ public class PantheonCommand implements DefaultCommandValues, Runnable { private final Boolean permissionsAccountsEnabled = false; @Option( - names = {"--permissions-config-path"}, + names = {"--permissions-config-file"}, description = "Path to permissions config TOML file (default: a file named \"permissions_config.toml\" in the Pantheon data folder)") - private String permissionsConfigPath = null; + private String permissionsConfigFile = null; @Option( names = {"--privacy-enabled"}, @@ -638,10 +638,10 @@ public class PantheonCommand implements DefaultCommandValues, Runnable { } } - private String getPermissionsConfigPath() { + private String getPermissionsConfigFile() { - return permissionsConfigPath != null - ? permissionsConfigPath + return permissionsConfigFile != null + ? permissionsConfigFile : dataDir().toAbsolutePath() + System.getProperty("file.separator") + DefaultCommandValues.PERMISSIONING_CONFIG_LOCATION; @@ -763,7 +763,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable { final PermissioningConfiguration permissioningConfiguration = PermissioningConfigurationBuilder.permissioningConfigurationFromToml( - getPermissionsConfigPath(), permissionsNodesEnabled, permissionsAccountsEnabled); + getPermissionsConfigFile(), permissionsNodesEnabled, permissionsAccountsEnabled); return Optional.of(permissioningConfiguration); } diff --git a/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java b/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java index 9db9e7e501..e6b1de75bf 100644 --- a/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java @@ -316,19 +316,19 @@ public class PantheonCommandTest extends CommandTestAbstract { @Test public void permissionsTomlPathWithoutOptionMustDisplayUsage() { - parseCommand("--permissions-config-path"); + parseCommand("--permissions-config-file"); verifyZeroInteractions(mockRunnerBuilder); assertThat(commandErrorOutput.toString()) - .startsWith("Missing required parameter for option '--permissions-config-path'"); + .startsWith("Missing required parameter for option '--permissions-config-file'"); assertThat(commandOutput.toString()).isEmpty(); } @Test public void permissionsEnabledWithNonexistentConfigFileMustError() { parseCommand( - "--permissions-accounts-enabled", "--permissions-config-path", "file-does-not-exist"); + "--permissions-accounts-enabled", "--permissions-config-file", "file-does-not-exist"); verifyZeroInteractions(mockRunnerBuilder); @@ -344,7 +344,7 @@ public class PantheonCommandTest extends CommandTestAbstract { Files.write(permToml, Resources.toByteArray(configFile)); parseCommand( - "--permissions-accounts-enabled", "--permissions-config-path", permToml.toString()); + "--permissions-accounts-enabled", "--permissions-config-file", permToml.toString()); PermissioningConfiguration permissioningConfiguration = PermissioningConfiguration.createDefault(); permissioningConfiguration.setConfigurationFilePath(permToml.toString()); diff --git a/pantheon/src/test/resources/everything_config.toml b/pantheon/src/test/resources/everything_config.toml index ceeb99e7ad..98cf494a01 100644 --- a/pantheon/src/test/resources/everything_config.toml +++ b/pantheon/src/test/resources/everything_config.toml @@ -73,7 +73,7 @@ min-gas-price="1" # Permissioning permissions-nodes-enabled=false permissions-accounts-enabled=false -permissions-config-path="./permissions_config.toml" +permissions-config-file="./permissions_config.toml" # Privacy privacy-url="http://127.0.0.1:8888"