Skip to content

Commit

Permalink
[#6424] improve(CLI): Refactor getURL in CLI
Browse files Browse the repository at this point in the history
fix some bugs.
  • Loading branch information
Abyss-lord committed Feb 12, 2025
1 parent 3dc8ea0 commit a7a8ba7
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

/* Context for a command */
public class CommandContext {
public static final String DEFAULT_URL = "http://localhost:8090";
private final boolean force;
private final boolean ignoreVersions;
private final String outputFormat;
Expand Down Expand Up @@ -127,7 +126,7 @@ private String getUrl() {
}

// Return the default localhost URL
return DEFAULT_URL;
return GravitinoCommandLine.DEFAULT_URL;
}

private boolean getIgnore() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

public abstract class CommandHandler {
public static final Joiner COMMA_JOINER = Joiner.on(", ").skipNulls();

public static final String DEFAULT_URL = "http://localhost:8090";

private String authEnv;
private boolean authSet = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public void handle() {
} catch (Exception exp) {
exitWithError(exp.getMessage());
}
printInformation("Apache Gravitino " + version);
printResults("Apache Gravitino " + version);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public void handle() {
exitWithError(exp.getMessage());
}

printInformation("Apache Gravitino " + version);
printResults("Apache Gravitino " + version);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void setUp() {
public void testCreateCommandContextWithDefaults() {
CommandContext commandContext = new CommandContext(mockCommandLine);

Assertions.assertEquals(CommandContext.DEFAULT_URL, commandContext.url());
Assertions.assertEquals(GravitinoCommandLine.DEFAULT_URL, commandContext.url());
Assertions.assertFalse(commandContext.ignoreVersions());
Assertions.assertFalse(commandContext.force());
Assertions.assertEquals(Command.OUTPUT_FORMAT_PLAIN, commandContext.outputFormat());
Expand Down

0 comments on commit a7a8ba7

Please sign in to comment.