Rename ssh commands from put/delete/get to enable/disable/status

As a consequence, also rename the existing "disable" command
to "disabled".

Change-Id: Idc8481228a350bd36f099f1e9368271383454f31
diff --git a/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommand.java b/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommand.java
index 46cb254..c6736cd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommand.java
@@ -20,7 +20,7 @@
 import com.google.gerrit.sshd.SshCommand;
 import com.google.inject.Inject;
 
-@CommandMetaData(name = "disable", description = "Disable ssh commands", runsAt = MASTER_OR_SLAVE)
+@CommandMetaData(name = "disabled", description = "Disable ssh commands", runsAt = MASTER_OR_SLAVE)
 class DisableCommand extends SshCommand {
   @Inject ReadOnlyConfig config;
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommandInterceptor.java b/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommandInterceptor.java
index 19b2592..1e422c8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommandInterceptor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableCommandInterceptor.java
@@ -38,7 +38,7 @@
   DisableCommandInterceptor(
       @PluginName String pluginName, ReadOnlyConfig config, ReadOnlyState state) {
     this.state = state;
-    this.disableCommand = pluginName + " disable";
+    this.disableCommand = pluginName + " disabled";
     allowPatterns.add(Pattern.compile(String.format(PATTERN, pluginName)));
     // Allow all SSH commands from this plugin
     allowPrefixes.add(pluginName);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableReadOnlyCommand.java b/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableReadOnlyCommand.java
index 392df17..a64d0b1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableReadOnlyCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/readonly/DisableReadOnlyCommand.java
@@ -24,8 +24,8 @@
 import java.io.IOException;
 
 @RequiresAnyCapability({ADMINISTRATE_SERVER, MAINTAIN_SERVER})
-@CommandMetaData(name = "delete", description = "Disable read only mode")
-class DeleteReadOnlyCommand extends SshCommand {
+@CommandMetaData(name = "disable", description = "Disable read only mode")
+class DisableReadOnlyCommand extends SshCommand {
   @Inject ReadOnlyEndpoint.Delete delete;
 
   @Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/readonly/EnableReadOnlyCommand.java b/src/main/java/com/googlesource/gerrit/plugins/readonly/EnableReadOnlyCommand.java
index bf5ffef..322a9f9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/readonly/EnableReadOnlyCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/readonly/EnableReadOnlyCommand.java
@@ -24,8 +24,8 @@
 import java.io.IOException;
 
 @RequiresAnyCapability({ADMINISTRATE_SERVER, MAINTAIN_SERVER})
-@CommandMetaData(name = "put", description = "Enable read only mode")
-class PutReadOnlyCommand extends SshCommand {
+@CommandMetaData(name = "enable", description = "Enable read only mode")
+class EnableReadOnlyCommand extends SshCommand {
   @Inject ReadOnlyEndpoint.Put put;
 
   @Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/readonly/GetReadOnlyStatusCommand.java b/src/main/java/com/googlesource/gerrit/plugins/readonly/GetReadOnlyStatusCommand.java
index 3a5c9db..06a41e5 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/readonly/GetReadOnlyStatusCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/readonly/GetReadOnlyStatusCommand.java
@@ -23,8 +23,8 @@
 import com.google.inject.Inject;
 
 @RequiresAnyCapability({ADMINISTRATE_SERVER, MAINTAIN_SERVER})
-@CommandMetaData(name = "get", description = "Show read only mode state")
-class GetReadOnlyCommand extends SshCommand {
+@CommandMetaData(name = "status", description = "Show read only mode state")
+class GetReadOnlyStatusCommand extends SshCommand {
   @Inject ReadOnlyEndpoint.Get get;
 
   @Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/readonly/SshModule.java b/src/main/java/com/googlesource/gerrit/plugins/readonly/SshModule.java
index c89816e..357c2f7 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/readonly/SshModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/readonly/SshModule.java
@@ -25,13 +25,13 @@
         .to(DisableCommandInterceptor.class);
     command(DisableCommand.class);
 
-    command(PutReadOnlyCommand.class);
-    alias("on", PutReadOnlyCommand.class);
+    command(EnableReadOnlyCommand.class);
+    alias("on", EnableReadOnlyCommand.class);
 
-    command(DeleteReadOnlyCommand.class);
-    alias("off", DeleteReadOnlyCommand.class);
+    command(DisableReadOnlyCommand.class);
+    alias("off", DisableReadOnlyCommand.class);
 
-    command(GetReadOnlyCommand.class);
-    alias("status", GetReadOnlyCommand.class);
+    command(GetReadOnlyStatusCommand.class);
+    alias("get", GetReadOnlyStatusCommand.class);
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyBySshIT.java b/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyBySshIT.java
index 3fe3e9e..83d6c68 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyBySshIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyBySshIT.java
@@ -22,12 +22,13 @@
 public class ReadOnlyBySshIT extends AbstractReadOnlyTest {
   @Override
   protected void setReadOnly(boolean readOnly) throws Exception {
+    String command = readOnly ? "enable" : "disable";
     String expectedStatus = readOnly ? "on" : "off";
 
-    adminSshSession.exec("readonly " + expectedStatus);
+    adminSshSession.exec("readonly " + command);
     adminSshSession.assertSuccess();
 
-    String result = adminSshSession.exec("readonly get");
+    String result = adminSshSession.exec("readonly status");
     assertThat(result).contains(expectedStatus);
   }
 }