From 34bea69a484cfcd983bd37e3088d2adff27b925b Mon Sep 17 00:00:00 2001 From: gbrodman Date: Wed, 5 Nov 2025 14:03:45 -0500 Subject: [PATCH] Remove no-longer-used servlets/components (#2868) With GKE, we don't need the individual servlets because the services aren't partitioned out the same way they were in GAE. We keep FrontendServlet and BackendServlet around for now as they serve as the backbone for the local RegistryTestServer (for testing things like the console). did some cursory tests on alpha and things seem to be unaffected -- I was able to curl RDAP (pubapi) and create domains --- .../registry/module/bsa/BsaComponent.java | 54 ------------- .../module/bsa/BsaRequestComponent.java | 52 ------------ .../module/bsa/BsaRequestHandler.java | 29 ------- .../registry/module/bsa/BsaServlet.java | 30 ------- .../registry/module/bsa/package-info.java | 16 ---- .../module/pubapi/PubApiComponent.java | 65 --------------- .../module/pubapi/PubApiRequestComponent.java | 74 ----------------- .../module/pubapi/PubApiRequestHandler.java | 31 ------- .../registry/module/pubapi/PubApiServlet.java | 31 ------- .../registry/module/pubapi/package-info.java | 16 ---- .../registry/module/tools/ToolsComponent.java | 69 ---------------- .../module/tools/ToolsRequestComponent.java | 80 ------------------- .../module/tools/ToolsRequestHandler.java | 30 ------- .../registry/module/tools/ToolsServlet.java | 31 ------- .../registry/module/RequestComponentTest.java | 26 ------ .../module/bsa/BsaRequestComponentTest.java | 41 ---------- .../registry/module/bsa/BsaServletTest.java | 36 --------- .../pubapi/PubApiRequestComponentTest.java | 41 ---------- .../module/pubapi/PubApiServletTest.java | 38 --------- .../tools/ToolsRequestComponentTest.java | 41 ---------- .../module/tools/ToolsServletTest.java | 38 --------- .../registry/module/bsa/bsa_routing.txt | 5 -- .../registry/module/pubapi/pubapi_routing.txt | 13 --- .../registry/module/tools/tools_routing.txt | 14 ---- 24 files changed, 901 deletions(-) delete mode 100644 core/src/main/java/google/registry/module/bsa/BsaComponent.java delete mode 100644 core/src/main/java/google/registry/module/bsa/BsaRequestComponent.java delete mode 100644 core/src/main/java/google/registry/module/bsa/BsaRequestHandler.java delete mode 100644 core/src/main/java/google/registry/module/bsa/BsaServlet.java delete mode 100644 core/src/main/java/google/registry/module/bsa/package-info.java delete mode 100644 core/src/main/java/google/registry/module/pubapi/PubApiComponent.java delete mode 100644 core/src/main/java/google/registry/module/pubapi/PubApiRequestComponent.java delete mode 100644 core/src/main/java/google/registry/module/pubapi/PubApiRequestHandler.java delete mode 100644 core/src/main/java/google/registry/module/pubapi/PubApiServlet.java delete mode 100644 core/src/main/java/google/registry/module/pubapi/package-info.java delete mode 100644 core/src/main/java/google/registry/module/tools/ToolsComponent.java delete mode 100644 core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java delete mode 100644 core/src/main/java/google/registry/module/tools/ToolsRequestHandler.java delete mode 100644 core/src/main/java/google/registry/module/tools/ToolsServlet.java delete mode 100644 core/src/test/java/google/registry/module/bsa/BsaRequestComponentTest.java delete mode 100644 core/src/test/java/google/registry/module/bsa/BsaServletTest.java delete mode 100644 core/src/test/java/google/registry/module/pubapi/PubApiRequestComponentTest.java delete mode 100644 core/src/test/java/google/registry/module/pubapi/PubApiServletTest.java delete mode 100644 core/src/test/java/google/registry/module/tools/ToolsRequestComponentTest.java delete mode 100644 core/src/test/java/google/registry/module/tools/ToolsServletTest.java delete mode 100644 core/src/test/resources/google/registry/module/bsa/bsa_routing.txt delete mode 100644 core/src/test/resources/google/registry/module/pubapi/pubapi_routing.txt delete mode 100644 core/src/test/resources/google/registry/module/tools/tools_routing.txt diff --git a/core/src/main/java/google/registry/module/bsa/BsaComponent.java b/core/src/main/java/google/registry/module/bsa/BsaComponent.java deleted file mode 100644 index b7ee2b875..000000000 --- a/core/src/main/java/google/registry/module/bsa/BsaComponent.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2023 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.module.bsa; - -import com.google.monitoring.metrics.MetricReporter; -import dagger.Component; -import dagger.Lazy; -import google.registry.config.CredentialModule; -import google.registry.config.RegistryConfig.ConfigModule; -import google.registry.groups.GmailModule; -import google.registry.keyring.KeyringModule; -import google.registry.module.bsa.BsaRequestComponent.BsaRequestComponentModule; -import google.registry.monitoring.whitebox.StackdriverModule; -import google.registry.persistence.PersistenceModule; -import google.registry.privileges.secretmanager.SecretManagerModule; -import google.registry.request.Modules.GsonModule; -import google.registry.request.Modules.UrlConnectionServiceModule; -import google.registry.request.auth.AuthModule; -import google.registry.util.UtilsModule; -import jakarta.inject.Singleton; - -@Singleton -@Component( - modules = { - AuthModule.class, - BsaRequestComponentModule.class, - ConfigModule.class, - CredentialModule.class, - GmailModule.class, - GsonModule.class, - PersistenceModule.class, - KeyringModule.class, - SecretManagerModule.class, - StackdriverModule.class, - UrlConnectionServiceModule.class, - UtilsModule.class - }) -interface BsaComponent { - BsaRequestHandler requestHandler(); - - Lazy metricReporter(); -} diff --git a/core/src/main/java/google/registry/module/bsa/BsaRequestComponent.java b/core/src/main/java/google/registry/module/bsa/BsaRequestComponent.java deleted file mode 100644 index 36c34874b..000000000 --- a/core/src/main/java/google/registry/module/bsa/BsaRequestComponent.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2023 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.module.bsa; - -import dagger.Module; -import dagger.Subcomponent; -import google.registry.bsa.BsaDownloadAction; -import google.registry.bsa.BsaRefreshAction; -import google.registry.bsa.BsaValidateAction; -import google.registry.bsa.UploadBsaUnavailableDomainsAction; -import google.registry.request.Modules.UrlConnectionServiceModule; -import google.registry.request.RequestComponentBuilder; -import google.registry.request.RequestModule; -import google.registry.request.RequestScope; - -@RequestScope -@Subcomponent(modules = {RequestModule.class, UrlConnectionServiceModule.class}) -public interface BsaRequestComponent { - - BsaDownloadAction bsaDownloadAction(); - - BsaRefreshAction bsaRefreshAction(); - - BsaValidateAction bsaValidateAction(); - - UploadBsaUnavailableDomainsAction uploadBsaUnavailableDomains(); - - @Subcomponent.Builder - abstract class Builder implements RequestComponentBuilder { - - @Override - public abstract Builder requestModule(RequestModule requestModule); - - @Override - public abstract BsaRequestComponent build(); - } - - @Module(subcomponents = BsaRequestComponent.class) - class BsaRequestComponentModule {} -} diff --git a/core/src/main/java/google/registry/module/bsa/BsaRequestHandler.java b/core/src/main/java/google/registry/module/bsa/BsaRequestHandler.java deleted file mode 100644 index 9db9cdd15..000000000 --- a/core/src/main/java/google/registry/module/bsa/BsaRequestHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2023 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.module.bsa; - -import google.registry.request.RequestHandler; -import google.registry.request.auth.RequestAuthenticator; -import jakarta.inject.Inject; -import jakarta.inject.Provider; - -public class BsaRequestHandler extends RequestHandler { - @Inject - public BsaRequestHandler( - Provider componentBuilderProvider, - RequestAuthenticator requestAuthenticator) { - super(componentBuilderProvider, requestAuthenticator); - } -} diff --git a/core/src/main/java/google/registry/module/bsa/BsaServlet.java b/core/src/main/java/google/registry/module/bsa/BsaServlet.java deleted file mode 100644 index 279e37c20..000000000 --- a/core/src/main/java/google/registry/module/bsa/BsaServlet.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2023 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.module.bsa; - -import com.google.monitoring.metrics.MetricReporter; -import dagger.Lazy; -import google.registry.module.ServletBase; - -public final class BsaServlet extends ServletBase { - - private static final BsaComponent component = DaggerBsaComponent.create(); - private static final BsaRequestHandler requestHandler = component.requestHandler(); - private static final Lazy metricReporter = component.metricReporter(); - - public BsaServlet() { - super(requestHandler, metricReporter); - } -} diff --git a/core/src/main/java/google/registry/module/bsa/package-info.java b/core/src/main/java/google/registry/module/bsa/package-info.java deleted file mode 100644 index 2a1c8cd61..000000000 --- a/core/src/main/java/google/registry/module/bsa/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2023 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. - -@javax.annotation.ParametersAreNonnullByDefault -package google.registry.module.bsa; diff --git a/core/src/main/java/google/registry/module/pubapi/PubApiComponent.java b/core/src/main/java/google/registry/module/pubapi/PubApiComponent.java deleted file mode 100644 index 3aa912b33..000000000 --- a/core/src/main/java/google/registry/module/pubapi/PubApiComponent.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2018 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.module.pubapi; - -import com.google.monitoring.metrics.MetricReporter; -import dagger.Component; -import dagger.Lazy; -import google.registry.config.CredentialModule; -import google.registry.config.RegistryConfig.ConfigModule; -import google.registry.flows.ServerTridProviderModule; -import google.registry.flows.custom.CustomLogicFactoryModule; -import google.registry.groups.DirectoryModule; -import google.registry.groups.GroupsModule; -import google.registry.groups.GroupssettingsModule; -import google.registry.keyring.KeyringModule; -import google.registry.keyring.api.KeyModule; -import google.registry.module.pubapi.PubApiRequestComponent.PubApiRequestComponentModule; -import google.registry.monitoring.whitebox.StackdriverModule; -import google.registry.persistence.PersistenceModule; -import google.registry.privileges.secretmanager.SecretManagerModule; -import google.registry.request.Modules.GsonModule; -import google.registry.request.Modules.NetHttpTransportModule; -import google.registry.request.auth.AuthModule; -import google.registry.util.UtilsModule; -import jakarta.inject.Singleton; - -/** Dagger component with instance lifetime for "pubapi" App Engine module. */ -@Singleton -@Component( - modules = { - AuthModule.class, - ConfigModule.class, - CredentialModule.class, - CustomLogicFactoryModule.class, - DirectoryModule.class, - GroupsModule.class, - GroupssettingsModule.class, - GsonModule.class, - KeyModule.class, - KeyringModule.class, - NetHttpTransportModule.class, - PersistenceModule.class, - PubApiRequestComponentModule.class, - SecretManagerModule.class, - ServerTridProviderModule.class, - StackdriverModule.class, - UtilsModule.class - }) -interface PubApiComponent { - PubApiRequestHandler requestHandler(); - - Lazy metricReporter(); -} diff --git a/core/src/main/java/google/registry/module/pubapi/PubApiRequestComponent.java b/core/src/main/java/google/registry/module/pubapi/PubApiRequestComponent.java deleted file mode 100644 index f5eebd25e..000000000 --- a/core/src/main/java/google/registry/module/pubapi/PubApiRequestComponent.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2018 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.module.pubapi; - -import dagger.Module; -import dagger.Subcomponent; -import google.registry.dns.DnsModule; -import google.registry.flows.CheckApiAction; -import google.registry.flows.CheckApiAction.CheckApiModule; -import google.registry.flows.TlsCredentials.EppTlsModule; -import google.registry.module.ReadinessProbeAction.ReadinessProbeActionPubApi; -import google.registry.monitoring.whitebox.WhiteboxModule; -import google.registry.rdap.RdapAutnumAction; -import google.registry.rdap.RdapDomainAction; -import google.registry.rdap.RdapDomainSearchAction; -import google.registry.rdap.RdapEmptyAction; -import google.registry.rdap.RdapEntityAction; -import google.registry.rdap.RdapEntitySearchAction; -import google.registry.rdap.RdapHelpAction; -import google.registry.rdap.RdapIpAction; -import google.registry.rdap.RdapModule; -import google.registry.rdap.RdapNameserverAction; -import google.registry.rdap.RdapNameserverSearchAction; -import google.registry.request.RequestComponentBuilder; -import google.registry.request.RequestModule; -import google.registry.request.RequestScope; - -/** Dagger component with per-request lifetime for "pubapi" App Engine module. */ -@RequestScope -@Subcomponent( - modules = { - CheckApiModule.class, - DnsModule.class, - EppTlsModule.class, - RdapModule.class, - RequestModule.class, - WhiteboxModule.class - }) -public interface PubApiRequestComponent { - CheckApiAction checkApiAction(); - RdapAutnumAction rdapAutnumAction(); - RdapDomainAction rdapDomainAction(); - RdapDomainSearchAction rdapDomainSearchAction(); - RdapEmptyAction rdapEmptyAction(); - RdapEntityAction rdapEntityAction(); - RdapEntitySearchAction rdapEntitySearchAction(); - RdapHelpAction rdapHelpAction(); - RdapIpAction rdapDefaultAction(); - RdapNameserverAction rdapNameserverAction(); - RdapNameserverSearchAction rdapNameserverSearchAction(); - - ReadinessProbeActionPubApi readinessProbeActionPubApi(); - - @Subcomponent.Builder - abstract class Builder implements RequestComponentBuilder { - @Override public abstract Builder requestModule(RequestModule requestModule); - @Override public abstract PubApiRequestComponent build(); - } - - @Module(subcomponents = PubApiRequestComponent.class) - class PubApiRequestComponentModule {} -} diff --git a/core/src/main/java/google/registry/module/pubapi/PubApiRequestHandler.java b/core/src/main/java/google/registry/module/pubapi/PubApiRequestHandler.java deleted file mode 100644 index c822912bd..000000000 --- a/core/src/main/java/google/registry/module/pubapi/PubApiRequestHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 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.module.pubapi; - -import google.registry.request.RequestHandler; -import google.registry.request.auth.RequestAuthenticator; -import jakarta.inject.Inject; -import jakarta.inject.Provider; - -/** Request handler for the frontend module. */ -public class PubApiRequestHandler extends RequestHandler { - - @Inject - PubApiRequestHandler( - Provider componentBuilderProvider, - RequestAuthenticator requestAuthenticator) { - super(componentBuilderProvider, requestAuthenticator); - } -} diff --git a/core/src/main/java/google/registry/module/pubapi/PubApiServlet.java b/core/src/main/java/google/registry/module/pubapi/PubApiServlet.java deleted file mode 100644 index b907f9042..000000000 --- a/core/src/main/java/google/registry/module/pubapi/PubApiServlet.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 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.module.pubapi; - -import com.google.monitoring.metrics.MetricReporter; -import dagger.Lazy; -import google.registry.module.ServletBase; - -/** Servlet that should handle all requests to our "default" App Engine module. */ -public final class PubApiServlet extends ServletBase { - - private static final PubApiComponent component = DaggerPubApiComponent.create(); - private static final PubApiRequestHandler requestHandler = component.requestHandler(); - private static final Lazy metricReporter = component.metricReporter(); - - public PubApiServlet() { - super(requestHandler, metricReporter); - } -} diff --git a/core/src/main/java/google/registry/module/pubapi/package-info.java b/core/src/main/java/google/registry/module/pubapi/package-info.java deleted file mode 100644 index 55adfa585..000000000 --- a/core/src/main/java/google/registry/module/pubapi/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 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. - -@javax.annotation.ParametersAreNonnullByDefault -package google.registry.module.pubapi; diff --git a/core/src/main/java/google/registry/module/tools/ToolsComponent.java b/core/src/main/java/google/registry/module/tools/ToolsComponent.java deleted file mode 100644 index 855cbb78f..000000000 --- a/core/src/main/java/google/registry/module/tools/ToolsComponent.java +++ /dev/null @@ -1,69 +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.module.tools; - -import com.google.monitoring.metrics.MetricReporter; -import dagger.Component; -import dagger.Lazy; -import google.registry.config.CloudTasksUtilsModule; -import google.registry.config.CredentialModule; -import google.registry.config.RegistryConfig.ConfigModule; -import google.registry.export.DriveModule; -import google.registry.flows.ServerTridProviderModule; -import google.registry.flows.custom.CustomLogicFactoryModule; -import google.registry.flows.domain.DomainDeletionTimeCacheModule; -import google.registry.groups.DirectoryModule; -import google.registry.groups.GroupsModule; -import google.registry.groups.GroupssettingsModule; -import google.registry.keyring.KeyringModule; -import google.registry.keyring.api.KeyModule; -import google.registry.module.tools.ToolsRequestComponent.ToolsRequestComponentModule; -import google.registry.monitoring.whitebox.StackdriverModule; -import google.registry.privileges.secretmanager.SecretManagerModule; -import google.registry.request.Modules.GsonModule; -import google.registry.request.Modules.NetHttpTransportModule; -import google.registry.request.auth.AuthModule; -import google.registry.util.UtilsModule; -import jakarta.inject.Singleton; - -/** Dagger component with instance lifetime for "tools" App Engine module. */ -@Singleton -@Component( - modules = { - AuthModule.class, - ConfigModule.class, - CredentialModule.class, - CustomLogicFactoryModule.class, - CloudTasksUtilsModule.class, - DirectoryModule.class, - DomainDeletionTimeCacheModule.class, - DriveModule.class, - GroupsModule.class, - GroupssettingsModule.class, - GsonModule.class, - KeyModule.class, - KeyringModule.class, - NetHttpTransportModule.class, - SecretManagerModule.class, - ServerTridProviderModule.class, - StackdriverModule.class, - ToolsRequestComponentModule.class, - UtilsModule.class - }) -interface ToolsComponent { - ToolsRequestHandler requestHandler(); - - Lazy metricReporter(); -} diff --git a/core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java b/core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java deleted file mode 100644 index 6421c5528..000000000 --- a/core/src/main/java/google/registry/module/tools/ToolsRequestComponent.java +++ /dev/null @@ -1,80 +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.module.tools; - -import dagger.Module; -import dagger.Subcomponent; -import google.registry.dns.DnsModule; -import google.registry.flows.EppToolAction; -import google.registry.flows.EppToolAction.EppToolModule; -import google.registry.flows.FlowComponent; -import google.registry.loadtest.LoadTestAction; -import google.registry.loadtest.LoadTestModule; -import google.registry.monitoring.whitebox.WhiteboxModule; -import google.registry.request.RequestComponentBuilder; -import google.registry.request.RequestModule; -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; -import google.registry.tools.server.ListTldsAction; -import google.registry.tools.server.RefreshDnsForAllDomainsAction; -import google.registry.tools.server.ToolsServerModule; -import google.registry.tools.server.UpdateUserGroupAction; -import google.registry.tools.server.VerifyOteAction; - -/** Dagger component with per-request lifetime for "tools" App Engine module. */ -@RequestScope -@Subcomponent( - modules = { - DnsModule.class, - EppToolModule.class, - LoadTestModule.class, - RequestModule.class, - ToolsServerModule.class, - WhiteboxModule.class, - }) -public interface ToolsRequestComponent { - FlowComponent.Builder flowComponentBuilder(); - - CreateGroupsAction createGroupsAction(); - EppToolAction eppToolAction(); - GenerateZoneFilesAction generateZoneFilesAction(); - ListDomainsAction listDomainsAction(); - ListHostsAction listHostsAction(); - ListPremiumListsAction listPremiumListsAction(); - ListRegistrarsAction listRegistrarsAction(); - ListReservedListsAction listReservedListsAction(); - ListTldsAction listTldsAction(); - LoadTestAction loadTestAction(); - RefreshDnsForAllDomainsAction refreshDnsForAllDomainsAction(); - - UpdateUserGroupAction updateUserGroupAction(); - - VerifyOteAction verifyOteAction(); - - @Subcomponent.Builder - abstract class Builder implements RequestComponentBuilder { - @Override public abstract Builder requestModule(RequestModule requestModule); - @Override public abstract ToolsRequestComponent build(); - } - - @Module(subcomponents = ToolsRequestComponent.class) - class ToolsRequestComponentModule {} -} diff --git a/core/src/main/java/google/registry/module/tools/ToolsRequestHandler.java b/core/src/main/java/google/registry/module/tools/ToolsRequestHandler.java deleted file mode 100644 index 68c888176..000000000 --- a/core/src/main/java/google/registry/module/tools/ToolsRequestHandler.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.module.tools; - -import google.registry.request.RequestHandler; -import google.registry.request.auth.RequestAuthenticator; -import jakarta.inject.Inject; -import jakarta.inject.Provider; - -/** Request handler for the tools module. */ -public class ToolsRequestHandler extends RequestHandler { - - @Inject ToolsRequestHandler( - Provider componentBuilderProvider, - RequestAuthenticator requestAuthenticator) { - super(componentBuilderProvider, requestAuthenticator); - } -} diff --git a/core/src/main/java/google/registry/module/tools/ToolsServlet.java b/core/src/main/java/google/registry/module/tools/ToolsServlet.java deleted file mode 100644 index 023c51164..000000000 --- a/core/src/main/java/google/registry/module/tools/ToolsServlet.java +++ /dev/null @@ -1,31 +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.module.tools; - -import com.google.monitoring.metrics.MetricReporter; -import dagger.Lazy; -import google.registry.module.ServletBase; - -/** Servlet that should handle all requests to our "tools" App Engine module. */ -public final class ToolsServlet extends ServletBase { - - private static final ToolsComponent component = DaggerToolsComponent.create(); - private static final ToolsRequestHandler requestHandler = component.requestHandler(); - private static final Lazy metricReporter = component.metricReporter(); - - public ToolsServlet() { - super(requestHandler, metricReporter); - } -} diff --git a/core/src/test/java/google/registry/module/RequestComponentTest.java b/core/src/test/java/google/registry/module/RequestComponentTest.java index 5b0f5d048..f0f9aaed0 100644 --- a/core/src/test/java/google/registry/module/RequestComponentTest.java +++ b/core/src/test/java/google/registry/module/RequestComponentTest.java @@ -18,29 +18,14 @@ import static com.google.common.truth.Truth.assertThat; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import google.registry.module.backend.BackendRequestComponent; -import google.registry.module.bsa.BsaRequestComponent; -import google.registry.module.frontend.FrontendRequestComponent; -import google.registry.module.pubapi.PubApiRequestComponent; -import google.registry.module.tools.ToolsRequestComponent; import google.registry.testing.GoldenFileTestHelper; import google.registry.testing.TestDataHelper; -import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /** Unit tests for {@link RequestComponent}. */ public class RequestComponentTest { - private static final ImmutableMap, String> GaeComponents = - ImmutableMap.of( - FrontendRequestComponent.class, "frontend", - BackendRequestComponent.class, "backend", - ToolsRequestComponent.class, "tools", - PubApiRequestComponent.class, "pubapi", - BsaRequestComponent.class, "bsa"); @Test void testRoutingMap() { @@ -49,17 +34,6 @@ public class RequestComponentTest { .isEqualToGolden(RequestComponentTest.class, "routing.txt"); } - @Test - @Disabled("To be removed with GAE components") - void testGaeToJettyRoutingCoverage() { - Set jettyRoutes = getRoutes(RequestComponent.class, "routing.txt"); - Set gaeRoutes = new HashSet<>(); - for (var component : GaeComponents.entrySet()) { - gaeRoutes.addAll(getRoutes(component.getKey(), component.getValue() + "_routing.txt")); - } - assertThat(jettyRoutes).isEqualTo(gaeRoutes); - } - private Set getRoutes(Class context, String filename) { return TestDataHelper.loadFile(context, filename) .trim() diff --git a/core/src/test/java/google/registry/module/bsa/BsaRequestComponentTest.java b/core/src/test/java/google/registry/module/bsa/BsaRequestComponentTest.java deleted file mode 100644 index 996f9e9ef..000000000 --- a/core/src/test/java/google/registry/module/bsa/BsaRequestComponentTest.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2023 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.module.bsa; - -import static com.google.common.truth.Truth.assertThat; - -import google.registry.request.Action.GaeService; -import google.registry.request.RouterDisplayHelper; -import google.registry.testing.GoldenFileTestHelper; -import org.junit.jupiter.api.Test; - -/** Unit tests for {@link BsaRequestComponent}. */ -public class BsaRequestComponentTest { - - @Test - void testRoutingMap() { - GoldenFileTestHelper.assertThatRoutesFromComponent(BsaRequestComponent.class) - .describedAs("bsa routing map") - .isEqualToGolden(BsaRequestComponent.class, "bsa_routing.txt"); - } - - @Test - void testRoutingService() { - assertThat( - RouterDisplayHelper.extractHumanReadableRoutesWithWrongService( - BsaRequestComponent.class, GaeService.BSA)) - .isEmpty(); - } -} diff --git a/core/src/test/java/google/registry/module/bsa/BsaServletTest.java b/core/src/test/java/google/registry/module/bsa/BsaServletTest.java deleted file mode 100644 index 3f94870d7..000000000 --- a/core/src/test/java/google/registry/module/bsa/BsaServletTest.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2023 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.module.bsa; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.junit.jupiter.api.Test; - -class BsaServletTest { - private final HttpServletRequest req = mock(HttpServletRequest.class); - private final HttpServletResponse rsp = mock(HttpServletResponse.class); - - @Test - void testService_unknownPath_returnsNotFound() throws Exception { - when(req.getMethod()).thenReturn("GET"); - when(req.getRequestURI()).thenReturn("/lol"); - new BsaServlet().service(req, rsp); - verify(rsp).sendError(404); - } -} diff --git a/core/src/test/java/google/registry/module/pubapi/PubApiRequestComponentTest.java b/core/src/test/java/google/registry/module/pubapi/PubApiRequestComponentTest.java deleted file mode 100644 index 6d4e32029..000000000 --- a/core/src/test/java/google/registry/module/pubapi/PubApiRequestComponentTest.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018 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.module.pubapi; - -import static com.google.common.truth.Truth.assertThat; - -import google.registry.request.Action.GaeService; -import google.registry.request.RouterDisplayHelper; -import google.registry.testing.GoldenFileTestHelper; -import org.junit.jupiter.api.Test; - -/** Unit tests for {@link PubApiRequestComponent}. */ -class PubApiRequestComponentTest { - - @Test - void testRoutingMap() { - GoldenFileTestHelper.assertThatRoutesFromComponent(PubApiRequestComponent.class) - .describedAs("pubapi routing map") - .isEqualToGolden(PubApiRequestComponentTest.class, "pubapi_routing.txt"); - } - - @Test - void testRoutingService() { - assertThat( - RouterDisplayHelper.extractHumanReadableRoutesWithWrongService( - PubApiRequestComponent.class, GaeService.PUBAPI)) - .isEmpty(); - } -} diff --git a/core/src/test/java/google/registry/module/pubapi/PubApiServletTest.java b/core/src/test/java/google/registry/module/pubapi/PubApiServletTest.java deleted file mode 100644 index f88f69216..000000000 --- a/core/src/test/java/google/registry/module/pubapi/PubApiServletTest.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018 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.module.pubapi; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.junit.jupiter.api.Test; - -/** Unit tests for {@link PubApiServlet}. */ -class PubApiServletTest { - - private final HttpServletRequest req = mock(HttpServletRequest.class); - private final HttpServletResponse rsp = mock(HttpServletResponse.class); - - @Test - void testService_unknownPath_returnNotFound() throws Exception { - when(req.getMethod()).thenReturn("GET"); - when(req.getRequestURI()).thenReturn("/lol"); - new PubApiServlet().service(req, rsp); - verify(rsp).sendError(404); - } -} diff --git a/core/src/test/java/google/registry/module/tools/ToolsRequestComponentTest.java b/core/src/test/java/google/registry/module/tools/ToolsRequestComponentTest.java deleted file mode 100644 index 8c6055c6e..000000000 --- a/core/src/test/java/google/registry/module/tools/ToolsRequestComponentTest.java +++ /dev/null @@ -1,41 +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.module.tools; - -import static com.google.common.truth.Truth.assertThat; - -import google.registry.request.Action.GaeService; -import google.registry.request.RouterDisplayHelper; -import google.registry.testing.GoldenFileTestHelper; -import org.junit.jupiter.api.Test; - -/** Unit tests for {@link ToolsRequestComponent}. */ -class ToolsRequestComponentTest { - - @Test - void testRoutingMap() { - GoldenFileTestHelper.assertThatRoutesFromComponent(ToolsRequestComponent.class) - .describedAs("tools routing map") - .isEqualToGolden(ToolsRequestComponentTest.class, "tools_routing.txt"); - } - - @Test - void testRoutingService() { - assertThat( - RouterDisplayHelper.extractHumanReadableRoutesWithWrongService( - ToolsRequestComponent.class, GaeService.TOOLS)) - .isEmpty(); - } -} diff --git a/core/src/test/java/google/registry/module/tools/ToolsServletTest.java b/core/src/test/java/google/registry/module/tools/ToolsServletTest.java deleted file mode 100644 index e33e8e8e0..000000000 --- a/core/src/test/java/google/registry/module/tools/ToolsServletTest.java +++ /dev/null @@ -1,38 +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.module.tools; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.junit.jupiter.api.Test; - -/** Unit tests for {@link ToolsServlet}. */ -class ToolsServletTest { - - private final HttpServletRequest req = mock(HttpServletRequest.class); - private final HttpServletResponse rsp = mock(HttpServletResponse.class); - - @Test - void testService_unknownPath_returnsNotFound() throws Exception { - when(req.getMethod()).thenReturn("GET"); - when(req.getRequestURI()).thenReturn("/lol"); - new ToolsServlet().service(req, rsp); - verify(rsp).sendError(404); - } -} diff --git a/core/src/test/resources/google/registry/module/bsa/bsa_routing.txt b/core/src/test/resources/google/registry/module/bsa/bsa_routing.txt deleted file mode 100644 index c270b3137..000000000 --- a/core/src/test/resources/google/registry/module/bsa/bsa_routing.txt +++ /dev/null @@ -1,5 +0,0 @@ -SERVICE PATH CLASS METHODS OK MIN USER_POLICY -BACKEND /_dr/task/bsaDownload BsaDownloadAction GET,POST n APP ADMIN -BACKEND /_dr/task/bsaRefresh BsaRefreshAction GET,POST n APP ADMIN -BACKEND /_dr/task/bsaValidate BsaValidateAction GET,POST n APP ADMIN -BACKEND /_dr/task/uploadBsaUnavailableNames UploadBsaUnavailableDomainsAction GET,POST n APP ADMIN diff --git a/core/src/test/resources/google/registry/module/pubapi/pubapi_routing.txt b/core/src/test/resources/google/registry/module/pubapi/pubapi_routing.txt deleted file mode 100644 index 944481d8f..000000000 --- a/core/src/test/resources/google/registry/module/pubapi/pubapi_routing.txt +++ /dev/null @@ -1,13 +0,0 @@ -SERVICE PATH CLASS METHODS OK MIN USER_POLICY -PUBAPI /check CheckApiAction GET n NONE PUBLIC -PUBAPI /rdap/ RdapEmptyAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/autnum/(*) RdapAutnumAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/domain/(*) RdapDomainAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/domains RdapDomainSearchAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/entities RdapEntitySearchAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/entity/(*) RdapEntityAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/help(*) RdapHelpAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/ip/(*) RdapIpAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/nameserver/(*) RdapNameserverAction GET,HEAD n NONE PUBLIC -PUBAPI /rdap/nameservers RdapNameserverSearchAction GET,HEAD n NONE PUBLIC -PUBAPI /ready/pubapi ReadinessProbeActionPubApi GET n NONE 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 deleted file mode 100644 index 9e95e8aa9..000000000 --- a/core/src/test/resources/google/registry/module/tools/tools_routing.txt +++ /dev/null @@ -1,14 +0,0 @@ -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 -BACKEND /_dr/admin/list/tlds ListTldsAction GET,POST n APP ADMIN -BACKEND /_dr/admin/updateUserGroup UpdateUserGroupAction POST n APP ADMIN -BACKEND /_dr/admin/verifyOte VerifyOteAction POST n APP ADMIN -BACKEND /_dr/epptool EppToolAction POST n APP ADMIN -BACKEND /_dr/loadtest LoadTestAction POST y APP ADMIN -BACKEND /_dr/task/generateZoneFiles GenerateZoneFilesAction POST n APP ADMIN -BACKEND /_dr/task/refreshDnsForAllDomains RefreshDnsForAllDomainsAction GET n APP ADMIN