diff --git a/modAionImpl/src/org/aion/zero/impl/cli/Cli.java b/modAionImpl/src/org/aion/zero/impl/cli/Cli.java index a53022ae17..b276b8b265 100644 --- a/modAionImpl/src/org/aion/zero/impl/cli/Cli.java +++ b/modAionImpl/src/org/aion/zero/impl/cli/Cli.java @@ -191,7 +191,7 @@ public ReturnType call(final String[] args, Cfg cfg) { // true means the UUID must be set boolean overwrite = cfg.fromXML(configFile); - // port option can be used with the -n, -d, -c, -i arguments + // determine the port configuration, can be combined with the -n, -d, -c, -i arguments if (options.getPort() != null) { int currentPort = cfg.getNet().getP2p().getPort(); @@ -216,13 +216,12 @@ public ReturnType call(final String[] args, Cfg cfg) { overwrite = true; System.out.println("Port set to: " + portNumber); } else { - System.out.println( - "Using the current port configuration: " + currentPort); + System.out.println("Using the current port configuration: " + currentPort); } - // no return, allow for other parameters combined with -c, -p + // no return, allow for other parameters combined with -p } - // 4. can be influenced by the -d argument above + // 4. can be influenced by the -n, -d, -p arguments above if (options.getConfig() != null) { // network was already set above @@ -260,7 +259,7 @@ public ReturnType call(final String[] args, Cfg cfg) { return ReturnType.EXIT; } - // 5. options that can be influenced by the -d and -n arguments + // 5. options that can be influenced by the -d, -n and -p arguments if (options.isInfo()) { System.out.println( diff --git a/modAionImpl/test/org/aion/zero/impl/cli/CliTest.java b/modAionImpl/test/org/aion/zero/impl/cli/CliTest.java index a099e0f332..7ae0b9b3d7 100644 --- a/modAionImpl/test/org/aion/zero/impl/cli/CliTest.java +++ b/modAionImpl/test/org/aion/zero/impl/cli/CliTest.java @@ -150,6 +150,11 @@ public void shutdown() { deleteRecursively(path); deleteRecursively(alternativePath); + // in case absolute paths are used + deleteRecursively(cfg.getKeystoreDir()); + deleteRecursively(cfg.getDatabaseDir()); + deleteRecursively(cfg.getLogDir()); + // to avoid deleting config for all tests if (BASE_PATH.contains(module)) { deleteRecursively(CONFIG_PATH); @@ -977,8 +982,26 @@ private Object parametersWithInfo() { parameters.add(new Object[] {new String[] {op, "-p", INVALID_PORT}, EXIT, expOnError}); } + // with port and directory + expected = new File(path, "mainnet").getAbsolutePath(); + for (String op : options) { + // with relative path + parameters.add( + new Object[] { + new String[] {op, "-d", dataDirectory, "-p", TEST_PORT}, EXIT, expected + }); + // with absolute path + parameters.add( + new Object[] { + new String[] {op, "-p", TEST_PORT, "-d", path.getAbsolutePath()}, + EXIT, + expected + }); + } + // with network and directory expected = new File(path, "mastery").getAbsolutePath(); + for (String op : options) { // with relative path parameters.add(