diff --git a/java/google/registry/rdap/RdapActionBase.java b/java/google/registry/rdap/RdapActionBase.java index 7dfefa84a..b3eb48001 100644 --- a/java/google/registry/rdap/RdapActionBase.java +++ b/java/google/registry/rdap/RdapActionBase.java @@ -49,6 +49,7 @@ import google.registry.request.Response; import google.registry.request.auth.AuthResult; import google.registry.request.auth.UserAuthInfo; import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; +import google.registry.util.Clock; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -87,6 +88,7 @@ public abstract class RdapActionBase implements Runnable { } @Inject Response response; + @Inject Clock clock; @Inject @RequestMethod Action.Method requestMethod; @Inject @RequestPath String requestPath; @Inject @FullServletPath String fullServletPath; diff --git a/java/google/registry/rdap/RdapDomainAction.java b/java/google/registry/rdap/RdapDomainAction.java index 3b55655ce..2563a3987 100644 --- a/java/google/registry/rdap/RdapDomainAction.java +++ b/java/google/registry/rdap/RdapDomainAction.java @@ -29,7 +29,6 @@ import google.registry.request.Action; import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.NotFoundException; import google.registry.request.auth.Auth; -import google.registry.util.Clock; import javax.inject.Inject; import org.joda.time.DateTime; @@ -44,8 +43,7 @@ public class RdapDomainAction extends RdapActionBase { public static final String PATH = "/rdap/domain/"; - @Inject Clock clock; - @Inject RdapDomainAction() {} + @Inject public RdapDomainAction() {} @Override public String getHumanReadableObjectTypeName() { diff --git a/java/google/registry/rdap/RdapDomainSearchAction.java b/java/google/registry/rdap/RdapDomainSearchAction.java index cc6ae752c..59c5ffac4 100644 --- a/java/google/registry/rdap/RdapDomainSearchAction.java +++ b/java/google/registry/rdap/RdapDomainSearchAction.java @@ -45,7 +45,6 @@ import google.registry.request.HttpException.NotFoundException; import google.registry.request.HttpException.UnprocessableEntityException; import google.registry.request.Parameter; import google.registry.request.auth.Auth; -import google.registry.util.Clock; import google.registry.util.Idn; import google.registry.util.NonFinalForTesting; import java.net.InetAddress; @@ -83,11 +82,10 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - @Inject Clock clock; @Inject @Parameter("name") Optional nameParam; @Inject @Parameter("nsLdhName") Optional nsLdhNameParam; @Inject @Parameter("nsIp") Optional nsIpParam; - @Inject RdapDomainSearchAction() {} + @Inject public RdapDomainSearchAction() {} @Override public String getHumanReadableObjectTypeName() { diff --git a/java/google/registry/rdap/RdapEntityAction.java b/java/google/registry/rdap/RdapEntityAction.java index 44f6d13ee..a88050b69 100644 --- a/java/google/registry/rdap/RdapEntityAction.java +++ b/java/google/registry/rdap/RdapEntityAction.java @@ -31,7 +31,6 @@ import google.registry.request.Action; import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.NotFoundException; import google.registry.request.auth.Auth; -import google.registry.util.Clock; import java.util.Optional; import javax.inject.Inject; import org.joda.time.DateTime; @@ -58,8 +57,7 @@ public class RdapEntityAction extends RdapActionBase { private static final Pattern ROID_PATTERN = Pattern.compile("[-_.a-zA-Z0-9]+"); - @Inject Clock clock; - @Inject RdapEntityAction() {} + @Inject public RdapEntityAction() {} @Override public String getHumanReadableObjectTypeName() { diff --git a/java/google/registry/rdap/RdapEntitySearchAction.java b/java/google/registry/rdap/RdapEntitySearchAction.java index 987063be1..85a42bc20 100644 --- a/java/google/registry/rdap/RdapEntitySearchAction.java +++ b/java/google/registry/rdap/RdapEntitySearchAction.java @@ -39,7 +39,6 @@ import google.registry.request.HttpException.NotFoundException; import google.registry.request.HttpException.UnprocessableEntityException; import google.registry.request.Parameter; import google.registry.request.auth.Auth; -import google.registry.util.Clock; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -84,11 +83,10 @@ public class RdapEntitySearchAction extends RdapSearchActionBase { public static final String PATH = "/rdap/entities"; - @Inject Clock clock; @Inject @Parameter("fn") Optional fnParam; @Inject @Parameter("handle") Optional handleParam; @Inject @Parameter("subtype") Optional subtypeParam; - @Inject RdapEntitySearchAction() {} + @Inject public RdapEntitySearchAction() {} private enum QueryType { FULL_NAME, diff --git a/java/google/registry/rdap/RdapHelpAction.java b/java/google/registry/rdap/RdapHelpAction.java index ab20cf83a..0f7a08158 100644 --- a/java/google/registry/rdap/RdapHelpAction.java +++ b/java/google/registry/rdap/RdapHelpAction.java @@ -23,7 +23,6 @@ import google.registry.rdap.RdapJsonFormatter.BoilerplateType; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.request.Action; import google.registry.request.auth.Auth; -import google.registry.util.Clock; import javax.inject.Inject; /** RDAP (new WHOIS) action for help requests. */ @@ -37,8 +36,7 @@ public class RdapHelpAction extends RdapActionBase { public static final String PATH = "/rdap/help"; - @Inject Clock clock; - @Inject RdapHelpAction() {} + @Inject public RdapHelpAction() {} @Override public String getHumanReadableObjectTypeName() { diff --git a/java/google/registry/rdap/RdapJsonFormatter.java b/java/google/registry/rdap/RdapJsonFormatter.java index d8d1bc3be..0c2c1fd05 100644 --- a/java/google/registry/rdap/RdapJsonFormatter.java +++ b/java/google/registry/rdap/RdapJsonFormatter.java @@ -29,7 +29,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import com.google.common.collect.Ordering; import com.google.common.collect.Streams; -import com.google.common.flogger.FluentLogger; import com.google.common.net.InetAddresses; import com.googlecode.objectify.Key; import google.registry.config.RdapNoticeDescriptor; @@ -83,8 +82,6 @@ public class RdapJsonFormatter { @Inject @Config("rdapHelpMap") ImmutableMap rdapHelpMap; @Inject RdapJsonFormatter() {} - private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - /** * What type of data to generate. Summary data includes only information about the object itself, * while full data includes associated items (e.g. for domains, full data includes the hosts, diff --git a/java/google/registry/rdap/RdapNameserverAction.java b/java/google/registry/rdap/RdapNameserverAction.java index 0d0e0f4a3..27e7e44f1 100644 --- a/java/google/registry/rdap/RdapNameserverAction.java +++ b/java/google/registry/rdap/RdapNameserverAction.java @@ -29,7 +29,6 @@ import google.registry.request.Action; import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.NotFoundException; import google.registry.request.auth.Auth; -import google.registry.util.Clock; import javax.inject.Inject; import org.joda.time.DateTime; @@ -44,8 +43,7 @@ public class RdapNameserverAction extends RdapActionBase { public static final String PATH = "/rdap/nameserver/"; - @Inject Clock clock; - @Inject RdapNameserverAction() {} + @Inject public RdapNameserverAction() {} @Override public String getHumanReadableObjectTypeName() { diff --git a/java/google/registry/rdap/RdapNameserverSearchAction.java b/java/google/registry/rdap/RdapNameserverSearchAction.java index faa2058ec..b36eddda5 100644 --- a/java/google/registry/rdap/RdapNameserverSearchAction.java +++ b/java/google/registry/rdap/RdapNameserverSearchAction.java @@ -38,7 +38,6 @@ import google.registry.request.HttpException.NotFoundException; import google.registry.request.HttpException.UnprocessableEntityException; import google.registry.request.Parameter; import google.registry.request.auth.Auth; -import google.registry.util.Clock; import google.registry.util.Idn; import java.net.InetAddress; import java.util.ArrayList; @@ -66,10 +65,9 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase { public static final String PATH = "/rdap/nameservers"; - @Inject Clock clock; @Inject @Parameter("name") Optional nameParam; @Inject @Parameter("ip") Optional ipParam; - @Inject RdapNameserverSearchAction() {} + @Inject public RdapNameserverSearchAction() {} @Override public String getHumanReadableObjectTypeName() { diff --git a/javatests/google/registry/rdap/RdapActionBaseTestCase.java b/javatests/google/registry/rdap/RdapActionBaseTestCase.java new file mode 100644 index 000000000..b7f7b1351 --- /dev/null +++ b/javatests/google/registry/rdap/RdapActionBaseTestCase.java @@ -0,0 +1,136 @@ +// 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.rdap; + +import static google.registry.rdap.RdapAuthorization.Role.ADMINISTRATOR; +import static google.registry.rdap.RdapAuthorization.Role.PUBLIC; +import static google.registry.rdap.RdapAuthorization.Role.REGISTRAR; +import static google.registry.request.Action.Method.GET; +import static google.registry.request.Action.Method.HEAD; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import com.google.appengine.api.users.User; +import google.registry.model.ofy.Ofy; +import google.registry.request.Action; +import google.registry.request.HttpException.ForbiddenException; +import google.registry.request.auth.AuthLevel; +import google.registry.request.auth.AuthResult; +import google.registry.request.auth.UserAuthInfo; +import google.registry.testing.AppEngineRule; +import google.registry.testing.FakeClock; +import google.registry.testing.FakeResponse; +import google.registry.testing.InjectRule; +import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; +import google.registry.util.TypeUtils; +import java.util.Optional; +import org.joda.time.DateTime; +import org.json.simple.JSONValue; +import org.junit.Before; +import org.junit.Rule; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Common unit test code for actions inheriting {@link RdapActionBase}. */ +@RunWith(JUnit4.class) +public class RdapActionBaseTestCase { + + @Rule + public final AppEngineRule appEngine = AppEngineRule.builder() + .withDatastore() + .build(); + + @Rule + public final InjectRule inject = new InjectRule(); + + protected static final AuthResult AUTH_RESULT = + AuthResult.create( + AuthLevel.USER, + UserAuthInfo.create(new User("rdap.user@user.com", "gmail.com", "12345"), false)); + + protected static final AuthResult AUTH_RESULT_ADMIN = + AuthResult.create( + AuthLevel.USER, + UserAuthInfo.create(new User("rdap.admin@google.com", "gmail.com", "12345"), true)); + + protected final AuthenticatedRegistrarAccessor registrarAccessor = + mock(AuthenticatedRegistrarAccessor.class); + + protected FakeResponse response = new FakeResponse(); + protected final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ")); + protected final RdapMetrics rdapMetrics = mock(RdapMetrics.class); + + protected RdapAuthorization.Role metricRole = PUBLIC; + protected A action; + + protected final String actionPath; + protected final Class rdapActionClass; + + protected RdapActionBaseTestCase(Class rdapActionClass, String actionPath) { + this.rdapActionClass = rdapActionClass; + this.actionPath = actionPath; + } + + @Before + public void baseSetUp() { + inject.setStaticField(Ofy.class, "clock", clock); + action = TypeUtils.instantiate(rdapActionClass); + action.registrarAccessor = registrarAccessor; + action.clock = clock; + action.authResult = AUTH_RESULT; + action.includeDeletedParam = Optional.empty(); + action.registrarParam = Optional.empty(); + action.formatOutputParam = Optional.empty(); + action.response = response; + action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); + action.rdapMetrics = rdapMetrics; + action.requestMethod = Action.Method.GET; + action.fullServletPath = "https://example.tld/rdap"; + action.rdapWhoisServer = null; + } + + protected void login(String clientId) { + when(registrarAccessor.guessClientId()).thenReturn(clientId); + action.authResult = AUTH_RESULT; + metricRole = REGISTRAR; + } + + protected void logout() { + when(registrarAccessor.guessClientId()).thenThrow(new ForbiddenException("not logged in")); + action.authResult = AUTH_RESULT; + metricRole = PUBLIC; + } + + protected void loginAsAdmin() { + when(registrarAccessor.guessClientId()).thenReturn("irrelevant"); + action.authResult = AUTH_RESULT_ADMIN; + metricRole = ADMINISTRATOR; + } + + protected Object generateActualJson(String domainName) { + action.requestPath = actionPath + domainName; + action.requestMethod = GET; + action.run(); + return JSONValue.parse(response.getPayload()); + } + + protected String generateHeadPayload(String domainName) { + action.requestPath = actionPath + domainName; + action.fullServletPath = "http://myserver.example.com" + actionPath; + action.requestMethod = HEAD; + action.run(); + return response.getPayload(); + } +} diff --git a/javatests/google/registry/rdap/RdapDomainActionTest.java b/javatests/google/registry/rdap/RdapDomainActionTest.java index fd0d4cb65..65acf8ffe 100644 --- a/javatests/google/registry/rdap/RdapDomainActionTest.java +++ b/javatests/google/registry/rdap/RdapDomainActionTest.java @@ -25,11 +25,8 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntr import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.TestDataHelper.loadFile; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -37,7 +34,6 @@ import google.registry.model.contact.ContactResource; import google.registry.model.domain.DomainBase; import google.registry.model.domain.Period; import google.registry.model.host.HostResource; -import google.registry.model.ofy.Ofy; import google.registry.model.registrar.Registrar; import google.registry.model.registry.Registry; import google.registry.model.reporting.HistoryEntry; @@ -46,61 +42,28 @@ import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapMetrics.WildcardType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; import google.registry.request.Action; -import google.registry.request.auth.AuthLevel; -import google.registry.request.auth.AuthResult; -import google.registry.request.auth.UserAuthInfo; -import google.registry.testing.AppEngineRule; -import google.registry.testing.FakeClock; -import google.registry.testing.FakeResponse; -import google.registry.testing.InjectRule; -import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; import java.util.List; import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; -import org.joda.time.DateTime; import org.json.simple.JSONObject; import org.json.simple.JSONValue; import org.junit.Before; import org.junit.Ignore; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Unit tests for {@link RdapDomainAction}. */ @RunWith(JUnit4.class) -public class RdapDomainActionTest { +public class RdapDomainActionTest extends RdapActionBaseTestCase { - @Rule - public final AppEngineRule appEngine = AppEngineRule.builder() - .withDatastore() - .build(); - - @Rule - public final InjectRule inject = new InjectRule(); - - private final FakeResponse response = new FakeResponse(); - private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ")); - private final AuthenticatedRegistrarAccessor registrarAccessor = - mock(AuthenticatedRegistrarAccessor.class); - private final RdapMetrics rdapMetrics = mock(RdapMetrics.class); - - private RdapDomainAction action; - - private static final AuthResult AUTH_RESULT = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@user.com", "gmail.com", "12345"), false)); - - private static final AuthResult AUTH_RESULT_ADMIN = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@google.com", "gmail.com", "12345"), true)); + public RdapDomainActionTest() { + super(RdapDomainAction.class, RdapDomainAction.PATH); + } @Before public void setUp() { - inject.setStaticField(Ofy.class, "clock", clock); // lol createTld("lol"); Registrar registrarLol = persistResource(makeRegistrar( @@ -265,35 +228,6 @@ public class RdapDomainActionTest { Period.create(1, Period.Unit.YEARS), "deleted", clock.nowUtc().minusMonths(6))); - - action = new RdapDomainAction(); - action.clock = clock; - action.requestMethod = Action.Method.GET; - action.fullServletPath = "https://example.com/rdap"; - action.response = response; - action.registrarParam = Optional.empty(); - action.includeDeletedParam = Optional.empty(); - action.formatOutputParam = Optional.empty(); - action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); - action.rdapWhoisServer = null; - action.registrarAccessor = registrarAccessor; - action.authResult = AUTH_RESULT; - action.rdapMetrics = rdapMetrics; - } - - private void login(String clientId) { - when(registrarAccessor.guessClientId()).thenReturn(clientId); - } - - private void loginAsAdmin() { - when(registrarAccessor.guessClientId()).thenReturn("irrelevant"); - action.authResult = AUTH_RESULT_ADMIN; - } - - private Object generateActualJson(String domainName) { - action.requestPath = RdapDomainAction.PATH + domainName; - action.run(); - return JSONValue.parse(response.getPayload()); } private Object generateExpectedJson( @@ -400,7 +334,7 @@ public class RdapDomainActionTest { builder, false, RdapTestHelper.createNotices( - "https://example.com/rdap/", + "https://example.tld/rdap/", (contactRoids == null) ? RdapTestHelper.ContactNoticeType.DOMAIN : RdapTestHelper.ContactNoticeType.NONE, diff --git a/javatests/google/registry/rdap/RdapDomainSearchActionTest.java b/javatests/google/registry/rdap/RdapDomainSearchActionTest.java index 20af008a8..94864f2cb 100644 --- a/javatests/google/registry/rdap/RdapDomainSearchActionTest.java +++ b/javatests/google/registry/rdap/RdapDomainSearchActionTest.java @@ -16,8 +16,6 @@ package google.registry.rdap; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.truth.Truth.assertThat; -import static google.registry.rdap.RdapAuthorization.Role.ADMINISTRATOR; -import static google.registry.rdap.RdapAuthorization.Role.REGISTRAR; import static google.registry.request.Action.Method.POST; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistDomainAsDeleted; @@ -31,10 +29,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntr import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.TestDataHelper.loadFile; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; @@ -46,7 +41,6 @@ import google.registry.model.contact.ContactResource; import google.registry.model.domain.DomainResource; import google.registry.model.domain.Period; import google.registry.model.host.HostResource; -import google.registry.model.ofy.Ofy; import google.registry.model.registrar.Registrar; import google.registry.model.registry.Registry; import google.registry.model.reporting.HistoryEntry; @@ -54,15 +48,7 @@ import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapMetrics.WildcardType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; -import google.registry.request.Action; -import google.registry.request.auth.AuthLevel; -import google.registry.request.auth.AuthResult; -import google.registry.request.auth.UserAuthInfo; -import google.registry.testing.AppEngineRule; -import google.registry.testing.FakeClock; import google.registry.testing.FakeResponse; -import google.registry.testing.InjectRule; -import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; import google.registry.util.Idn; import java.net.IDN; import java.net.URLDecoder; @@ -71,42 +57,22 @@ import java.util.List; import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; -import org.joda.time.DateTime; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; import org.junit.Before; import org.junit.Ignore; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Unit tests for {@link RdapDomainSearchAction}. */ @RunWith(JUnit4.class) -public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { +public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { - @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); - - @Rule public final InjectRule inject = new InjectRule(); - - private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01T00:00:00Z")); - private final AuthenticatedRegistrarAccessor registrarAccessor = - mock(AuthenticatedRegistrarAccessor.class); - private final RdapDomainSearchAction action = new RdapDomainSearchAction(); - - private static final AuthResult AUTH_RESULT = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@user.com", "gmail.com", "12345"), false)); - - private static final AuthResult AUTH_RESULT_ADMIN = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@google.com", "gmail.com", "12345"), true)); - - - private FakeResponse response = new FakeResponse(); + public RdapDomainSearchActionTest() { + super(RdapDomainSearchAction.class, RdapDomainSearchAction.PATH); + } private Registrar registrar; private DomainResource domainCatLol; @@ -131,6 +97,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { private Object generateActualJson( RequestType requestType, String paramValue, String cursor) { action.requestPath = RdapDomainSearchAction.PATH; + action.requestMethod = POST; String requestTypeParam = null; switch (requestType) { case NAME: @@ -180,7 +147,6 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { @Before public void setUp() { RdapDomainSearchAction.maxNameserversInFirstStage = 40; - inject.setStaticField(Ofy.class, "clock", clock); // cat.lol and cat2.lol createTld("lol"); @@ -394,34 +360,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { "created", clock.nowUtc())); - action.clock = clock; - action.requestMethod = Action.Method.GET; - action.fullServletPath = "https://example.com/rdap"; - action.requestUrl = "https://example.com/rdap/domains"; - action.parameterMap = ImmutableListMultimap.of(); action.requestMethod = POST; - action.response = response; - action.registrarParam = Optional.empty(); - action.includeDeletedParam = Optional.empty(); - action.formatOutputParam = Optional.empty(); - action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); - action.rdapWhoisServer = null; - action.registrarAccessor = registrarAccessor; - action.authResult = AUTH_RESULT; - action.rdapMetrics = rdapMetrics; - action.cursorTokenParam = Optional.empty(); - action.rdapResultSetMaxSize = 4; - } - - private void login(String clientId) { - when(registrarAccessor.guessClientId()).thenReturn(clientId); - metricRole = REGISTRAR; - } - - private void loginAsAdmin() { - when(registrarAccessor.guessClientId()).thenReturn("irrelevant"); - action.authResult = AUTH_RESULT_ADMIN; - metricRole = ADMINISTRATOR; } private Object generateExpectedJsonForTwoDomains() { @@ -562,7 +501,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { builder.put("domainSearchResults", ImmutableList.of(obj)); builder.put("rdapConformance", ImmutableList.of("rdap_level_0")); RdapTestHelper.addDomainBoilerplateNotices( - builder, RdapTestHelper.createNotices("https://example.com/rdap/")); + builder, RdapTestHelper.createNotices("https://example.tld/rdap/")); return new JSONObject(builder.build()); } diff --git a/javatests/google/registry/rdap/RdapEntityActionTest.java b/javatests/google/registry/rdap/RdapEntityActionTest.java index 808b479e0..44835b21b 100644 --- a/javatests/google/registry/rdap/RdapEntityActionTest.java +++ b/javatests/google/registry/rdap/RdapEntityActionTest.java @@ -25,61 +25,35 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResourc import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.TestDataHelper.loadFile; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import google.registry.model.contact.ContactResource; import google.registry.model.host.HostResource; -import google.registry.model.ofy.Ofy; import google.registry.model.registrar.Registrar; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapMetrics.WildcardType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; import google.registry.request.Action; -import google.registry.request.auth.AuthLevel; -import google.registry.request.auth.AuthResult; -import google.registry.request.auth.UserAuthInfo; -import google.registry.testing.AppEngineRule; -import google.registry.testing.FakeClock; -import google.registry.testing.FakeResponse; -import google.registry.testing.InjectRule; -import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; -import org.joda.time.DateTime; import org.json.simple.JSONValue; 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 RdapEntityAction}. */ @RunWith(JUnit4.class) -public class RdapEntityActionTest { +public class RdapEntityActionTest extends RdapActionBaseTestCase { - @Rule - public final AppEngineRule appEngine = AppEngineRule.builder() - .withDatastore() - .build(); - - @Rule - public final InjectRule inject = new InjectRule(); - - private final FakeResponse response = new FakeResponse(); - private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ")); - private final AuthenticatedRegistrarAccessor registrarAccessor = - mock(AuthenticatedRegistrarAccessor.class); - private final RdapMetrics rdapMetrics = mock(RdapMetrics.class); - - private RdapEntityAction action; + public RdapEntityActionTest() { + super(RdapEntityAction.class, RdapEntityAction.PATH); + } private Registrar registrarLol; private ContactResource registrant; @@ -88,19 +62,8 @@ public class RdapEntityActionTest { private ContactResource disconnectedContact; private ContactResource deletedContact; - private static final AuthResult AUTH_RESULT = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@user.com", "gmail.com", "12345"), false)); - - private static final AuthResult AUTH_RESULT_ADMIN = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@google.com", "gmail.com", "12345"), true)); - @Before public void setUp() { - inject.setStaticField(Ofy.class, "clock", clock); // lol createTld("lol"); registrarLol = persistResource(makeRegistrar( @@ -167,34 +130,6 @@ public class RdapEntityActionTest { clock.nowUtc().minusYears(1), registrarLol, clock.nowUtc().minusMonths(6)); - action = new RdapEntityAction(); - action.clock = clock; - action.requestMethod = Action.Method.GET; - action.fullServletPath = "https://example.com/rdap"; - action.response = response; - action.registrarParam = Optional.empty(); - action.includeDeletedParam = Optional.empty(); - action.formatOutputParam = Optional.empty(); - action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); - action.rdapWhoisServer = null; - action.registrarAccessor = registrarAccessor; - action.authResult = AUTH_RESULT; - action.rdapMetrics = rdapMetrics; - } - - private void login(String registrar) { - when(registrarAccessor.guessClientId()).thenReturn(registrar); - } - - private void loginAsAdmin() { - action.authResult = AUTH_RESULT_ADMIN; - when(registrarAccessor.guessClientId()).thenReturn("irrelevant"); - } - - private Object generateActualJson(String name) { - action.requestPath = RdapEntityAction.PATH + name; - action.run(); - return JSONValue.parse(response.getPayload()); } private Object generateExpectedJson(String handle, String expectedOutputFile) { @@ -262,7 +197,7 @@ public class RdapEntityActionTest { RdapTestHelper.addNonDomainBoilerplateNotices( builder, RdapTestHelper.createNotices( - "https://example.com/rdap/", + "https://example.tld/rdap/", addNoPersonalDataRemark ? RdapTestHelper.ContactNoticeType.CONTACT : RdapTestHelper.ContactNoticeType.NONE, diff --git a/javatests/google/registry/rdap/RdapEntitySearchActionTest.java b/javatests/google/registry/rdap/RdapEntitySearchActionTest.java index 7d9ad6626..da1f0889d 100644 --- a/javatests/google/registry/rdap/RdapEntitySearchActionTest.java +++ b/javatests/google/registry/rdap/RdapEntitySearchActionTest.java @@ -16,8 +16,6 @@ package google.registry.rdap; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.truth.Truth.assertThat; -import static google.registry.rdap.RdapAuthorization.Role.ADMINISTRATOR; -import static google.registry.rdap.RdapAuthorization.Role.REGISTRAR; import static google.registry.request.Action.Method.GET; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistResource; @@ -30,64 +28,44 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntr import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.TestDataHelper.loadFile; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; import google.registry.model.ImmutableObject; import google.registry.model.contact.ContactResource; -import google.registry.model.ofy.Ofy; import google.registry.model.registrar.Registrar; import google.registry.model.reporting.HistoryEntry; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; -import google.registry.request.Action; -import google.registry.request.auth.AuthLevel; -import google.registry.request.auth.AuthResult; -import google.registry.request.auth.UserAuthInfo; -import google.registry.testing.AppEngineRule; -import google.registry.testing.FakeClock; import google.registry.testing.FakeResponse; -import google.registry.testing.InjectRule; -import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; import java.net.URLDecoder; import java.util.List; import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; -import org.joda.time.DateTime; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; 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 RdapEntitySearchAction}. */ @RunWith(JUnit4.class) -public class RdapEntitySearchActionTest extends RdapSearchActionTestCase { +public class RdapEntitySearchActionTest extends RdapSearchActionTestCase { - @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); - @Rule public final InjectRule inject = new InjectRule(); + public RdapEntitySearchActionTest() { + super(RdapEntitySearchAction.class, RdapEntitySearchAction.PATH); + } private enum QueryType { FULL_NAME, HANDLE } - private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01T00:00:00Z")); - private final AuthenticatedRegistrarAccessor registrarAccessor = - mock(AuthenticatedRegistrarAccessor.class); - private final RdapEntitySearchAction action = new RdapEntitySearchAction(); - - private FakeResponse response = new FakeResponse(); - private Registrar registrarDeleted; private Registrar registrarInactive; private Registrar registrarTest; @@ -128,20 +106,8 @@ public class RdapEntitySearchActionTest extends RdapSearchActionTestCase { return JSONValue.parse(response.getPayload()); } - private static final AuthResult AUTH_RESULT = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@user.com", "gmail.com", "12345"), false)); - - private static final AuthResult AUTH_RESULT_ADMIN = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@google.com", "gmail.com", "12345"), true)); - @Before public void setUp() { - inject.setStaticField(Ofy.class, "clock", clock); - createTld("tld"); // deleted @@ -187,37 +153,9 @@ public class RdapEntitySearchActionTest extends RdapSearchActionTestCase { registrarDeleted, clock.nowUtc().minusMonths(6)); - action.clock = clock; - action.requestMethod = Action.Method.GET; - action.fullServletPath = "https://example.com/rdap"; - action.requestUrl = "https://example.com/rdap/entities"; - action.requestPath = RdapEntitySearchAction.PATH; - action.parameterMap = ImmutableListMultimap.of(); - action.response = response; - action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); - action.rdapResultSetMaxSize = 4; - action.rdapWhoisServer = null; action.fnParam = Optional.empty(); action.handleParam = Optional.empty(); action.subtypeParam = Optional.empty(); - action.registrarParam = Optional.empty(); - action.includeDeletedParam = Optional.empty(); - action.formatOutputParam = Optional.empty(); - action.registrarAccessor = registrarAccessor; - action.authResult = AUTH_RESULT; - action.rdapMetrics = rdapMetrics; - action.cursorTokenParam = Optional.empty(); - } - - private void login(String registrar) { - when(registrarAccessor.guessClientId()).thenReturn(registrar); - metricRole = REGISTRAR; - } - - private void loginAsAdmin() { - action.authResult = AUTH_RESULT_ADMIN; - when(registrarAccessor.guessClientId()).thenReturn("irrelevant"); - metricRole = ADMINISTRATOR; } private Object generateExpectedJson(String expectedOutputFile) { @@ -269,7 +207,7 @@ public class RdapEntitySearchActionTest extends RdapSearchActionTestCase { builder.put("entitySearchResults", ImmutableList.of(obj)); builder.put("rdapConformance", ImmutableList.of("rdap_level_0")); RdapTestHelper.addNonDomainBoilerplateNotices( - builder, RdapTestHelper.createNotices("https://example.com/rdap/")); + builder, RdapTestHelper.createNotices("https://example.tld/rdap/")); return new JSONObject(builder.build()); } diff --git a/javatests/google/registry/rdap/RdapHelpActionTest.java b/javatests/google/registry/rdap/RdapHelpActionTest.java index 33262a0cc..7117d26e9 100644 --- a/javatests/google/registry/rdap/RdapHelpActionTest.java +++ b/javatests/google/registry/rdap/RdapHelpActionTest.java @@ -16,73 +16,22 @@ package google.registry.rdap; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.TestDataHelper.loadFile; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableMap; -import google.registry.model.ofy.Ofy; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapMetrics.WildcardType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; import google.registry.request.Action; -import google.registry.request.auth.AuthLevel; -import google.registry.request.auth.AuthResult; -import google.registry.request.auth.UserAuthInfo; -import google.registry.testing.FakeClock; -import google.registry.testing.FakeResponse; -import google.registry.testing.InjectRule; -import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; -import java.util.Optional; -import org.joda.time.DateTime; import org.json.simple.JSONValue; -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 RdapHelpAction}. */ -@RunWith(JUnit4.class) -public class RdapHelpActionTest { +public class RdapHelpActionTest extends RdapActionBaseTestCase { - @Rule - public final InjectRule inject = new InjectRule(); - - private final FakeResponse response = new FakeResponse(); - private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ")); - private final AuthenticatedRegistrarAccessor registrarAccessor = - mock(AuthenticatedRegistrarAccessor.class); - private final User user = new User("rdap.user@example.com", "gmail.com", "12345"); - private final UserAuthInfo userAuthInfo = UserAuthInfo.create(user, false); - private final RdapMetrics rdapMetrics = mock(RdapMetrics.class); - - private RdapHelpAction action; - - @Before - public void setUp() { - inject.setStaticField(Ofy.class, "clock", clock); - - action = new RdapHelpAction(); - action.clock = clock; - action.fullServletPath = "https://example.tld/rdap"; - action.requestMethod = Action.Method.GET; - action.registrarAccessor = registrarAccessor; - action.authResult = AuthResult.create(AuthLevel.USER, userAuthInfo); - action.includeDeletedParam = Optional.empty(); - action.registrarParam = Optional.empty(); - action.formatOutputParam = Optional.empty(); - action.response = response; - action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); - action.rdapWhoisServer = null; - action.rdapMetrics = rdapMetrics; - } - - private Object generateActualJson(String helpPath) { - action.requestPath = RdapHelpAction.PATH + helpPath; - action.run(); - return JSONValue.parse(response.getPayload()); + public RdapHelpActionTest() { + super(RdapHelpAction.class, RdapHelpAction.PATH); } private Object generateExpectedJson(String name, String expectedOutputFile) { diff --git a/javatests/google/registry/rdap/RdapNameserverActionTest.java b/javatests/google/registry/rdap/RdapNameserverActionTest.java index 340ba3bf7..5f90fc1e0 100644 --- a/javatests/google/registry/rdap/RdapNameserverActionTest.java +++ b/javatests/google/registry/rdap/RdapNameserverActionTest.java @@ -20,72 +20,36 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.TestDataHelper.loadFile; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import google.registry.model.ofy.Ofy; import google.registry.model.registrar.Registrar; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapMetrics.WildcardType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; import google.registry.request.Action; -import google.registry.request.HttpException.ForbiddenException; -import google.registry.request.auth.AuthLevel; -import google.registry.request.auth.AuthResult; -import google.registry.request.auth.UserAuthInfo; -import google.registry.testing.AppEngineRule; -import google.registry.testing.FakeClock; -import google.registry.testing.FakeResponse; -import google.registry.testing.InjectRule; -import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; -import org.joda.time.DateTime; import org.json.simple.JSONValue; 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 RdapNameserverAction}. */ @RunWith(JUnit4.class) -public class RdapNameserverActionTest { +public class RdapNameserverActionTest extends RdapActionBaseTestCase { - @Rule - public final AppEngineRule appEngine = AppEngineRule.builder() - .withDatastore() - .build(); - - @Rule - public final InjectRule inject = new InjectRule(); - - private final FakeResponse response = new FakeResponse(); - private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ")); - private final AuthenticatedRegistrarAccessor registrarAccessor = - mock(AuthenticatedRegistrarAccessor.class); - private final RdapMetrics rdapMetrics = mock(RdapMetrics.class); - - private static final AuthResult AUTH_RESULT = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@user.com", "gmail.com", "12345"), false)); - - private static final AuthResult AUTH_RESULT_ADMIN = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@google.com", "gmail.com", "12345"), true)); + public RdapNameserverActionTest() { + super(RdapNameserverAction.class, RdapNameserverAction.PATH); + } @Before public void setUp() { - inject.setStaticField(Ofy.class, "clock", clock); // normal createTld("lol"); makeAndPersistHostResource( @@ -111,43 +75,6 @@ public class RdapNameserverActionTest { makeAndPersistHostResource("ns1.domain.external", "9.10.11.12", clock.nowUtc().minusYears(1)); } - private RdapNameserverAction newRdapNameserverAction( - String input, Optional desiredRegistrar, Optional includeDeleted) { - return newRdapNameserverAction(input, desiredRegistrar, includeDeleted, AUTH_RESULT); - } - - private RdapNameserverAction newRdapNameserverAction( - String input, - Optional desiredRegistrar, - Optional includeDeleted, - AuthResult authResult) { - RdapNameserverAction action = new RdapNameserverAction(); - action.clock = clock; - action.requestMethod = Action.Method.GET; - action.fullServletPath = "https://example.tld/rdap"; - action.response = response; - action.requestPath = RdapNameserverAction.PATH.concat(input); - action.registrarParam = desiredRegistrar; - action.includeDeletedParam = includeDeleted; - action.formatOutputParam = Optional.empty(); - action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); - action.rdapWhoisServer = null; - action.authResult = authResult; - action.registrarAccessor = registrarAccessor; - action.rdapMetrics = rdapMetrics; - return action; - } - - private Object generateActualJson(String name) { - return generateActualJson(name, Optional.empty(), Optional.empty()); - } - - private Object generateActualJson( - String name, Optional desiredRegistrar, Optional includeDeleted) { - newRdapNameserverAction(name, desiredRegistrar, includeDeleted).run(); - return JSONValue.parse(response.getPayload()); - } - private Object generateExpectedJson( String name, @Nullable ImmutableMap otherSubstitutions, @@ -328,9 +255,8 @@ public class RdapNameserverActionTest { @Test public void testNameserver_found_sameRegistrarRequested() { - assertThat( - generateActualJson( - "ns1.cat.lol", Optional.of("TheRegistrar"), Optional.empty())) + action.registrarParam = Optional.of("TheRegistrar"); + assertThat(generateActualJson("ns1.cat.lol")) .isEqualTo( generateExpectedJsonWithTopLevelEntries( "ns1.cat.lol", @@ -345,7 +271,9 @@ public class RdapNameserverActionTest { @Test public void testNameserver_notFound_differentRegistrarRequested() { - generateActualJson("ns1.cat.lol", Optional.of("otherregistrar"), Optional.of(false)); + action.registrarParam = Optional.of("otherregistrar"); + action.includeDeletedParam = Optional.of(false); + generateActualJson("ns1.cat.lol"); assertThat(response.getStatus()).isEqualTo(404); } @@ -357,29 +285,32 @@ public class RdapNameserverActionTest { @Test public void testDeletedNameserver_notFound_includeDeletedSetFalse() { - generateActualJson("nsdeleted.cat.lol", Optional.empty(), Optional.of(false)); + action.includeDeletedParam = Optional.of(false); + generateActualJson("nsdeleted.cat.lol"); assertThat(response.getStatus()).isEqualTo(404); } @Test public void testDeletedNameserver_notFound_notLoggedIn() { - when(registrarAccessor.guessClientId()).thenThrow(new ForbiddenException("blah")); - generateActualJson("nsdeleted.cat.lol", Optional.empty(), Optional.of(true)); + logout(); + action.includeDeletedParam = Optional.of(true); + generateActualJson("nsdeleted.cat.lol"); assertThat(response.getStatus()).isEqualTo(404); } @Test public void testDeletedNameserver_notFound_loggedInAsDifferentRegistrar() { - when(registrarAccessor.guessClientId()).thenReturn("otherregistrar"); - generateActualJson("nsdeleted.cat.lol", Optional.empty(), Optional.of(true)); + login("otherregistrar"); + action.includeDeletedParam = Optional.of(true); + generateActualJson("nsdeleted.cat.lol"); assertThat(response.getStatus()).isEqualTo(404); } @Test public void testDeletedNameserver_found_loggedInAsCorrectRegistrar() { - when(registrarAccessor.guessClientId()).thenReturn("TheRegistrar"); - assertThat( - generateActualJson("nsdeleted.cat.lol", Optional.empty(), Optional.of(true))) + login("TheRegistrar"); + action.includeDeletedParam = Optional.of(true); + assertThat(generateActualJson("nsdeleted.cat.lol")) .isEqualTo( generateExpectedJsonWithTopLevelEntries( "nsdeleted.cat.lol", @@ -394,14 +325,9 @@ public class RdapNameserverActionTest { @Test public void testDeletedNameserver_found_loggedInAsAdmin() { - when(registrarAccessor.guessClientId()).thenReturn("irrelevant"); - newRdapNameserverAction( - "nsdeleted.cat.lol", - Optional.empty(), - Optional.of(true), - AUTH_RESULT_ADMIN) - .run(); - assertThat(JSONValue.parse(response.getPayload())) + loginAsAdmin(); + action.includeDeletedParam = Optional.of(true); + assertThat(generateActualJson("nsdeleted.cat.lol")) .isEqualTo( generateExpectedJsonWithTopLevelEntries( "nsdeleted.cat.lol", @@ -416,9 +342,10 @@ public class RdapNameserverActionTest { @Test public void testDeletedNameserver_found_sameRegistrarRequested() { - when(registrarAccessor.guessClientId()).thenReturn("TheRegistrar"); - assertThat( - generateActualJson("nsdeleted.cat.lol", Optional.of("TheRegistrar"), Optional.of(true))) + login("TheRegistrar"); + action.registrarParam = Optional.of("TheRegistrar"); + action.includeDeletedParam = Optional.of(true); + assertThat(generateActualJson("nsdeleted.cat.lol")) .isEqualTo( generateExpectedJsonWithTopLevelEntries( "nsdeleted.cat.lol", @@ -433,8 +360,10 @@ public class RdapNameserverActionTest { @Test public void testDeletedNameserver_notFound_differentRegistrarRequested() { - when(registrarAccessor.guessClientId()).thenReturn("TheRegistrar"); - generateActualJson("ns1.cat.lol", Optional.of("otherregistrar"), Optional.of(false)); + login("TheRegistrar"); + action.registrarParam = Optional.of("otherregistrar"); + action.includeDeletedParam = Optional.of(false); + generateActualJson("ns1.cat.lol"); assertThat(response.getStatus()).isEqualTo(404); } diff --git a/javatests/google/registry/rdap/RdapNameserverSearchActionTest.java b/javatests/google/registry/rdap/RdapNameserverSearchActionTest.java index 804864d28..2ca9be4a7 100644 --- a/javatests/google/registry/rdap/RdapNameserverSearchActionTest.java +++ b/javatests/google/registry/rdap/RdapNameserverSearchActionTest.java @@ -15,8 +15,6 @@ package google.registry.rdap; import static com.google.common.truth.Truth.assertThat; -import static google.registry.rdap.RdapAuthorization.Role.ADMINISTRATOR; -import static google.registry.rdap.RdapAuthorization.Role.REGISTRAR; import static google.registry.request.Action.Method.GET; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistResource; @@ -29,10 +27,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResourc import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; import static google.registry.testing.TestDataHelper.loadFile; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; @@ -40,58 +35,31 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Key; import google.registry.model.domain.DomainResource; import google.registry.model.host.HostResource; -import google.registry.model.ofy.Ofy; import google.registry.model.registrar.Registrar; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapMetrics.WildcardType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; -import google.registry.request.Action; -import google.registry.request.auth.AuthLevel; -import google.registry.request.auth.AuthResult; -import google.registry.request.auth.UserAuthInfo; -import google.registry.testing.AppEngineRule; -import google.registry.testing.FakeClock; import google.registry.testing.FakeResponse; -import google.registry.testing.InjectRule; -import google.registry.ui.server.registrar.AuthenticatedRegistrarAccessor; import java.net.URLDecoder; import java.util.Optional; import javax.annotation.Nullable; -import org.joda.time.DateTime; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; 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 RdapNameserverSearchAction}. */ @RunWith(JUnit4.class) -public class RdapNameserverSearchActionTest extends RdapSearchActionTestCase { - - @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); - - @Rule public final InjectRule inject = new InjectRule(); - - private FakeResponse response = new FakeResponse(); - private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01T00:00:00Z")); - private final AuthenticatedRegistrarAccessor registrarAccessor = - mock(AuthenticatedRegistrarAccessor.class); - private final RdapNameserverSearchAction action = new RdapNameserverSearchAction(); - - private static final AuthResult AUTH_RESULT = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@user.com", "gmail.com", "12345"), false)); - - private static final AuthResult AUTH_RESULT_ADMIN = - AuthResult.create( - AuthLevel.USER, - UserAuthInfo.create(new User("rdap.user@google.com", "gmail.com", "12345"), true)); +public class RdapNameserverSearchActionTest + extends RdapSearchActionTestCase { + public RdapNameserverSearchActionTest() { + super(RdapNameserverSearchAction.class, RdapNameserverSearchAction.PATH); + } private DomainResource domainCatLol; private HostResource hostNs1CatLol; @@ -184,36 +152,8 @@ public class RdapNameserverSearchActionTest extends RdapSearchActionTestCase { persistResource( hostNs2CatLol.asBuilder().setSuperordinateDomain(Key.create(domainCatLol)).build()); - inject.setStaticField(Ofy.class, "clock", clock); - action.clock = clock; - action.fullServletPath = "https://example.tld/rdap"; - action.requestUrl = "https://example.tld/rdap/nameservers"; - action.requestPath = RdapNameserverSearchAction.PATH; - action.parameterMap = ImmutableListMultimap.of(); - action.requestMethod = Action.Method.GET; - action.response = response; - action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter(); - action.rdapResultSetMaxSize = 4; - action.rdapWhoisServer = null; action.ipParam = Optional.empty(); action.nameParam = Optional.empty(); - action.registrarParam = Optional.empty(); - action.includeDeletedParam = Optional.empty(); - action.formatOutputParam = Optional.empty(); - action.authResult = AUTH_RESULT; - action.registrarAccessor = registrarAccessor; - action.rdapMetrics = rdapMetrics; - action.cursorTokenParam = Optional.empty(); - } - private void login(String clientId) { - when(registrarAccessor.guessClientId()).thenReturn(clientId); - metricRole = REGISTRAR; - } - - private void loginAsAdmin() { - when(registrarAccessor.guessClientId()).thenReturn("irrelevant"); - action.authResult = AUTH_RESULT_ADMIN; - metricRole = ADMINISTRATOR; } private Object generateExpectedJson(String expectedOutputFile) { diff --git a/javatests/google/registry/rdap/RdapSearchActionTestCase.java b/javatests/google/registry/rdap/RdapSearchActionTestCase.java index 098abf639..eaa19eca8 100644 --- a/javatests/google/registry/rdap/RdapSearchActionTestCase.java +++ b/javatests/google/registry/rdap/RdapSearchActionTestCase.java @@ -14,26 +14,39 @@ package google.registry.rdap; -import static google.registry.rdap.RdapAuthorization.Role.PUBLIC; import static javax.servlet.http.HttpServletResponse.SC_OK; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import com.google.common.collect.ImmutableListMultimap; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.SearchType; import google.registry.rdap.RdapMetrics.WildcardType; import google.registry.rdap.RdapSearchResults.IncompletenessWarningType; import google.registry.request.Action; import java.util.Optional; +import org.junit.Before; -public class RdapSearchActionTestCase { +/** Common unit test code for actions inheriting {@link RdapSearchActionBase}. */ +public class RdapSearchActionTestCase + extends RdapActionBaseTestCase { + + protected RdapSearchActionTestCase(Class rdapActionClass, String path) { + super(rdapActionClass, path); + } - RdapAuthorization.Role metricRole = PUBLIC; SearchType metricSearchType = SearchType.NONE; WildcardType metricWildcardType = WildcardType.INVALID; int metricPrefixLength = 0; int metricStatusCode = SC_OK; - final RdapMetrics rdapMetrics = mock(RdapMetrics.class); + + @Before + public void initRdapSearchActionTestCase() { + action.parameterMap = ImmutableListMultimap.of(); + action.cursorTokenParam = Optional.empty(); + action.rdapResultSetMaxSize = 4; + action.requestUrl = "https://example.tld" + actionPath; + action.requestPath = actionPath; + } void rememberWildcardType(String queryString) { try { diff --git a/javatests/google/registry/rdap/testdata/rdap_associated_contact.json b/javatests/google/registry/rdap/testdata/rdap_associated_contact.json index fcb9805d3..272663dd0 100644 --- a/javatests/google/registry/rdap/testdata/rdap_associated_contact.json +++ b/javatests/google/registry/rdap/testdata/rdap_associated_contact.json @@ -5,9 +5,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/%NAME%", + "value" : "https://example.tld/rdap/entity/%NAME%", "rel" : "self", - "href": "https://example.com/rdap/entity/%NAME%", + "href": "https://example.tld/rdap/entity/%NAME%", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_associated_contact_no_personal_data.json b/javatests/google/registry/rdap/testdata/rdap_associated_contact_no_personal_data.json index 09efb1f90..797433221 100644 --- a/javatests/google/registry/rdap/testdata/rdap_associated_contact_no_personal_data.json +++ b/javatests/google/registry/rdap/testdata/rdap_associated_contact_no_personal_data.json @@ -5,9 +5,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/%NAME%", + "value" : "https://example.tld/rdap/entity/%NAME%", "rel" : "self", - "href": "https://example.com/rdap/entity/%NAME%", + "href": "https://example.tld/rdap/entity/%NAME%", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_contact.json b/javatests/google/registry/rdap/testdata/rdap_contact.json index ae00985a0..4126d80bf 100644 --- a/javatests/google/registry/rdap/testdata/rdap_contact.json +++ b/javatests/google/registry/rdap/testdata/rdap_contact.json @@ -5,9 +5,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/%NAME%", + "value" : "https://example.tld/rdap/entity/%NAME%", "rel" : "self", - "href": "https://example.com/rdap/entity/%NAME%", + "href": "https://example.tld/rdap/entity/%NAME%", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_contact_deleted.json b/javatests/google/registry/rdap/testdata/rdap_contact_deleted.json index 2e4072474..3dba0de55 100644 --- a/javatests/google/registry/rdap/testdata/rdap_contact_deleted.json +++ b/javatests/google/registry/rdap/testdata/rdap_contact_deleted.json @@ -5,9 +5,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/%NAME%", + "value" : "https://example.tld/rdap/entity/%NAME%", "rel" : "self", - "href": "https://example.com/rdap/entity/%NAME%", + "href": "https://example.tld/rdap/entity/%NAME%", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_contact_no_personal_data_with_remark.json b/javatests/google/registry/rdap/testdata/rdap_contact_no_personal_data_with_remark.json index 99be4fe79..fc5d60088 100644 --- a/javatests/google/registry/rdap/testdata/rdap_contact_no_personal_data_with_remark.json +++ b/javatests/google/registry/rdap/testdata/rdap_contact_no_personal_data_with_remark.json @@ -5,9 +5,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/%NAME%", + "value" : "https://example.tld/rdap/entity/%NAME%", "rel" : "self", - "href": "https://example.com/rdap/entity/%NAME%", + "href": "https://example.tld/rdap/entity/%NAME%", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_domain.json b/javatests/google/registry/rdap/testdata/rdap_domain.json index b02e3f86e..f2aa4b6cc 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domain.json +++ b/javatests/google/registry/rdap/testdata/rdap_domain.json @@ -8,10 +8,10 @@ "handle": "%HANDLE%", "links": [ { - "href": "https://example.com/rdap/domain/%NAME%", + "href": "https://example.tld/rdap/domain/%NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%NAME%" + "value": "https://example.tld/rdap/domain/%NAME%" } ], "events": [ @@ -42,10 +42,10 @@ "handle": "%NAMESERVER1ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%" } ], "ldhName": "%NAMESERVER1NAME%", @@ -74,10 +74,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -129,10 +129,10 @@ "handle": "%NAMESERVER2ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%" } ], "ldhName": "%NAMESERVER2NAME%", @@ -161,10 +161,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -222,10 +222,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT1ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT1ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT1ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT1ROID%" } ], "events": [ @@ -315,10 +315,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT2ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT2ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT2ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT2ROID%" } ], "events": [ @@ -408,10 +408,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT3ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT3ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT3ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT3ROID%" } ], "events": [ @@ -497,10 +497,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ diff --git a/javatests/google/registry/rdap/testdata/rdap_domain_cat2.json b/javatests/google/registry/rdap/testdata/rdap_domain_cat2.json index f8c03c622..5999d4bc0 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domain_cat2.json +++ b/javatests/google/registry/rdap/testdata/rdap_domain_cat2.json @@ -8,10 +8,10 @@ "handle": "%HANDLE%", "links": [ { - "href": "https://example.com/rdap/domain/%NAME%", + "href": "https://example.tld/rdap/domain/%NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%NAME%" + "value": "https://example.tld/rdap/domain/%NAME%" } ], "events": [ @@ -42,10 +42,10 @@ "handle": "%NAMESERVER1ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%" } ], "ldhName": "%NAMESERVER1NAME%", @@ -74,10 +74,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -129,10 +129,10 @@ "handle": "%NAMESERVER2ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%" } ], "ldhName": "%NAMESERVER2NAME%", @@ -161,10 +161,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -222,10 +222,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT1ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT1ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT1ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT1ROID%" } ], "events": [ @@ -315,10 +315,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT2ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT2ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT2ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT2ROID%" } ], "events": [ @@ -408,10 +408,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT3ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT3ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT3ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT3ROID%" } ], "events": [ @@ -497,10 +497,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ diff --git a/javatests/google/registry/rdap/testdata/rdap_domain_deleted.json b/javatests/google/registry/rdap/testdata/rdap_domain_deleted.json index d5827f9fb..0575d830c 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domain_deleted.json +++ b/javatests/google/registry/rdap/testdata/rdap_domain_deleted.json @@ -9,10 +9,10 @@ "handle": "%HANDLE%", "links": [ { - "href": "https://example.com/rdap/domain/%NAME%", + "href": "https://example.tld/rdap/domain/%NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%NAME%" + "value": "https://example.tld/rdap/domain/%NAME%" } ], "events": [ @@ -48,10 +48,10 @@ "handle": "%NAMESERVER1ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%" } ], "ldhName": "%NAMESERVER1NAME%", @@ -80,10 +80,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -134,10 +134,10 @@ "handle": "%NAMESERVER2ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%" } ], "ldhName": "%NAMESERVER2NAME%", @@ -166,10 +166,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -226,10 +226,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT1ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT1ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT1ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT1ROID%" } ], "events": [ @@ -318,10 +318,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT2ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT2ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT2ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT2ROID%" } ], "events": [ @@ -410,10 +410,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT3ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT3ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT3ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT3ROID%" } ], "events": [ @@ -499,10 +499,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ diff --git a/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts.json b/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts.json index e8b0e4945..cfb1346c0 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts.json +++ b/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts.json @@ -10,10 +10,10 @@ ], "links": [ { - "href": "https://example.com/rdap/domain/%NAME%", + "href": "https://example.tld/rdap/domain/%NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%NAME%" + "value": "https://example.tld/rdap/domain/%NAME%" } ], "events": [ @@ -44,10 +44,10 @@ "handle": "%NAMESERVER1ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%" } ], "ldhName": "%NAMESERVER1NAME%", @@ -76,10 +76,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -131,10 +131,10 @@ "handle": "%NAMESERVER2ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%" } ], "ldhName": "%NAMESERVER2NAME%", @@ -163,10 +163,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -220,9 +220,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/1", + "value" : "https://example.tld/rdap/entity/1", "rel" : "self", - "href" : "https://example.com/rdap/entity/1", + "href" : "https://example.tld/rdap/entity/1", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts_with_remark.json b/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts_with_remark.json index 7ae7a4c71..e9cffacab 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts_with_remark.json +++ b/javatests/google/registry/rdap/testdata/rdap_domain_no_contacts_with_remark.json @@ -10,10 +10,10 @@ ], "links": [ { - "href": "https://example.com/rdap/domain/%NAME%", + "href": "https://example.tld/rdap/domain/%NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%NAME%" + "value": "https://example.tld/rdap/domain/%NAME%" } ], "events": [ @@ -44,10 +44,10 @@ "handle": "%NAMESERVER1ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER1NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER1NAME%" } ], "ldhName": "%NAMESERVER1NAME%", @@ -76,10 +76,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -131,10 +131,10 @@ "handle": "%NAMESERVER2ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER2NAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER2NAME%" } ], "ldhName": "%NAMESERVER2NAME%", @@ -163,10 +163,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -220,9 +220,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/1", + "value" : "https://example.tld/rdap/entity/1", "rel" : "self", - "href" : "https://example.com/rdap/entity/1", + "href" : "https://example.tld/rdap/entity/1", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_domain_unicode.json b/javatests/google/registry/rdap/testdata/rdap_domain_unicode.json index 2d50cfaaa..1f228a31f 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domain_unicode.json +++ b/javatests/google/registry/rdap/testdata/rdap_domain_unicode.json @@ -9,10 +9,10 @@ "handle": "%HANDLE%", "links": [ { - "href": "https://example.com/rdap/domain/%PUNYCODENAME%", + "href": "https://example.tld/rdap/domain/%PUNYCODENAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%PUNYCODENAME%" + "value": "https://example.tld/rdap/domain/%PUNYCODENAME%" } ], "events": [ @@ -44,11 +44,11 @@ "links": [ { "href": - "https://example.com/rdap/nameserver/%NAMESERVER1PUNYCODENAME%", + "https://example.tld/rdap/nameserver/%NAMESERVER1PUNYCODENAME%", "type": "application/rdap+json", "rel": "self", "value": - "https://example.com/rdap/nameserver/%NAMESERVER1PUNYCODENAME%" + "https://example.tld/rdap/nameserver/%NAMESERVER1PUNYCODENAME%" } ], "ldhName": "%NAMESERVER1PUNYCODENAME%", @@ -77,10 +77,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -133,11 +133,11 @@ "links": [ { "href": - "https://example.com/rdap/nameserver/%NAMESERVER2PUNYCODENAME%", + "https://example.tld/rdap/nameserver/%NAMESERVER2PUNYCODENAME%", "type": "application/rdap+json", "rel": "self", "value": - "https://example.com/rdap/nameserver/%NAMESERVER2PUNYCODENAME%" + "https://example.tld/rdap/nameserver/%NAMESERVER2PUNYCODENAME%" } ], "ldhName": "%NAMESERVER2PUNYCODENAME%", @@ -166,10 +166,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -227,10 +227,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT1ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT1ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT1ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT1ROID%" } ], "events": [ @@ -320,10 +320,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT2ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT2ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT2ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT2ROID%" } ], "events": [ @@ -413,10 +413,10 @@ ], "links": [ { - "href": "https://example.com/rdap/entity/%CONTACT3ROID%", + "href": "https://example.tld/rdap/entity/%CONTACT3ROID%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/%CONTACT3ROID%" + "value": "https://example.tld/rdap/entity/%CONTACT3ROID%" } ], "events": [ @@ -502,10 +502,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ diff --git a/javatests/google/registry/rdap/testdata/rdap_domain_unicode_no_contacts_with_remark.json b/javatests/google/registry/rdap/testdata/rdap_domain_unicode_no_contacts_with_remark.json index 22ad10440..188eb77a1 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domain_unicode_no_contacts_with_remark.json +++ b/javatests/google/registry/rdap/testdata/rdap_domain_unicode_no_contacts_with_remark.json @@ -11,10 +11,10 @@ ], "links": [ { - "href": "https://example.com/rdap/domain/%PUNYCODENAME%", + "href": "https://example.tld/rdap/domain/%PUNYCODENAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%PUNYCODENAME%" + "value": "https://example.tld/rdap/domain/%PUNYCODENAME%" } ], "events": [ @@ -45,10 +45,10 @@ "handle": "%NAMESERVER1ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER1PUNYCODENAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER1PUNYCODENAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER1PUNYCODENAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER1PUNYCODENAME%" } ], "ldhName": "%NAMESERVER1PUNYCODENAME%", @@ -78,10 +78,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -133,10 +133,10 @@ "handle": "%NAMESERVER2ROID%", "links": [ { - "href": "https://example.com/rdap/nameserver/%NAMESERVER2PUNYCODENAME%", + "href": "https://example.tld/rdap/nameserver/%NAMESERVER2PUNYCODENAME%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/nameserver/%NAMESERVER2PUNYCODENAME%" + "value": "https://example.tld/rdap/nameserver/%NAMESERVER2PUNYCODENAME%" } ], "ldhName": "%NAMESERVER2PUNYCODENAME%", @@ -166,10 +166,10 @@ "roles": [ "registrar" ], "links": [ { - "href": "https://example.com/rdap/entity/1", + "href": "https://example.tld/rdap/entity/1", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/entity/1" + "value": "https://example.tld/rdap/entity/1" } ], "vcardArray" : [ @@ -223,9 +223,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/1", + "value" : "https://example.tld/rdap/entity/1", "rel" : "self", - "href" : "https://example.com/rdap/entity/1", + "href" : "https://example.tld/rdap/entity/1", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_domains_four_truncated.json b/javatests/google/registry/rdap/testdata/rdap_domains_four_truncated.json index c59d21c60..ae33f9ec8 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domains_four_truncated.json +++ b/javatests/google/registry/rdap/testdata/rdap_domains_four_truncated.json @@ -10,10 +10,10 @@ "handle": "%DOMAINHANDLE1%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME1%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME1%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME1%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME1%" } ], "ldhName": "%DOMAINNAME1%", @@ -38,10 +38,10 @@ "handle": "%DOMAINHANDLE2%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME2%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME2%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME2%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME2%" } ], "ldhName": "%DOMAINNAME2%", @@ -66,10 +66,10 @@ "handle": "%DOMAINHANDLE3%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME3%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME3%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME3%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME3%" } ], "ldhName": "%DOMAINNAME3%", @@ -94,10 +94,10 @@ "handle": "%DOMAINHANDLE4%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME4%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME4%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME4%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME4%" } ], "ldhName": "%DOMAINNAME4%", @@ -134,7 +134,7 @@ { "type" : "application/rdap+json", "rel" : "next", - "href" : "https://example.com/rdap/domains?%NEXT_QUERY%" + "href" : "https://example.tld/rdap/domains?%NEXT_QUERY%" } ] }, @@ -156,7 +156,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode.json b/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode.json index 78da1f8d0..7284756c8 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode.json +++ b/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode.json @@ -10,10 +10,10 @@ "handle": "%DOMAINHANDLE1%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME1%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME1%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME1%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME1%" } ], "ldhName": "%DOMAINNAME1%", @@ -38,10 +38,10 @@ "handle": "%DOMAINHANDLE2%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME2%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME2%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME2%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME2%" } ], "ldhName": "%DOMAINNAME2%", @@ -66,10 +66,10 @@ "handle": "%DOMAINHANDLE3%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME3%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME3%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME3%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME3%" } ], "ldhName": "%DOMAINNAME3%", @@ -94,10 +94,10 @@ "handle": "%DOMAINHANDLE4%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME4%", + "href": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME4%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME4%" + "value": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME4%" } ], "ldhName": "%DOMAINPUNYCODENAME4%", @@ -137,7 +137,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode_truncated.json b/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode_truncated.json index d1faa63d2..65456c053 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode_truncated.json +++ b/javatests/google/registry/rdap/testdata/rdap_domains_four_with_one_unicode_truncated.json @@ -10,10 +10,10 @@ "handle": "%DOMAINHANDLE1%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME1%", + "href": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME1%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME1%" + "value": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME1%" } ], "ldhName": "%DOMAINPUNYCODENAME1%", @@ -38,10 +38,10 @@ "handle": "%DOMAINHANDLE2%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME2%", + "href": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME2%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME2%" + "value": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME2%" } ], "ldhName": "%DOMAINPUNYCODENAME2%", @@ -66,10 +66,10 @@ "handle": "%DOMAINHANDLE3%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME3%", + "href": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME3%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME3%" + "value": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME3%" } ], "ldhName": "%DOMAINPUNYCODENAME3%", @@ -94,10 +94,10 @@ "handle": "%DOMAINHANDLE4%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME4%", + "href": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME4%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINPUNYCODENAME4%" + "value": "https://example.tld/rdap/domain/%DOMAINPUNYCODENAME4%" } ], "ldhName": "%DOMAINPUNYCODENAME4%", @@ -135,7 +135,7 @@ { "type" : "application/rdap+json", "rel" : "next", - "href" : "https://example.com/rdap/domains?%NEXT_QUERY%" + "href" : "https://example.tld/rdap/domains?%NEXT_QUERY%" } ] }, @@ -157,7 +157,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_domains_two.json b/javatests/google/registry/rdap/testdata/rdap_domains_two.json index f3f563358..17e4a8888 100644 --- a/javatests/google/registry/rdap/testdata/rdap_domains_two.json +++ b/javatests/google/registry/rdap/testdata/rdap_domains_two.json @@ -10,10 +10,10 @@ "handle": "%DOMAINHANDLE1%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME1%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME1%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME1%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME1%" } ], "ldhName": "%DOMAINNAME1%", @@ -38,10 +38,10 @@ "handle": "%DOMAINHANDLE2%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME2%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME2%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME2%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME2%" } ], "ldhName": "%DOMAINNAME2%", @@ -80,7 +80,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_incomplete_domain_result_set.json b/javatests/google/registry/rdap/testdata/rdap_incomplete_domain_result_set.json index 63284469e..6d54897ea 100644 --- a/javatests/google/registry/rdap/testdata/rdap_incomplete_domain_result_set.json +++ b/javatests/google/registry/rdap/testdata/rdap_incomplete_domain_result_set.json @@ -7,8 +7,8 @@ [ { "rel":"self", - "href":"https://example.com/rdap/domain/%DOMAINNAME1%", - "value":"https://example.com/rdap/domain/%DOMAINNAME1%", + "href":"https://example.tld/rdap/domain/%DOMAINNAME1%", + "value":"https://example.tld/rdap/domain/%DOMAINNAME1%", "type":"application/rdap+json" } ], @@ -39,8 +39,8 @@ [ { "rel":"self", - "href":"https://example.com/rdap/domain/%DOMAINNAME2%", - "value":"https://example.com/rdap/domain/%DOMAINNAME2%", + "href":"https://example.tld/rdap/domain/%DOMAINNAME2%", + "value":"https://example.tld/rdap/domain/%DOMAINNAME2%", "type":"application/rdap+json" } ], @@ -71,8 +71,8 @@ [ { "rel":"self", - "href":"https://example.com/rdap/domain/%DOMAINNAME3%", - "value":"https://example.com/rdap/domain/%DOMAINNAME3%", + "href":"https://example.tld/rdap/domain/%DOMAINNAME3%", + "value":"https://example.tld/rdap/domain/%DOMAINNAME3%", "type":"application/rdap+json" } ], @@ -127,7 +127,7 @@ { "rel":"alternate", "href":"https://www.registry.tld/about/rdap/tos.html", - "value":"https://example.com/rdap/help/tos", + "value":"https://example.tld/rdap/help/tos", "type":"text/html" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_incomplete_domains.json b/javatests/google/registry/rdap/testdata/rdap_incomplete_domains.json index 95d4f55e6..4bbe9af83 100644 --- a/javatests/google/registry/rdap/testdata/rdap_incomplete_domains.json +++ b/javatests/google/registry/rdap/testdata/rdap_incomplete_domains.json @@ -20,10 +20,10 @@ "handle":"%DOMAINHANDLE1%", "links":[ { - "value":"https://example.com/rdap/domain/%DOMAINNAME1%", + "value":"https://example.tld/rdap/domain/%DOMAINNAME1%", "type":"application/rdap+json", "rel":"self", - "href":"https://example.com/rdap/domain/%DOMAINNAME1%" + "href":"https://example.tld/rdap/domain/%DOMAINNAME1%" } ], "objectClassName":"domain" @@ -48,10 +48,10 @@ "handle":"%DOMAINHANDLE2%", "links":[ { - "value":"https://example.com/rdap/domain/%DOMAINNAME2%", + "value":"https://example.tld/rdap/domain/%DOMAINNAME2%", "type":"application/rdap+json", "rel":"self", - "href":"https://example.com/rdap/domain/%DOMAINNAME2%" + "href":"https://example.tld/rdap/domain/%DOMAINNAME2%" } ], "objectClassName":"domain" @@ -81,7 +81,7 @@ ], "links":[ { - "value":"https://example.com/rdap/help/tos", + "value":"https://example.tld/rdap/help/tos", "type":"text/html", "rel":"alternate", "href":"https://www.registry.tld/about/rdap/tos.html" diff --git a/javatests/google/registry/rdap/testdata/rdap_multiple_contacts.json b/javatests/google/registry/rdap/testdata/rdap_multiple_contacts.json index fe20cdccc..d8272cfdb 100644 --- a/javatests/google/registry/rdap/testdata/rdap_multiple_contacts.json +++ b/javatests/google/registry/rdap/testdata/rdap_multiple_contacts.json @@ -8,9 +8,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/2-ROID", + "value" : "https://example.tld/rdap/entity/2-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/2-ROID", + "href": "https://example.tld/rdap/entity/2-ROID", "type" : "application/rdap+json" } ], @@ -55,9 +55,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/2-Registrar", + "value" : "https://example.tld/rdap/entity/2-Registrar", "rel" : "self", - "href": "https://example.com/rdap/entity/2-Registrar", + "href": "https://example.tld/rdap/entity/2-Registrar", "type" : "application/rdap+json" } ], @@ -122,7 +122,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_multiple_contacts2.json b/javatests/google/registry/rdap/testdata/rdap_multiple_contacts2.json index 674a7c652..7ee99fdff 100644 --- a/javatests/google/registry/rdap/testdata/rdap_multiple_contacts2.json +++ b/javatests/google/registry/rdap/testdata/rdap_multiple_contacts2.json @@ -8,9 +8,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/4-ROID", + "value" : "https://example.tld/rdap/entity/4-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/4-ROID", + "href": "https://example.tld/rdap/entity/4-ROID", "type" : "application/rdap+json" } ], @@ -54,9 +54,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/2-ROID", + "value" : "https://example.tld/rdap/entity/2-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/2-ROID", + "href": "https://example.tld/rdap/entity/2-ROID", "type" : "application/rdap+json" } ], @@ -115,7 +115,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_nontruncated_contacts.json b/javatests/google/registry/rdap/testdata/rdap_nontruncated_contacts.json index 00c643b1a..3b7b1dd2b 100644 --- a/javatests/google/registry/rdap/testdata/rdap_nontruncated_contacts.json +++ b/javatests/google/registry/rdap/testdata/rdap_nontruncated_contacts.json @@ -8,9 +8,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0001-ROID", + "value" : "https://example.tld/rdap/entity/0001-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0001-ROID", + "href": "https://example.tld/rdap/entity/0001-ROID", "type" : "application/rdap+json" } ], @@ -54,9 +54,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0002-ROID", + "value" : "https://example.tld/rdap/entity/0002-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0002-ROID", + "href": "https://example.tld/rdap/entity/0002-ROID", "type" : "application/rdap+json" } ], @@ -100,9 +100,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0003-ROID", + "value" : "https://example.tld/rdap/entity/0003-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0003-ROID", + "href": "https://example.tld/rdap/entity/0003-ROID", "type" : "application/rdap+json" } ], @@ -146,9 +146,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0004-ROID", + "value" : "https://example.tld/rdap/entity/0004-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0004-ROID", + "href": "https://example.tld/rdap/entity/0004-ROID", "type" : "application/rdap+json" } ], @@ -207,7 +207,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_nontruncated_domains.json b/javatests/google/registry/rdap/testdata/rdap_nontruncated_domains.json index 71cfa3e82..beba670dc 100644 --- a/javatests/google/registry/rdap/testdata/rdap_nontruncated_domains.json +++ b/javatests/google/registry/rdap/testdata/rdap_nontruncated_domains.json @@ -10,10 +10,10 @@ "handle": "%DOMAINHANDLE1%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME1%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME1%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME1%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME1%" } ], "ldhName": "%DOMAINNAME1%", @@ -38,10 +38,10 @@ "handle": "%DOMAINHANDLE2%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME2%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME2%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME2%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME2%" } ], "ldhName": "%DOMAINNAME2%", @@ -66,10 +66,10 @@ "handle": "%DOMAINHANDLE3%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME3%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME3%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME3%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME3%" } ], "ldhName": "%DOMAINNAME3%", @@ -94,10 +94,10 @@ "handle": "%DOMAINHANDLE4%", "links": [ { - "href": "https://example.com/rdap/domain/%DOMAINNAME4%", + "href": "https://example.tld/rdap/domain/%DOMAINNAME4%", "type": "application/rdap+json", "rel": "self", - "value": "https://example.com/rdap/domain/%DOMAINNAME4%" + "value": "https://example.tld/rdap/domain/%DOMAINNAME4%" } ], "ldhName": "%DOMAINNAME4%", @@ -136,7 +136,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_nontruncated_registrars.json b/javatests/google/registry/rdap/testdata/rdap_nontruncated_registrars.json index 70d52494d..278e235f3 100644 --- a/javatests/google/registry/rdap/testdata/rdap_nontruncated_registrars.json +++ b/javatests/google/registry/rdap/testdata/rdap_nontruncated_registrars.json @@ -8,9 +8,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/301", + "value" : "https://example.tld/rdap/entity/301", "rel" : "self", - "href": "https://example.com/rdap/entity/301", + "href": "https://example.tld/rdap/entity/301", "type" : "application/rdap+json" } ], @@ -61,9 +61,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/302", + "value" : "https://example.tld/rdap/entity/302", "rel" : "self", - "href": "https://example.com/rdap/entity/302", + "href": "https://example.tld/rdap/entity/302", "type" : "application/rdap+json" } ], @@ -114,9 +114,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/303", + "value" : "https://example.tld/rdap/entity/303", "rel" : "self", - "href": "https://example.com/rdap/entity/303", + "href": "https://example.tld/rdap/entity/303", "type" : "application/rdap+json" } ], @@ -167,9 +167,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/304", + "value" : "https://example.tld/rdap/entity/304", "rel" : "self", - "href": "https://example.com/rdap/entity/304", + "href": "https://example.tld/rdap/entity/304", "type" : "application/rdap+json" } ], @@ -235,7 +235,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_registrar.json b/javatests/google/registry/rdap/testdata/rdap_registrar.json index cc7ce08da..ea06b7eb2 100644 --- a/javatests/google/registry/rdap/testdata/rdap_registrar.json +++ b/javatests/google/registry/rdap/testdata/rdap_registrar.json @@ -6,9 +6,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/%NAME%", + "value" : "https://example.tld/rdap/entity/%NAME%", "rel" : "self", - "href": "https://example.com/rdap/entity/%NAME%", + "href": "https://example.tld/rdap/entity/%NAME%", "type" : "application/rdap+json" } ], diff --git a/javatests/google/registry/rdap/testdata/rdap_truncated_contacts.json b/javatests/google/registry/rdap/testdata/rdap_truncated_contacts.json index 5e107ff04..0da5c435f 100644 --- a/javatests/google/registry/rdap/testdata/rdap_truncated_contacts.json +++ b/javatests/google/registry/rdap/testdata/rdap_truncated_contacts.json @@ -8,9 +8,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0001-ROID", + "value" : "https://example.tld/rdap/entity/0001-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0001-ROID", + "href": "https://example.tld/rdap/entity/0001-ROID", "type" : "application/rdap+json" } ], @@ -54,9 +54,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0002-ROID", + "value" : "https://example.tld/rdap/entity/0002-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0002-ROID", + "href": "https://example.tld/rdap/entity/0002-ROID", "type" : "application/rdap+json" } ], @@ -100,9 +100,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0003-ROID", + "value" : "https://example.tld/rdap/entity/0003-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0003-ROID", + "href": "https://example.tld/rdap/entity/0003-ROID", "type" : "application/rdap+json" } ], @@ -146,9 +146,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0004-ROID", + "value" : "https://example.tld/rdap/entity/0004-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0004-ROID", + "href": "https://example.tld/rdap/entity/0004-ROID", "type" : "application/rdap+json" } ], @@ -203,7 +203,7 @@ [ { "type" : "application/rdap+json", - "href" : "https://example.com/rdap/entities?%NAME%", + "href" : "https://example.tld/rdap/entities?%NAME%", "rel" : "next" } ], @@ -227,7 +227,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_truncated_mixed_entities.json b/javatests/google/registry/rdap/testdata/rdap_truncated_mixed_entities.json index a00ccff41..e8cc66966 100644 --- a/javatests/google/registry/rdap/testdata/rdap_truncated_mixed_entities.json +++ b/javatests/google/registry/rdap/testdata/rdap_truncated_mixed_entities.json @@ -8,9 +8,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0001-ROID", + "value" : "https://example.tld/rdap/entity/0001-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0001-ROID", + "href": "https://example.tld/rdap/entity/0001-ROID", "type" : "application/rdap+json" } ], @@ -54,9 +54,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0002-ROID", + "value" : "https://example.tld/rdap/entity/0002-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0002-ROID", + "href": "https://example.tld/rdap/entity/0002-ROID", "type" : "application/rdap+json" } ], @@ -100,9 +100,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/0003-ROID", + "value" : "https://example.tld/rdap/entity/0003-ROID", "rel" : "self", - "href": "https://example.com/rdap/entity/0003-ROID", + "href": "https://example.tld/rdap/entity/0003-ROID", "type" : "application/rdap+json" } ], @@ -146,9 +146,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/301", + "value" : "https://example.tld/rdap/entity/301", "rel" : "self", - "href": "https://example.com/rdap/entity/301", + "href": "https://example.tld/rdap/entity/301", "type" : "application/rdap+json" } ], @@ -210,7 +210,7 @@ [ { "type" : "application/rdap+json", - "href" : "https://example.com/rdap/entities?%NAME%", + "href" : "https://example.tld/rdap/entities?%NAME%", "rel" : "next" } ], @@ -234,7 +234,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html" diff --git a/javatests/google/registry/rdap/testdata/rdap_truncated_registrars.json b/javatests/google/registry/rdap/testdata/rdap_truncated_registrars.json index dcc3e9a2f..9b10af5c5 100644 --- a/javatests/google/registry/rdap/testdata/rdap_truncated_registrars.json +++ b/javatests/google/registry/rdap/testdata/rdap_truncated_registrars.json @@ -8,9 +8,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/301", + "value" : "https://example.tld/rdap/entity/301", "rel" : "self", - "href": "https://example.com/rdap/entity/301", + "href": "https://example.tld/rdap/entity/301", "type" : "application/rdap+json" } ], @@ -61,9 +61,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/302", + "value" : "https://example.tld/rdap/entity/302", "rel" : "self", - "href": "https://example.com/rdap/entity/302", + "href": "https://example.tld/rdap/entity/302", "type" : "application/rdap+json" } ], @@ -114,9 +114,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/303", + "value" : "https://example.tld/rdap/entity/303", "rel" : "self", - "href": "https://example.com/rdap/entity/303", + "href": "https://example.tld/rdap/entity/303", "type" : "application/rdap+json" } ], @@ -167,9 +167,9 @@ "links" : [ { - "value" : "https://example.com/rdap/entity/304", + "value" : "https://example.tld/rdap/entity/304", "rel" : "self", - "href": "https://example.com/rdap/entity/304", + "href": "https://example.tld/rdap/entity/304", "type" : "application/rdap+json" } ], @@ -231,7 +231,7 @@ [ { "type" : "application/rdap+json", - "href" : "https://example.com/rdap/entities?%NAME%", + "href" : "https://example.tld/rdap/entities?%NAME%", "rel" : "next" } ], @@ -255,7 +255,7 @@ "links" : [ { - "value" : "https://example.com/rdap/help/tos", + "value" : "https://example.tld/rdap/help/tos", "rel" : "alternate", "href" : "https://www.registry.tld/about/rdap/tos.html", "type" : "text/html"