mirror of
https://github.com/google/nomulus
synced 2026-04-24 02:00:50 +00:00
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
This commit is contained in:
@@ -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<Class<?>, 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<Route> jettyRoutes = getRoutes(RequestComponent.class, "routing.txt");
|
||||
Set<Route> gaeRoutes = new HashSet<>();
|
||||
for (var component : GaeComponents.entrySet()) {
|
||||
gaeRoutes.addAll(getRoutes(component.getKey(), component.getValue() + "_routing.txt"));
|
||||
}
|
||||
assertThat(jettyRoutes).isEqualTo(gaeRoutes);
|
||||
}
|
||||
|
||||
private Set<Route> getRoutes(Class<?> context, String filename) {
|
||||
return TestDataHelper.loadFile(context, filename)
|
||||
.trim()
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user