From 272b517977b341881d9418e8a30cf1ed249720ea Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Thu, 5 Sep 2024 10:54:04 -0400 Subject: [PATCH] Remove List{Domains,Hosts} commands These commands have been broken for a long time due to result sizes. We can enhance them by pagination. However, since no one has requested a fix, removal makes more sense. --- .../registry/module/RequestComponent.java | 6 - .../module/tools/ToolsRequestComponent.java | 4 - .../registry/tools/ListDomainsCommand.java | 60 ---- .../registry/tools/ListHostsCommand.java | 28 -- .../google/registry/tools/RegistryTool.java | 2 - .../tools/ListDomainsCommandTest.java | 84 ------ .../registry/tools/ListHostsCommandTest.java | 30 -- .../tools/server/ListDomainsActionTest.java | 267 ------------------ .../tools/server/ListHostsActionTest.java | 99 ------- .../google/registry/module/routing.txt | 4 +- .../registry/module/tools/tools_routing.txt | 2 - 11 files changed, 1 insertion(+), 585 deletions(-) delete mode 100644 core/src/main/java/google/registry/tools/ListDomainsCommand.java delete mode 100644 core/src/main/java/google/registry/tools/ListHostsCommand.java delete mode 100644 core/src/test/java/google/registry/tools/ListDomainsCommandTest.java delete mode 100644 core/src/test/java/google/registry/tools/ListHostsCommandTest.java delete mode 100644 core/src/test/java/google/registry/tools/server/ListDomainsActionTest.java delete mode 100644 core/src/test/java/google/registry/tools/server/ListHostsActionTest.java diff --git a/core/src/main/java/google/registry/module/RequestComponent.java b/core/src/main/java/google/registry/module/RequestComponent.java index 604af4a88e9..b4da28e8169 100644 --- a/core/src/main/java/google/registry/module/RequestComponent.java +++ b/core/src/main/java/google/registry/module/RequestComponent.java @@ -99,8 +99,6 @@ import google.registry.tmch.TmchSmdrlAction; import google.registry.tools.server.CreateGroupsAction; import google.registry.tools.server.GenerateZoneFilesAction; -import google.registry.tools.server.ListDomainsAction; -import google.registry.tools.server.ListHostsAction; import google.registry.tools.server.ListPremiumListsAction; import google.registry.tools.server.ListRegistrarsAction; import google.registry.tools.server.ListReservedListsAction; @@ -225,10 +223,6 @@ interface RequestComponent { IcannReportingUploadAction icannReportingUploadAction(); - ListDomainsAction listDomainsAction(); - - ListHostsAction listHostsAction(); - ListPremiumListsAction listPremiumListsAction(); ListRegistrarsAction listRegistrarsAction(); diff --git a/core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java b/core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java index 6421c5528c1..fc8efed1934 100644 --- a/core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java +++ b/core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java @@ -28,8 +28,6 @@ import google.registry.request.RequestScope; import google.registry.tools.server.CreateGroupsAction; import google.registry.tools.server.GenerateZoneFilesAction; -import google.registry.tools.server.ListDomainsAction; -import google.registry.tools.server.ListHostsAction; import google.registry.tools.server.ListPremiumListsAction; import google.registry.tools.server.ListRegistrarsAction; import google.registry.tools.server.ListReservedListsAction; @@ -56,8 +54,6 @@ public interface ToolsRequestComponent { CreateGroupsAction createGroupsAction(); EppToolAction eppToolAction(); GenerateZoneFilesAction generateZoneFilesAction(); - ListDomainsAction listDomainsAction(); - ListHostsAction listHostsAction(); ListPremiumListsAction listPremiumListsAction(); ListRegistrarsAction listRegistrarsAction(); ListReservedListsAction listReservedListsAction(); diff --git a/core/src/main/java/google/registry/tools/ListDomainsCommand.java b/core/src/main/java/google/registry/tools/ListDomainsCommand.java deleted file mode 100644 index b7329817848..00000000000 --- a/core/src/main/java/google/registry/tools/ListDomainsCommand.java +++ /dev/null @@ -1,60 +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 static google.registry.model.tld.Tlds.getTldsOfType; -import static google.registry.util.CollectionUtils.isNullOrEmpty; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import com.google.common.base.Joiner; -import com.google.common.collect.ImmutableMap; -import google.registry.model.tld.Tld.TldType; -import google.registry.tools.server.ListDomainsAction; -import java.util.List; - -/** Command to list all second-level domains on specified TLD(s). */ -@Parameters(separators = " =", commandDescription = "List domains on TLD(s).") -final class ListDomainsCommand extends ListObjectsCommand { - - @Parameter( - names = {"-t", "--tld", "--tlds"}, - description = "Comma-delimited list of TLDs to list domains on; defaults to all REAL TLDs.") - private List tlds; - - @Parameter( - names = {"-n", "--limit"}, - description = "Max number of domains to list, most recent first; defaults to no limit." - ) - private int maxDomains = Integer.MAX_VALUE; - - @Override - String getCommandPath() { - return ListDomainsAction.PATH; - } - - /** Returns a map of parameters to be sent to the server (in addition to the usual ones). */ - @Override - ImmutableMap getParameterMap() { - // Default to all REAL TLDs if not specified. - if (isNullOrEmpty(tlds)) { - tlds = getTldsOfType(TldType.REAL).asList(); - } - String tldsParam = Joiner.on(',').join(tlds); - checkArgument(tldsParam.length() < 1024, "Total length of TLDs is too long for URL parameter"); - return ImmutableMap.of("tlds", tldsParam, "limit", maxDomains); - } -} diff --git a/core/src/main/java/google/registry/tools/ListHostsCommand.java b/core/src/main/java/google/registry/tools/ListHostsCommand.java deleted file mode 100644 index 0fe9b3a4485..00000000000 --- a/core/src/main/java/google/registry/tools/ListHostsCommand.java +++ /dev/null @@ -1,28 +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.beust.jcommander.Parameters; -import google.registry.tools.server.ListHostsAction; - -/** Command to list all Host entities in the system. */ -@Parameters(separators = " =", commandDescription = "List all hosts.") -final class ListHostsCommand extends ListObjectsCommand { - - @Override - String getCommandPath() { - return ListHostsAction.PATH; - } -} diff --git a/core/src/main/java/google/registry/tools/RegistryTool.java b/core/src/main/java/google/registry/tools/RegistryTool.java index 6c47986f446..e92db84f9de 100644 --- a/core/src/main/java/google/registry/tools/RegistryTool.java +++ b/core/src/main/java/google/registry/tools/RegistryTool.java @@ -86,9 +86,7 @@ public final class RegistryTool { .put("ghostryde", GhostrydeCommand.class) .put("hash_certificate", HashCertificateCommand.class) .put("list_cursors", ListCursorsCommand.class) - .put("list_domains", ListDomainsCommand.class) .put("list_feature_flags", ListFeatureFlagsCommand.class) - .put("list_hosts", ListHostsCommand.class) .put("list_premium_lists", ListPremiumListsCommand.class) .put("list_registrars", ListRegistrarsCommand.class) .put("list_reserved_lists", ListReservedListsCommand.class) diff --git a/core/src/test/java/google/registry/tools/ListDomainsCommandTest.java b/core/src/test/java/google/registry/tools/ListDomainsCommandTest.java deleted file mode 100644 index f53436182fc..00000000000 --- a/core/src/test/java/google/registry/tools/ListDomainsCommandTest.java +++ /dev/null @@ -1,84 +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 google.registry.testing.DatabaseHelper.createTlds; -import static google.registry.testing.DatabaseHelper.newTld; -import static google.registry.testing.DatabaseHelper.persistResource; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; - -import com.google.common.collect.ImmutableMap; -import com.google.common.net.MediaType; -import google.registry.model.tld.Tld.TldType; -import google.registry.tools.server.ListDomainsAction; -import org.junit.jupiter.api.Test; -import org.mockito.junit.jupiter.MockitoSettings; -import org.mockito.quality.Strictness; - -/** - * Unit tests for {@link ListDomainsCommand}. - * - * @see ListObjectsCommandTestCase - */ -public class ListDomainsCommandTest extends ListObjectsCommandTestCase { - - @Override - final String getTaskPath() { - return ListDomainsAction.PATH; - } - - @Override - protected ImmutableMap getOtherParameters() { - return ImmutableMap.of("tlds", "foo", "limit", Integer.MAX_VALUE); - } - - @Test - @MockitoSettings(strictness = Strictness.LENIENT) - void test_tldsParamTooLong() { - String tldsParam = "--tlds=foo,bar" + ",baz".repeat(300); - IllegalArgumentException thrown = - assertThrows(IllegalArgumentException.class, () -> runCommand(tldsParam)); - assertThat(thrown) - .hasMessageThat() - .contains("Total length of TLDs is too long for URL parameter"); - } - - @Test - void test_bothParamsSpecified() throws Exception { - runCommand("--tlds=foo,bar", "--limit=100"); - verify(connection) - .sendPostRequest( - eq(getTaskPath()), - eq(ImmutableMap.of("tlds", "foo,bar", "limit", 100)), - eq(MediaType.PLAIN_TEXT_UTF_8), - eq(new byte[0])); - } - - @Test - void test_defaultsToAllRealTlds() throws Exception { - createTlds("tldone", "tldtwo"); - persistResource(newTld("fake", "FAKE").asBuilder().setTldType(TldType.TEST).build()); - runCommand(); - verify(connection) - .sendPostRequest( - eq(getTaskPath()), - eq(ImmutableMap.of("tlds", "tldone,tldtwo", "limit", Integer.MAX_VALUE)), - eq(MediaType.PLAIN_TEXT_UTF_8), - eq(new byte[0])); - } -} diff --git a/core/src/test/java/google/registry/tools/ListHostsCommandTest.java b/core/src/test/java/google/registry/tools/ListHostsCommandTest.java deleted file mode 100644 index ef70d5e53e7..00000000000 --- a/core/src/test/java/google/registry/tools/ListHostsCommandTest.java +++ /dev/null @@ -1,30 +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 google.registry.tools.server.ListHostsAction; - -/** - * Unit tests for {@link ListHostsCommand}. - * - * @see ListObjectsCommandTestCase - */ -class ListHostsCommandTest extends ListObjectsCommandTestCase { - - @Override - final String getTaskPath() { - return ListHostsAction.PATH; - } -} diff --git a/core/src/test/java/google/registry/tools/server/ListDomainsActionTest.java b/core/src/test/java/google/registry/tools/server/ListDomainsActionTest.java deleted file mode 100644 index a93dfe78d08..00000000000 --- a/core/src/test/java/google/registry/tools/server/ListDomainsActionTest.java +++ /dev/null @@ -1,267 +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.server; - -import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.createTlds; -import static google.registry.testing.DatabaseHelper.persistActiveDomain; - -import com.google.common.collect.ImmutableSet; -import google.registry.testing.FakeClock; -import java.util.Optional; -import org.joda.time.DateTime; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -/** Unit tests for {@link ListDomainsAction}. */ -class ListDomainsActionTest extends ListActionTestCase { - - private ListDomainsAction action; - - @BeforeEach - void beforeEach() { - createTld("foo"); - action = new ListDomainsAction(); - action.clock = new FakeClock(DateTime.parse("2018-01-01TZ")); - action.limit = Integer.MAX_VALUE; - } - - @Test - void testRun_invalidRequest_missingTlds() { - action.tlds = ImmutableSet.of(); - testRunError( - action, - Optional.empty(), - Optional.empty(), - Optional.empty(), - "^Must specify TLDs to query$"); - } - - @Test - void testRun_invalidRequest_invalidTld() { - action.tlds = ImmutableSet.of("%%%badtld%%%"); - testRunError( - action, - Optional.empty(), - Optional.empty(), - Optional.empty(), - "^TLDs do not exist: %%%badtld%%%$"); - } - - @Test - void testRun_noParameters() { - action.tlds = ImmutableSet.of("foo"); - testRunSuccess(action, Optional.empty(), Optional.empty(), Optional.empty()); - } - - @Test - void testRun_twoLinesWithIdOnly() { - action.tlds = ImmutableSet.of("foo"); - createTlds("bar", "sim"); - persistActiveDomain("dontlist.bar", DateTime.parse("2015-02-14T15:15:15Z")); - persistActiveDomain("example1.foo", DateTime.parse("2015-02-15T15:15:15Z")); - persistActiveDomain("example2.foo", DateTime.parse("2015-02-16T15:15:15Z")); - persistActiveDomain("notlistedaswell.sim", DateTime.parse("2015-02-17T15:15:15Z")); - // Only list the two domains in .foo, not the .bar or .sim ones. - testRunSuccess( - action, - Optional.empty(), - Optional.empty(), - Optional.empty(), - "^example1.foo$", - "^example2.foo$"); - } - - @Test - void testRun_multipleTlds() { - action.tlds = ImmutableSet.of("bar", "foo"); - createTlds("bar", "sim"); - persistActiveDomain("dolist.bar", DateTime.parse("2015-01-15T15:15:15Z")); - persistActiveDomain("example1.foo", DateTime.parse("2015-02-15T15:15:15Z")); - persistActiveDomain("example2.foo", DateTime.parse("2015-03-15T15:15:15Z")); - persistActiveDomain("notlistedaswell.sim", DateTime.parse("2015-04-15T15:15:15Z")); - testRunSuccess( - action, - Optional.empty(), - Optional.empty(), - Optional.empty(), - "^dolist.bar", - "^example1.foo$", - "^example2.foo$"); - } - - @Test - void testRun_moreTldsThanMaxNumSubqueries() { - ListDomainsAction.maxNumSubqueries = 2; - createTlds("baa", "bab", "bac", "bad"); - action.tlds = ImmutableSet.of("baa", "bab", "bac", "bad"); - action.limit = 4; - persistActiveDomain("domain1.baa", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("domain2.bab", DateTime.parse("2009-03-04T16:00:00Z")); - persistActiveDomain("domain3.bac", DateTime.parse("2011-03-04T16:00:00Z")); - persistActiveDomain("domain4.bad", DateTime.parse("2010-06-04T16:00:00Z")); - persistActiveDomain("domain5.baa", DateTime.parse("2008-01-04T16:00:00Z")); - // Since the limit is 4, expect all but domain5.baa (the oldest), sorted by creationTime asc. - testRunSuccess( - action, - Optional.empty(), - Optional.empty(), - Optional.empty(), - "^domain2.bab$", - "^domain1.baa$", - "^domain4.bad$", - "^domain3.bac$"); - } - - @Test - void testRun_twoLinesWithIdOnlyNoHeader() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("example1.foo", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("example2.foo", DateTime.parse("2011-03-04T16:00:00Z")); - testRunSuccess( - action, - Optional.empty(), - Optional.of(false), - Optional.empty(), - "^example1.foo$", - "^example2.foo$"); - } - - @Test - void testRun_twoLinesWithIdOnlyExplicitHeader() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("test1.foo", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("test2.foo", DateTime.parse("2011-03-04T16:00:00Z")); - testRunSuccess( - action, - Optional.empty(), - Optional.of(true), - Optional.empty(), - "^domainName$", - "^-+\\s*$", - "^test1.foo\\s*$", - "^test2.foo\\s*$"); - } - - @Test - void testRun_twoLinesWithRepoId() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("example1.foo", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("example3.foo", DateTime.parse("2011-03-04T16:00:00Z")); - testRunSuccess( - action, - Optional.of("repoId"), - Optional.empty(), - Optional.empty(), - "^domainName\\s+repoId\\s*$", - "^-+\\s+-+\\s*$", - "^example1.foo\\s+2-FOO\\s*$", - "^example3.foo\\s+4-FOO\\s*$"); - } - - @Test - void testRun_twoLinesWithRepoIdNoHeader() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("example1.foo", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("example3.foo", DateTime.parse("2011-03-04T16:00:00Z")); - testRunSuccess( - action, - Optional.of("repoId"), - Optional.of(false), - Optional.empty(), - "^example1.foo 2-FOO$", - "^example3.foo 4-FOO$"); - } - - @Test - void testRun_twoLinesWithRepoIdExplicitHeader() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("example1.foo", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("example3.foo", DateTime.parse("2011-03-04T16:00:00Z")); - testRunSuccess( - action, - Optional.of("repoId"), - Optional.of(true), - Optional.empty(), - "^domainName\\s+repoId\\s*$", - "^-+\\s+-+\\s*$", - "^example1.foo\\s+2-FOO\\s*$", - "^example3.foo\\s+4-FOO\\s*$"); - } - - @Test - void testRun_twoLinesWithWildcard() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("example1.foo", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("example3.foo", DateTime.parse("2010-03-05T16:00:00Z")); - testRunSuccess( - action, - Optional.of("*"), - Optional.empty(), - Optional.empty(), - "^domainName\\s+.*repoId", - "^-+\\s+-+", - "^example1.foo\\s+.*2-FOO", - "^example3.foo\\s+.*4-FOO"); - } - - @Test - void testRun_twoLinesWithWildcardAndAnotherField() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("example1.foo", DateTime.parse("2010-03-04T16:00:00Z")); - persistActiveDomain("example3.foo", DateTime.parse("2010-03-04T17:00:00Z")); - testRunSuccess( - action, - Optional.of("*,repoId"), - Optional.empty(), - Optional.empty(), - "^domainName\\s+.*repoId", - "^-+\\s+-+", - "^example1.foo\\s+.*2-FOO", - "^example3.foo\\s+.*4-FOO"); - } - - @Test - void testRun_withBadField_returnsError() { - action.tlds = ImmutableSet.of("foo"); - persistActiveDomain("example2.foo"); - persistActiveDomain("example1.foo"); - testRunError( - action, - Optional.of("badfield"), - Optional.empty(), - Optional.empty(), - "^Field 'badfield' not found - recognized fields are:"); - } - - @Test - void testRun_limitFiltersOutOldestDomains() { - createTlds("bar", "baz"); - action.tlds = ImmutableSet.of("foo", "bar"); - action.limit = 2; - persistActiveDomain("example4.foo", DateTime.parse("2017-04-01TZ")); - persistActiveDomain("example1.foo", DateTime.parse("2017-01-01TZ")); - persistActiveDomain("example2.bar", DateTime.parse("2017-02-01TZ")); - persistActiveDomain("example3.bar", DateTime.parse("2017-03-01TZ")); - persistActiveDomain("example5.baz", DateTime.parse("2018-01-01TZ")); - testRunSuccess( - action, - Optional.empty(), - Optional.empty(), - Optional.empty(), - "^example3.bar$", - "^example4.foo$"); - } -} diff --git a/core/src/test/java/google/registry/tools/server/ListHostsActionTest.java b/core/src/test/java/google/registry/tools/server/ListHostsActionTest.java deleted file mode 100644 index 32b64536ca9..00000000000 --- a/core/src/test/java/google/registry/tools/server/ListHostsActionTest.java +++ /dev/null @@ -1,99 +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.server; - -import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.persistActiveHost; - -import google.registry.testing.FakeClock; -import java.util.Optional; -import org.joda.time.DateTime; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -/** Unit tests for {@link ListHostsAction}. */ -class ListHostsActionTest extends ListActionTestCase { - - private ListHostsAction action; - - @BeforeEach - void beforeEach() { - createTld("foo"); - action = new ListHostsAction(); - action.clock = new FakeClock(DateTime.parse("2000-01-01TZ")); - } - - @Test - void testRun_noParameters() { - testRunSuccess(action, Optional.empty(), Optional.empty(), Optional.empty()); - } - - @Test - void testRun_twoLinesWithRepoId() { - persistActiveHost("example2.foo"); - persistActiveHost("example1.foo"); - testRunSuccess( - action, - Optional.of("repoId"), - Optional.empty(), - Optional.empty(), - "^hostName\\s+repoId\\s*$", - "^-+\\s+-+\\s*$", - "^example1.foo\\s+3-ROID\\s*$", - "^example2.foo\\s+2-ROID\\s*$"); - } - - @Test - void testRun_twoLinesWithWildcard() { - persistActiveHost("example2.foo"); - persistActiveHost("example1.foo"); - testRunSuccess( - action, - Optional.of("*"), - Optional.empty(), - Optional.empty(), - "^hostName\\s+.*repoId", - "^-+\\s+-+", - "^example1.foo\\s+.*2", - "^example2.foo\\s+.*1"); - } - - @Test - void testRun_twoLinesWithWildcardAndAnotherField() { - persistActiveHost("example2.foo"); - persistActiveHost("example1.foo"); - testRunSuccess( - action, - Optional.of("*,repoId"), - Optional.empty(), - Optional.empty(), - "^hostName\\s+.*repoId", - "^-+\\s+-+", - "^example1.foo\\s+.*2", - "^example2.foo\\s+.*1"); - } - - @Test - void testRun_withBadField_returnsError() { - persistActiveHost("example2.foo"); - persistActiveHost("example1.foo"); - testRunError( - action, - Optional.of("badfield"), - Optional.empty(), - Optional.empty(), - "^Field 'badfield' not found - recognized fields are:"); - } -} diff --git a/core/src/test/resources/google/registry/module/routing.txt b/core/src/test/resources/google/registry/module/routing.txt index c86c57c3475..7f15ad51b2d 100644 --- a/core/src/test/resources/google/registry/module/routing.txt +++ b/core/src/test/resources/google/registry/module/routing.txt @@ -1,8 +1,6 @@ SERVICE PATH CLASS METHODS OK MIN USER_POLICY FRONTEND /_dr/epp EppTlsAction POST n APP ADMIN BACKEND /_dr/admin/createGroups CreateGroupsAction POST n APP ADMIN -BACKEND /_dr/admin/list/domains ListDomainsAction GET,POST n APP ADMIN -BACKEND /_dr/admin/list/hosts ListHostsAction GET,POST n APP ADMIN BACKEND /_dr/admin/list/premiumLists ListPremiumListsAction GET,POST n APP ADMIN BACKEND /_dr/admin/list/registrars ListRegistrarsAction GET,POST n APP ADMIN BACKEND /_dr/admin/list/reservedLists ListReservedListsAction GET,POST n APP ADMIN @@ -78,4 +76,4 @@ CONSOLE /console-api/registry-lock-verify ConsoleRegistryLockV CONSOLE /console-api/settings/contacts ContactAction GET,POST n USER PUBLIC CONSOLE /console-api/settings/security SecurityAction POST n USER PUBLIC CONSOLE /console-api/settings/whois-fields WhoisRegistrarFieldsAction POST n USER PUBLIC -CONSOLE /console-api/userdata ConsoleUserDataAction GET n USER PUBLIC \ No newline at end of file +CONSOLE /console-api/userdata ConsoleUserDataAction GET n USER PUBLIC diff --git a/core/src/test/resources/google/registry/module/tools/tools_routing.txt b/core/src/test/resources/google/registry/module/tools/tools_routing.txt index 9e95e8aa92b..aa073a68518 100644 --- a/core/src/test/resources/google/registry/module/tools/tools_routing.txt +++ b/core/src/test/resources/google/registry/module/tools/tools_routing.txt @@ -1,7 +1,5 @@ SERVICE PATH CLASS METHODS OK MIN USER_POLICY BACKEND /_dr/admin/createGroups CreateGroupsAction POST n APP ADMIN -BACKEND /_dr/admin/list/domains ListDomainsAction GET,POST n APP ADMIN -BACKEND /_dr/admin/list/hosts ListHostsAction GET,POST n APP ADMIN BACKEND /_dr/admin/list/premiumLists ListPremiumListsAction GET,POST n APP ADMIN BACKEND /_dr/admin/list/registrars ListRegistrarsAction GET,POST n APP ADMIN BACKEND /_dr/admin/list/reservedLists ListReservedListsAction GET,POST n APP ADMIN