Skip to content

Commit

Permalink
fix: Renamed command
Browse files Browse the repository at this point in the history
  • Loading branch information
jruaux committed Mar 21, 2024
1 parent 91ca359 commit 36c41ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public class Admin implements AutoCloseable {
public static final String DEFAULT_HOST = "localhost";
public static final int DEFAULT_PORT = 9443;

private static final Command PING = Command.name("PING").build();
private static final RedisCommand PING = RedisCommand.name("PING").build();
private static final String BOOTSTRAP = "bootstrap";
private static final String MODULES = "modules";
private static final String BDBS = "bdbs";
private static final String COMMAND = "command";
private static final String CONTENT_TYPE_JSON = "application/json";
private static final String V1 = "/v1/";
private static final CharSequence PATH_SEPARATOR = "/";
private static final Duration DEFAULT_DATABASE_CREATION_TIMEOUT = Duration.ofSeconds(30);
private static final Duration DEFAULT_DATABASE_CREATION_TIMEOUT = Duration.ofSeconds(10);
private static final Duration DEFAULT_DATABASE_CREATION_POLL_INTERVAL = Duration.ofSeconds(1);

private final ObjectMapper objectMapper = new ObjectMapper()
Expand Down Expand Up @@ -310,7 +310,7 @@ private Bootstrap getBootstrap() throws IOException, GeneralSecurityException {
return get(v1(BOOTSTRAP), Bootstrap.class);
}

public CommandResponse executeCommand(long bdb, Command command) throws IOException, GeneralSecurityException {
public CommandResponse executeCommand(long bdb, RedisCommand command) throws IOException, GeneralSecurityException {
return post(v1(BDBS, String.valueOf(bdb), COMMAND), command, CommandResponse.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Command {
public class RedisCommand {

private String name;
private String command;
private List<String> args = new ArrayList<>();

public String getName() {
return name;
public String getCommand() {
return command;
}

public void setName(String command) {
this.name = command;
public void setCommand(String command) {
this.command = command;
}

public List<String> getArgs() {
Expand All @@ -34,23 +34,23 @@ public static Builder name(String name) {

public static class Builder {

private final String name;
private final String command;
private List<String> args = new ArrayList<>();

public Builder(String name) {
this.name = name;
this.command = name;
}

public Builder args(String... args) {
this.args = new ArrayList<>(Arrays.asList(args));
return this;
}

public Command build() {
Command command = new Command();
command.setName(name);
command.setArgs(args);
return command;
public RedisCommand build() {
RedisCommand cmd = new RedisCommand();
cmd.setCommand(this.command);
cmd.setArgs(args);
return cmd;
}

}
Expand Down

0 comments on commit 36c41ba

Please sign in to comment.