diff --git a/core/src/main/java/google/registry/tools/CreateSandboxTldCommand.java b/core/src/main/java/google/registry/tools/CreateSandboxTldCommand.java deleted file mode 100644 index e25e62f69..000000000 --- a/core/src/main/java/google/registry/tools/CreateSandboxTldCommand.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.tools; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.beust.jcommander.Parameters; -import google.registry.config.RegistryEnvironment; - -/** Command to create a TLD in sandbox, separated out for gTech use. */ -@Parameters(separators = " =", commandDescription = "Create new sandbox TLD(s)") -final class CreateSandboxTldCommand extends CreateTldCommand { - - @Override - void assertAllowedEnvironment() { - checkArgument( - RegistryEnvironment.get() == RegistryEnvironment.SANDBOX, - "This command can only be run in the sandbox environment"); - } -} diff --git a/core/src/main/java/google/registry/tools/GtechTool.java b/core/src/main/java/google/registry/tools/GtechTool.java deleted file mode 100644 index 427c29bb9..000000000 --- a/core/src/main/java/google/registry/tools/GtechTool.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.tools; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; - -/** Command line interface with a subset of commands that are safe for tech support to run. */ -public final class GtechTool { - - /** Names of commands from {@link RegistryTool#COMMAND_MAP} to include in GtechTool. */ - @VisibleForTesting - static final ImmutableSet COMMAND_SET = ImmutableSet.of( - "canonicalize_labels", - "check_domain", - "check_domain_claims", - "convert_idn", - "count_domains", - "create_anchor_tenant", - "create_contact", - "create_domain", - "create_host", - "create_registrar", - "create_registrar_groups", - "create_sandbox_tld", - "delete_domain", - "generate_dns_report", - "get_allocation_token", - "get_claims_list", - "get_contact", - "get_domain", - "get_history_entries", - "get_host", - "get_registrar", - "get_routing_map", - "get_schema", - "get_schema_tree", - "get_tld", - "hash_certificate", - "list_registrars", - "list_tlds", - "lock_domain", - "login", - "logout", - "registrar_contact", - "setup_ote", - "uniform_rapid_suspension", - "unlock_domain", - "unrenew_domain", - "update_domain", - "update_registrar", - "update_sandbox_tld", - "update_server_locks", - "validate_login_credentials", - "verify_ote", - "whois_query"); - - @VisibleForTesting - static final ImmutableMap> COMMAND_MAP = - ImmutableMap.copyOf(Maps.filterKeys(RegistryTool.COMMAND_MAP, Predicates.in(COMMAND_SET))); - - public static void main(String[] args) throws Exception { - RegistryToolEnvironment.parseFromArgs(args).setup(); - try (RegistryCli cli = new RegistryCli("gtech_tool", COMMAND_MAP)) { - cli.run(args); - } - } -} diff --git a/core/src/main/java/google/registry/tools/RegistryCli.java b/core/src/main/java/google/registry/tools/RegistryCli.java index 2d02cb9bf..0e60d9162 100644 --- a/core/src/main/java/google/registry/tools/RegistryCli.java +++ b/core/src/main/java/google/registry/tools/RegistryCli.java @@ -44,8 +44,7 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider; final class RegistryCli implements AutoCloseable, CommandRunner { // The environment parameter is parsed twice: once here, and once with {@link - // RegistryToolEnvironment#parseFromArgs} in the {@link RegistryTool#main} or {@link - // GtechTool#main} functions. + // RegistryToolEnvironment#parseFromArgs} in the {@link RegistryTool#main} function. // // The flag names must be in sync between the two, and also - this is ugly and we should feel bad. @Parameter( diff --git a/core/src/main/java/google/registry/tools/RegistryTool.java b/core/src/main/java/google/registry/tools/RegistryTool.java index 649147f13..0b95f14bd 100644 --- a/core/src/main/java/google/registry/tools/RegistryTool.java +++ b/core/src/main/java/google/registry/tools/RegistryTool.java @@ -44,7 +44,6 @@ public final class RegistryTool { .put("create_registrar", CreateRegistrarCommand.class) .put("create_registrar_groups", CreateRegistrarGroupsCommand.class) .put("create_reserved_list", CreateReservedListCommand.class) - .put("create_sandbox_tld", CreateSandboxTldCommand.class) .put("create_tld", CreateTldCommand.class) .put("curl", CurlCommand.class) .put("delete_allocation_tokens", DeleteAllocationTokensCommand.class) @@ -114,7 +113,6 @@ public final class RegistryTool { .put("update_premium_list", UpdatePremiumListCommand.class) .put("update_registrar", UpdateRegistrarCommand.class) .put("update_reserved_list", UpdateReservedListCommand.class) - .put("update_sandbox_tld", UpdateSandboxTldCommand.class) .put("update_server_locks", UpdateServerLocksCommand.class) .put("update_tld", UpdateTldCommand.class) .put("upload_claims_list", UploadClaimsListCommand.class) diff --git a/core/src/main/java/google/registry/tools/UpdateSandboxTldCommand.java b/core/src/main/java/google/registry/tools/UpdateSandboxTldCommand.java deleted file mode 100644 index 59412ebcc..000000000 --- a/core/src/main/java/google/registry/tools/UpdateSandboxTldCommand.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.tools; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.beust.jcommander.Parameters; -import google.registry.config.RegistryEnvironment; - -/** Command to update a TLD in sandbox, separated out for gTech use. */ -@Parameters(separators = " =", commandDescription = "Update new sandbox TLD(s)") -final class UpdateSandboxTldCommand extends UpdateTldCommand { - - @Override - void assertAllowedEnvironment() { - checkArgument( - RegistryEnvironment.get() == RegistryEnvironment.SANDBOX, - "This command can only be run in the sandbox environment"); - } -} diff --git a/core/src/test/java/google/registry/tools/GtechToolTest.java b/core/src/test/java/google/registry/tools/GtechToolTest.java deleted file mode 100644 index 6d26e3557..000000000 --- a/core/src/test/java/google/registry/tools/GtechToolTest.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.tools; - -import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth.assertWithMessage; - -import com.google.common.collect.Sets; -import google.registry.testing.SystemPropertyRule; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Unit tests for {@link GtechTool}. */ -@RunWith(JUnit4.class) -public class GtechToolTest { - - @Rule public final SystemPropertyRule systemPropertyRule = new SystemPropertyRule(); - - @Before - public void init() { - RegistryToolEnvironment.UNITTEST.setup(systemPropertyRule); - } - - @Test - public void test_commandMap_namesAreInAlphabeticalOrder() { - assertThat(GtechTool.COMMAND_MAP.keySet()).isInStrictOrder(); - } - - @Test - public void test_commandSet_namesAreSubsetOfRegistryToolCommands() { - assertWithMessage("commands in GtechTool.COMMAND_SET but not in RegistryTool.COMMAND_MAP") - .that(Sets.difference(GtechTool.COMMAND_SET, RegistryTool.COMMAND_MAP.keySet())) - .isEmpty(); - } -}