diff --git a/core/src/main/java/google/registry/batch/AsyncTaskEnqueuer.java b/core/src/main/java/google/registry/batch/AsyncTaskEnqueuer.java index 604eb9d74..3426937ba 100644 --- a/core/src/main/java/google/registry/batch/AsyncTaskEnqueuer.java +++ b/core/src/main/java/google/registry/batch/AsyncTaskEnqueuer.java @@ -126,18 +126,18 @@ public final class AsyncTaskEnqueuer { public void enqueueAsyncDelete( EppResource resourceToDelete, DateTime now, - String requestingClientId, + String requestingRegistrarId, Trid trid, boolean isSuperuser) { Key resourceKey = Key.create(resourceToDelete); logger.atInfo().log( "Enqueuing async deletion of %s on behalf of registrar %s.", - resourceKey, requestingClientId); + resourceKey, requestingRegistrarId); TaskOptions task = TaskOptions.Builder.withMethod(Method.PULL) .countdownMillis(asyncDeleteDelay.getMillis()) .param(PARAM_RESOURCE_KEY, resourceKey.getString()) - .param(PARAM_REQUESTING_CLIENT_ID, requestingClientId) + .param(PARAM_REQUESTING_CLIENT_ID, requestingRegistrarId) .param(PARAM_SERVER_TRANSACTION_ID, trid.getServerTransactionId()) .param(PARAM_IS_SUPERUSER, Boolean.toString(isSuperuser)) .param(PARAM_REQUESTED_TIME, now.toString()); diff --git a/core/src/main/java/google/registry/batch/DeleteContactsAndHostsAction.java b/core/src/main/java/google/registry/batch/DeleteContactsAndHostsAction.java index 75db980c9..df522ae54 100644 --- a/core/src/main/java/google/registry/batch/DeleteContactsAndHostsAction.java +++ b/core/src/main/java/google/registry/batch/DeleteContactsAndHostsAction.java @@ -343,15 +343,15 @@ public class DeleteContactsAndHostsAction implements Runnable { } // Contacts and external hosts have a direct client id. For subordinate hosts it needs to be // read off of the superordinate domain. - String resourceClientId = resource.getPersistedCurrentSponsorClientId(); + String resourceRegistrarId = resource.getPersistedCurrentSponsorRegistrarId(); if (resource instanceof HostResource && ((HostResource) resource).isSubordinate()) { - resourceClientId = + resourceRegistrarId = tm().loadByKey(((HostResource) resource).getSuperordinateDomain()) .cloneProjectedAtTime(now) - .getCurrentSponsorClientId(); + .getCurrentSponsorRegistrarId(); } boolean requestedByCurrentOwner = - resourceClientId.equals(deletionRequest.requestingClientId()); + resourceRegistrarId.equals(deletionRequest.requestingClientId()); boolean deleteAllowed = hasNoActiveReferences && (requestedByCurrentOwner || deletionRequest.isSuperuser()); @@ -371,14 +371,14 @@ public class DeleteContactsAndHostsAction implements Runnable { HistoryEntry historyEntry = HistoryEntry.createBuilderForResource(resource) - .setClientId(deletionRequest.requestingClientId()) + .setRegistrarId(deletionRequest.requestingClientId()) .setModificationTime(now) .setType(getHistoryEntryType(resource, deleteAllowed)) .build(); PollMessage.OneTime pollMessage = new PollMessage.OneTime.Builder() - .setClientId(deletionRequest.requestingClientId()) + .setRegistrarId(deletionRequest.requestingClientId()) .setMsg(pollMessageText) .setParent(historyEntry) .setEventTime(now) diff --git a/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java b/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java index 86b4e1704..7d35e9f31 100644 --- a/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java +++ b/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java @@ -135,7 +135,7 @@ public class DeleteLoadTestDataAction implements Runnable { } private void deleteContact(ContactResource contact) { - if (!LOAD_TEST_REGISTRARS.contains(contact.getPersistedCurrentSponsorClientId())) { + if (!LOAD_TEST_REGISTRARS.contains(contact.getPersistedCurrentSponsorRegistrarId())) { return; } // We cannot remove contacts from domains in the general case, so we cannot delete contacts @@ -150,7 +150,7 @@ public class DeleteLoadTestDataAction implements Runnable { } private void deleteHost(HostResource host) { - if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorClientId())) { + if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorRegistrarId())) { return; } VKey hostVKey = host.createVKey(); @@ -198,7 +198,7 @@ public class DeleteLoadTestDataAction implements Runnable { @Override public final void map(EppResource resource) { - if (LOAD_TEST_REGISTRARS.contains(resource.getPersistedCurrentSponsorClientId())) { + if (LOAD_TEST_REGISTRARS.contains(resource.getPersistedCurrentSponsorRegistrarId())) { deleteResource(resource); getContext() .incrementCounter( diff --git a/core/src/main/java/google/registry/batch/DeleteProberDataAction.java b/core/src/main/java/google/registry/batch/DeleteProberDataAction.java index 67b48b183..419ada0e2 100644 --- a/core/src/main/java/google/registry/batch/DeleteProberDataAction.java +++ b/core/src/main/java/google/registry/batch/DeleteProberDataAction.java @@ -291,7 +291,7 @@ public class DeleteProberDataAction implements Runnable { .setModificationTime(tm().getTransactionTime()) .setBySuperuser(true) .setReason("Deletion of prober data") - .setClientId(registryAdminRegistrarId) + .setRegistrarId(registryAdminRegistrarId) .build(); // Note that we don't bother handling grace periods, billing events, pending transfers, poll // messages, or auto-renews because those will all be hard-deleted the next time the job runs diff --git a/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java b/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java index 83dd4474f..0f61ca188 100644 --- a/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java +++ b/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java @@ -324,7 +324,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable { DomainHistory historyEntry = new DomainHistory.Builder() .setBySuperuser(false) - .setClientId(recurring.getClientId()) + .setRegistrarId(recurring.getRegistrarId()) .setModificationTime(tm().getTransactionTime()) .setDomain(tm().loadByKey(domainKey)) .setPeriod(Period.create(1, YEARS)) @@ -354,7 +354,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable { syntheticOneTimesBuilder.add( new OneTime.Builder() .setBillingTime(billingTime) - .setClientId(recurring.getClientId()) + .setRegistrarId(recurring.getRegistrarId()) .setCost(renewCost) .setEventTime(eventTime) .setFlags(union(recurring.getFlags(), Flag.SYNTHETIC)) diff --git a/core/src/main/java/google/registry/batch/RelockDomainAction.java b/core/src/main/java/google/registry/batch/RelockDomainAction.java index 17b32ef89..9e90f2df2 100644 --- a/core/src/main/java/google/registry/batch/RelockDomainAction.java +++ b/core/src/main/java/google/registry/batch/RelockDomainAction.java @@ -203,11 +203,11 @@ public class RelockDomainAction implements Runnable { "Domain %s has a pending transfer.", domainName); checkArgument( - domain.getCurrentSponsorClientId().equals(oldLock.getRegistrarId()), + domain.getCurrentSponsorRegistrarId().equals(oldLock.getRegistrarId()), "Domain %s has been transferred from registrar %s to registrar %s since the unlock.", domainName, oldLock.getRegistrarId(), - domain.getCurrentSponsorClientId()); + domain.getCurrentSponsorRegistrarId()); } private void handleNonRetryableFailure(RegistryLock oldLock, Throwable t) { @@ -293,7 +293,7 @@ public class RelockDomainAction implements Runnable { private ImmutableSet getEmailRecipients(String registrarId) { Registrar registrar = - Registrar.loadByClientIdCached(registrarId) + Registrar.loadByRegistrarIdCached(registrarId) .orElseThrow( () -> new IllegalStateException(String.format("Unknown registrar %s", registrarId))); diff --git a/core/src/main/java/google/registry/batch/SendExpiringCertificateNotificationEmailAction.java b/core/src/main/java/google/registry/batch/SendExpiringCertificateNotificationEmailAction.java index b5412554b..8d4ca3ac4 100644 --- a/core/src/main/java/google/registry/batch/SendExpiringCertificateNotificationEmailAction.java +++ b/core/src/main/java/google/registry/batch/SendExpiringCertificateNotificationEmailAction.java @@ -172,7 +172,7 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable registrar.getRegistrarName(), certificateType, expirationDate, - registrar.getClientId())) + registrar.getRegistrarId())) .setRecipients(recipients) .setCcs(getEmailAddresses(registrar, Type.ADMIN)) .build()); diff --git a/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java b/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java index b2b169d66..0cebe5d79 100644 --- a/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java +++ b/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java @@ -125,7 +125,7 @@ public class InvoicingPipeline implements Serializable { oneTime.getId(), DateTimeUtils.toZonedDateTime(oneTime.getBillingTime(), ZoneId.of("UTC")), DateTimeUtils.toZonedDateTime(oneTime.getEventTime(), ZoneId.of("UTC")), - registrar.getClientId(), + registrar.getRegistrarId(), registrar.getBillingIdentifier().toString(), registrar.getPoNumber().orElse(""), DomainNameUtils.getTldFromDomainName(oneTime.getTargetId()), diff --git a/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java b/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java index d1c1a3898..fe40932d6 100644 --- a/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java +++ b/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java @@ -151,7 +151,7 @@ public class Spec11Pipeline implements Serializable { return DomainNameInfo.create( domainBase.getDomainName(), domainBase.getRepoId(), - domainBase.getCurrentSponsorClientId(), + domainBase.getCurrentSponsorRegistrarId(), emailAddress); } @@ -199,15 +199,15 @@ public class Spec11Pipeline implements Serializable { MapElements.into(TypeDescriptors.strings()) .via( (KV> kv) -> { - String clientId = kv.getKey(); + String registrarId = kv.getKey(); checkArgument( kv.getValue().iterator().hasNext(), String.format( - "Registrar with ID %s had no corresponding threats", clientId)); + "Registrar with ID %s had no corresponding threats", registrarId)); String email = kv.getValue().iterator().next().email(); JSONObject output = new JSONObject(); try { - output.put(REGISTRAR_CLIENT_ID_FIELD, clientId); + output.put(REGISTRAR_CLIENT_ID_FIELD, registrarId); output.put(REGISTRAR_EMAIL_FIELD, email); JSONArray threatMatchArray = new JSONArray(); for (EmailAndThreatMatch emailAndThreatMatch : kv.getValue()) { diff --git a/core/src/main/java/google/registry/config/RegistryConfig.java b/core/src/main/java/google/registry/config/RegistryConfig.java index e2be00294..5edb93995 100644 --- a/core/src/main/java/google/registry/config/RegistryConfig.java +++ b/core/src/main/java/google/registry/config/RegistryConfig.java @@ -1138,8 +1138,8 @@ public final class RegistryConfig { } /** - * Returns the clientId of the registrar that admins are automatically logged in as if they - * aren't otherwise associated with one. + * Returns the ID of the registrar that admins are automatically logged in as if they aren't + * otherwise associated with one. */ @Provides @Config("registryAdminClientId") diff --git a/core/src/main/java/google/registry/export/SyncGroupMembersAction.java b/core/src/main/java/google/registry/export/SyncGroupMembersAction.java index ad26ee2d0..b495cca36 100644 --- a/core/src/main/java/google/registry/export/SyncGroupMembersAction.java +++ b/core/src/main/java/google/registry/export/SyncGroupMembersAction.java @@ -19,7 +19,7 @@ import static com.google.common.collect.ImmutableSet.toImmutableSet; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.request.Action.Method.POST; import static google.registry.util.CollectionUtils.nullToEmpty; -import static google.registry.util.RegistrarUtils.normalizeClientId; +import static google.registry.util.RegistrarUtils.normalizeRegistrarId; import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; import static javax.servlet.http.HttpServletResponse.SC_OK; @@ -96,16 +96,15 @@ public final class SyncGroupMembersAction implements Runnable { } /** - * Returns the Google Groups email address for the given registrar clientId and - * RegistrarContact.Type + * Returns the Google Groups email address for the given registrar ID and RegistrarContact.Type. */ public static String getGroupEmailAddressForContactType( - String clientId, RegistrarContact.Type type, String gSuiteDomainName) { - // Take the registrar's clientId, make it lowercase, and remove all characters that aren't + String registrarId, RegistrarContact.Type type, String gSuiteDomainName) { + // Take the registrar's ID, make it lowercase, and remove all characters that aren't // alphanumeric, hyphens, or underscores. return String.format( "%s-%s-contacts@%s", - normalizeClientId(clientId), type.getDisplayName(), gSuiteDomainName); + normalizeRegistrarId(registrarId), type.getDisplayName(), gSuiteDomainName); } /** @@ -176,8 +175,8 @@ public final class SyncGroupMembersAction implements Runnable { long totalAdded = 0; long totalRemoved = 0; for (final RegistrarContact.Type type : RegistrarContact.Type.values()) { - groupKey = getGroupEmailAddressForContactType( - registrar.getClientId(), type, gSuiteDomainName); + groupKey = + getGroupEmailAddressForContactType(registrar.getRegistrarId(), type, gSuiteDomainName); Set currentMembers = groupsConnection.getMembersOfGroup(groupKey); Set desiredMembers = registrarContacts @@ -196,11 +195,13 @@ public final class SyncGroupMembersAction implements Runnable { } logger.atInfo().log( "Successfully synced contacts for registrar %s: added %d and removed %d", - registrar.getClientId(), totalAdded, totalRemoved); + registrar.getRegistrarId(), totalAdded, totalRemoved); } catch (IOException e) { // Package up exception and re-throw with attached additional relevant info. - String msg = String.format("Couldn't sync contacts for registrar %s to group %s", - registrar.getClientId(), groupKey); + String msg = + String.format( + "Couldn't sync contacts for registrar %s to group %s", + registrar.getRegistrarId(), groupKey); throw new RuntimeException(msg, e); } } diff --git a/core/src/main/java/google/registry/export/sheet/SyncRegistrarsSheet.java b/core/src/main/java/google/registry/export/sheet/SyncRegistrarsSheet.java index 7bffb7886..f718bfa43 100644 --- a/core/src/main/java/google/registry/export/sheet/SyncRegistrarsSheet.java +++ b/core/src/main/java/google/registry/export/sheet/SyncRegistrarsSheet.java @@ -82,7 +82,7 @@ class SyncRegistrarsSheet { new Ordering() { @Override public int compare(Registrar left, Registrar right) { - return left.getClientId().compareTo(right.getClientId()); + return left.getRegistrarId().compareTo(right.getRegistrarId()); } }.immutableSortedCopy(Registrar.loadAllCached()).stream() .filter( @@ -116,7 +116,7 @@ class SyncRegistrarsSheet { // and you'll need to remove deleted columns probably like a week after // deployment. // - builder.put("clientIdentifier", convert(registrar.getClientId())); + builder.put("clientIdentifier", convert(registrar.getRegistrarId())); builder.put("registrarName", convert(registrar.getRegistrarName())); builder.put("state", convert(registrar.getState())); builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier())); diff --git a/core/src/main/java/google/registry/flows/EppController.java b/core/src/main/java/google/registry/flows/EppController.java index 7de8bf6e3..04e3ebc18 100644 --- a/core/src/main/java/google/registry/flows/EppController.java +++ b/core/src/main/java/google/registry/flows/EppController.java @@ -61,7 +61,7 @@ public final class EppController { boolean isDryRun, boolean isSuperuser, byte[] inputXmlBytes) { - eppMetricBuilder.setClientId(Optional.ofNullable(sessionMetadata.getClientId())); + eppMetricBuilder.setRegistrarId(Optional.ofNullable(sessionMetadata.getRegistrarId())); try { EppInput eppInput; try { @@ -76,7 +76,7 @@ public final class EppController { JSONValue.toJSONString( ImmutableMap.of( "clientId", - nullToEmpty(sessionMetadata.getClientId()), + nullToEmpty(sessionMetadata.getRegistrarId()), "resultCode", e.getResult().getCode().code, "resultMessage", diff --git a/core/src/main/java/google/registry/flows/EppMetrics.java b/core/src/main/java/google/registry/flows/EppMetrics.java index 4637a0c71..f097c16a3 100644 --- a/core/src/main/java/google/registry/flows/EppMetrics.java +++ b/core/src/main/java/google/registry/flows/EppMetrics.java @@ -88,7 +88,7 @@ public class EppMetrics { String eppStatusCode = metric.getStatus().isPresent() ? String.valueOf(metric.getStatus().get().code) : ""; eppRequestsByRegistrar.increment( - metric.getCommandName().orElse(""), metric.getClientId().orElse(""), eppStatusCode); + metric.getCommandName().orElse(""), metric.getRegistrarId().orElse(""), eppStatusCode); eppRequestsByTld.increment( metric.getCommandName().orElse(""), metric.getTld().orElse(""), eppStatusCode); } diff --git a/core/src/main/java/google/registry/flows/EppToolAction.java b/core/src/main/java/google/registry/flows/EppToolAction.java index c51d02025..40f1428d0 100644 --- a/core/src/main/java/google/registry/flows/EppToolAction.java +++ b/core/src/main/java/google/registry/flows/EppToolAction.java @@ -38,7 +38,10 @@ public class EppToolAction implements Runnable { public static final String PATH = "/_dr/epptool"; - @Inject @Parameter("clientId") String clientId; + @Inject + @Parameter("clientId") + String registrarId; + @Inject @Parameter("superuser") boolean isSuperuser; @Inject @Parameter("dryRun") boolean isDryRun; @Inject @Parameter("xml") String xml; @@ -49,8 +52,7 @@ public class EppToolAction implements Runnable { public void run() { eppRequestHandler.executeEpp( new StatelessRequestSessionMetadata( - clientId, - ProtocolDefinition.getVisibleServiceExtensionUris()), + registrarId, ProtocolDefinition.getVisibleServiceExtensionUris()), new PasswordOnlyTransportCredentials(), EppRequestSource.TOOL, isDryRun, diff --git a/core/src/main/java/google/registry/flows/ExtensionManager.java b/core/src/main/java/google/registry/flows/ExtensionManager.java index 8f393e69c..a1dbb0a02 100644 --- a/core/src/main/java/google/registry/flows/ExtensionManager.java +++ b/core/src/main/java/google/registry/flows/ExtensionManager.java @@ -26,7 +26,7 @@ import com.google.common.flogger.FluentLogger; import google.registry.flows.EppException.CommandUseErrorException; import google.registry.flows.EppException.SyntaxErrorException; import google.registry.flows.EppException.UnimplementedExtensionException; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.exceptions.OnlyToolCanPassMetadataException; import google.registry.flows.exceptions.UnauthorizedForSuperuserExtensionException; @@ -55,7 +55,7 @@ public final class ExtensionManager { @Inject EppInput eppInput; @Inject SessionMetadata sessionMetadata; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @Superuser boolean isSuperuser; @Inject Class flowClass; @Inject EppRequestSource eppRequestSource; @@ -101,7 +101,7 @@ public final class ExtensionManager { } logger.atInfo().log( "Client %s is attempting to run %s without declaring URIs %s on login", - clientId, flowClass.getSimpleName(), undeclaredUris); + registrarId, flowClass.getSimpleName(), undeclaredUris); } private static final ImmutableSet ALLOWED_METADATA_EPP_REQUEST_SOURCES = diff --git a/core/src/main/java/google/registry/flows/FlowModule.java b/core/src/main/java/google/registry/flows/FlowModule.java index aae0a55e0..2a891b666 100644 --- a/core/src/main/java/google/registry/flows/FlowModule.java +++ b/core/src/main/java/google/registry/flows/FlowModule.java @@ -164,11 +164,11 @@ public class FlowModule { @Provides @FlowScope - @ClientId - static String provideClientId(SessionMetadata sessionMetadata) { - // Treat a missing clientId as null so we can always inject a non-null value. All we do with the - // clientId is log it (as "") or detect its absence, both of which work fine with empty. - return Strings.nullToEmpty(sessionMetadata.getClientId()); + @RegistrarId + static String provideRegistrarId(SessionMetadata sessionMetadata) { + // Treat a missing registrarId as null so we can always inject a non-null value. All we do with + // the registrarId is log it (as "") or detect its absence, both of which work fine with empty. + return Strings.nullToEmpty(sessionMetadata.getRegistrarId()); } @Provides @@ -220,14 +220,14 @@ public class FlowModule { Trid trid, byte[] inputXmlBytes, boolean isSuperuser, - String clientId, + String registrarId, EppInput eppInput) { builder .setModificationTime(tm().getTransactionTime()) .setTrid(trid) .setXmlBytes(inputXmlBytes) .setBySuperuser(isSuperuser) - .setClientId(clientId); + .setRegistrarId(registrarId); Optional metadataExtension = eppInput.getSingleExtension(MetadataExtension.class); metadataExtension.ifPresent( @@ -249,10 +249,10 @@ public class FlowModule { Trid trid, @InputXml byte[] inputXmlBytes, @Superuser boolean isSuperuser, - @ClientId String clientId, + @RegistrarId String registrarId, EppInput eppInput) { return makeHistoryEntryBuilder( - new ContactHistory.Builder(), trid, inputXmlBytes, isSuperuser, clientId, eppInput); + new ContactHistory.Builder(), trid, inputXmlBytes, isSuperuser, registrarId, eppInput); } /** @@ -266,10 +266,10 @@ public class FlowModule { Trid trid, @InputXml byte[] inputXmlBytes, @Superuser boolean isSuperuser, - @ClientId String clientId, + @RegistrarId String registrarId, EppInput eppInput) { return makeHistoryEntryBuilder( - new HostHistory.Builder(), trid, inputXmlBytes, isSuperuser, clientId, eppInput); + new HostHistory.Builder(), trid, inputXmlBytes, isSuperuser, registrarId, eppInput); } /** @@ -283,10 +283,10 @@ public class FlowModule { Trid trid, @InputXml byte[] inputXmlBytes, @Superuser boolean isSuperuser, - @ClientId String clientId, + @RegistrarId String registrarId, EppInput eppInput) { return makeHistoryEntryBuilder( - new DomainHistory.Builder(), trid, inputXmlBytes, isSuperuser, clientId, eppInput); + new DomainHistory.Builder(), trid, inputXmlBytes, isSuperuser, registrarId, eppInput); } /** @@ -322,7 +322,7 @@ public class FlowModule { /** Dagger qualifier for registrar client id. */ @Qualifier @Documented - public @interface ClientId {} + public @interface RegistrarId {} /** Dagger qualifier for the target id (foreign key) for single resource flows. */ @Qualifier diff --git a/core/src/main/java/google/registry/flows/FlowReporter.java b/core/src/main/java/google/registry/flows/FlowReporter.java index 7c15e45d4..82b158cf7 100644 --- a/core/src/main/java/google/registry/flows/FlowReporter.java +++ b/core/src/main/java/google/registry/flows/FlowReporter.java @@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Streams; import com.google.common.flogger.FluentLogger; -import google.registry.flows.FlowModule.ClientId; import google.registry.flows.FlowModule.InputXml; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.annotations.ReportingSpec; import google.registry.model.eppcommon.Trid; import google.registry.model.eppinput.EppInput; @@ -45,7 +45,7 @@ public class FlowReporter { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); @Inject Trid trid; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @InputXml byte[] inputXmlBytes; @Inject EppInput eppInput; @Inject Class flowClass; @@ -64,7 +64,7 @@ public class FlowReporter { JSONValue.toJSONString( new ImmutableMap.Builder() .put("serverTrid", trid.getServerTransactionId()) - .put("clientId", clientId) + .put("clientId", registrarId) .put("commandType", eppInput.getCommandType()) .put("resourceType", eppInput.getResourceType().orElse("")) .put("flowClassName", flowClass.getSimpleName()) diff --git a/core/src/main/java/google/registry/flows/FlowRunner.java b/core/src/main/java/google/registry/flows/FlowRunner.java index 07bd5f6c0..e1859ba7c 100644 --- a/core/src/main/java/google/registry/flows/FlowRunner.java +++ b/core/src/main/java/google/registry/flows/FlowRunner.java @@ -19,9 +19,9 @@ import static google.registry.xml.XmlTransformer.prettyPrint; import com.google.common.base.Strings; import com.google.common.flogger.FluentLogger; -import google.registry.flows.FlowModule.ClientId; import google.registry.flows.FlowModule.DryRun; import google.registry.flows.FlowModule.InputXml; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.Transactional; import google.registry.flows.session.LoginFlow; @@ -38,7 +38,7 @@ public class FlowRunner { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject TransportCredentials credentials; @Inject EppRequestSource eppRequestSource; @Inject Provider flowProvider; @@ -59,7 +59,7 @@ public class FlowRunner { logger.atInfo().log( COMMAND_LOG_FORMAT, trid.getServerTransactionId(), - clientId, + registrarId, sessionMetadata, prettyXml.replace("\n", "\n\t"), credentials, @@ -74,8 +74,8 @@ public class FlowRunner { if (!isTransactional) { EppOutput eppOutput = EppOutput.create(flowProvider.get().run()); if (flowClass.equals(LoginFlow.class)) { - // In LoginFlow, clientId isn't known until after the flow executes, so save it then. - eppMetricBuilder.setClientId(sessionMetadata.getClientId()); + // In LoginFlow, registrarId isn't known until after the flow executes, so save it then. + eppMetricBuilder.setRegistrarId(sessionMetadata.getRegistrarId()); } return eppOutput; } diff --git a/core/src/main/java/google/registry/flows/FlowUtils.java b/core/src/main/java/google/registry/flows/FlowUtils.java index 5316b0f68..89c5bf7af 100644 --- a/core/src/main/java/google/registry/flows/FlowUtils.java +++ b/core/src/main/java/google/registry/flows/FlowUtils.java @@ -47,8 +47,8 @@ public final class FlowUtils { private FlowUtils() {} /** Validate that there is a logged in client. */ - public static void validateClientIsLoggedIn(String clientId) throws EppException { - if (clientId.isEmpty()) { + public static void validateRegistrarIsLoggedIn(String registrarId) throws EppException { + if (registrarId.isEmpty()) { throw new NotLoggedInException(); } } diff --git a/core/src/main/java/google/registry/flows/HttpSessionMetadata.java b/core/src/main/java/google/registry/flows/HttpSessionMetadata.java index 4a366e285..5b171b737 100644 --- a/core/src/main/java/google/registry/flows/HttpSessionMetadata.java +++ b/core/src/main/java/google/registry/flows/HttpSessionMetadata.java @@ -25,7 +25,7 @@ import javax.servlet.http.HttpSession; /** A metadata class that is a wrapper around {@link HttpSession}. */ public class HttpSessionMetadata implements SessionMetadata { - private static final String CLIENT_ID = "CLIENT_ID"; + private static final String REGISTRAR_ID = "REGISTRAR_ID"; private static final String SERVICE_EXTENSIONS = "SERVICE_EXTENSIONS"; private static final String FAILED_LOGIN_ATTEMPTS = "FAILED_LOGIN_ATTEMPTS"; @@ -41,8 +41,8 @@ public class HttpSessionMetadata implements SessionMetadata { } @Override - public String getClientId() { - return (String) session.getAttribute(CLIENT_ID); + public String getRegistrarId() { + return (String) session.getAttribute(REGISTRAR_ID); } @Override @@ -57,8 +57,8 @@ public class HttpSessionMetadata implements SessionMetadata { } @Override - public void setClientId(String clientId) { - session.setAttribute(CLIENT_ID, clientId); + public void setRegistrarId(String registrarId) { + session.setAttribute(REGISTRAR_ID, registrarId); } @Override @@ -79,7 +79,7 @@ public class HttpSessionMetadata implements SessionMetadata { @Override public String toString() { return toStringHelper(getClass()) - .add("clientId", getClientId()) + .add("clientId", getRegistrarId()) .add("failedLoginAttempts", getFailedLoginAttempts()) .add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris()))) .toString(); diff --git a/core/src/main/java/google/registry/flows/ResourceFlowUtils.java b/core/src/main/java/google/registry/flows/ResourceFlowUtils.java index f277ec902..6364df7dc 100644 --- a/core/src/main/java/google/registry/flows/ResourceFlowUtils.java +++ b/core/src/main/java/google/registry/flows/ResourceFlowUtils.java @@ -69,10 +69,10 @@ public final class ResourceFlowUtils { */ private static final int FAILFAST_CHECK_COUNT = 5; - /** Check that the given clientId corresponds to the owner of given resource. */ - public static void verifyResourceOwnership(String myClientId, EppResource resource) + /** Check that the given registrarId corresponds to the owner of given resource. */ + public static void verifyResourceOwnership(String myRegistrarId, EppResource resource) throws EppException { - if (!myClientId.equals(resource.getPersistedCurrentSponsorClientId())) { + if (!myRegistrarId.equals(resource.getPersistedCurrentSponsorRegistrarId())) { throw new ResourceNotOwnedException(); } } @@ -138,8 +138,8 @@ public final class ResourceFlowUtils { } public static void verifyTransferInitiator( - String clientId, R resource) throws NotTransferInitiatorException { - if (!resource.getTransferData().getGainingClientId().equals(clientId)) { + String registrarId, R resource) throws NotTransferInitiatorException { + if (!resource.getTransferData().getGainingRegistrarId().equals(registrarId)) { throw new NotTransferInitiatorException(); } } @@ -155,12 +155,12 @@ public final class ResourceFlowUtils { } public static void verifyResourceDoesNotExist( - Class clazz, String targetId, DateTime now, String clientId) throws EppException { + Class clazz, String targetId, DateTime now, String registrarId) throws EppException { VKey key = loadAndGetKey(clazz, targetId, now); if (key != null) { R resource = tm().loadByKey(key); // These are similar exceptions, but we can track them internally as log-based metrics. - if (Objects.equals(clientId, resource.getPersistedCurrentSponsorClientId())) { + if (Objects.equals(registrarId, resource.getPersistedCurrentSponsorRegistrarId())) { throw new ResourceAlreadyExistsForThisClientException(targetId); } else { throw new ResourceCreateContentionException(targetId); diff --git a/core/src/main/java/google/registry/flows/SessionMetadata.java b/core/src/main/java/google/registry/flows/SessionMetadata.java index 106f6f965..c9c8cd3b5 100644 --- a/core/src/main/java/google/registry/flows/SessionMetadata.java +++ b/core/src/main/java/google/registry/flows/SessionMetadata.java @@ -26,13 +26,13 @@ public interface SessionMetadata { */ void invalidate(); - String getClientId(); + String getRegistrarId(); Set getServiceExtensionUris(); int getFailedLoginAttempts(); - void setClientId(String clientId); + void setRegistrarId(String registrarId); void setServiceExtensionUris(Set serviceExtensionUris); diff --git a/core/src/main/java/google/registry/flows/StatelessRequestSessionMetadata.java b/core/src/main/java/google/registry/flows/StatelessRequestSessionMetadata.java index 17231e7e2..5b237665a 100644 --- a/core/src/main/java/google/registry/flows/StatelessRequestSessionMetadata.java +++ b/core/src/main/java/google/registry/flows/StatelessRequestSessionMetadata.java @@ -25,12 +25,12 @@ import java.util.Set; /** A read-only {@link SessionMetadata} that doesn't support login/logout. */ public class StatelessRequestSessionMetadata implements SessionMetadata { - private final String clientId; + private final String registrarId; private final ImmutableSet serviceExtensionUris; public StatelessRequestSessionMetadata( - String clientId, ImmutableSet serviceExtensionUris) { - this.clientId = checkNotNull(clientId); + String registrarId, ImmutableSet serviceExtensionUris) { + this.registrarId = checkNotNull(registrarId); this.serviceExtensionUris = checkNotNull(serviceExtensionUris); } @@ -40,8 +40,8 @@ public class StatelessRequestSessionMetadata implements SessionMetadata { } @Override - public String getClientId() { - return clientId; + public String getRegistrarId() { + return registrarId; } @Override @@ -55,7 +55,7 @@ public class StatelessRequestSessionMetadata implements SessionMetadata { } @Override - public void setClientId(String clientId) { + public void setRegistrarId(String registrarId) { throw new UnsupportedOperationException(); } @@ -77,7 +77,7 @@ public class StatelessRequestSessionMetadata implements SessionMetadata { @Override public String toString() { return toStringHelper(getClass()) - .add("clientId", getClientId()) + .add("clientId", getRegistrarId()) .add("failedLoginAttempts", getFailedLoginAttempts()) .add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris()))) .toString(); diff --git a/core/src/main/java/google/registry/flows/TlsCredentials.java b/core/src/main/java/google/registry/flows/TlsCredentials.java index c4234a0fe..80b754afb 100644 --- a/core/src/main/java/google/registry/flows/TlsCredentials.java +++ b/core/src/main/java/google/registry/flows/TlsCredentials.java @@ -97,7 +97,7 @@ public class TlsCredentials implements TransportCredentials { if (ipAddressAllowList.isEmpty()) { logger.atInfo().log( "Skipping IP allow list check because %s doesn't have an IP allow list.", - registrar.getClientId()); + registrar.getRegistrarId()); return; } // In the rare unexpected case that the client inet address wasn't passed along at all, then @@ -113,7 +113,7 @@ public class TlsCredentials implements TransportCredentials { logger.atInfo().log( "Authentication error: IP address %s is not allow-listed for registrar %s; allow list is:" + " %s", - clientInetAddr, registrar.getClientId(), ipAddressAllowList); + clientInetAddr, registrar.getRegistrarId(), ipAddressAllowList); throw new BadRegistrarIpAddressException(); } @@ -132,7 +132,8 @@ public class TlsCredentials implements TransportCredentials { // Check that the request included the certificate hash if (!clientCertificateHash.isPresent()) { logger.atInfo().log( - "Request from registrar %s did not include X-SSL-Certificate.", registrar.getClientId()); + "Request from registrar %s did not include X-SSL-Certificate.", + registrar.getRegistrarId()); throw new MissingRegistrarCertificateException(); } // Check if the certificate hash is equal to the one on file for the registrar. @@ -141,7 +142,7 @@ public class TlsCredentials implements TransportCredentials { logger.atWarning().log( "Non-matching certificate hash (%s) for %s, wanted either %s or %s.", clientCertificateHash, - registrar.getClientId(), + registrar.getRegistrarId(), registrar.getClientCertificateHash(), registrar.getFailoverClientCertificateHash()); throw new BadRegistrarCertificateException(); @@ -156,7 +157,7 @@ public class TlsCredentials implements TransportCredentials { } catch (InsecureCertificateException e) { logger.atWarning().log( "Registrar certificate used for %s does not meet certificate requirements: %s", - registrar.getClientId(), e.getMessage()); + registrar.getRegistrarId(), e.getMessage()); throw new CertificateContainsSecurityViolationsException(e); } } diff --git a/core/src/main/java/google/registry/flows/contact/ContactCheckFlow.java b/core/src/main/java/google/registry/flows/contact/ContactCheckFlow.java index 07fe57708..78db93ccc 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactCheckFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactCheckFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount; import static google.registry.model.EppResourceUtils.checkResourcesExist; @@ -24,7 +24,7 @@ import google.registry.config.RegistryConfig.Config; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.annotations.ReportingSpec; import google.registry.model.contact.ContactCommand.Check; import google.registry.model.contact.ContactResource; @@ -47,7 +47,7 @@ import javax.inject.Inject; public final class ContactCheckFlow implements Flow { @Inject ResourceCommand resourceCommand; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject ExtensionManager extensionManager; @Inject Clock clock; @Inject @Config("maxChecks") int maxChecks; @@ -57,7 +57,7 @@ public final class ContactCheckFlow implements Flow { @Override public final EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); ImmutableList targetIds = ((Check) resourceCommand).getTargetIds(); verifyTargetIdCount(targetIds, maxChecks); ImmutableSet existingIds = diff --git a/core/src/main/java/google/registry/flows/contact/ContactCreateFlow.java b/core/src/main/java/google/registry/flows/contact/ContactCreateFlow.java index 10d13a4c4..c8931935b 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactCreateFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactCreateFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist; import static google.registry.flows.contact.ContactFlowUtils.validateAsciiPostalInfo; import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy; @@ -27,7 +27,7 @@ import com.googlecode.objectify.Key; import google.registry.config.RegistryConfig.Config; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; @@ -60,7 +60,7 @@ public final class ContactCreateFlow implements TransactionalFlow { @Inject ResourceCommand resourceCommand; @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject ContactHistory.Builder historyBuilder; @Inject EppResponse.Builder responseBuilder; @@ -71,16 +71,16 @@ public final class ContactCreateFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); Create command = (Create) resourceCommand; DateTime now = tm().getTransactionTime(); - verifyResourceDoesNotExist(ContactResource.class, targetId, now, clientId); + verifyResourceDoesNotExist(ContactResource.class, targetId, now, registrarId); ContactResource newContact = new ContactResource.Builder() .setContactId(targetId) .setAuthInfo(command.getAuthInfo()) - .setCreationClientId(clientId) - .setPersistedCurrentSponsorClientId(clientId) + .setCreationRegistrarId(registrarId) + .setPersistedCurrentSponsorRegistrarId(registrarId) .setRepoId(createRepoId(allocateId(), roidSuffix)) .setFaxNumber(command.getFax()) .setVoiceNumber(command.getVoice()) diff --git a/core/src/main/java/google/registry/flows/contact/ContactDeleteFlow.java b/core/src/main/java/google/registry/flows/contact/ContactDeleteFlow.java index c0764e576..b2129a546 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactDeleteFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactDeleteFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.checkLinkedDomains; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; @@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableSet; import google.registry.batch.AsyncTaskEnqueuer; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -75,7 +75,7 @@ public final class ContactDeleteFlow implements TransactionalFlow { StatusValue.SERVER_DELETE_PROHIBITED); @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Trid trid; @Inject @Superuser boolean isSuperuser; @@ -91,21 +91,21 @@ public final class ContactDeleteFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); checkLinkedDomains(targetId, now, ContactResource.class, DomainBase::getReferencedContacts); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES); verifyOptionalAuthInfo(authInfo, existingContact); if (!isSuperuser) { - verifyResourceOwnership(clientId, existingContact); + verifyResourceOwnership(registrarId, existingContact); } Type historyEntryType; Code resultCode; ContactResource newContact; if (tm().isOfy()) { asyncTaskEnqueuer.enqueueAsyncDelete( - existingContact, tm().getTransactionTime(), clientId, trid, isSuperuser); + existingContact, tm().getTransactionTime(), registrarId, trid, isSuperuser); newContact = existingContact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build(); historyEntryType = Type.CONTACT_PENDING_DELETE; resultCode = SUCCESS_WITH_ACTION_PENDING; @@ -113,7 +113,7 @@ public final class ContactDeleteFlow implements TransactionalFlow { // Handle pending transfers on contact deletion. newContact = existingContact.getStatusValues().contains(StatusValue.PENDING_TRANSFER) - ? denyPendingTransfer(existingContact, SERVER_CANCELLED, now, clientId) + ? denyPendingTransfer(existingContact, SERVER_CANCELLED, now, registrarId) : existingContact; // Wipe out PII on contact deletion. newContact = diff --git a/core/src/main/java/google/registry/flows/contact/ContactFlowUtils.java b/core/src/main/java/google/registry/flows/contact/ContactFlowUtils.java index d039670fb..870e9641d 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactFlowUtils.java +++ b/core/src/main/java/google/registry/flows/contact/ContactFlowUtils.java @@ -73,7 +73,7 @@ public class ContactFlowUtils { DateTime now, Key contactHistoryKey) { return new PollMessage.OneTime.Builder() - .setClientId(transferData.getGainingClientId()) + .setRegistrarId(transferData.getGainingRegistrarId()) .setEventTime(transferData.getPendingTransferExpirationTime()) .setMsg(transferData.getTransferStatus().getMessage()) .setResponseData( @@ -92,7 +92,7 @@ public class ContactFlowUtils { static PollMessage createLosingTransferPollMessage( String targetId, TransferData transferData, Key contactHistoryKey) { return new PollMessage.OneTime.Builder() - .setClientId(transferData.getLosingClientId()) + .setRegistrarId(transferData.getLosingRegistrarId()) .setEventTime(transferData.getPendingTransferExpirationTime()) .setMsg(transferData.getTransferStatus().getMessage()) .setResponseData(ImmutableList.of(createTransferResponse(targetId, transferData))) @@ -105,8 +105,8 @@ public class ContactFlowUtils { String targetId, TransferData transferData) { return new ContactTransferResponse.Builder() .setContactId(targetId) - .setGainingClientId(transferData.getGainingClientId()) - .setLosingClientId(transferData.getLosingClientId()) + .setGainingRegistrarId(transferData.getGainingRegistrarId()) + .setLosingRegistrarId(transferData.getLosingRegistrarId()) .setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime()) .setTransferRequestTime(transferData.getTransferRequestTime()) .setTransferStatus(transferData.getTransferStatus()) diff --git a/core/src/main/java/google/registry/flows/contact/ContactInfoFlow.java b/core/src/main/java/google/registry/flows/contact/ContactInfoFlow.java index 2364564b3..0c9b21a03 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactInfoFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactInfoFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership; import static google.registry.model.EppResourceUtils.isLinked; @@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableSet; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.annotations.ReportingSpec; @@ -54,7 +54,7 @@ public final class ContactInfoFlow implements Flow { @Inject ExtensionManager extensionManager; @Inject Clock clock; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Optional authInfo; @Inject @Superuser boolean isSuperuser; @@ -67,13 +67,13 @@ public final class ContactInfoFlow implements Flow { public final EppResponse run() throws EppException { DateTime now = clock.nowUtc(); extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); ContactResource contact = loadAndVerifyExistence(ContactResource.class, targetId, now); if (!isSuperuser) { - verifyResourceOwnership(clientId, contact); + verifyResourceOwnership(registrarId, contact); } boolean includeAuthInfo = - clientId.equals(contact.getCurrentSponsorClientId()) || authInfo.isPresent(); + registrarId.equals(contact.getCurrentSponsorRegistrarId()) || authInfo.isPresent(); ImmutableSet.Builder statusValues = new ImmutableSet.Builder<>(); statusValues.addAll(contact.getStatusValues()); if (isLinked(contact.createVKey(), now)) { @@ -89,10 +89,10 @@ public final class ContactInfoFlow implements Flow { .setVoiceNumber(contact.getVoiceNumber()) .setFaxNumber(contact.getFaxNumber()) .setEmailAddress(contact.getEmailAddress()) - .setCurrentSponsorClientId(contact.getCurrentSponsorClientId()) - .setCreationClientId(contact.getCreationClientId()) + .setCurrentSponsorClientId(contact.getCurrentSponsorRegistrarId()) + .setCreationClientId(contact.getCreationRegistrarId()) .setCreationTime(contact.getCreationTime()) - .setLastEppUpdateClientId(contact.getLastEppUpdateClientId()) + .setLastEppUpdateClientId(contact.getLastEppUpdateRegistrarId()) .setLastEppUpdateTime(contact.getLastEppUpdateTime()) .setLastTransferTime(contact.getLastTransferTime()) .setAuthInfo(includeAuthInfo ? contact.getAuthInfo() : null) diff --git a/core/src/main/java/google/registry/flows/contact/ContactTransferApproveFlow.java b/core/src/main/java/google/registry/flows/contact/ContactTransferApproveFlow.java index 437c23ac8..6b28d61fd 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactTransferApproveFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactTransferApproveFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; @@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Key; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; @@ -64,7 +64,7 @@ public final class ContactTransferApproveFlow implements TransactionalFlow { @Inject ResourceCommand resourceCommand; @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Optional authInfo; @Inject ContactHistory.Builder historyBuilder; @@ -79,12 +79,12 @@ public final class ContactTransferApproveFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); verifyOptionalAuthInfo(authInfo, existingContact); verifyHasPendingTransfer(existingContact); - verifyResourceOwnership(clientId, existingContact); + verifyResourceOwnership(registrarId, existingContact); ContactResource newContact = approvePendingTransfer(existingContact, TransferStatus.CLIENT_APPROVED, now); ContactHistory contactHistory = diff --git a/core/src/main/java/google/registry/flows/contact/ContactTransferCancelFlow.java b/core/src/main/java/google/registry/flows/contact/ContactTransferCancelFlow.java index c6ceb6049..16382ed68 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactTransferCancelFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactTransferCancelFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; @@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Key; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; @@ -65,7 +65,7 @@ public final class ContactTransferCancelFlow implements TransactionalFlow { @Inject ResourceCommand resourceCommand; @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject ContactHistory.Builder historyBuilder; @Inject EppResponse.Builder responseBuilder; @@ -75,14 +75,14 @@ public final class ContactTransferCancelFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); verifyOptionalAuthInfo(authInfo, existingContact); verifyHasPendingTransfer(existingContact); - verifyTransferInitiator(clientId, existingContact); + verifyTransferInitiator(registrarId, existingContact); ContactResource newContact = - denyPendingTransfer(existingContact, TransferStatus.CLIENT_CANCELLED, now, clientId); + denyPendingTransfer(existingContact, TransferStatus.CLIENT_CANCELLED, now, registrarId); ContactHistory contactHistory = historyBuilder.setType(CONTACT_TRANSFER_CANCEL).setContact(newContact).build(); // Create a poll message for the losing client. diff --git a/core/src/main/java/google/registry/flows/contact/ContactTransferQueryFlow.java b/core/src/main/java/google/registry/flows/contact/ContactTransferQueryFlow.java index 416a3d533..f991a2a8d 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactTransferQueryFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactTransferQueryFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse; @@ -22,7 +22,7 @@ import static google.registry.flows.contact.ContactFlowUtils.createTransferRespo import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.exceptions.NoTransferHistoryToQueryException; @@ -55,7 +55,7 @@ public final class ContactTransferQueryFlow implements Flow { @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Clock clock; @Inject EppResponse.Builder responseBuilder; @@ -64,7 +64,7 @@ public final class ContactTransferQueryFlow implements Flow { @Override public final EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); ContactResource contact = loadAndVerifyExistence(ContactResource.class, targetId, clock.nowUtc()); verifyOptionalAuthInfo(authInfo, contact); @@ -76,8 +76,8 @@ public final class ContactTransferQueryFlow implements Flow { // Note that the authorization info on the command (if present) has already been verified. If // it's present, then the other checks are unnecessary. if (!authInfo.isPresent() - && !clientId.equals(contact.getTransferData().getGainingClientId()) - && !clientId.equals(contact.getTransferData().getLosingClientId())) { + && !registrarId.equals(contact.getTransferData().getGainingRegistrarId()) + && !registrarId.equals(contact.getTransferData().getLosingRegistrarId())) { throw new NotAuthorizedToViewTransferException(); } return responseBuilder diff --git a/core/src/main/java/google/registry/flows/contact/ContactTransferRejectFlow.java b/core/src/main/java/google/registry/flows/contact/ContactTransferRejectFlow.java index 6789e791f..30173c80b 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactTransferRejectFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactTransferRejectFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.contact; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; @@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Key; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; @@ -63,7 +63,7 @@ public final class ContactTransferRejectFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject ContactHistory.Builder historyBuilder; @Inject EppResponse.Builder responseBuilder; @@ -73,14 +73,14 @@ public final class ContactTransferRejectFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); verifyOptionalAuthInfo(authInfo, existingContact); verifyHasPendingTransfer(existingContact); - verifyResourceOwnership(clientId, existingContact); + verifyResourceOwnership(registrarId, existingContact); ContactResource newContact = - denyPendingTransfer(existingContact, TransferStatus.CLIENT_REJECTED, now, clientId); + denyPendingTransfer(existingContact, TransferStatus.CLIENT_REJECTED, now, registrarId); ContactHistory contactHistory = historyBuilder.setType(CONTACT_TRANSFER_REJECT).setContact(newContact).build(); PollMessage gainingPollMessage = diff --git a/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java b/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java index 29b075849..163caa97a 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java @@ -15,7 +15,7 @@ package google.registry.flows.contact; import static google.registry.flows.FlowUtils.createHistoryKey; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyAuthInfoPresentForResourceTransfer; @@ -32,7 +32,7 @@ import com.googlecode.objectify.Key; import google.registry.config.RegistryConfig.Config; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; @@ -80,7 +80,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String gainingClientId; + @Inject @RegistrarId String gainingClientId; @Inject @TargetId String targetId; @Inject @Config("contactAutomaticTransferLength") Duration automaticTransferLength; @@ -93,7 +93,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(gainingClientId); + validateRegistrarIsLoggedIn(gainingClientId); DateTime now = tm().getTransactionTime(); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); verifyAuthInfoPresentForResourceTransfer(authInfo); @@ -102,7 +102,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow { if (TransferStatus.PENDING.equals(existingContact.getTransferData().getTransferStatus())) { throw new AlreadyPendingTransferException(targetId); } - String losingClientId = existingContact.getCurrentSponsorClientId(); + String losingClientId = existingContact.getCurrentSponsorRegistrarId(); // Verify that this client doesn't already sponsor this resource. if (gainingClientId.equals(losingClientId)) { throw new ObjectAlreadySponsoredException(); @@ -114,8 +114,8 @@ public final class ContactTransferRequestFlow implements TransactionalFlow { new ContactTransferData.Builder() .setTransferRequestTime(now) .setTransferRequestTrid(trid) - .setGainingClientId(gainingClientId) - .setLosingClientId(losingClientId) + .setGainingRegistrarId(gainingClientId) + .setLosingRegistrarId(losingClientId) .setPendingTransferExpirationTime(transferExpirationTime) .setTransferStatus(TransferStatus.SERVER_APPROVED) .build(); diff --git a/core/src/main/java/google/registry/flows/contact/ContactUpdateFlow.java b/core/src/main/java/google/registry/flows/contact/ContactUpdateFlow.java index bfca805d6..b93e15b2e 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactUpdateFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactUpdateFlow.java @@ -15,7 +15,7 @@ package google.registry.flows.contact; import static com.google.common.collect.Sets.union; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.checkSameValuesNotAddedAndRemoved; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable; @@ -30,7 +30,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import com.google.common.collect.ImmutableSet; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -79,7 +79,7 @@ public final class ContactUpdateFlow implements TransactionalFlow { @Inject ResourceCommand resourceCommand; @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject ContactHistory.Builder historyBuilder; @@ -90,7 +90,7 @@ public final class ContactUpdateFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); Update command = (Update) resourceCommand; DateTime now = tm().getTransactionTime(); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); @@ -98,7 +98,7 @@ public final class ContactUpdateFlow implements TransactionalFlow { ImmutableSet statusToRemove = command.getInnerRemove().getStatusValues(); ImmutableSet statusesToAdd = command.getInnerAdd().getStatusValues(); if (!isSuperuser) { // The superuser can update any contact and set any status. - verifyResourceOwnership(clientId, existingContact); + verifyResourceOwnership(registrarId, existingContact); verifyAllStatusesAreClientSettable(union(statusesToAdd, statusToRemove)); } verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES); @@ -125,17 +125,18 @@ public final class ContactUpdateFlow implements TransactionalFlow { builder.setInternationalizedPostalInfo(null); } } - ContactResource newContact = builder - .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(clientId) - .setAuthInfo(preferFirst(change.getAuthInfo(), existingContact.getAuthInfo())) - .setDisclose(preferFirst(change.getDisclose(), existingContact.getDisclose())) - .setEmailAddress(preferFirst(change.getEmail(), existingContact.getEmailAddress())) - .setFaxNumber(preferFirst(change.getFax(), existingContact.getFaxNumber())) - .setVoiceNumber(preferFirst(change.getVoice(), existingContact.getVoiceNumber())) - .addStatusValues(statusesToAdd) - .removeStatusValues(statusToRemove) - .build(); + ContactResource newContact = + builder + .setLastEppUpdateTime(now) + .setLastEppUpdateRegistrarId(registrarId) + .setAuthInfo(preferFirst(change.getAuthInfo(), existingContact.getAuthInfo())) + .setDisclose(preferFirst(change.getDisclose(), existingContact.getDisclose())) + .setEmailAddress(preferFirst(change.getEmail(), existingContact.getEmailAddress())) + .setFaxNumber(preferFirst(change.getFax(), existingContact.getFaxNumber())) + .setVoiceNumber(preferFirst(change.getVoice(), existingContact.getVoiceNumber())) + .addStatusValues(statusesToAdd) + .removeStatusValues(statusToRemove) + .build(); // If the resource is marked with clientUpdateProhibited, and this update did not clear that // status, then the update must be disallowed (unless a superuser is requesting the change). if (!isSuperuser diff --git a/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java b/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java index 38f08d9b7..264c036d5 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java @@ -17,7 +17,7 @@ package google.registry.flows.domain; import static com.google.common.base.Strings.emptyToNull; import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.ImmutableMap.toImmutableMap; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount; import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld; import static google.registry.flows.domain.DomainFlowUtils.getReservationTypes; @@ -41,7 +41,7 @@ import google.registry.flows.EppException; import google.registry.flows.EppException.ParameterValuePolicyErrorException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.custom.DomainCheckFlowCustomLogic; @@ -113,7 +113,7 @@ public final class DomainCheckFlow implements Flow { @Inject ResourceCommand resourceCommand; @Inject ExtensionManager extensionManager; @Inject EppInput eppInput; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @Config("maxChecks") @@ -135,7 +135,7 @@ public final class DomainCheckFlow implements Flow { FeeCheckCommandExtension.class, LaunchCheckExtension.class, AllocationTokenExtension.class); flowCustomLogic.beforeValidation(); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); ImmutableList domainNames = ((Check) resourceCommand).getTargetIds(); verifyTargetIdCount(domainNames, maxChecks); DateTime now = clock.nowUtc(); @@ -151,7 +151,7 @@ public final class DomainCheckFlow implements Flow { String tld = parsedDomain.parent().toString(); boolean tldFirstTimeSeen = seenTlds.add(tld); if (tldFirstTimeSeen && !isSuperuser) { - checkAllowedAccessToTld(clientId, tld); + checkAllowedAccessToTld(registrarId, tld); verifyNotInPredelegation(Registry.get(tld), now); } } @@ -172,7 +172,7 @@ public final class DomainCheckFlow implements Flow { allocationTokenFlowUtils.checkDomainsWithToken( ImmutableList.copyOf(parsedDomains.values()), tokenExtension.getAllocationToken(), - clientId, + registrarId, now)); ImmutableList.Builder checksBuilder = new ImmutableList.Builder<>(); diff --git a/core/src/main/java/google/registry/flows/domain/DomainClaimsCheckFlow.java b/core/src/main/java/google/registry/flows/domain/DomainClaimsCheckFlow.java index 5ba0d323a..d64399e48 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainClaimsCheckFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainClaimsCheckFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.domain; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount; import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld; import static google.registry.flows.domain.DomainFlowUtils.validateDomainName; @@ -31,7 +31,7 @@ import google.registry.flows.EppException; import google.registry.flows.EppException.CommandUseErrorException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.annotations.ReportingSpec; import google.registry.model.domain.DomainCommand.Check; @@ -69,7 +69,7 @@ public final class DomainClaimsCheckFlow implements Flow { @Inject ExtensionManager extensionManager; @Inject EppInput eppInput; @Inject ResourceCommand resourceCommand; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @Superuser boolean isSuperuser; @Inject Clock clock; @Inject @Config("maxChecks") int maxChecks; @@ -82,7 +82,7 @@ public final class DomainClaimsCheckFlow implements Flow { public EppResponse run() throws EppException { extensionManager.register(LaunchCheckExtension.class, AllocationTokenExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); if (eppInput.getSingleExtension(AllocationTokenExtension.class).isPresent()) { throw new DomainClaimsCheckNotAllowedWithAllocationTokens(); } @@ -97,7 +97,7 @@ public final class DomainClaimsCheckFlow implements Flow { // Only validate access to a TLD the first time it is encountered. if (seenTlds.add(tld)) { if (!isSuperuser) { - checkAllowedAccessToTld(clientId, tld); + checkAllowedAccessToTld(registrarId, tld); Registry registry = Registry.get(tld); DateTime now = clock.nowUtc(); verifyNotInPredelegation(registry, now); diff --git a/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java b/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java index 46415b94d..ec4c55f61 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java @@ -16,7 +16,7 @@ package google.registry.flows.domain; import static com.google.common.collect.ImmutableSet.toImmutableSet; import static google.registry.flows.FlowUtils.persistEntityChanges; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist; import static google.registry.flows.domain.DomainFlowUtils.COLLISION_MESSAGE; import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld; @@ -62,7 +62,7 @@ import google.registry.flows.EppException; import google.registry.flows.EppException.CommandUseErrorException; import google.registry.flows.EppException.ParameterValuePolicyErrorException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -204,7 +204,7 @@ public class DomainCreateFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject EppInput eppInput; @Inject ResourceCommand resourceCommand; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -226,15 +226,15 @@ public class DomainCreateFlow implements TransactionalFlow { AllocationTokenExtension.class); flowCustomLogic.beforeValidation(); extensionManager.validate(); - validateClientIsLoggedIn(clientId); - verifyRegistrarIsActive(clientId); + validateRegistrarIsLoggedIn(registrarId); + verifyRegistrarIsActive(registrarId); DateTime now = tm().getTransactionTime(); DomainCommand.Create command = cloneAndLinkReferences((Create) resourceCommand, now); Period period = command.getPeriod(); verifyUnitIsYears(period); int years = period.getValue(); validateRegistrationPeriod(years); - verifyResourceDoesNotExist(DomainBase.class, targetId, now, clientId); + verifyResourceDoesNotExist(DomainBase.class, targetId, now, registrarId); // Validate that this is actually a legal domain name on a TLD that the registrar has access to. InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName()); String domainLabel = domainName.parts().get(0); @@ -252,7 +252,7 @@ public class DomainCreateFlow implements TransactionalFlow { } boolean isSunriseCreate = hasSignedMarks && (tldState == START_DATE_SUNRISE); Optional allocationToken = - verifyAllocationTokenIfPresent(command, registry, clientId, now); + verifyAllocationTokenIfPresent(command, registry, registrarId, now); boolean isAnchorTenant = isAnchorTenant( domainName, allocationToken, eppInput.getSingleExtension(MetadataExtension.class)); @@ -261,7 +261,7 @@ public class DomainCreateFlow implements TransactionalFlow { // notice without specifying a claims key, ignore the registry phase, and override blocks on // registering premium domains. if (!isSuperuser) { - checkAllowedAccessToTld(clientId, registry.getTldStr()); + checkAllowedAccessToTld(registrarId, registry.getTldStr()); boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken); verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, isValidReservedCreate, hasSignedMarks); if (launchCreate.isPresent()) { @@ -276,7 +276,7 @@ public class DomainCreateFlow implements TransactionalFlow { if (now.isBefore(registry.getClaimsPeriodEnd())) { verifyClaimsNoticeIfAndOnlyIfNeeded(domainName, hasSignedMarks, hasClaimsNotice); } - verifyPremiumNameIsNotBlocked(targetId, now, clientId); + verifyPremiumNameIsNotBlocked(targetId, now, registrarId); verifySignedMarkOnlyInSunrise(hasSignedMarks, tldState); } String signedMarkId = null; @@ -338,8 +338,8 @@ public class DomainCreateFlow implements TransactionalFlow { : ImmutableSet.of(); DomainBase domain = new DomainBase.Builder() - .setCreationClientId(clientId) - .setPersistedCurrentSponsorClientId(clientId) + .setCreationRegistrarId(registrarId) + .setPersistedCurrentSponsorRegistrarId(registrarId) .setRepoId(repoId) .setIdnTableName(validateDomainNameWithIdnTables(domainName)) .setRegistrationExpirationTime(registrationExpirationTime) @@ -361,7 +361,7 @@ public class DomainCreateFlow implements TransactionalFlow { buildDomainHistory(domain, registry, now, period, registry.getAddGracePeriodLength()); if (reservationTypes.contains(NAME_COLLISION)) { entitiesToSave.add( - createNameCollisionOneTimePollMessage(targetId, domainHistory, clientId, now)); + createNameCollisionOneTimePollMessage(targetId, domainHistory, registrarId, now)); } entitiesToSave.add( domain, @@ -472,14 +472,14 @@ public class DomainCreateFlow implements TransactionalFlow { /** Verifies and returns the allocation token if one is specified, otherwise does nothing. */ private Optional verifyAllocationTokenIfPresent( - DomainCommand.Create command, Registry registry, String clientId, DateTime now) + DomainCommand.Create command, Registry registry, String registrarId, DateTime now) throws EppException { Optional extension = eppInput.getSingleExtension(AllocationTokenExtension.class); return Optional.ofNullable( extension.isPresent() ? allocationTokenFlowUtils.loadTokenAndValidateDomainCreate( - command, extension.get().getAllocationToken(), registry, clientId, now) + command, extension.get().getAllocationToken(), registry, registrarId, now) : null); } @@ -524,7 +524,7 @@ public class DomainCreateFlow implements TransactionalFlow { return new BillingEvent.OneTime.Builder() .setReason(Reason.CREATE) .setTargetId(targetId) - .setClientId(clientId) + .setRegistrarId(registrarId) .setPeriodYears(years) .setCost(feesAndCredits.getCreateCost()) .setEventTime(now) @@ -545,7 +545,7 @@ public class DomainCreateFlow implements TransactionalFlow { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(targetId) - .setClientId(clientId) + .setRegistrarId(registrarId) .setEventTime(registrationExpirationTime) .setRecurrenceEndTime(END_OF_TIME) .setParent(domainHistoryKey) @@ -556,7 +556,7 @@ public class DomainCreateFlow implements TransactionalFlow { Key domainHistoryKey, DateTime registrationExpirationTime) { return new PollMessage.Autorenew.Builder() .setTargetId(targetId) - .setClientId(clientId) + .setRegistrarId(registrarId) .setEventTime(registrationExpirationTime) .setMsg("Domain was auto-renewed.") .setParentKey(domainHistoryKey) @@ -568,7 +568,7 @@ public class DomainCreateFlow implements TransactionalFlow { return new BillingEvent.OneTime.Builder() .setReason(Reason.FEE_EARLY_ACCESS) .setTargetId(createBillingEvent.getTargetId()) - .setClientId(createBillingEvent.getClientId()) + .setRegistrarId(createBillingEvent.getRegistrarId()) .setPeriodYears(1) .setCost(feesAndCredits.getEapCost()) .setEventTime(createBillingEvent.getEventTime()) @@ -579,9 +579,12 @@ public class DomainCreateFlow implements TransactionalFlow { } private static PollMessage.OneTime createNameCollisionOneTimePollMessage( - String fullyQualifiedDomainName, HistoryEntry historyEntry, String clientId, DateTime now) { + String fullyQualifiedDomainName, + HistoryEntry historyEntry, + String registrarId, + DateTime now) { return new PollMessage.OneTime.Builder() - .setClientId(clientId) + .setRegistrarId(registrarId) .setEventTime(now) .setMsg(COLLISION_MESSAGE) // Remind the registrar of the name collision policy. .setResponseData( diff --git a/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java b/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java index 822020fb5..29c50d870 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java @@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Strings.isNullOrEmpty; import static google.registry.flows.FlowUtils.createHistoryKey; import static google.registry.flows.FlowUtils.persistEntityChanges; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; @@ -50,7 +50,7 @@ import google.registry.dns.DnsQueue; import google.registry.flows.EppException; import google.registry.flows.EppException.AssociationProhibitsOperationException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.SessionMetadata; @@ -124,7 +124,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { @Inject EppInput eppInput; @Inject SessionMetadata sessionMetadata; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -141,7 +141,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { MetadataExtension.class, SecDnsCreateExtension.class, DomainDeleteSuperuserExtension.class); flowCustomLogic.beforeValidation(); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); // Loads the target resource if it exists DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); @@ -153,12 +153,12 @@ public final class DomainDeleteFlow implements TransactionalFlow { DomainBase.Builder builder; if (existingDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { builder = - denyPendingTransfer(existingDomain, TransferStatus.SERVER_CANCELLED, now, clientId) + denyPendingTransfer(existingDomain, TransferStatus.SERVER_CANCELLED, now, registrarId) .asBuilder(); } else { builder = existingDomain.asBuilder(); } - builder.setLastEppUpdateTime(now).setLastEppUpdateClientId(clientId); + builder.setLastEppUpdateTime(now).setLastEppUpdateRegistrarId(registrarId); Duration redemptionGracePeriodLength = registry.getRedemptionGracePeriodLength(); Duration pendingDeleteLength = registry.getPendingDeleteLength(); Optional domainDeleteSuperuserExtension = @@ -199,7 +199,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { GracePeriodStatus.REDEMPTION, existingDomain.getRepoId(), redemptionTime, - clientId))); + registrarId))); // Note: The expiration time is unchanged, so if it's before the new deletion time, there will // be a "phantom autorenew" where the expiration time advances. No poll message will be // produced (since we are ending the autorenew recurrences at "now" below) and the billing @@ -220,7 +220,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { // Send a second poll message immediately if the domain is being deleted asynchronously by a // registrar other than the sponsoring registrar (which will necessarily be a superuser). if (durationUntilDelete.isLongerThan(Duration.ZERO) - && !clientId.equals(existingDomain.getPersistedCurrentSponsorClientId())) { + && !registrarId.equals(existingDomain.getPersistedCurrentSponsorRegistrarId())) { entitiesToSave.add( createImmediateDeletePollMessage(existingDomain, domainHistoryKey, now, deletionTime)); } @@ -292,9 +292,9 @@ public final class DomainDeleteFlow implements TransactionalFlow { verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES); verifyOptionalAuthInfo(authInfo, existingDomain); if (!isSuperuser) { - verifyResourceOwnership(clientId, existingDomain); + verifyResourceOwnership(registrarId, existingDomain); verifyNotInPredelegation(registry, now); - checkAllowedAccessToTld(clientId, registry.getTld().toString()); + checkAllowedAccessToTld(registrarId, registry.getTld().toString()); } if (!existingDomain.getSubordinateHosts().isEmpty()) { throw new DomainToDeleteHasHostsException(); @@ -347,7 +347,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { : "Deleted by registry administrator.") : "Domain deleted."; return new PollMessage.OneTime.Builder() - .setClientId(existingDomain.getCurrentSponsorClientId()) + .setRegistrarId(existingDomain.getCurrentSponsorRegistrarId()) .setEventTime(deletionTime) .setMsg(message) .setResponseData( @@ -364,7 +364,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { DateTime now, DateTime deletionTime) { return new PollMessage.OneTime.Builder() - .setClientId(existingDomain.getPersistedCurrentSponsorClientId()) + .setRegistrarId(existingDomain.getPersistedCurrentSponsorRegistrarId()) .setEventTime(now) .setParentKey(domainHistoryKey) .setMsg( diff --git a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java index c2e2ec563..eda6c79a1 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java @@ -285,8 +285,8 @@ public class DomainFlowUtils { } /** Check if the registrar running the flow has access to the TLD in question. */ - public static void checkAllowedAccessToTld(String clientId, String tld) throws EppException { - if (!Registrar.loadByClientIdCached(clientId).get().getAllowedTlds().contains(tld)) { + public static void checkAllowedAccessToTld(String registrarId, String tld) throws EppException { + if (!Registrar.loadByRegistrarIdCached(registrarId).get().getAllowedTlds().contains(tld)) { throw new DomainFlowUtils.NotAuthorizedForTldException(tld); } } @@ -464,10 +464,10 @@ public class DomainFlowUtils { * where it would not be allowed is if domain name is premium, and premium names are blocked by * this registrar. */ - static void verifyPremiumNameIsNotBlocked(String domainName, DateTime priceTime, String clientId) - throws EppException { + static void verifyPremiumNameIsNotBlocked( + String domainName, DateTime priceTime, String registrarId) throws EppException { if (isDomainPremium(domainName, priceTime)) { - if (Registrar.loadByClientIdCached(clientId).get().getBlockPremiumNames()) { + if (Registrar.loadByRegistrarIdCached(registrarId).get().getBlockPremiumNames()) { throw new PremiumNameBlockedException(); } } @@ -495,7 +495,7 @@ public class DomainFlowUtils { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setEventTime(domain.getRegistrationExpirationTime()); } @@ -506,7 +506,7 @@ public class DomainFlowUtils { public static PollMessage.Autorenew.Builder newAutorenewPollMessage(DomainBase domain) { return new PollMessage.Autorenew.Builder() .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setEventTime(domain.getRegistrationExpirationTime()) .setMsg("Domain was auto-renewed."); } @@ -896,9 +896,9 @@ public class DomainFlowUtils { *

Non-active registrars are not allowed to run operations that cost money, like domain creates * or renews. */ - static void verifyRegistrarIsActive(String clientId) + static void verifyRegistrarIsActive(String registrarId) throws RegistrarMustBeActiveForThisOperationException { - Registrar registrar = Registrar.loadByClientIdCached(clientId).get(); + Registrar registrar = Registrar.loadByRegistrarIdCached(registrarId).get(); if (registrar.getState() != State.ACTIVE) { throw new RegistrarMustBeActiveForThisOperationException(); } diff --git a/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java b/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java index 532e363b8..6aa343567 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.domain; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.domain.DomainFlowUtils.addSecDnsExtensionIfPresent; @@ -30,7 +30,7 @@ import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.custom.DomainInfoFlowCustomLogic; @@ -79,7 +79,7 @@ public final class DomainInfoFlow implements Flow { @Inject ResourceCommand resourceCommand; @Inject EppInput eppInput; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Clock clock; @Inject EppResponse.Builder responseBuilder; @@ -94,7 +94,7 @@ public final class DomainInfoFlow implements Flow { extensionManager.register(FeeInfoCommandExtensionV06.class); flowCustomLogic.beforeValidation(); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = clock.nowUtc(); DomainBase domain = verifyExistence( DomainBase.class, targetId, loadByForeignKey(DomainBase.class, targetId, now)); @@ -112,12 +112,12 @@ public final class DomainInfoFlow implements Flow { DomainInfoData.newBuilder() .setFullyQualifiedDomainName(domain.getDomainName()) .setRepoId(domain.getRepoId()) - .setCurrentSponsorClientId(domain.getCurrentSponsorClientId()) + .setCurrentSponsorClientId(domain.getCurrentSponsorRegistrarId()) .setRegistrant( transactIfJpaTm(() -> tm().loadByKey(domain.getRegistrant())).getContactId()); // If authInfo is non-null, then the caller is authorized to see the full information since we // will have already verified the authInfo is valid. - if (clientId.equals(domain.getCurrentSponsorClientId()) || authInfo.isPresent()) { + if (registrarId.equals(domain.getCurrentSponsorRegistrarId()) || authInfo.isPresent()) { HostsRequest hostsRequest = ((Info) resourceCommand).getHostsRequest(); infoBuilder .setStatusValues(domain.getStatusValues()) @@ -126,9 +126,9 @@ public final class DomainInfoFlow implements Flow { .setNameservers(hostsRequest.requestDelegated() ? domain.loadNameserverHostNames() : null) .setSubordinateHosts( hostsRequest.requestSubordinate() ? domain.getSubordinateHosts() : null) - .setCreationClientId(domain.getCreationClientId()) + .setCreationClientId(domain.getCreationRegistrarId()) .setCreationTime(domain.getCreationTime()) - .setLastEppUpdateClientId(domain.getLastEppUpdateClientId()) + .setLastEppUpdateClientId(domain.getLastEppUpdateRegistrarId()) .setLastEppUpdateTime(domain.getLastEppUpdateTime()) .setRegistrationExpirationTime(domain.getRegistrationExpirationTime()) .setLastTransferTime(domain.getLastTransferTime()) diff --git a/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java b/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java index 30dd31637..e78da4aa8 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java @@ -16,7 +16,7 @@ package google.registry.flows.domain; import static google.registry.flows.FlowUtils.createHistoryKey; import static google.registry.flows.FlowUtils.persistEntityChanges; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; @@ -39,7 +39,7 @@ import com.googlecode.objectify.Key; import google.registry.flows.EppException; import google.registry.flows.EppException.ParameterValueRangeErrorException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -123,7 +123,7 @@ public final class DomainRenewFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject EppInput eppInput; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -137,8 +137,8 @@ public final class DomainRenewFlow implements TransactionalFlow { extensionManager.register(FeeRenewCommandExtension.class, MetadataExtension.class); flowCustomLogic.beforeValidation(); extensionManager.validate(); - validateClientIsLoggedIn(clientId); - verifyRegistrarIsActive(clientId); + validateRegistrarIsLoggedIn(registrarId); + verifyRegistrarIsActive(registrarId); DateTime now = tm().getTransactionTime(); Renew command = (Renew) resourceCommand; // Loads the target resource if it exists @@ -182,7 +182,7 @@ public final class DomainRenewFlow implements TransactionalFlow { existingDomain .asBuilder() .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(clientId) + .setLastEppUpdateRegistrarId(registrarId) .setRegistrationExpirationTime(newExpirationTime) .setAutorenewBillingEvent(newAutorenewEvent.createVKey()) .setAutorenewPollMessage(newAutorenewPollMessage.createVKey()) @@ -250,8 +250,8 @@ public final class DomainRenewFlow implements TransactionalFlow { verifyOptionalAuthInfo(authInfo, existingDomain); verifyNoDisallowedStatuses(existingDomain, RENEW_DISALLOWED_STATUSES); if (!isSuperuser) { - verifyResourceOwnership(clientId, existingDomain); - checkAllowedAccessToTld(clientId, existingDomain.getTld()); + verifyResourceOwnership(registrarId, existingDomain); + checkAllowedAccessToTld(registrarId, existingDomain.getTld()); } verifyUnitIsYears(command.getPeriod()); // If the date they specify doesn't match the expiration, fail. (This is an idempotence check). @@ -266,7 +266,7 @@ public final class DomainRenewFlow implements TransactionalFlow { return new BillingEvent.OneTime.Builder() .setReason(Reason.RENEW) .setTargetId(targetId) - .setClientId(clientId) + .setRegistrarId(registrarId) .setPeriodYears(years) .setCost(renewCost) .setEventTime(now) diff --git a/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java b/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java index 9aee758ea..2ad97eb6e 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java @@ -15,7 +15,7 @@ package google.registry.flows.domain; import static google.registry.flows.FlowUtils.createHistoryKey; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership; @@ -40,7 +40,7 @@ import google.registry.flows.EppException; import google.registry.flows.EppException.CommandUseErrorException; import google.registry.flows.EppException.StatusProhibitsOperationException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -116,7 +116,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject EppInput eppInput; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -132,8 +132,8 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { MetadataExtension.class, RgpUpdateExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); - verifyRegistrarIsActive(clientId); + validateRegistrarIsLoggedIn(registrarId); + verifyRegistrarIsActive(registrarId); Update command = (Update) resourceCommand; DateTime now = tm().getTransactionTime(); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); @@ -174,7 +174,12 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { .build(); DomainBase newDomain = performRestore( - existingDomain, newExpirationTime, autorenewEvent, autorenewPollMessage, now, clientId); + existingDomain, + newExpirationTime, + autorenewEvent, + autorenewPollMessage, + now, + registrarId); updateForeignKeyIndexDeletionTime(newDomain); DomainHistory domainHistory = buildDomainHistory(newDomain, now); entitiesToSave.add(newDomain, domainHistory, autorenewEvent, autorenewPollMessage); @@ -205,10 +210,10 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { DateTime now) throws EppException { verifyOptionalAuthInfo(authInfo, existingDomain); if (!isSuperuser) { - verifyResourceOwnership(clientId, existingDomain); + verifyResourceOwnership(registrarId, existingDomain); verifyNotReserved(InternetDomainName.from(targetId), false); - verifyPremiumNameIsNotBlocked(targetId, now, clientId); - checkAllowedAccessToTld(clientId, existingDomain.getTld()); + verifyPremiumNameIsNotBlocked(targetId, now, registrarId); + checkAllowedAccessToTld(registrarId, existingDomain.getTld()); } // No other changes can be specified on a restore request. if (!command.noChangesPresent()) { @@ -227,7 +232,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { BillingEvent.Recurring autorenewEvent, PollMessage.Autorenew autorenewPollMessage, DateTime now, - String clientId) { + String registrarId) { return existingDomain .asBuilder() .setRegistrationExpirationTime(newExpirationTime) @@ -241,7 +246,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { // it won't immediately be deleted again. .setAutorenewEndTime(Optional.empty()) .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(clientId) + .setLastEppUpdateRegistrarId(registrarId) .build(); } @@ -261,7 +266,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { Key domainHistoryKey, Money cost, DateTime now) { return new BillingEvent.OneTime.Builder() .setTargetId(targetId) - .setClientId(clientId) + .setRegistrarId(registrarId) .setEventTime(now) .setBillingTime(now) .setPeriodYears(1) diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java index 97bc49838..d4cacca10 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java @@ -16,7 +16,7 @@ package google.registry.flows.domain; import static com.google.common.collect.Iterables.getOnlyElement; import static google.registry.flows.FlowUtils.createHistoryKey; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.computeExDateForApprovalTime; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; @@ -40,7 +40,7 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Key; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -89,7 +89,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -104,18 +104,18 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); verifyOptionalAuthInfo(authInfo, existingDomain); verifyHasPendingTransfer(existingDomain); - verifyResourceOwnership(clientId, existingDomain); + verifyResourceOwnership(registrarId, existingDomain); String tld = existingDomain.getTld(); if (!isSuperuser) { - checkAllowedAccessToTld(clientId, tld); + checkAllowedAccessToTld(registrarId, tld); } DomainTransferData transferData = existingDomain.getTransferData(); - String gainingClientId = transferData.getGainingClientId(); + String gainingRegistrarId = transferData.getGainingRegistrarId(); // Create a transfer billing event for 1 year, unless the superuser extension was used to set // the transfer period to zero. There is not a transfer cost if the transfer period is zero. Key domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); @@ -127,7 +127,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { new BillingEvent.OneTime.Builder() .setReason(Reason.TRANSFER) .setTargetId(targetId) - .setClientId(gainingClientId) + .setRegistrarId(gainingRegistrarId) .setPeriodYears(1) .setCost(getDomainRenewCost(targetId, transferData.getTransferRequestTime(), 1)) .setEventTime(now) @@ -162,7 +162,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(targetId) - .setClientId(gainingClientId) + .setRegistrarId(gainingRegistrarId) .setEventTime(newExpirationTime) .setRecurrenceEndTime(END_OF_TIME) .setParent(domainHistoryKey) @@ -171,7 +171,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { PollMessage.Autorenew gainingClientAutorenewPollMessage = new PollMessage.Autorenew.Builder() .setTargetId(targetId) - .setClientId(gainingClientId) + .setRegistrarId(gainingRegistrarId) .setEventTime(newExpirationTime) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") @@ -206,10 +206,10 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { oneTime))) .orElseGet(ImmutableSet::of)) .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(clientId) + .setLastEppUpdateRegistrarId(registrarId) .build(); Registry registry = Registry.get(existingDomain.getTld()); - DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, gainingClientId); + DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, gainingRegistrarId); // Create a poll message for the gaining client. PollMessage gainingClientPollMessage = createGainingTransferPollMessage( @@ -232,7 +232,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { } private DomainHistory buildDomainHistory( - DomainBase newDomain, Registry registry, DateTime now, String gainingClientId) { + DomainBase newDomain, Registry registry, DateTime now, String gainingRegistrarId) { ImmutableSet cancelingRecords = createCancelingRecords( newDomain, @@ -241,7 +241,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { ImmutableSet.of(TRANSFER_SUCCESSFUL)); return historyBuilder .setType(DOMAIN_TRANSFER_APPROVE) - .setOtherClientId(gainingClientId) + .setOtherRegistrarId(gainingRegistrarId) .setDomain(newDomain) .setDomainTransactionRecords( union( diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java index 6dd611a63..eb8e1f326 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java @@ -15,7 +15,7 @@ package google.registry.flows.domain; import static google.registry.flows.FlowUtils.createHistoryKey; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; @@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Key; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -76,7 +76,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -87,24 +87,24 @@ public final class DomainTransferCancelFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); verifyOptionalAuthInfo(authInfo, existingDomain); verifyHasPendingTransfer(existingDomain); - verifyTransferInitiator(clientId, existingDomain); + verifyTransferInitiator(registrarId, existingDomain); if (!isSuperuser) { - checkAllowedAccessToTld(clientId, existingDomain.getTld()); + checkAllowedAccessToTld(registrarId, existingDomain.getTld()); } Registry registry = Registry.get(existingDomain.getTld()); Key domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); historyBuilder .setId(domainHistoryKey.getId()) - .setOtherClientId(existingDomain.getTransferData().getLosingClientId()); + .setOtherRegistrarId(existingDomain.getTransferData().getLosingRegistrarId()); DomainBase newDomain = - denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, clientId); + denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, registrarId); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now); tm().putAll( newDomain, diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java index 417eff215..0cf74d71c 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.domain; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse; @@ -22,7 +22,7 @@ import static google.registry.flows.domain.DomainTransferUtils.createTransferRes import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.ResourceFlowUtils; import google.registry.flows.annotations.ReportingSpec; @@ -59,7 +59,7 @@ public final class DomainTransferQueryFlow implements Flow { @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Clock clock; @Inject EppResponse.Builder responseBuilder; @@ -68,7 +68,7 @@ public final class DomainTransferQueryFlow implements Flow { @Override public final EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = clock.nowUtc(); DomainBase domain = loadAndVerifyExistence(DomainBase.class, targetId, now); verifyOptionalAuthInfo(authInfo, domain); @@ -81,8 +81,8 @@ public final class DomainTransferQueryFlow implements Flow { // Note that the authorization info on the command (if present) has already been verified. If // it's present, then the other checks are unnecessary. if (!authInfo.isPresent() - && !clientId.equals(transferData.getGainingClientId()) - && !clientId.equals(transferData.getLosingClientId())) { + && !registrarId.equals(transferData.getGainingRegistrarId()) + && !registrarId.equals(transferData.getLosingRegistrarId())) { throw new NotAuthorizedToViewTransferException(); } DateTime newExpirationTime = null; diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java index dcee1eb05..8428c0ff0 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java @@ -15,7 +15,7 @@ package google.registry.flows.domain; import static google.registry.flows.FlowUtils.createHistoryKey; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; @@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Key; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -78,7 +78,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -89,23 +89,23 @@ public final class DomainTransferRejectFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); Registry registry = Registry.get(existingDomain.getTld()); Key domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); historyBuilder .setId(domainHistoryKey.getId()) - .setOtherClientId(existingDomain.getTransferData().getGainingClientId()); + .setOtherRegistrarId(existingDomain.getTransferData().getGainingRegistrarId()); verifyOptionalAuthInfo(authInfo, existingDomain); verifyHasPendingTransfer(existingDomain); - verifyResourceOwnership(clientId, existingDomain); + verifyResourceOwnership(registrarId, existingDomain); if (!isSuperuser) { - checkAllowedAccessToTld(clientId, existingDomain.getTld()); + checkAllowedAccessToTld(registrarId, existingDomain.getTld()); } DomainBase newDomain = - denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, clientId); + denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, registrarId); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now); tm().putAll( newDomain, diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java index 6c3d59a0a..f54b685f3 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java @@ -15,7 +15,7 @@ package google.registry.flows.domain; import static google.registry.flows.FlowUtils.createHistoryKey; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.computeExDateForApprovalTime; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo; @@ -41,7 +41,7 @@ import com.googlecode.objectify.Key; import google.registry.batch.AsyncTaskEnqueuer; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -125,7 +125,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject EppInput eppInput; @Inject Optional authInfo; - @Inject @ClientId String gainingClientId; + @Inject @RegistrarId String gainingClientId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -142,7 +142,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { FeeTransferCommandExtension.class, MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(gainingClientId); + validateRegistrarIsLoggedIn(gainingClientId); verifyRegistrarIsActive(gainingClientId); DateTime now = tm().getTransactionTime(); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); @@ -174,7 +174,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { Key domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); historyBuilder .setId(domainHistoryKey.getId()) - .setOtherClientId(existingDomain.getCurrentSponsorClientId()); + .setOtherRegistrarId(existingDomain.getCurrentSponsorRegistrarId()); DateTime automaticTransferTime = superuserExtension.isPresent() ? now.plusDays(superuserExtension.get().getAutomaticTransferLength()) @@ -207,8 +207,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { new DomainTransferData.Builder() .setTransferRequestTrid(trid) .setTransferRequestTime(now) - .setGainingClientId(gainingClientId) - .setLosingClientId(existingDomain.getCurrentSponsorClientId()) + .setGainingRegistrarId(gainingClientId) + .setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId()) .setPendingTransferExpirationTime(automaticTransferTime) .setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime), serverApproveEntities, @@ -231,7 +231,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { .setTransferData(pendingTransferData) .addStatusValue(StatusValue.PENDING_TRANSFER) .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(gainingClientId) + .setLastEppUpdateRegistrarId(gainingClientId) .build(); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, period); @@ -264,7 +264,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { throw new AlreadyPendingTransferException(targetId); } // Verify that this client doesn't already sponsor this resource. - if (gainingClientId.equals(existingDomain.getCurrentSponsorClientId())) { + if (gainingClientId.equals(existingDomain.getCurrentSponsorRegistrarId())) { throw new ObjectAlreadySponsoredException(); } verifyTransferPeriod(period, superuserExtension); diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java b/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java index c2ea2d17b..523576c8e 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java @@ -108,7 +108,7 @@ public final class DomainTransferUtils { Key domainHistoryKey, DomainBase existingDomain, Trid trid, - String gainingClientId, + String gainingRegistrarId, Optional transferCost, DateTime now) { String targetId = existingDomain.getDomainName(); @@ -117,8 +117,8 @@ public final class DomainTransferUtils { new DomainTransferData.Builder() .setTransferRequestTrid(trid) .setTransferRequestTime(now) - .setGainingClientId(gainingClientId) - .setLosingClientId(existingDomain.getCurrentSponsorClientId()) + .setGainingRegistrarId(gainingRegistrarId) + .setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId()) .setPendingTransferExpirationTime(automaticTransferTime) .setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime) .setTransferStatus(TransferStatus.SERVER_APPROVED) @@ -132,7 +132,7 @@ public final class DomainTransferUtils { automaticTransferTime, domainHistoryKey, targetId, - gainingClientId, + gainingRegistrarId, registry, cost))); createOptionalAutorenewCancellation( @@ -141,10 +141,10 @@ public final class DomainTransferUtils { return builder .add( createGainingClientAutorenewEvent( - serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingClientId)) + serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingRegistrarId)) .add( createGainingClientAutorenewPollMessage( - serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingClientId)) + serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingRegistrarId)) .add( createGainingTransferPollMessage( targetId, @@ -169,7 +169,7 @@ public final class DomainTransferUtils { DateTime now, Key domainHistoryKey) { return new PollMessage.OneTime.Builder() - .setClientId(transferData.getGainingClientId()) + .setRegistrarId(transferData.getGainingRegistrarId()) .setEventTime(transferData.getPendingTransferExpirationTime()) .setMsg(transferData.getTransferStatus().getMessage()) .setResponseData( @@ -191,7 +191,7 @@ public final class DomainTransferUtils { @Nullable DateTime extendedRegistrationExpirationTime, Key domainHistoryKey) { return new PollMessage.OneTime.Builder() - .setClientId(transferData.getLosingClientId()) + .setRegistrarId(transferData.getLosingRegistrarId()) .setEventTime(transferData.getPendingTransferExpirationTime()) .setMsg(transferData.getTransferStatus().getMessage()) .setResponseData( @@ -208,8 +208,8 @@ public final class DomainTransferUtils { @Nullable DateTime extendedRegistrationExpirationTime) { return new DomainTransferResponse.Builder() .setFullyQualifiedDomainName(targetId) - .setGainingClientId(transferData.getGainingClientId()) - .setLosingClientId(transferData.getLosingClientId()) + .setGainingRegistrarId(transferData.getGainingRegistrarId()) + .setLosingRegistrarId(transferData.getLosingRegistrarId()) .setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime()) .setTransferRequestTime(transferData.getTransferRequestTime()) .setTransferStatus(transferData.getTransferStatus()) @@ -221,10 +221,10 @@ public final class DomainTransferUtils { DateTime serverApproveNewExpirationTime, Key domainHistoryKey, String targetId, - String gainingClientId) { + String gainingRegistrarId) { return new PollMessage.Autorenew.Builder() .setTargetId(targetId) - .setClientId(gainingClientId) + .setRegistrarId(gainingRegistrarId) .setEventTime(serverApproveNewExpirationTime) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") @@ -236,12 +236,12 @@ public final class DomainTransferUtils { DateTime serverApproveNewExpirationTime, Key domainHistoryKey, String targetId, - String gainingClientId) { + String gainingRegistrarId) { return new BillingEvent.Recurring.Builder() .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(targetId) - .setClientId(gainingClientId) + .setRegistrarId(gainingRegistrarId) .setEventTime(serverApproveNewExpirationTime) .setRecurrenceEndTime(END_OF_TIME) .setParent(domainHistoryKey) @@ -291,13 +291,13 @@ public final class DomainTransferUtils { DateTime automaticTransferTime, Key domainHistoryKey, String targetId, - String gainingClientId, + String gainingRegistrarId, Registry registry, Money transferCost) { return new BillingEvent.OneTime.Builder() .setReason(Reason.TRANSFER) .setTargetId(targetId) - .setClientId(gainingClientId) + .setRegistrarId(gainingRegistrarId) .setCost(transferCost) .setPeriodYears(1) .setEventTime(automaticTransferTime) diff --git a/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java b/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java index 37bf28142..561c88436 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java @@ -19,7 +19,7 @@ import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.collect.Sets.symmetricDifference; import static com.google.common.collect.Sets.union; import static google.registry.flows.FlowUtils.persistEntityChanges; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.checkSameValuesNotAddedAndRemoved; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable; @@ -47,7 +47,7 @@ import com.google.common.net.InternetDomainName; import google.registry.dns.DnsQueue; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -139,7 +139,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; @Inject EppInput eppInput; @Inject Optional authInfo; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject DomainHistory.Builder historyBuilder; @@ -158,7 +158,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { DomainUpdateSuperuserExtension.class); flowCustomLogic.beforeValidation(); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); Update command = cloneAndLinkReferences((Update) resourceCommand, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); @@ -197,10 +197,10 @@ public final class DomainUpdateFlow implements TransactionalFlow { String tld = existingDomain.getTld(); if (!isSuperuser) { verifyNoDisallowedStatuses(existingDomain, UPDATE_DISALLOWED_STATUSES); - verifyResourceOwnership(clientId, existingDomain); + verifyResourceOwnership(registrarId, existingDomain); verifyClientUpdateNotProhibited(command, existingDomain); verifyAllStatusesAreClientSettable(union(add.getStatusValues(), remove.getStatusValues())); - checkAllowedAccessToTld(clientId, tld); + checkAllowedAccessToTld(registrarId, tld); } Registry registry = Registry.get(tld); Optional feeUpdate = @@ -244,7 +244,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { secDnsUpdate.get()) : domain.getDsData()) .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(clientId) + .setLastEppUpdateRegistrarId(registrarId) .addStatusValues(add.getStatusValues()) .removeStatusValues(remove.getStatusValues()) .addNameservers(add.getNameservers().stream().collect(toImmutableSet())) @@ -291,15 +291,16 @@ public final class DomainUpdateFlow implements TransactionalFlow { : symmetricDifference(existingDomain.getStatusValues(), newDomain.getStatusValues())) { if (statusValue.isChargedStatus()) { // Only charge once. - return Optional.of(new BillingEvent.OneTime.Builder() - .setReason(Reason.SERVER_STATUS) - .setTargetId(targetId) - .setClientId(clientId) - .setCost(Registry.get(existingDomain.getTld()).getServerStatusChangeCost()) - .setEventTime(now) - .setBillingTime(now) - .setParent(historyEntry) - .build()); + return Optional.of( + new BillingEvent.OneTime.Builder() + .setReason(Reason.SERVER_STATUS) + .setTargetId(targetId) + .setRegistrarId(registrarId) + .setCost(Registry.get(existingDomain.getTld()).getServerStatusChangeCost()) + .setEventTime(now) + .setBillingTime(now) + .setParent(historyEntry) + .build()); } } } diff --git a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java index 9424b366c..a7b644b58 100644 --- a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java +++ b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java @@ -36,7 +36,7 @@ public class AllocationTokenCustomLogic { DomainCommand.Create command, AllocationToken token, Registry registry, - String clientId, + String registrarId, DateTime now) throws EppException { // Do nothing. @@ -47,7 +47,7 @@ public class AllocationTokenCustomLogic { public ImmutableMap checkDomainsWithToken( ImmutableList domainNames, AllocationToken token, - String clientId, + String registrarId, DateTime now) { // Do nothing. return Maps.toMap(domainNames, k -> ""); diff --git a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java index e31122a22..31bd072a1 100644 --- a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java +++ b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java @@ -58,12 +58,19 @@ public class AllocationTokenFlowUtils { * for this request. */ public AllocationToken loadTokenAndValidateDomainCreate( - DomainCommand.Create command, String token, Registry registry, String clientId, DateTime now) + DomainCommand.Create command, + String token, + Registry registry, + String registrarId, + DateTime now) throws EppException { AllocationToken tokenEntity = loadToken(token); validateToken( - InternetDomainName.from(command.getFullyQualifiedDomainName()), tokenEntity, clientId, now); - return tokenCustomLogic.validateToken(command, tokenEntity, registry, clientId, now); + InternetDomainName.from(command.getFullyQualifiedDomainName()), + tokenEntity, + registrarId, + now); + return tokenCustomLogic.validateToken(command, tokenEntity, registry, registrarId, now); } /** @@ -74,7 +81,7 @@ public class AllocationTokenFlowUtils { * validate have blank messages (i.e. no error). */ public AllocationTokenDomainCheckResults checkDomainsWithToken( - List domainNames, String token, String clientId, DateTime now) { + List domainNames, String token, String registrarId, DateTime now) { // If the token is completely invalid, return the error message for all domain names AllocationToken tokenEntity; try { @@ -91,7 +98,7 @@ public class AllocationTokenFlowUtils { ImmutableMap.Builder resultsBuilder = new ImmutableMap.Builder<>(); for (InternetDomainName domainName : domainNames) { try { - validateToken(domainName, tokenEntity, clientId, now); + validateToken(domainName, tokenEntity, registrarId, now); validDomainNames.add(domainName); } catch (EppException e) { resultsBuilder.put(domainName, e.getMessage()); @@ -101,7 +108,7 @@ public class AllocationTokenFlowUtils { // For all valid domain names, run the custom logic and include the results resultsBuilder.putAll( tokenCustomLogic.checkDomainsWithToken( - validDomainNames.build(), tokenEntity, clientId, now)); + validDomainNames.build(), tokenEntity, registrarId, now)); return AllocationTokenDomainCheckResults.create( Optional.of(tokenEntity), resultsBuilder.build()); } @@ -123,10 +130,10 @@ public class AllocationTokenFlowUtils { * @throws EppException if the token is invalid in any way */ private void validateToken( - InternetDomainName domainName, AllocationToken token, String clientId, DateTime now) + InternetDomainName domainName, AllocationToken token, String registrarId, DateTime now) throws EppException { if (!token.getAllowedRegistrarIds().isEmpty() - && !token.getAllowedRegistrarIds().contains(clientId)) { + && !token.getAllowedRegistrarIds().contains(registrarId)) { throw new AllocationTokenNotValidForRegistrarException(); } if (!token.getAllowedTlds().isEmpty() diff --git a/core/src/main/java/google/registry/flows/host/HostCheckFlow.java b/core/src/main/java/google/registry/flows/host/HostCheckFlow.java index b00c72e19..b8c102496 100644 --- a/core/src/main/java/google/registry/flows/host/HostCheckFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostCheckFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.host; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount; import static google.registry.model.EppResourceUtils.checkResourcesExist; @@ -24,7 +24,7 @@ import google.registry.config.RegistryConfig.Config; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.annotations.ReportingSpec; import google.registry.model.eppinput.ResourceCommand; import google.registry.model.eppoutput.CheckData.HostCheck; @@ -47,7 +47,7 @@ import javax.inject.Inject; public final class HostCheckFlow implements Flow { @Inject ResourceCommand resourceCommand; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject ExtensionManager extensionManager; @Inject @Config("maxChecks") int maxChecks; @Inject Clock clock; @@ -57,7 +57,7 @@ public final class HostCheckFlow implements Flow { @Override public final EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); ImmutableList hostnames = ((Check) resourceCommand).getTargetIds(); verifyTargetIdCount(hostnames, maxChecks); ImmutableSet existingIds = diff --git a/core/src/main/java/google/registry/flows/host/HostCreateFlow.java b/core/src/main/java/google/registry/flows/host/HostCreateFlow.java index 199159dc6..6155ba6c3 100644 --- a/core/src/main/java/google/registry/flows/host/HostCreateFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostCreateFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.host; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist; import static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain; import static google.registry.flows.host.HostFlowUtils.validateHostName; @@ -34,7 +34,7 @@ import google.registry.flows.EppException; import google.registry.flows.EppException.ParameterValueRangeErrorException; import google.registry.flows.EppException.RequiredParameterMissingException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; @@ -84,7 +84,7 @@ public final class HostCreateFlow implements TransactionalFlow { @Inject ResourceCommand resourceCommand; @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject HostHistory.Builder historyBuilder; @Inject DnsQueue dnsQueue; @@ -101,17 +101,17 @@ public final class HostCreateFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); Create command = (Create) resourceCommand; DateTime now = tm().getTransactionTime(); - verifyResourceDoesNotExist(HostResource.class, targetId, now, clientId); + verifyResourceDoesNotExist(HostResource.class, targetId, now, registrarId); // The superordinate domain of the host object if creating an in-bailiwick host, or null if // creating an external host. This is looked up before we actually create the Host object so // we can detect error conditions earlier. Optional superordinateDomain = lookupSuperordinateDomain(validateHostName(targetId), now); verifySuperordinateDomainNotInPendingDelete(superordinateDomain.orElse(null)); - verifySuperordinateDomainOwnership(clientId, superordinateDomain.orElse(null)); + verifySuperordinateDomainOwnership(registrarId, superordinateDomain.orElse(null)); boolean willBeSubordinate = superordinateDomain.isPresent(); boolean hasIpAddresses = !isNullOrEmpty(command.getInetAddresses()); if (willBeSubordinate != hasIpAddresses) { @@ -122,8 +122,8 @@ public final class HostCreateFlow implements TransactionalFlow { } HostResource newHost = new HostResource.Builder() - .setCreationClientId(clientId) - .setPersistedCurrentSponsorClientId(clientId) + .setCreationRegistrarId(registrarId) + .setPersistedCurrentSponsorRegistrarId(registrarId) .setHostName(targetId) .setInetAddresses(command.getInetAddresses()) .setRepoId(createRepoId(allocateId(), roidSuffix)) diff --git a/core/src/main/java/google/registry/flows/host/HostDeleteFlow.java b/core/src/main/java/google/registry/flows/host/HostDeleteFlow.java index ddf4aaa68..f5188fb4a 100644 --- a/core/src/main/java/google/registry/flows/host/HostDeleteFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostDeleteFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.host; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.checkLinkedDomains; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; @@ -29,7 +29,7 @@ import google.registry.batch.AsyncTaskEnqueuer; import google.registry.dns.DnsQueue; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -78,7 +78,7 @@ public final class HostDeleteFlow implements TransactionalFlow { private static final DnsQueue dnsQueue = DnsQueue.create(); @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Trid trid; @Inject @Superuser boolean isSuperuser; @@ -93,7 +93,7 @@ public final class HostDeleteFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); DateTime now = tm().getTransactionTime(); validateHostName(targetId); checkLinkedDomains(targetId, now, HostResource.class, DomainBase::getNameservers); @@ -106,14 +106,14 @@ public final class HostDeleteFlow implements TransactionalFlow { existingHost.isSubordinate() ? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now) : existingHost; - verifyResourceOwnership(clientId, owningResource); + verifyResourceOwnership(registrarId, owningResource); } HistoryEntry.Type historyEntryType; Result.Code resultCode; HostResource newHost; if (tm().isOfy()) { asyncTaskEnqueuer.enqueueAsyncDelete( - existingHost, tm().getTransactionTime(), clientId, trid, isSuperuser); + existingHost, tm().getTransactionTime(), registrarId, trid, isSuperuser); newHost = existingHost.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build(); historyEntryType = Type.HOST_PENDING_DELETE; resultCode = SUCCESS_WITH_ACTION_PENDING; diff --git a/core/src/main/java/google/registry/flows/host/HostFlowUtils.java b/core/src/main/java/google/registry/flows/host/HostFlowUtils.java index b714cd8bd..3c35a4e24 100644 --- a/core/src/main/java/google/registry/flows/host/HostFlowUtils.java +++ b/core/src/main/java/google/registry/flows/host/HostFlowUtils.java @@ -105,11 +105,11 @@ public class HostFlowUtils { } } - /** Ensure that the superordinate domain is sponsored by the provided clientId. */ - static void verifySuperordinateDomainOwnership( - String clientId, DomainBase superordinateDomain) throws EppException { + /** Ensure that the superordinate domain is sponsored by the provided registrar ID. */ + static void verifySuperordinateDomainOwnership(String registrarId, DomainBase superordinateDomain) + throws EppException { if (superordinateDomain != null - && !clientId.equals(superordinateDomain.getCurrentSponsorClientId())) { + && !registrarId.equals(superordinateDomain.getCurrentSponsorRegistrarId())) { throw new HostDomainNotOwnedException(); } } diff --git a/core/src/main/java/google/registry/flows/host/HostInfoFlow.java b/core/src/main/java/google/registry/flows/host/HostInfoFlow.java index e5d8f0b35..39d891026 100644 --- a/core/src/main/java/google/registry/flows/host/HostInfoFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostInfoFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.host; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.host.HostFlowUtils.validateHostName; import static google.registry.model.EppResourceUtils.isLinked; @@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableSet; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.annotations.ReportingSpec; import google.registry.model.domain.DomainBase; @@ -53,7 +53,7 @@ import org.joda.time.DateTime; public final class HostInfoFlow implements Flow { @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject Clock clock; @Inject EppResponse.Builder responseBuilder; @@ -62,7 +62,7 @@ public final class HostInfoFlow implements Flow { @Override public EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); validateHostName(targetId); DateTime now = clock.nowUtc(); HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now); @@ -80,14 +80,14 @@ public final class HostInfoFlow implements Flow { transactIfJpaTm( () -> tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now)); hostInfoDataBuilder - .setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId()) + .setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorRegistrarId()) .setLastTransferTime(host.computeLastTransferTime(superordinateDomain)); if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { statusValues.add(StatusValue.PENDING_TRANSFER); } } else { hostInfoDataBuilder - .setCurrentSponsorClientId(host.getPersistedCurrentSponsorClientId()) + .setCurrentSponsorClientId(host.getPersistedCurrentSponsorRegistrarId()) .setLastTransferTime(host.getLastTransferTime()); } return responseBuilder @@ -97,9 +97,9 @@ public final class HostInfoFlow implements Flow { .setRepoId(host.getRepoId()) .setStatusValues(statusValues.build()) .setInetAddresses(host.getInetAddresses()) - .setCreationClientId(host.getCreationClientId()) + .setCreationClientId(host.getCreationRegistrarId()) .setCreationTime(host.getCreationTime()) - .setLastEppUpdateClientId(host.getLastEppUpdateClientId()) + .setLastEppUpdateClientId(host.getLastEppUpdateRegistrarId()) .setLastEppUpdateTime(host.getLastEppUpdateTime()) .build()) .build(); diff --git a/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java b/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java index 3d2f3d774..69f8029ef 100644 --- a/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java @@ -16,7 +16,7 @@ package google.registry.flows.host; import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.collect.Sets.union; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.ResourceFlowUtils.checkSameValuesNotAddedAndRemoved; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable; @@ -39,7 +39,7 @@ import google.registry.flows.EppException.ObjectAlreadyExistsException; import google.registry.flows.EppException.ParameterValueRangeErrorException; import google.registry.flows.EppException.StatusProhibitsOperationException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; @@ -113,7 +113,7 @@ public final class HostUpdateFlow implements TransactionalFlow { @Inject ResourceCommand resourceCommand; @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @TargetId String targetId; @Inject @Superuser boolean isSuperuser; @Inject HostHistory.Builder historyBuilder; @@ -126,7 +126,7 @@ public final class HostUpdateFlow implements TransactionalFlow { public final EppResponse run() throws EppException { extensionManager.register(MetadataExtension.class); extensionManager.validate(); - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); Update command = (Update) resourceCommand; Change change = command.getInnerChange(); String suppliedNewHostName = change.getFullyQualifiedHostName(); @@ -170,10 +170,10 @@ public final class HostUpdateFlow implements TransactionalFlow { // since external hosts store their own clientId. For subordinate hosts the canonical clientId // comes from the superordinate domain, but we might as well update the persisted value. For // non-superusers this is the flow clientId, but for superusers it might not be, so compute it. - String newPersistedClientId = + String newPersistedRegistrarId = newSuperordinateDomain.isPresent() - ? newSuperordinateDomain.get().getCurrentSponsorClientId() - : owningResource.getPersistedCurrentSponsorClientId(); + ? newSuperordinateDomain.get().getCurrentSponsorRegistrarId() + : owningResource.getPersistedCurrentSponsorRegistrarId(); HostResource newHost = existingHost .asBuilder() @@ -183,11 +183,11 @@ public final class HostUpdateFlow implements TransactionalFlow { .addInetAddresses(add.getInetAddresses()) .removeInetAddresses(remove.getInetAddresses()) .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(clientId) + .setLastEppUpdateRegistrarId(registrarId) .setSuperordinateDomain(newSuperordinateDomainKey) .setLastSuperordinateChange(lastSuperordinateChange) .setLastTransferTime(lastTransferTime) - .setPersistedCurrentSponsorClientId(newPersistedClientId) + .setPersistedCurrentSponsorRegistrarId(newPersistedRegistrarId) .build(); verifyHasIpsIffIsExternal(command, existingHost, newHost); ImmutableSet.Builder entitiesToInsert = new ImmutableSet.Builder<>(); @@ -217,12 +217,12 @@ public final class HostUpdateFlow implements TransactionalFlow { if (!isSuperuser) { // Verify that the host belongs to this registrar, either directly or because it is currently // subordinate to a domain owned by this registrar. - verifyResourceOwnership(clientId, owningResource); + verifyResourceOwnership(registrarId, owningResource); if (isHostRename && !existingHost.isSubordinate()) { throw new CannotRenameExternalHostException(); } // Verify that the new superordinate domain belongs to this registrar. - verifySuperordinateDomainOwnership(clientId, newSuperordinateDomain); + verifySuperordinateDomainOwnership(registrarId, newSuperordinateDomain); ImmutableSet statusesToAdd = command.getInnerAdd().getStatusValues(); ImmutableSet statusesToRemove = command.getInnerRemove().getStatusValues(); // If the resource is marked with clientUpdateProhibited, and this update does not clear that diff --git a/core/src/main/java/google/registry/flows/poll/PollAckFlow.java b/core/src/main/java/google/registry/flows/poll/PollAckFlow.java index 67a0f87b4..07c58d224 100644 --- a/core/src/main/java/google/registry/flows/poll/PollAckFlow.java +++ b/core/src/main/java/google/registry/flows/poll/PollAckFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.poll; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.poll.PollFlowUtils.ackPollMessage; import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount; import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_NO_MESSAGES; @@ -29,8 +29,8 @@ import google.registry.flows.EppException.ObjectDoesNotExistException; import google.registry.flows.EppException.ParameterValueSyntaxErrorException; import google.registry.flows.EppException.RequiredParameterMissingException; import google.registry.flows.ExtensionManager; -import google.registry.flows.FlowModule.ClientId; import google.registry.flows.FlowModule.PollMessageId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.TransactionalFlow; import google.registry.model.eppoutput.EppResponse; import google.registry.model.poll.MessageQueueInfo; @@ -58,15 +58,16 @@ import org.joda.time.DateTime; public class PollAckFlow implements TransactionalFlow { @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @PollMessageId String messageId; @Inject EppResponse.Builder responseBuilder; + @Inject PollAckFlow() {} @Override public final EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); if (messageId.isEmpty()) { throw new MissingMessageIdException(); } @@ -94,7 +95,7 @@ public class PollAckFlow implements TransactionalFlow { // Make sure this client is authorized to ack this message. It could be that the message is // supposed to go to a different registrar. - if (!clientId.equals(pollMessage.getClientId())) { + if (!registrarId.equals(pollMessage.getRegistrarId())) { throw new NotAuthorizedToAckMessageException(); } @@ -107,7 +108,7 @@ public class PollAckFlow implements TransactionalFlow { // acked, then we return a special status code indicating that. Note that the query will // include the message being acked. - int messageCount = tm().doTransactionless(() -> getPollMessageCount(clientId, now)); + int messageCount = tm().doTransactionless(() -> getPollMessageCount(registrarId, now)); // Within the same transaction, Datastore will not reflect the updated count (potentially // reduced by one thanks to the acked poll message). SQL will, however, so we shouldn't reduce // the count in the SQL case. diff --git a/core/src/main/java/google/registry/flows/poll/PollRequestFlow.java b/core/src/main/java/google/registry/flows/poll/PollRequestFlow.java index 1540e26d7..20d6ef832 100644 --- a/core/src/main/java/google/registry/flows/poll/PollRequestFlow.java +++ b/core/src/main/java/google/registry/flows/poll/PollRequestFlow.java @@ -14,7 +14,7 @@ package google.registry.flows.poll; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.flows.poll.PollFlowUtils.getFirstPollMessage; import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount; import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACK_MESSAGE; @@ -25,8 +25,8 @@ import google.registry.flows.EppException; import google.registry.flows.EppException.ParameterValueSyntaxErrorException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; import google.registry.flows.FlowModule.PollMessageId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.model.eppoutput.EppResponse; import google.registry.model.poll.MessageQueueInfo; import google.registry.model.poll.PollMessage; @@ -50,7 +50,7 @@ import org.joda.time.DateTime; public class PollRequestFlow implements Flow { @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject @PollMessageId String messageId; @Inject Clock clock; @Inject EppResponse.Builder responseBuilder; @@ -59,13 +59,13 @@ public class PollRequestFlow implements Flow { @Override public final EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); if (!messageId.isEmpty()) { throw new UnexpectedMessageIdException(); } // Return the oldest message from the queue. DateTime now = clock.nowUtc(); - Optional maybePollMessage = getFirstPollMessage(clientId, now); + Optional maybePollMessage = getFirstPollMessage(registrarId, now); if (!maybePollMessage.isPresent()) { return responseBuilder.setResultFromCode(SUCCESS_WITH_NO_MESSAGES).build(); } @@ -76,7 +76,7 @@ public class PollRequestFlow implements Flow { new MessageQueueInfo.Builder() .setQueueDate(pollMessage.getEventTime()) .setMsg(pollMessage.getMsg()) - .setQueueLength(getPollMessageCount(clientId, now)) + .setQueueLength(getPollMessageCount(registrarId, now)) .setMessageId(makePollMessageExternalId(pollMessage)) .build()) .setMultipleResData(pollMessage.getResponseData()) diff --git a/core/src/main/java/google/registry/flows/session/LoginFlow.java b/core/src/main/java/google/registry/flows/session/LoginFlow.java index c07ee95ae..378e59e4c 100644 --- a/core/src/main/java/google/registry/flows/session/LoginFlow.java +++ b/core/src/main/java/google/registry/flows/session/LoginFlow.java @@ -30,7 +30,7 @@ import google.registry.flows.EppException.UnimplementedObjectServiceException; import google.registry.flows.EppException.UnimplementedOptionException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.SessionMetadata; import google.registry.flows.TransportCredentials; import google.registry.model.eppcommon.ProtocolDefinition; @@ -56,7 +56,7 @@ import javax.inject.Inject; * @error {@link google.registry.flows.TlsCredentials.MissingRegistrarCertificateException} * @error {@link google.registry.flows.TransportCredentials.BadRegistrarPasswordException} * @error {@link LoginFlow.AlreadyLoggedInException} - * @error {@link LoginFlow.BadRegistrarClientIdException} + * @error {@link BadRegistrarIdException} * @error {@link LoginFlow.TooManyFailedLoginsException} * @error {@link LoginFlow.PasswordChangesNotSupportedException} * @error {@link LoginFlow.RegistrarAccountNotActiveException} @@ -73,8 +73,9 @@ public class LoginFlow implements Flow { @Inject EppInput eppInput; @Inject SessionMetadata sessionMetadata; @Inject TransportCredentials credentials; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject EppResponse.Builder responseBuilder; + @Inject LoginFlow() {} /** Run the flow and log errors. */ @@ -92,7 +93,7 @@ public class LoginFlow implements Flow { public final EppResponse runWithoutLogging() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. Login login = (Login) eppInput.getCommandWrapper().getCommand(); - if (!clientId.isEmpty()) { + if (!registrarId.isEmpty()) { throw new AlreadyLoggedInException(); } Options options = login.getOptions(); @@ -114,9 +115,9 @@ public class LoginFlow implements Flow { } serviceExtensionUrisBuilder.add(uri); } - Optional registrar = Registrar.loadByClientIdCached(login.getClientId()); + Optional registrar = Registrar.loadByRegistrarIdCached(login.getClientId()); if (!registrar.isPresent()) { - throw new BadRegistrarClientIdException(login.getClientId()); + throw new BadRegistrarIdException(login.getClientId()); } // AuthenticationErrorExceptions will propagate up through here. @@ -139,15 +140,15 @@ public class LoginFlow implements Flow { // We are in! sessionMetadata.resetFailedLoginAttempts(); - sessionMetadata.setClientId(login.getClientId()); + sessionMetadata.setRegistrarId(login.getClientId()); sessionMetadata.setServiceExtensionUris(serviceExtensionUrisBuilder.build()); return responseBuilder.setIsLoginResponse().build(); } - /** Registrar with this client ID could not be found. */ - static class BadRegistrarClientIdException extends AuthenticationErrorException { - public BadRegistrarClientIdException(String clientId) { - super("Registrar with this client ID could not be found: " + clientId); + /** Registrar with this ID could not be found. */ + static class BadRegistrarIdException extends AuthenticationErrorException { + public BadRegistrarIdException(String registrarId) { + super("Registrar with this ID could not be found: " + registrarId); } } diff --git a/core/src/main/java/google/registry/flows/session/LogoutFlow.java b/core/src/main/java/google/registry/flows/session/LogoutFlow.java index 129319537..eb65fc9b9 100644 --- a/core/src/main/java/google/registry/flows/session/LogoutFlow.java +++ b/core/src/main/java/google/registry/flows/session/LogoutFlow.java @@ -14,13 +14,13 @@ package google.registry.flows.session; -import static google.registry.flows.FlowUtils.validateClientIsLoggedIn; +import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn; import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.Flow; -import google.registry.flows.FlowModule.ClientId; +import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.SessionMetadata; import google.registry.model.eppoutput.EppResponse; import javax.inject.Inject; @@ -33,7 +33,7 @@ import javax.inject.Inject; public class LogoutFlow implements Flow { @Inject ExtensionManager extensionManager; - @Inject @ClientId String clientId; + @Inject @RegistrarId String registrarId; @Inject SessionMetadata sessionMetadata; @Inject EppResponse.Builder responseBuilder; @Inject LogoutFlow() {} @@ -41,7 +41,7 @@ public class LogoutFlow implements Flow { @Override public final EppResponse run() throws EppException { extensionManager.validate(); // There are no legal extensions for this flow. - validateClientIsLoggedIn(clientId); + validateRegistrarIsLoggedIn(registrarId); sessionMetadata.invalidate(); return responseBuilder.setResultFromCode(SUCCESS_AND_CLOSE).build(); } diff --git a/core/src/main/java/google/registry/loadtest/LoadTestAction.java b/core/src/main/java/google/registry/loadtest/LoadTestAction.java index b4648809b..e5e0d30e5 100644 --- a/core/src/main/java/google/registry/loadtest/LoadTestAction.java +++ b/core/src/main/java/google/registry/loadtest/LoadTestAction.java @@ -74,10 +74,10 @@ public class LoadTestAction implements Runnable { public static final String PATH = "/_dr/loadtest"; - /** The client identifier of the registrar to use for load testing. */ + /** The ID of the registrar to use for load testing. */ @Inject @Parameter("loadtestClientId") - String clientId; + String registrarId; /** * The number of seconds to delay the execution of the first load testing tasks by. Preparatory @@ -276,11 +276,11 @@ public class LoadTestAction implements Runnable { || hostInfosPerSecond > 0, "You must specify at least one of the 'operations per second' parameters."); logger.atInfo().log( - "Running load test with the following params. clientId: %s, delaySeconds: %d, " + "Running load test with the following params. registrarId: %s, delaySeconds: %d, " + "runSeconds: %d, successful|failed domain creates/s: %d|%d, domain infos/s: %d, " + "domain checks/s: %d, successful|failed contact creates/s: %d|%d, " + "contact infos/s: %d, successful|failed host creates/s: %d|%d, host infos/s: %d.", - clientId, + registrarId, delaySeconds, runSeconds, successfulDomainCreatesPerSecond, @@ -327,13 +327,14 @@ public class LoadTestAction implements Runnable { for (int i = 0; i < xmls.size(); i++) { // Space tasks evenly within across a second. int offsetMillis = (int) (1000.0 / xmls.size() * i); - tasks.add(TaskOptions.Builder.withUrl("/_dr/epptool") - .etaMillis(start.getMillis() + offsetMillis) - .header(X_CSRF_TOKEN, xsrfToken) - .param("clientId", clientId) - .param("superuser", Boolean.FALSE.toString()) - .param("dryRun", Boolean.FALSE.toString()) - .param("xml", xmls.get(i))); + tasks.add( + TaskOptions.Builder.withUrl("/_dr/epptool") + .etaMillis(start.getMillis() + offsetMillis) + .header(X_CSRF_TOKEN, xsrfToken) + .param("clientId", registrarId) + .param("superuser", Boolean.FALSE.toString()) + .param("dryRun", Boolean.FALSE.toString()) + .param("xml", xmls.get(i))); } return tasks.build(); } diff --git a/core/src/main/java/google/registry/model/EppResource.java b/core/src/main/java/google/registry/model/EppResource.java index 5c193a989..79967a220 100644 --- a/core/src/main/java/google/registry/model/EppResource.java +++ b/core/src/main/java/google/registry/model/EppResource.java @@ -175,7 +175,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable { return creationTime.getTimestamp(); } - public String getCreationClientId() { + public String getCreationRegistrarId() { return creationClientId; } @@ -183,7 +183,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable { return lastEppUpdateTime; } - public String getLastEppUpdateClientId() { + public String getLastEppUpdateRegistrarId() { return lastEppUpdateClientId; } @@ -193,7 +193,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable { *

For subordinate hosts, this value may not represent the actual current client id, which is * the client id of the superordinate host. For all other resources this is the true client id. */ - public final String getPersistedCurrentSponsorClientId() { + public final String getPersistedCurrentSponsorRegistrarId() { return currentSponsorClientId; } @@ -294,14 +294,14 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable { } /** Set the current sponsoring registrar. */ - public B setPersistedCurrentSponsorClientId(String currentSponsorClientId) { - getInstance().currentSponsorClientId = currentSponsorClientId; + public B setPersistedCurrentSponsorRegistrarId(String currentSponsorRegistrarId) { + getInstance().currentSponsorClientId = currentSponsorRegistrarId; return thisCastToDerived(); } /** Set the registrar that created this resource. */ - public B setCreationClientId(String creationClientId) { - getInstance().creationClientId = creationClientId; + public B setCreationRegistrarId(String creationRegistrarId) { + getInstance().creationClientId = creationRegistrarId; return thisCastToDerived(); } @@ -312,8 +312,8 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable { } /** Set the registrar who last performed a {@literal } on this resource. */ - public B setLastEppUpdateClientId(String lastEppUpdateClientId) { - getInstance().lastEppUpdateClientId = lastEppUpdateClientId; + public B setLastEppUpdateRegistrarId(String lastEppUpdateRegistrarId) { + getInstance().lastEppUpdateClientId = lastEppUpdateRegistrarId; return thisCastToDerived(); } diff --git a/core/src/main/java/google/registry/model/EppResourceUtils.java b/core/src/main/java/google/registry/model/EppResourceUtils.java index d9054accb..24c1d946f 100644 --- a/core/src/main/java/google/registry/model/EppResourceUtils.java +++ b/core/src/main/java/google/registry/model/EppResourceUtils.java @@ -240,7 +240,7 @@ public final class EppResourceUtils { .removeStatusValue(StatusValue.PENDING_TRANSFER) .setTransferData((T) transferDataBuilder.build()) .setLastTransferTime(transferData.getPendingTransferExpirationTime()) - .setPersistedCurrentSponsorClientId(transferData.getGainingClientId()); + .setPersistedCurrentSponsorRegistrarId(transferData.getGainingRegistrarId()); } /** diff --git a/core/src/main/java/google/registry/model/OteAccountBuilder.java b/core/src/main/java/google/registry/model/OteAccountBuilder.java index 477cea41d..d4d2389fa 100644 --- a/core/src/main/java/google/registry/model/OteAccountBuilder.java +++ b/core/src/main/java/google/registry/model/OteAccountBuilder.java @@ -63,7 +63,7 @@ import org.joda.time.Duration; *

Usage example: * *

{@code
- * OteAccountBuilder.forClientId("example")
+ * OteAccountBuilder.forRegistrarId("example")
  *     .addContact("contact@email.com") // OPTIONAL
  *     .setPassword("password") // OPTIONAL
  *     .setCertificateHash(certificateHash) // OPTIONAL
@@ -111,7 +111,7 @@ public final class OteAccountBuilder {
           DateTime.parse("2030-03-01T00:00:00Z"),
           Money.of(CurrencyUnit.USD, 0));
 
-  private final ImmutableMap clientIdToTld;
+  private final ImmutableMap registrarIdToTld;
   private final Registry sunriseTld;
   private final Registry gaTld;
   private final Registry eapTld;
@@ -121,16 +121,16 @@ public final class OteAccountBuilder {
   private ImmutableList registrars;
   private boolean replaceExisting = false;
 
-  private OteAccountBuilder(String baseClientId) {
+  private OteAccountBuilder(String baseRegistrarId) {
     checkState(
         RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION,
         "Can't setup OT&E in production");
-    clientIdToTld = createClientIdToTldMap(baseClientId);
-    sunriseTld = createTld(baseClientId + "-sunrise", START_DATE_SUNRISE, false, 0);
-    gaTld = createTld(baseClientId + "-ga", GENERAL_AVAILABILITY, false, 2);
-    eapTld = createTld(baseClientId + "-eap", GENERAL_AVAILABILITY, true, 3);
+    registrarIdToTld = createRegistrarIdToTldMap(baseRegistrarId);
+    sunriseTld = createTld(baseRegistrarId + "-sunrise", START_DATE_SUNRISE, false, 0);
+    gaTld = createTld(baseRegistrarId + "-ga", GENERAL_AVAILABILITY, false, 2);
+    eapTld = createTld(baseRegistrarId + "-eap", GENERAL_AVAILABILITY, true, 3);
     registrars =
-        clientIdToTld.keySet().stream()
+        registrarIdToTld.keySet().stream()
             .map(OteAccountBuilder::createRegistrar)
             .collect(toImmutableList());
   }
@@ -138,11 +138,11 @@ public final class OteAccountBuilder {
   /**
    * Creates an OteAccountBuilder for the given base client ID.
    *
-   * @param baseClientId the base clientId which will help name all the entities we create. Normally
-   * is the same as the "prod" clientId designated for this registrar.
+   * @param baseRegistrarId the base registrar ID which will help name all the entities we create.
+   *     Normally is the same as the "prod" ID designated for this registrar.
    */
-  public static OteAccountBuilder forClientId(String baseClientId) {
-    return new OteAccountBuilder(baseClientId);
+  public static OteAccountBuilder forRegistrarId(String baseRegistrarId) {
+    return new OteAccountBuilder(baseRegistrarId);
   }
 
   /**
@@ -232,14 +232,15 @@ public final class OteAccountBuilder {
    */
   public ImmutableMap buildAndPersist() {
     saveAllEntities();
-    return clientIdToTld;
+    return registrarIdToTld;
   }
 
   /**
-   * Return map from the OT&E clientIds we will create to the new TLDs they will have access to.
+   * Return map from the OT&E registrarIds we will create to the new TLDs they will have access
+   * to.
    */
-  public ImmutableMap getClientIdToTldMap() {
-    return clientIdToTld;
+  public ImmutableMap getRegistrarIdToTldMap() {
+    return registrarIdToTld;
   }
 
   /** Saves all the OT&E entities we created. */
@@ -279,7 +280,7 @@ public final class OteAccountBuilder {
   }
 
   private Registrar addAllowedTld(Registrar registrar) {
-    String tld = clientIdToTld.get(registrar.getClientId());
+    String tld = registrarIdToTld.get(registrar.getRegistrarId());
     if (registrar.getAllowedTlds().contains(tld)) {
       return registrar;
     }
@@ -324,7 +325,7 @@ public final class OteAccountBuilder {
    */
   private static Registrar createRegistrar(String registrarName) {
     return new Registrar.Builder()
-        .setClientId(registrarName)
+        .setRegistrarId(registrarName)
         .setRegistrarName(registrarName)
         .setType(Registrar.Type.OTE)
         .setLocalizedAddress(DEFAULT_ADDRESS)
@@ -346,31 +347,31 @@ public final class OteAccountBuilder {
         .build();
   }
 
-  /** Returns the ClientIds of the OT&E, with the TLDs each has access to. */
-  public static ImmutableMap createClientIdToTldMap(String baseClientId) {
+  /** Returns the registrar IDs of the OT&E, with the TLDs each has access to. */
+  public static ImmutableMap createRegistrarIdToTldMap(String baseRegistrarId) {
     checkArgument(
-        REGISTRAR_PATTERN.matcher(baseClientId).matches(),
+        REGISTRAR_PATTERN.matcher(baseRegistrarId).matches(),
         "Invalid registrar name: %s",
-        baseClientId);
+        baseRegistrarId);
     return new ImmutableMap.Builder()
-        .put(baseClientId + "-1", baseClientId + "-sunrise")
+        .put(baseRegistrarId + "-1", baseRegistrarId + "-sunrise")
         // The -2 registrar no longer exists because landrush no longer exists.
-        .put(baseClientId + "-3", baseClientId + "-ga")
-        .put(baseClientId + "-4", baseClientId + "-ga")
-        .put(baseClientId + "-5", baseClientId + "-eap")
+        .put(baseRegistrarId + "-3", baseRegistrarId + "-ga")
+        .put(baseRegistrarId + "-4", baseRegistrarId + "-ga")
+        .put(baseRegistrarId + "-5", baseRegistrarId + "-eap")
         .build();
   }
 
-  /** Returns the base client ID that correspond to a given OT&E client ID. */
-  public static String getBaseClientId(String oteClientId) {
-    int index = oteClientId.lastIndexOf('-');
-    checkArgument(index > 0, "Invalid OT&E client ID: %s", oteClientId);
-    String baseClientId = oteClientId.substring(0, index);
+  /** Returns the base registrar ID that corresponds to a given OT&E registrar ID. */
+  public static String getBaseRegistrarId(String oteRegistrarId) {
+    int index = oteRegistrarId.lastIndexOf('-');
+    checkArgument(index > 0, "Invalid OT&E registrar ID: %s", oteRegistrarId);
+    String baseRegistrarId = oteRegistrarId.substring(0, index);
     checkArgument(
-        createClientIdToTldMap(baseClientId).containsKey(oteClientId),
-        "ID %s is not one of the OT&E client IDs for base %s",
-        oteClientId,
-        baseClientId);
-    return baseClientId;
+        createRegistrarIdToTldMap(baseRegistrarId).containsKey(oteRegistrarId),
+        "ID %s is not one of the OT&E registrar IDs for base %s",
+        oteRegistrarId,
+        baseRegistrarId);
+    return baseRegistrarId;
   }
 }
diff --git a/core/src/main/java/google/registry/model/OteStats.java b/core/src/main/java/google/registry/model/OteStats.java
index 977ef797c..208074187 100644
--- a/core/src/main/java/google/registry/model/OteStats.java
+++ b/core/src/main/java/google/registry/model/OteStats.java
@@ -196,7 +196,7 @@ public class OteStats {
    */
   private OteStats recordRegistrarHistory(String registrarName) {
     ImmutableCollection registrarIds =
-        OteAccountBuilder.createClientIdToTldMap(registrarName).keySet();
+        OteAccountBuilder.createRegistrarIdToTldMap(registrarName).keySet();
 
     for (HistoryEntry historyEntry : HistoryEntryDao.loadHistoryObjectsByRegistrars(registrarIds)) {
       try {
diff --git a/core/src/main/java/google/registry/model/ResourceTransferUtils.java b/core/src/main/java/google/registry/model/ResourceTransferUtils.java
index f99935778..747c7fe47 100644
--- a/core/src/main/java/google/registry/model/ResourceTransferUtils.java
+++ b/core/src/main/java/google/registry/model/ResourceTransferUtils.java
@@ -72,8 +72,9 @@ public final class ResourceTransferUtils {
                       ? domainTransferData.getTransferredRegistrationExpirationTime()
                       : null);
     }
-    builder.setGainingClientId(transferData.getGainingClientId())
-        .setLosingClientId(transferData.getLosingClientId())
+    builder
+        .setGainingRegistrarId(transferData.getGainingRegistrarId())
+        .setLosingRegistrarId(transferData.getLosingRegistrarId())
         .setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
         .setTransferRequestTime(transferData.getTransferRequestTime())
         .setTransferStatus(transferData.getTransferStatus());
@@ -119,7 +120,7 @@ public final class ResourceTransferUtils {
       tm().delete(oldTransferData.getServerApproveEntities());
       tm().put(
               new PollMessage.OneTime.Builder()
-                  .setClientId(oldTransferData.getGainingClientId())
+                  .setRegistrarId(oldTransferData.getGainingRegistrarId())
                   .setEventTime(now)
                   .setMsg(TransferStatus.SERVER_CANCELLED.getMessage())
                   .setResponseData(
@@ -178,7 +179,7 @@ public final class ResourceTransferUtils {
     B builder = resolvePendingTransfer(resource, transferStatus, now);
     return builder
         .setLastTransferTime(now)
-        .setPersistedCurrentSponsorClientId(resource.getTransferData().getGainingClientId())
+        .setPersistedCurrentSponsorRegistrarId(resource.getTransferData().getGainingRegistrarId())
         .build();
   }
 
@@ -195,7 +196,7 @@ public final class ResourceTransferUtils {
     checkArgument(transferStatus.isDenied(), "Not a denial transfer status");
     return resolvePendingTransfer(resource, transferStatus, now)
         .setLastEppUpdateTime(now)
-        .setLastEppUpdateClientId(lastEppUpdateClientId)
+        .setLastEppUpdateRegistrarId(lastEppUpdateClientId)
         .build();
   }
 }
diff --git a/core/src/main/java/google/registry/model/billing/BillingEvent.java b/core/src/main/java/google/registry/model/billing/BillingEvent.java
index bbb9f7a76..c4910018c 100644
--- a/core/src/main/java/google/registry/model/billing/BillingEvent.java
+++ b/core/src/main/java/google/registry/model/billing/BillingEvent.java
@@ -163,7 +163,7 @@ public abstract class BillingEvent extends ImmutableObject
     domainRepoId = parent.getParent().getName();
   }
 
-  public String getClientId() {
+  public String getRegistrarId() {
     return clientId;
   }
 
@@ -223,8 +223,8 @@ public abstract class BillingEvent extends ImmutableObject
       return thisCastToDerived();
     }
 
-    public B setClientId(String clientId) {
-      getInstance().clientId = clientId;
+    public B setRegistrarId(String registrarId) {
+      getInstance().clientId = registrarId;
       return thisCastToDerived();
     }
 
@@ -660,7 +660,7 @@ public abstract class BillingEvent extends ImmutableObject
           new BillingEvent.Cancellation.Builder()
               .setReason(checkNotNull(GRACE_PERIOD_TO_REASON.get(gracePeriod.getType())))
               .setTargetId(targetId)
-              .setClientId(gracePeriod.getClientId())
+              .setRegistrarId(gracePeriod.getRegistrarId())
               .setEventTime(eventTime)
               // The charge being cancelled will take place at the grace period's expiration time.
               .setBillingTime(gracePeriod.getExpirationTime())
@@ -778,7 +778,7 @@ public abstract class BillingEvent extends ImmutableObject
     public static Modification createRefundFor(
         OneTime billingEvent, DomainHistory historyEntry, String description) {
       return new Builder()
-          .setClientId(billingEvent.getClientId())
+          .setRegistrarId(billingEvent.getRegistrarId())
           .setFlags(billingEvent.getFlags())
           .setReason(billingEvent.getReason())
           .setTargetId(billingEvent.getTargetId())
diff --git a/core/src/main/java/google/registry/model/contact/ContactBase.java b/core/src/main/java/google/registry/model/contact/ContactBase.java
index 47b884b7f..c0304fc0f 100644
--- a/core/src/main/java/google/registry/model/contact/ContactBase.java
+++ b/core/src/main/java/google/registry/model/contact/ContactBase.java
@@ -237,8 +237,8 @@ public class ContactBase extends EppResource implements ResourceWithTransferData
     return disclose;
   }
 
-  public String getCurrentSponsorClientId() {
-    return getPersistedCurrentSponsorClientId();
+  public String getCurrentSponsorRegistrarId() {
+    return getPersistedCurrentSponsorRegistrarId();
   }
 
   @Override
diff --git a/core/src/main/java/google/registry/model/contact/ContactResource.java b/core/src/main/java/google/registry/model/contact/ContactResource.java
index 4046d346d..cde42cf35 100644
--- a/core/src/main/java/google/registry/model/contact/ContactResource.java
+++ b/core/src/main/java/google/registry/model/contact/ContactResource.java
@@ -88,7 +88,7 @@ public class ContactResource extends ContactBase
     public Builder copyFrom(ContactBase contactBase) {
       return this.setAuthInfo(contactBase.getAuthInfo())
           .setContactId(contactBase.getContactId())
-          .setCreationClientId(contactBase.getCreationClientId())
+          .setCreationRegistrarId(contactBase.getCreationRegistrarId())
           .setCreationTime(contactBase.getCreationTime())
           .setDeletionTime(contactBase.getDeletionTime())
           .setDisclose(contactBase.getDisclose())
@@ -96,10 +96,11 @@ public class ContactResource extends ContactBase
           .setFaxNumber(contactBase.getFaxNumber())
           .setInternationalizedPostalInfo(contactBase.getInternationalizedPostalInfo())
           .setLastTransferTime(contactBase.getLastTransferTime())
-          .setLastEppUpdateClientId(contactBase.getLastEppUpdateClientId())
+          .setLastEppUpdateRegistrarId(contactBase.getLastEppUpdateRegistrarId())
           .setLastEppUpdateTime(contactBase.getLastEppUpdateTime())
           .setLocalizedPostalInfo(contactBase.getLocalizedPostalInfo())
-          .setPersistedCurrentSponsorClientId(contactBase.getPersistedCurrentSponsorClientId())
+          .setPersistedCurrentSponsorRegistrarId(
+              contactBase.getPersistedCurrentSponsorRegistrarId())
           .setRepoId(contactBase.getRepoId())
           .setStatusValues(contactBase.getStatusValues())
           .setTransferData(contactBase.getTransferData())
diff --git a/core/src/main/java/google/registry/model/domain/DomainBase.java b/core/src/main/java/google/registry/model/domain/DomainBase.java
index e9f5bb0e2..04eeb3543 100644
--- a/core/src/main/java/google/registry/model/domain/DomainBase.java
+++ b/core/src/main/java/google/registry/model/domain/DomainBase.java
@@ -194,7 +194,7 @@ public class DomainBase extends DomainContent
           .setAutorenewBillingEvent(domainContent.getAutorenewBillingEvent())
           .setAutorenewEndTime(domainContent.getAutorenewEndTime())
           .setContacts(domainContent.getContacts())
-          .setCreationClientId(domainContent.getCreationClientId())
+          .setCreationRegistrarId(domainContent.getCreationRegistrarId())
           .setCreationTime(domainContent.getCreationTime())
           .setDomainName(domainContent.getDomainName())
           .setDeletePollMessage(domainContent.getDeletePollMessage())
@@ -204,10 +204,11 @@ public class DomainBase extends DomainContent
           .setIdnTableName(domainContent.getIdnTableName())
           .setLastTransferTime(domainContent.getLastTransferTime())
           .setLaunchNotice(domainContent.getLaunchNotice())
-          .setLastEppUpdateClientId(domainContent.getLastEppUpdateClientId())
+          .setLastEppUpdateRegistrarId(domainContent.getLastEppUpdateRegistrarId())
           .setLastEppUpdateTime(domainContent.getLastEppUpdateTime())
           .setNameservers(domainContent.getNameservers())
-          .setPersistedCurrentSponsorClientId(domainContent.getPersistedCurrentSponsorClientId())
+          .setPersistedCurrentSponsorRegistrarId(
+              domainContent.getPersistedCurrentSponsorRegistrarId())
           .setRegistrant(domainContent.getRegistrant())
           .setRegistrationExpirationTime(domainContent.getRegistrationExpirationTime())
           .setRepoId(domainContent.getRepoId())
diff --git a/core/src/main/java/google/registry/model/domain/DomainContent.java b/core/src/main/java/google/registry/model/domain/DomainContent.java
index 1357ad0b3..d43f9ffef 100644
--- a/core/src/main/java/google/registry/model/domain/DomainContent.java
+++ b/core/src/main/java/google/registry/model/domain/DomainContent.java
@@ -520,8 +520,8 @@ public class DomainContent extends EppResource
     this.dsData = dsData;
   }
 
-  public final String getCurrentSponsorClientId() {
-    return getPersistedCurrentSponsorClientId();
+  public final String getCurrentSponsorRegistrarId() {
+    return getPersistedCurrentSponsorRegistrarId();
   }
 
   /** Returns true if DNS information should be published for the given domain. */
@@ -617,7 +617,7 @@ public class DomainContent extends EppResource
                     domain.getRepoId(),
                     transferExpirationTime.plus(
                         Registry.get(domain.getTld()).getTransferGracePeriodLength()),
-                    transferData.getGainingClientId(),
+                    transferData.getGainingRegistrarId(),
                     transferData.getServerApproveBillingEvent())));
       } else {
         // There won't be a billing event, so we don't need a grace period
@@ -627,7 +627,7 @@ public class DomainContent extends EppResource
       setAutomaticTransferSuccessProperties(builder, transferData);
       builder
           .setLastEppUpdateTime(transferExpirationTime)
-          .setLastEppUpdateClientId(transferData.getGainingClientId());
+          .setLastEppUpdateRegistrarId(transferData.getGainingRegistrarId());
       // Finish projecting to now.
       return (T) builder.build().cloneProjectedAtTime(now);
     }
@@ -653,7 +653,7 @@ public class DomainContent extends EppResource
                   domain.getRepoId(),
                   lastAutorenewTime.plus(
                       Registry.get(domain.getTld()).getAutoRenewGracePeriodLength()),
-                  domain.getCurrentSponsorClientId(),
+                  domain.getCurrentSponsorRegistrarId(),
                   domain.getAutorenewBillingEvent()));
       newLastEppUpdateTime = Optional.of(lastAutorenewTime);
     }
@@ -679,7 +679,7 @@ public class DomainContent extends EppResource
           || newLastEppUpdateTime.get().isAfter(domain.getLastEppUpdateTime())) {
         builder
             .setLastEppUpdateTime(newLastEppUpdateTime.get())
-            .setLastEppUpdateClientId(domain.getCurrentSponsorClientId());
+            .setLastEppUpdateRegistrarId(domain.getCurrentSponsorRegistrarId());
       }
     }
 
diff --git a/core/src/main/java/google/registry/model/domain/DomainHistory.java b/core/src/main/java/google/registry/model/domain/DomainHistory.java
index f9a03a753..6b9fd7181 100644
--- a/core/src/main/java/google/registry/model/domain/DomainHistory.java
+++ b/core/src/main/java/google/registry/model/domain/DomainHistory.java
@@ -176,8 +176,9 @@ public class DomainHistory extends HistoryEntry implements SqlEntity {
   @Nullable
   @Access(AccessType.PROPERTY)
   @Column(name = "historyOtherRegistrarId")
+  @Override
   public String getOtherRegistrarId() {
-    return super.getOtherClientId();
+    return super.getOtherRegistrarId();
   }
 
   /**
diff --git a/core/src/main/java/google/registry/model/domain/GracePeriod.java b/core/src/main/java/google/registry/model/domain/GracePeriod.java
index 8a3a5f8f6..0d68683e0 100644
--- a/core/src/main/java/google/registry/model/domain/GracePeriod.java
+++ b/core/src/main/java/google/registry/model/domain/GracePeriod.java
@@ -58,7 +58,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
       GracePeriodStatus type,
       String domainRepoId,
       DateTime expirationTime,
-      String clientId,
+      String registrarId,
       @Nullable VKey billingEventOneTime,
       @Nullable VKey billingEventRecurring,
       @Nullable Long gracePeriodId) {
@@ -72,7 +72,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
     instance.type = checkArgumentNotNull(type);
     instance.domainRepoId = checkArgumentNotNull(domainRepoId);
     instance.expirationTime = checkArgumentNotNull(expirationTime);
-    instance.clientId = checkArgumentNotNull(clientId);
+    instance.clientId = checkArgumentNotNull(registrarId);
     instance.billingEventOneTime = BillingEventVKey.create(billingEventOneTime);
     instance.billingEventRecurring = BillingRecurrenceVKey.create(billingEventRecurring);
     return instance;
@@ -89,10 +89,10 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
       GracePeriodStatus type,
       String domainRepoId,
       DateTime expirationTime,
-      String clientId,
+      String registrarId,
       @Nullable VKey billingEventOneTime) {
     return createInternal(
-        type, domainRepoId, expirationTime, clientId, billingEventOneTime, null, null);
+        type, domainRepoId, expirationTime, registrarId, billingEventOneTime, null, null);
   }
 
   /**
@@ -108,11 +108,11 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
       GracePeriodStatus type,
       String domainRepoId,
       DateTime expirationTime,
-      String clientId,
+      String registrarId,
       @Nullable VKey billingEventOneTime,
       @Nullable Long gracePeriodId) {
     return createInternal(
-        type, domainRepoId, expirationTime, clientId, billingEventOneTime, null, gracePeriodId);
+        type, domainRepoId, expirationTime, registrarId, billingEventOneTime, null, gracePeriodId);
   }
 
   public static GracePeriod createFromHistory(GracePeriodHistory history) {
@@ -131,11 +131,11 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
       GracePeriodStatus type,
       String domainRepoId,
       DateTime expirationTime,
-      String clientId,
+      String registrarId,
       VKey billingEventRecurring) {
     checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null");
     return createInternal(
-        type, domainRepoId, expirationTime, clientId, null, billingEventRecurring, null);
+        type, domainRepoId, expirationTime, registrarId, null, billingEventRecurring, null);
   }
 
   /** Creates a GracePeriod for a Recurring billing event and a given {@link #gracePeriodId}. */
@@ -144,18 +144,24 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
       GracePeriodStatus type,
       String domainRepoId,
       DateTime expirationTime,
-      String clientId,
+      String registrarId,
       VKey billingEventRecurring,
       @Nullable Long gracePeriodId) {
     checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null");
     return createInternal(
-        type, domainRepoId, expirationTime, clientId, null, billingEventRecurring, gracePeriodId);
+        type,
+        domainRepoId,
+        expirationTime,
+        registrarId,
+        null,
+        billingEventRecurring,
+        gracePeriodId);
   }
 
   /** Creates a GracePeriod with no billing event. */
   public static GracePeriod createWithoutBillingEvent(
-      GracePeriodStatus type, String domainRepoId, DateTime expirationTime, String clientId) {
-    return createInternal(type, domainRepoId, expirationTime, clientId, null, null, null);
+      GracePeriodStatus type, String domainRepoId, DateTime expirationTime, String registrarId) {
+    return createInternal(type, domainRepoId, expirationTime, registrarId, null, null, null);
   }
 
   /** Constructs a GracePeriod of the given type from the provided one-time BillingEvent. */
@@ -165,7 +171,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
         type,
         domainRepoId,
         billingEvent.getBillingTime(),
-        billingEvent.getClientId(),
+        billingEvent.getRegistrarId(),
         billingEvent.createVKey());
   }
 
@@ -175,7 +181,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
    *
    * 

TODO(b/162739503): Remove this function after fully migrating to Cloud SQL. */ - public GracePeriod cloneAfterOfyLoad(String domainRepoId) { + GracePeriod cloneAfterOfyLoad(String domainRepoId) { GracePeriod clone = clone(this); clone.domainRepoId = checkArgumentNotNull(domainRepoId); return clone; diff --git a/core/src/main/java/google/registry/model/domain/GracePeriodBase.java b/core/src/main/java/google/registry/model/domain/GracePeriodBase.java index 9dc547a56..b6894648c 100644 --- a/core/src/main/java/google/registry/model/domain/GracePeriodBase.java +++ b/core/src/main/java/google/registry/model/domain/GracePeriodBase.java @@ -91,7 +91,7 @@ public class GracePeriodBase extends ImmutableObject { return expirationTime; } - public String getClientId() { + public String getRegistrarId() { return clientId; } diff --git a/core/src/main/java/google/registry/model/host/HostResource.java b/core/src/main/java/google/registry/model/host/HostResource.java index 2094b8a9b..20f877600 100644 --- a/core/src/main/java/google/registry/model/host/HostResource.java +++ b/core/src/main/java/google/registry/model/host/HostResource.java @@ -70,16 +70,16 @@ public class HostResource extends HostBase } public Builder copyFrom(HostBase hostBase) { - return this.setCreationClientId(hostBase.getCreationClientId()) + return this.setCreationRegistrarId(hostBase.getCreationRegistrarId()) .setCreationTime(hostBase.getCreationTime()) .setDeletionTime(hostBase.getDeletionTime()) .setHostName(hostBase.getHostName()) .setInetAddresses(hostBase.getInetAddresses()) .setLastTransferTime(hostBase.getLastTransferTime()) .setLastSuperordinateChange(hostBase.getLastSuperordinateChange()) - .setLastEppUpdateClientId(hostBase.getLastEppUpdateClientId()) + .setLastEppUpdateRegistrarId(hostBase.getLastEppUpdateRegistrarId()) .setLastEppUpdateTime(hostBase.getLastEppUpdateTime()) - .setPersistedCurrentSponsorClientId(hostBase.getPersistedCurrentSponsorClientId()) + .setPersistedCurrentSponsorRegistrarId(hostBase.getPersistedCurrentSponsorRegistrarId()) .setRepoId(hostBase.getRepoId()) .setSuperordinateDomain(hostBase.getSuperordinateDomain()) .setStatusValues(hostBase.getStatusValues()); diff --git a/core/src/main/java/google/registry/model/poll/PollMessage.java b/core/src/main/java/google/registry/model/poll/PollMessage.java index d4ba74770..6903dc21c 100644 --- a/core/src/main/java/google/registry/model/poll/PollMessage.java +++ b/core/src/main/java/google/registry/model/poll/PollMessage.java @@ -142,7 +142,7 @@ public abstract class PollMessage extends ImmutableObject return id; } - public String getClientId() { + public String getRegistrarId() { return clientId; } @@ -219,8 +219,8 @@ public abstract class PollMessage extends ImmutableObject return thisCastToDerived(); } - public B setClientId(String clientId) { - getInstance().clientId = clientId; + public B setRegistrarId(String registrarId) { + getInstance().clientId = registrarId; return thisCastToDerived(); } @@ -441,8 +441,8 @@ public abstract class PollMessage extends ImmutableObject transferResponse = new ContactTransferResponse.Builder() .setContactId(contactId) - .setGainingClientId(transferResponse.getGainingClientId()) - .setLosingClientId(transferResponse.getLosingClientId()) + .setGainingRegistrarId(transferResponse.getGainingRegistrarId()) + .setLosingRegistrarId(transferResponse.getLosingRegistrarId()) .setTransferStatus(transferResponse.getTransferStatus()) .setTransferRequestTime(transferResponse.getTransferRequestTime()) .setPendingTransferExpirationTime( @@ -453,8 +453,8 @@ public abstract class PollMessage extends ImmutableObject transferResponse = new DomainTransferResponse.Builder() .setFullyQualifiedDomainName(fullyQualifiedDomainName) - .setGainingClientId(transferResponse.getGainingClientId()) - .setLosingClientId(transferResponse.getLosingClientId()) + .setGainingRegistrarId(transferResponse.getGainingRegistrarId()) + .setLosingRegistrarId(transferResponse.getLosingRegistrarId()) .setTransferStatus(transferResponse.getTransferStatus()) .setTransferRequestTime(transferResponse.getTransferRequestTime()) .setPendingTransferExpirationTime( diff --git a/core/src/main/java/google/registry/model/registrar/Registrar.java b/core/src/main/java/google/registry/model/registrar/Registrar.java index fdcf70509..c66d479b6 100644 --- a/core/src/main/java/google/registry/model/registrar/Registrar.java +++ b/core/src/main/java/google/registry/model/registrar/Registrar.java @@ -222,14 +222,15 @@ public class Registrar extends ImmutableObject comparing(RegistrarContact::getEmailAddress, String::compareTo); /** - * A caching {@link Supplier} of a clientId to {@link Registrar} map. + * A caching {@link Supplier} of a registrarId to {@link Registrar} map. * *

The supplier's get() method enters a transactionless context briefly to avoid enrolling the * query inside an unrelated client-affecting transaction. */ - private static final Supplier> CACHE_BY_CLIENT_ID = + private static final Supplier> CACHE_BY_REGISTRAR_ID = memoizeWithShortExpiration( - () -> tm().doTransactionless(() -> Maps.uniqueIndex(loadAll(), Registrar::getClientId))); + () -> + tm().doTransactionless(() -> Maps.uniqueIndex(loadAll(), Registrar::getRegistrarId))); @Parent @Transient Key parent = getCrossTldKey(); @@ -479,7 +480,7 @@ public class Registrar extends ImmutableObject /** Whether or not registry lock is allowed for this registrar. */ boolean registryLockAllowed = false; - public String getClientId() { + public String getRegistrarId() { return clientIdentifier; } @@ -764,13 +765,13 @@ public class Registrar extends ImmutableObject super(instance); } - public Builder setClientId(String clientId) { - // Client id must be [3,16] chars long. See "clIDType" in the base EPP schema of RFC 5730. + public Builder setRegistrarId(String registrarId) { + // Registrar id must be [3,16] chars long. See "clIDType" in the base EPP schema of RFC 5730. // (Need to validate this here as there's no matching EPP XSD for validation.) checkArgument( - Range.closed(3, 16).contains(clientId.length()), - "Client identifier must be 3-16 characters long."); - getInstance().clientIdentifier = clientId; + Range.closed(3, 16).contains(registrarId.length()), + "Registrar ID must be 3-16 characters long."); + getInstance().clientIdentifier = registrarId; return this; } @@ -1026,40 +1027,40 @@ public class Registrar extends ImmutableObject /** Loads all registrar entities using an in-memory cache. */ public static Iterable loadAllCached() { - return CACHE_BY_CLIENT_ID.get().values(); + return CACHE_BY_REGISTRAR_ID.get().values(); } /** Loads all registrar keys using an in-memory cache. */ public static ImmutableSet> loadAllKeysCached() { - return CACHE_BY_CLIENT_ID.get().keySet().stream() + return CACHE_BY_REGISTRAR_ID.get().keySet().stream() .map(Registrar::createVKey) .collect(toImmutableSet()); } - /** Loads and returns a registrar entity by its client id directly from Datastore. */ - public static Optional loadByClientId(String clientId) { - checkArgument(!Strings.isNullOrEmpty(clientId), "clientId must be specified"); - return transactIfJpaTm(() -> tm().loadByKeyIfPresent(createVKey(clientId))); + /** Loads and returns a registrar entity by its id directly from Datastore. */ + public static Optional loadByRegistrarId(String registrarId) { + checkArgument(!Strings.isNullOrEmpty(registrarId), "registrarId must be specified"); + return transactIfJpaTm(() -> tm().loadByKeyIfPresent(createVKey(registrarId))); } /** - * Loads and returns a registrar entity by its client id using an in-memory cache. + * Loads and returns a registrar entity by its id using an in-memory cache. * *

Returns empty if the registrar isn't found. */ - public static Optional loadByClientIdCached(String clientId) { - checkArgument(!Strings.isNullOrEmpty(clientId), "clientId must be specified"); - return Optional.ofNullable(CACHE_BY_CLIENT_ID.get().get(clientId)); + public static Optional loadByRegistrarIdCached(String registrarId) { + checkArgument(!Strings.isNullOrEmpty(registrarId), "registrarId must be specified"); + return Optional.ofNullable(CACHE_BY_REGISTRAR_ID.get().get(registrarId)); } /** - * Loads and returns a registrar entity by its client id using an in-memory cache. + * Loads and returns a registrar entity by its id using an in-memory cache. * *

Throws if the registrar isn't found. */ - public static Registrar loadRequiredRegistrarCached(String clientId) { - Optional registrar = loadByClientIdCached(clientId); - checkArgument(registrar.isPresent(), "couldn't find registrar '%s'", clientId); + public static Registrar loadRequiredRegistrarCached(String registrarId) { + Optional registrar = loadByRegistrarIdCached(registrarId); + checkArgument(registrar.isPresent(), "couldn't find registrar '%s'", registrarId); return registrar.get(); } } diff --git a/core/src/main/java/google/registry/model/registrar/RegistrarContact.java b/core/src/main/java/google/registry/model/registrar/RegistrarContact.java index bcaf96aff..aff28987b 100644 --- a/core/src/main/java/google/registry/model/registrar/RegistrarContact.java +++ b/core/src/main/java/google/registry/model/registrar/RegistrarContact.java @@ -229,7 +229,7 @@ public class RegistrarContact extends ImmutableObject .query( "DELETE FROM RegistrarPoc WHERE registrarId = :registrarId AND " + "emailAddress NOT IN :emailAddressesToKeep") - .setParameter("registrarId", registrar.getClientId()) + .setParameter("registrarId", registrar.getRegistrarId()) .setParameter("emailAddressesToKeep", emailAddressesToKeep) .executeUpdate(); } diff --git a/core/src/main/java/google/registry/model/reporting/HistoryEntry.java b/core/src/main/java/google/registry/model/reporting/HistoryEntry.java index 899280897..42b38f0ef 100644 --- a/core/src/main/java/google/registry/model/reporting/HistoryEntry.java +++ b/core/src/main/java/google/registry/model/reporting/HistoryEntry.java @@ -260,11 +260,11 @@ public class HistoryEntry extends ImmutableObject implements Buildable, Datastor return modificationTime; } - public String getClientId() { + public String getRegistrarId() { return clientId; } - public String getOtherClientId() { + public String getOtherRegistrarId() { return otherClientId; } @@ -489,13 +489,13 @@ public class HistoryEntry extends ImmutableObject implements Buildable, Datastor return thisCastToDerived(); } - public B setClientId(String clientId) { - getInstance().clientId = clientId; + public B setRegistrarId(String registrarId) { + getInstance().clientId = registrarId; return thisCastToDerived(); } - public B setOtherClientId(String otherClientId) { - getInstance().otherClientId = otherClientId; + public B setOtherRegistrarId(String otherRegistrarId) { + getInstance().otherClientId = otherRegistrarId; return thisCastToDerived(); } diff --git a/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java b/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java index 98ce0eda4..f87fec788 100644 --- a/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java +++ b/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java @@ -64,7 +64,7 @@ public abstract class BaseTransferObject extends ImmutableObject { return transferStatus; } - public String getGainingClientId() { + public String getGainingRegistrarId() { return gainingClientId; } @@ -72,7 +72,7 @@ public abstract class BaseTransferObject extends ImmutableObject { return transferRequestTime; } - public String getLosingClientId() { + public String getLosingRegistrarId() { return losingClientId; } @@ -99,8 +99,8 @@ public abstract class BaseTransferObject extends ImmutableObject { } /** Set the gaining registrar for a pending transfer on this resource. */ - public B setGainingClientId(String gainingClientId) { - getInstance().gainingClientId = gainingClientId; + public B setGainingRegistrarId(String gainingRegistrarId) { + getInstance().gainingClientId = gainingRegistrarId; return thisCastToDerived(); } @@ -111,8 +111,8 @@ public abstract class BaseTransferObject extends ImmutableObject { } /** Set the losing registrar for a pending transfer on this resource. */ - public B setLosingClientId(String losingClientId) { - getInstance().losingClientId = losingClientId; + public B setLosingRegistrarId(String losingRegistrarId) { + getInstance().losingClientId = losingRegistrarId; return thisCastToDerived(); } diff --git a/core/src/main/java/google/registry/model/transfer/TransferData.java b/core/src/main/java/google/registry/model/transfer/TransferData.java index 74ffca61f..7e7edd981 100644 --- a/core/src/main/java/google/registry/model/transfer/TransferData.java +++ b/core/src/main/java/google/registry/model/transfer/TransferData.java @@ -142,8 +142,8 @@ public abstract class TransferData< newBuilder .setTransferRequestTrid(this.transferRequestTrid) .setTransferRequestTime(this.transferRequestTime) - .setGainingClientId(this.gainingClientId) - .setLosingClientId(this.losingClientId); + .setGainingRegistrarId(this.gainingClientId) + .setLosingRegistrarId(this.losingClientId); return newBuilder; } diff --git a/core/src/main/java/google/registry/monitoring/whitebox/EppMetric.java b/core/src/main/java/google/registry/monitoring/whitebox/EppMetric.java index 89228fb11..cdcd0551c 100644 --- a/core/src/main/java/google/registry/monitoring/whitebox/EppMetric.java +++ b/core/src/main/java/google/registry/monitoring/whitebox/EppMetric.java @@ -35,7 +35,7 @@ public abstract class EppMetric { public abstract Optional getCommandName(); - public abstract Optional getClientId(); + public abstract Optional getRegistrarId(); public abstract Optional getTld(); @@ -78,9 +78,9 @@ public abstract class EppMetric { return setCommandName(flowSimpleClassName.replaceFirst("Flow$", "")); } - public abstract Builder setClientId(String clientId); + public abstract Builder setRegistrarId(String registrarId); - public abstract Builder setClientId(Optional clientId); + public abstract Builder setRegistrarId(Optional registrarId); public abstract Builder setTld(String tld); diff --git a/core/src/main/java/google/registry/rdap/RdapActionBase.java b/core/src/main/java/google/registry/rdap/RdapActionBase.java index 90507f972..8d26cea07 100644 --- a/core/src/main/java/google/registry/rdap/RdapActionBase.java +++ b/core/src/main/java/google/registry/rdap/RdapActionBase.java @@ -201,8 +201,8 @@ public abstract class RdapActionBase implements Runnable { * eligible to see deleted information. Admins can see all deleted information, while * authenticated registrars can see only their own deleted information. Note that if this method * returns true, it just means that some deleted information might be viewable. If this is a - * registrar request, the caller must still verify that the registrar can see each particular - * item by calling {@link RdapAuthorization#isAuthorizedForClientId}. + * registrar request, the caller must still verify that the registrar can see each particular item + * by calling {@link RdapAuthorization#isAuthorizedForRegistrar}. */ boolean shouldIncludeDeleted() { // If includeDeleted is not specified, or set to false, we don't need to go any further. @@ -212,7 +212,7 @@ public abstract class RdapActionBase implements Runnable { // Return true if we *might* be allowed to view any deleted info, meaning we're either an admin // or have access to at least one registrar's data return rdapAuthorization.role() == RdapAuthorization.Role.ADMINISTRATOR - || !rdapAuthorization.clientIds().isEmpty(); + || !rdapAuthorization.registrarIds().isEmpty(); } DeletedItemHandling getDeletedItemHandling() { @@ -228,8 +228,8 @@ public abstract class RdapActionBase implements Runnable { boolean isAuthorized(EppResource eppResource) { return getRequestTime().isBefore(eppResource.getDeletionTime()) || (shouldIncludeDeleted() - && rdapAuthorization.isAuthorizedForClientId( - eppResource.getPersistedCurrentSponsorClientId())); + && rdapAuthorization.isAuthorizedForRegistrar( + eppResource.getPersistedCurrentSponsorRegistrarId())); } /** @@ -240,8 +240,8 @@ public abstract class RdapActionBase implements Runnable { */ boolean isAuthorized(Registrar registrar) { return (registrar.isLiveAndPubliclyVisible() - || (shouldIncludeDeleted() - && rdapAuthorization.isAuthorizedForClientId(registrar.getClientId()))); + || (shouldIncludeDeleted() + && rdapAuthorization.isAuthorizedForRegistrar(registrar.getRegistrarId()))); } String canonicalizeName(String name) { diff --git a/core/src/main/java/google/registry/rdap/RdapAuthorization.java b/core/src/main/java/google/registry/rdap/RdapAuthorization.java index 991cf12a6..0a230e26b 100644 --- a/core/src/main/java/google/registry/rdap/RdapAuthorization.java +++ b/core/src/main/java/google/registry/rdap/RdapAuthorization.java @@ -32,22 +32,22 @@ public abstract class RdapAuthorization extends ImmutableObject { public abstract Role role(); /** The registrar client IDs for which access is granted (used only if the role is REGISTRAR. */ - public abstract ImmutableSet clientIds(); + public abstract ImmutableSet registrarIds(); - static RdapAuthorization create(Role role, String clientId) { - return new AutoValue_RdapAuthorization(role, ImmutableSet.of(clientId)); + static RdapAuthorization create(Role role, String registrarId) { + return new AutoValue_RdapAuthorization(role, ImmutableSet.of(registrarId)); } static RdapAuthorization create(Role role, ImmutableSet clientIds) { return new AutoValue_RdapAuthorization(role, clientIds); } - boolean isAuthorizedForClientId(String clientId) { + boolean isAuthorizedForRegistrar(String registrarId) { switch (role()) { case ADMINISTRATOR: return true; case REGISTRAR: - return clientIds().contains(clientId); + return registrarIds().contains(registrarId); default: return false; } diff --git a/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java b/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java index 3e131b5ba..2b92d16be 100644 --- a/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java +++ b/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java @@ -392,7 +392,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { partialStringQuery.getInitialString(), shouldIncludeDeleted() ? START_OF_TIME : getRequestTime()); return (!host.isPresent() - || !desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorClientId())) + || !desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorRegistrarId())) ? ImmutableList.of() : ImmutableList.of(host.get().createVKey()); } else { @@ -434,7 +434,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { fqhn, shouldIncludeDeleted() ? START_OF_TIME : getRequestTime()); if (host.isPresent() - && desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorClientId())) { + && desiredRegistrar + .get() + .equals(host.get().getPersistedCurrentSponsorRegistrarId())) { builder.add(host.get().createVKey()); } } else { diff --git a/core/src/main/java/google/registry/rdap/RdapEntitySearchAction.java b/core/src/main/java/google/registry/rdap/RdapEntitySearchAction.java index 574db9618..040e7d38a 100644 --- a/core/src/main/java/google/registry/rdap/RdapEntitySearchAction.java +++ b/core/src/main/java/google/registry/rdap/RdapEntitySearchAction.java @@ -272,7 +272,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase { DeletedItemHandling.EXCLUDE, rdapResultSetMaxSize + 1); if (!rdapAuthorization.role().equals(Role.ADMINISTRATOR)) { - query = query.filter("currentSponsorClientId in", rdapAuthorization.clientIds()); + query = query.filter("currentSponsorClientId in", rdapAuthorization.registrarIds()); } resultSet = getMatchingResources(query, false, rdapResultSetMaxSize + 1); } else { @@ -290,7 +290,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase { if (!rdapAuthorization.role().equals(Role.ADMINISTRATOR)) { builder = builder.whereFieldIsIn( - "currentSponsorClientId", rdapAuthorization.clientIds()); + "currentSponsorClientId", rdapAuthorization.registrarIds()); } return getMatchingResourcesSql(builder, false, rdapResultSetMaxSize + 1); }); diff --git a/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java b/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java index 7ef9c344c..1fbd619e5 100644 --- a/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java +++ b/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java @@ -288,7 +288,7 @@ public class RdapJsonFormatter { Event.builder() .setEventAction(EventAction.REGISTRATION) .setEventActor( - Optional.ofNullable(domainBase.getCreationClientId()).orElse("(none)")) + Optional.ofNullable(domainBase.getCreationRegistrarId()).orElse("(none)")) .setEventDate(domainBase.getCreationTime()) .build(), Event.builder() @@ -307,7 +307,7 @@ public class RdapJsonFormatter { // // See {@link createRdapRegistrarEntity} for details of section 2.4 conformance Registrar registrar = - Registrar.loadRequiredRegistrarCached(domainBase.getCurrentSponsorClientId()); + Registrar.loadRequiredRegistrarCached(domainBase.getCurrentSponsorRegistrarId()); builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL)); // RDAP Technical Implementation Guide 3.2: must have link to the registrar's RDAP URL for this // domain, with rel=related. @@ -457,7 +457,8 @@ public class RdapJsonFormatter { // RDAP Response Profile 4.3 - Registrar member is optional, so we only set it for FULL if (outputDataType == OutputDataType.FULL) { Registrar registrar = - Registrar.loadRequiredRegistrarCached(hostResource.getPersistedCurrentSponsorClientId()); + Registrar.loadRequiredRegistrarCached( + hostResource.getPersistedCurrentSponsorRegistrarId()); builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL)); } if (outputDataType != OutputDataType.INTERNAL) { @@ -490,7 +491,7 @@ public class RdapJsonFormatter { // // 2.8 allows for unredacted output for authorized people. boolean isAuthorized = - rdapAuthorization.isAuthorizedForClientId(contactResource.getCurrentSponsorClientId()); + rdapAuthorization.isAuthorizedForRegistrar(contactResource.getCurrentSponsorRegistrarId()); // ROID needs to be redacted if we aren't authorized, so we can't have a self-link for // unauthorized users @@ -741,7 +742,7 @@ public class RdapJsonFormatter { .noneMatch(contact -> contact.roles().contains(RdapEntity.Role.ABUSE))) { logger.atWarning().log( "Registrar '%s' (IANA ID %s) is missing ABUSE contact", - registrar.getClientId(), registrar.getIanaIdentifier()); + registrar.getRegistrarId(), registrar.getIanaIdentifier()); } builder.entitiesBuilder().addAll(registrarContacts); } @@ -910,7 +911,7 @@ public class RdapJsonFormatter { eventsBuilder.add( Event.builder() .setEventAction(rdapEventAction) - .setEventActor(historyEntry.getClientId()) + .setEventActor(historyEntry.getRegistrarId()) .setEventDate(modificationTime) .build()); // The last change time might not be the lastEppUpdateTime, since some changes happen without diff --git a/core/src/main/java/google/registry/rdap/RdapSearchActionBase.java b/core/src/main/java/google/registry/rdap/RdapSearchActionBase.java index cc3cb6c91..fba31d296 100644 --- a/core/src/main/java/google/registry/rdap/RdapSearchActionBase.java +++ b/core/src/main/java/google/registry/rdap/RdapSearchActionBase.java @@ -125,7 +125,7 @@ public abstract class RdapSearchActionBase extends RdapActionBase { protected boolean shouldBeVisible(EppResource eppResource) { return isAuthorized(eppResource) && (!registrarParam.isPresent() - || registrarParam.get().equals(eppResource.getPersistedCurrentSponsorClientId())); + || registrarParam.get().equals(eppResource.getPersistedCurrentSponsorRegistrarId())); } /** @@ -138,7 +138,7 @@ public abstract class RdapSearchActionBase extends RdapActionBase { */ protected boolean shouldBeVisible(Registrar registrar) { return isAuthorized(registrar) - && (!registrarParam.isPresent() || registrarParam.get().equals(registrar.getClientId())); + && (!registrarParam.isPresent() || registrarParam.get().equals(registrar.getRegistrarId())); } /** diff --git a/core/src/main/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsAction.java b/core/src/main/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsAction.java index 32fa8d3e4..f1f15aab0 100644 --- a/core/src/main/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsAction.java +++ b/core/src/main/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsAction.java @@ -216,12 +216,12 @@ public final class UpdateRegistrarRdapBaseUrlsAction implements Runnable { if (registrar.getRdapBaseUrls().equals(baseUrls)) { logger.atInfo().log( "No change in RdapBaseUrls for registrar %s (ianaId %s)", - registrar.getClientId(), ianaId); + registrar.getRegistrarId(), ianaId); return; } logger.atInfo().log( "Updating RdapBaseUrls for registrar %s (ianaId %s) from %s to %s", - registrar.getClientId(), + registrar.getRegistrarId(), ianaId, registrar.getRdapBaseUrls(), baseUrls); diff --git a/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java b/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java index 255568f31..4ec66997f 100644 --- a/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java +++ b/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java @@ -63,9 +63,9 @@ final class ContactResourceToXjcConverter { bean.getPostalInfos().add(convertPostalInfo(internationalizedPostalInfo)); } bean.setId(model.getContactId()); - bean.setClID(model.getCurrentSponsorClientId()); - bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null)); - bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null)); + bean.setClID(model.getCurrentSponsorRegistrarId()); + bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null)); + bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null)); bean.setCrDate(model.getCreationTime()); bean.setUpDate(model.getLastEppUpdateTime()); bean.setTrDate(model.getLastTransferTime()); @@ -112,8 +112,8 @@ final class ContactResourceToXjcConverter { private static XjcRdeContactTransferDataType convertTransferData(TransferData model) { XjcRdeContactTransferDataType bean = new XjcRdeContactTransferDataType(); bean.setTrStatus(XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName())); - bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingClientId())); - bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId())); + bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingRegistrarId())); + bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingRegistrarId())); bean.setReDate(model.getTransferRequestTime()); bean.setAcDate(model.getPendingTransferExpirationTime()); return bean; diff --git a/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java b/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java index 8ed46d5be..59f0ea6ab 100644 --- a/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java +++ b/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java @@ -91,12 +91,12 @@ final class DomainBaseToXjcConverter { // o A element that contains the identifier of the sponsoring // registrar. - bean.setClID(model.getCurrentSponsorClientId()); + bean.setClID(model.getCurrentSponsorRegistrarId()); // o A element that contains the identifier of the registrar // that created the domain name object. An OPTIONAL client attribute // is used to specify the client that performed the operation. - bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null)); + bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null)); // o An OPTIONAL element that contains the date and time of // the domain name object creation. This element MUST be present if @@ -120,7 +120,7 @@ final class DomainBaseToXjcConverter { // MUST NOT be present if the domain has never been modified. An // OPTIONAL client attribute is used to specify the client that // performed the operation. - bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null)); + bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null)); // o An OPTIONAL element that contains the date and time of // the most recent domain object successful transfer. This element @@ -254,9 +254,8 @@ final class DomainBaseToXjcConverter { } private static boolean hasGainingAndLosingRegistrars(DomainBase model) { - return - !Strings.isNullOrEmpty(model.getTransferData().getGainingClientId()) - && !Strings.isNullOrEmpty(model.getTransferData().getLosingClientId()); + return !Strings.isNullOrEmpty(model.getTransferData().getGainingRegistrarId()) + && !Strings.isNullOrEmpty(model.getTransferData().getLosingRegistrarId()); } /** Converts {@link TransferData} to {@link XjcRdeDomainTransferDataType}. */ @@ -264,8 +263,8 @@ final class DomainBaseToXjcConverter { XjcRdeDomainTransferDataType bean = new XjcRdeDomainTransferDataType(); bean.setTrStatus( XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName())); - bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingClientId())); - bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId())); + bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingRegistrarId())); + bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingRegistrarId())); bean.setReDate(model.getTransferRequestTime()); bean.setAcDate(model.getPendingTransferExpirationTime()); bean.setExDate(model.getTransferredRegistrationExpirationTime()); diff --git a/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java b/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java index 759454e61..364528b33 100644 --- a/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java +++ b/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java @@ -47,10 +47,11 @@ final class HostResourceToXjcConverter { /** Converts {@link HostResource} to {@link XjcRdeHost}. */ static XjcRdeHost convertSubordinateHost(HostResource model, DomainBase superordinateDomain) { - XjcRdeHost bean = convertHostCommon( - model, - superordinateDomain.getCurrentSponsorClientId(), - model.computeLastTransferTime(superordinateDomain)); + XjcRdeHost bean = + convertHostCommon( + model, + superordinateDomain.getCurrentSponsorRegistrarId(), + model.computeLastTransferTime(superordinateDomain)); if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { bean.getStatuses().add(convertStatusValue(StatusValue.PENDING_TRANSFER)); } @@ -60,22 +61,20 @@ final class HostResourceToXjcConverter { /** Converts {@link HostResource} to {@link XjcRdeHost}. */ static XjcRdeHost convertExternalHost(HostResource model) { return convertHostCommon( - model, - model.getPersistedCurrentSponsorClientId(), - model.getLastTransferTime()); + model, model.getPersistedCurrentSponsorRegistrarId(), model.getLastTransferTime()); } private static XjcRdeHost convertHostCommon( - HostResource model, String clientId, DateTime lastTransferTime) { + HostResource model, String registrarId, DateTime lastTransferTime) { XjcRdeHost bean = new XjcRdeHost(); bean.setName(model.getHostName()); bean.setRoid(model.getRepoId()); bean.setCrDate(model.getCreationTime()); bean.setUpDate(model.getLastEppUpdateTime()); - bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null)); - bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null)); - bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null)); - bean.setClID(clientId); + bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null)); + bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null)); + bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null)); + bean.setClID(registrarId); bean.setTrDate(lastTransferTime); for (StatusValue status : model.getStatusValues()) { // TODO(b/34844887): Remove when PENDING_TRANSFER is not persisted on host resources. diff --git a/core/src/main/java/google/registry/rde/RdeStagingMapper.java b/core/src/main/java/google/registry/rde/RdeStagingMapper.java index a9c45aaf7..9a153b398 100644 --- a/core/src/main/java/google/registry/rde/RdeStagingMapper.java +++ b/core/src/main/java/google/registry/rde/RdeStagingMapper.java @@ -88,9 +88,9 @@ public final class RdeStagingMapper extends Mapper has a superordinate relationship // to a subordinate , or of domain, contact and // host objects. - bean.setId(model.getClientId()); + bean.setId(model.getRegistrarId()); // o An element that contains the name of the registrar. bean.setName(model.getRegistrarName()); diff --git a/core/src/main/java/google/registry/reporting/billing/CopyDetailReportsAction.java b/core/src/main/java/google/registry/reporting/billing/CopyDetailReportsAction.java index b885fdf17..f84d052c4 100644 --- a/core/src/main/java/google/registry/reporting/billing/CopyDetailReportsAction.java +++ b/core/src/main/java/google/registry/reporting/billing/CopyDetailReportsAction.java @@ -103,7 +103,7 @@ public final class CopyDetailReportsAction implements Runnable { // The standard report format is "invoice_details_yyyy-MM_registrarId_tld.csv // TODO(larryruili): Determine a safer way of enforcing this. String registrarId = Iterables.get(Splitter.on('_').split(detailReportName), 3); - Optional registrar = Registrar.loadByClientId(registrarId); + Optional registrar = Registrar.loadByRegistrarId(registrarId); if (!registrar.isPresent()) { logger.atWarning().log( "Registrar %s not found in database for file %s", registrar, detailReportName); diff --git a/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java b/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java index d4aa88c34..75b2ce088 100644 --- a/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java +++ b/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java @@ -207,14 +207,15 @@ public class Spec11EmailUtils { } } - private InternetAddress getEmailAddressForRegistrar(String clientId) throws MessagingException { + private InternetAddress getEmailAddressForRegistrar(String registrarId) + throws MessagingException { // Attempt to use the registrar's WHOIS abuse contact, then fall back to the regular address. Registrar registrar = - Registrar.loadByClientIdCached(clientId) + Registrar.loadByRegistrarIdCached(registrarId) .orElseThrow( () -> new IllegalArgumentException( - String.format("Could not find registrar %s", clientId))); + String.format("Could not find registrar %s", registrarId))); return new InternetAddress( registrar .getWhoisAbuseContact() diff --git a/core/src/main/java/google/registry/reporting/spec11/Spec11RegistrarThreatMatchesParser.java b/core/src/main/java/google/registry/reporting/spec11/Spec11RegistrarThreatMatchesParser.java index 57d9dcd79..531bb855f 100644 --- a/core/src/main/java/google/registry/reporting/spec11/Spec11RegistrarThreatMatchesParser.java +++ b/core/src/main/java/google/registry/reporting/spec11/Spec11RegistrarThreatMatchesParser.java @@ -104,12 +104,12 @@ public class Spec11RegistrarThreatMatchesParser { private RegistrarThreatMatches parseRegistrarThreatMatch(String line) throws JSONException { JSONObject reportJSON = new JSONObject(line); - String clientId = reportJSON.getString(Spec11Pipeline.REGISTRAR_CLIENT_ID_FIELD); + String registrarId = reportJSON.getString(Spec11Pipeline.REGISTRAR_CLIENT_ID_FIELD); JSONArray threatMatchesArray = reportJSON.getJSONArray(Spec11Pipeline.THREAT_MATCHES_FIELD); ImmutableList.Builder threatMatches = ImmutableList.builder(); for (int i = 0; i < threatMatchesArray.length(); i++) { threatMatches.add(ThreatMatch.fromJSON(threatMatchesArray.getJSONObject(i))); } - return RegistrarThreatMatches.create(clientId, threatMatches.build()); + return RegistrarThreatMatches.create(registrarId, threatMatches.build()); } } diff --git a/core/src/main/java/google/registry/request/auth/AuthenticatedRegistrarAccessor.java b/core/src/main/java/google/registry/request/auth/AuthenticatedRegistrarAccessor.java index 25692e049..cd3a4a792 100644 --- a/core/src/main/java/google/registry/request/auth/AuthenticatedRegistrarAccessor.java +++ b/core/src/main/java/google/registry/request/auth/AuthenticatedRegistrarAccessor.java @@ -220,36 +220,36 @@ public class AuthenticatedRegistrarAccessor { *

Throws a {@link RegistrarAccessDeniedException} if the user is not logged in, or not * authorized to access the requested registrar. * - * @param clientId ID of the registrar we request + * @param registrarId ID of the registrar we request */ - public Registrar getRegistrar(String clientId) throws RegistrarAccessDeniedException { + public Registrar getRegistrar(String registrarId) throws RegistrarAccessDeniedException { Registrar registrar = - Registrar.loadByClientId(clientId) + Registrar.loadByRegistrarId(registrarId) .orElseThrow( () -> new RegistrarAccessDeniedException( - String.format("Registrar %s does not exist", clientId))); - verifyAccess(clientId); + String.format("Registrar %s does not exist", registrarId))); + verifyAccess(registrarId); - if (!clientId.equals(registrar.getClientId())) { + if (!registrarId.equals(registrar.getRegistrarId())) { logger.atSevere().log( "registrarLoader.apply(clientId) returned a Registrar with a different clientId. " + "Requested: %s, returned: %s.", - clientId, registrar.getClientId()); + registrarId, registrar.getRegistrarId()); throw new RegistrarAccessDeniedException("Internal error - please check logs"); } return registrar; } - public void verifyAccess(String clientId) throws RegistrarAccessDeniedException { - ImmutableSet roles = getAllClientIdWithRoles().get(clientId); + public void verifyAccess(String registrarId) throws RegistrarAccessDeniedException { + ImmutableSet roles = getAllClientIdWithRoles().get(registrarId); if (roles.isEmpty()) { throw new RegistrarAccessDeniedException( - String.format("%s doesn't have access to registrar %s", userIdForLogging, clientId)); + String.format("%s doesn't have access to registrar %s", userIdForLogging, registrarId)); } - logger.atInfo().log("%s has %s access to registrar %s.", userIdForLogging, roles, clientId); + logger.atInfo().log("%s has %s access to registrar %s.", userIdForLogging, roles, registrarId); } public String userIdForLogging() { @@ -331,7 +331,7 @@ public class AuthenticatedRegistrarAccessor { // Filter out disabled registrars (note that pending registrars still allow console login). auditedOfy().load().keys(accessibleClientIds).values().stream() .filter(registrar -> registrar.getState() != State.DISABLED) - .forEach(registrar -> builder.put(registrar.getClientId(), Role.OWNER)); + .forEach(registrar -> builder.put(registrar.getRegistrarId(), Role.OWNER)); } else { jpaTm() .transact( @@ -345,7 +345,7 @@ public class AuthenticatedRegistrarAccessor { .setParameter("gaeUserId", user.getUserId()) .setParameter("state", State.DISABLED) .getResultStream() - .forEach(registrar -> builder.put(registrar.getClientId(), Role.OWNER))); + .forEach(registrar -> builder.put(registrar.getRegistrarId(), Role.OWNER))); } // Admins have ADMIN access to all registrars, and also OWNER access to the registry registrar @@ -358,10 +358,10 @@ public class AuthenticatedRegistrarAccessor { registrar -> { if (registrar.getType() != Registrar.Type.REAL || !registrar.isLive() - || registrar.getClientId().equals(registryAdminClientId)) { - builder.put(registrar.getClientId(), Role.OWNER); + || registrar.getRegistrarId().equals(registryAdminClientId)) { + builder.put(registrar.getRegistrarId(), Role.OWNER); } - builder.put(registrar.getClientId(), Role.ADMIN); + builder.put(registrar.getRegistrarId(), Role.ADMIN); })); } diff --git a/core/src/main/java/google/registry/request/auth/OAuthAuthenticationMechanism.java b/core/src/main/java/google/registry/request/auth/OAuthAuthenticationMechanism.java index d9bb816cd..89de32274 100644 --- a/core/src/main/java/google/registry/request/auth/OAuthAuthenticationMechanism.java +++ b/core/src/main/java/google/registry/request/auth/OAuthAuthenticationMechanism.java @@ -87,7 +87,7 @@ public class OAuthAuthenticationMechanism implements AuthenticationMechanism { // authentication result, so we can call them one by one. User currentUser; boolean isUserAdmin; - String clientId; + String oauthClientId; ImmutableSet authorizedScopes; try { String[] availableOauthScopeArray = availableOauthScopes.toArray(new String[0]); @@ -95,8 +95,8 @@ public class OAuthAuthenticationMechanism implements AuthenticationMechanism { isUserAdmin = oauthService.isUserAdmin(availableOauthScopeArray); logger.atInfo().log( "current user: %s (%s)", currentUser, isUserAdmin ? "admin" : "not admin"); - clientId = oauthService.getClientId(availableOauthScopeArray); - logger.atInfo().log("client ID: %s", clientId); + oauthClientId = oauthService.getClientId(availableOauthScopeArray); + logger.atInfo().log("client ID: %s", oauthClientId); authorizedScopes = ImmutableSet.copyOf(oauthService.getAuthorizedScopes(availableOauthScopeArray)); logger.atInfo().log("authorized scope(s): %s", authorizedScopes); @@ -104,13 +104,13 @@ public class OAuthAuthenticationMechanism implements AuthenticationMechanism { logger.atInfo().withCause(e).log("unable to get OAuth information"); return AuthResult.create(NONE); } - if ((currentUser == null) || (clientId == null) || (authorizedScopes == null)) { + if ((currentUser == null) || (oauthClientId == null) || (authorizedScopes == null)) { return AuthResult.create(NONE); } // Make sure that the client ID matches, to avoid a confused deputy attack; see: // http://stackoverflow.com/a/17439317/1179226 - if (!allowedOauthClientIds.contains(clientId)) { + if (!allowedOauthClientIds.contains(oauthClientId)) { logger.atInfo().log("client ID is not allowed"); return AuthResult.create(NONE); } @@ -128,8 +128,6 @@ public class OAuthAuthenticationMechanism implements AuthenticationMechanism { currentUser, isUserAdmin, OAuthTokenInfo.create( - ImmutableSet.copyOf(authorizedScopes), - clientId, - rawAccessToken))); + ImmutableSet.copyOf(authorizedScopes), oauthClientId, rawAccessToken))); } } diff --git a/core/src/main/java/google/registry/tmch/LordnTaskUtils.java b/core/src/main/java/google/registry/tmch/LordnTaskUtils.java index 1e33eaf3c..888f86e3e 100644 --- a/core/src/main/java/google/registry/tmch/LordnTaskUtils.java +++ b/core/src/main/java/google/registry/tmch/LordnTaskUtils.java @@ -71,7 +71,7 @@ public final class LordnTaskUtils { domain.getRepoId(), domain.getDomainName(), domain.getSmdId(), - getIanaIdentifier(domain.getCreationClientId()), + getIanaIdentifier(domain.getCreationRegistrarId()), transactionTime); // Used as creation time. } @@ -82,15 +82,15 @@ public final class LordnTaskUtils { domain.getRepoId(), domain.getDomainName(), domain.getLaunchNotice().getNoticeId().getTcnId(), - getIanaIdentifier(domain.getCreationClientId()), + getIanaIdentifier(domain.getCreationRegistrarId()), transactionTime, // Used as creation time. domain.getLaunchNotice().getAcceptedTime()); } - /** Retrieves the IANA identifier for a registrar based on the client id. */ - private static String getIanaIdentifier(String clientId) { - Optional registrar = Registrar.loadByClientIdCached(clientId); - checkState(registrar.isPresent(), "No registrar found for client id: %s", clientId); + /** Retrieves the IANA identifier for a registrar by its ID. */ + private static String getIanaIdentifier(String registrarId) { + Optional registrar = Registrar.loadByRegistrarIdCached(registrarId); + checkState(registrar.isPresent(), "No registrar found with ID: %s", registrarId); // Return the string "null" for null identifiers, since some Registrar.Types such as OTE will // have null iana ids. return String.valueOf(registrar.get().getIanaIdentifier()); diff --git a/core/src/main/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java b/core/src/main/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java index 49108eae9..9a2f617fa 100644 --- a/core/src/main/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java +++ b/core/src/main/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java @@ -276,9 +276,10 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand { DateTime now = DateTime.now(UTC); for (String clientId : mainParameters) { Registrar oldRegistrar = getOldRegistrar(clientId); - Registrar.Builder builder = (oldRegistrar == null) - ? new Registrar.Builder().setClientId(clientId) - : oldRegistrar.asBuilder(); + Registrar.Builder builder = + (oldRegistrar == null) + ? new Registrar.Builder().setRegistrarId(clientId) + : oldRegistrar.asBuilder(); if (!isNullOrEmpty(password)) { builder.setPassword(password); diff --git a/core/src/main/java/google/registry/tools/CreateRegistrarCommand.java b/core/src/main/java/google/registry/tools/CreateRegistrarCommand.java index 67a7203fa..67a60e5c8 100644 --- a/core/src/main/java/google/registry/tools/CreateRegistrarCommand.java +++ b/core/src/main/java/google/registry/tools/CreateRegistrarCommand.java @@ -23,7 +23,7 @@ import static google.registry.tools.RegistryToolEnvironment.PRODUCTION; import static google.registry.tools.RegistryToolEnvironment.SANDBOX; import static google.registry.tools.RegistryToolEnvironment.UNITTEST; import static google.registry.util.PreconditionsUtils.checkArgumentNotNull; -import static google.registry.util.RegistrarUtils.normalizeClientId; +import static google.registry.util.RegistrarUtils.normalizeRegistrarId; import static java.util.stream.Collectors.toCollection; import com.beust.jcommander.Parameter; @@ -76,21 +76,23 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand checkArgument(clientId.length() <= 16, "Client identifier (%s) is too long", clientId); if (Registrar.Type.REAL.equals(registrarType)) { checkArgument( - clientId.equals(normalizeClientId(clientId)), + clientId.equals(normalizeRegistrarId(clientId)), "Client identifier (%s) can only contain lowercase letters, numbers, and hyphens", clientId); } checkState( - !Registrar.loadByClientId(clientId).isPresent(), "Registrar %s already exists", clientId); + !Registrar.loadByRegistrarId(clientId).isPresent(), + "Registrar %s already exists", + clientId); List collisions = Streams.stream(Registrar.loadAll()) - .filter(registrar -> normalizeClientId(registrar.getClientId()).equals(clientId)) + .filter(registrar -> normalizeRegistrarId(registrar.getRegistrarId()).equals(clientId)) .collect(toCollection(ArrayList::new)); if (!collisions.isEmpty()) { throw new IllegalArgumentException( String.format( "The registrar client identifier %s normalizes identically to existing registrar %s", - clientId, collisions.get(0).getClientId())); + clientId, collisions.get(0).getRegistrarId())); } return null; } diff --git a/core/src/main/java/google/registry/tools/CreateRegistrarGroupsCommand.java b/core/src/main/java/google/registry/tools/CreateRegistrarGroupsCommand.java index 1128bea5a..bf947b9d9 100644 --- a/core/src/main/java/google/registry/tools/CreateRegistrarGroupsCommand.java +++ b/core/src/main/java/google/registry/tools/CreateRegistrarGroupsCommand.java @@ -51,7 +51,9 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand for (String clientId : clientIds) { Registrar registrar = checkArgumentPresent( - Registrar.loadByClientId(clientId), "Could not load registrar with id %s", clientId); + Registrar.loadByRegistrarId(clientId), + "Could not load registrar with id %s", + clientId); registrars.add(registrar); } } @@ -77,7 +79,7 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand for (Registrar registrar : registrars) { connection.sendPostRequest( CreateGroupsAction.PATH, - ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, registrar.getClientId()), + ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, registrar.getRegistrarId()), MediaType.PLAIN_TEXT_UTF_8, new byte[0]); } diff --git a/core/src/main/java/google/registry/tools/DeleteTldCommand.java b/core/src/main/java/google/registry/tools/DeleteTldCommand.java index 0b79207f8..a6c9ca96e 100644 --- a/core/src/main/java/google/registry/tools/DeleteTldCommand.java +++ b/core/src/main/java/google/registry/tools/DeleteTldCommand.java @@ -60,7 +60,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements CommandWithRem checkState( !registrar.getAllowedTlds().contains(tld), "Cannot delete TLD because registrar %s lists it as an allowed TLD", - registrar.getClientId()); + registrar.getRegistrarId()); } checkState(!tldContainsDomains(tld), "Cannot delete TLD because a domain is defined on it"); } diff --git a/core/src/main/java/google/registry/tools/DomainLockUtils.java b/core/src/main/java/google/registry/tools/DomainLockUtils.java index 4977f2fd5..45d18099e 100644 --- a/core/src/main/java/google/registry/tools/DomainLockUtils.java +++ b/core/src/main/java/google/registry/tools/DomainLockUtils.java @@ -315,7 +315,7 @@ public final class DomainLockUtils { // The user must have specified either the correct registrar ID or the admin registrar ID checkArgument( registryAdminRegistrarId.equals(registrarId) - || domain.getCurrentSponsorClientId().equals(registrarId), + || domain.getCurrentSponsorRegistrarId().equals(registrarId), "Domain %s is not owned by registrar %s", domainName, registrarId); @@ -364,7 +364,7 @@ public final class DomainLockUtils { "%s of a domain through a RegistryLock operation", isLock ? "Lock" : "Unlock"); DomainHistory domainHistory = new DomainHistory.Builder() - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setBySuperuser(lock.isSuperuser()) .setRequestedByRegistrar(!lock.isSuperuser()) .setType(HistoryEntry.Type.DOMAIN_UPDATE) @@ -379,7 +379,7 @@ public final class DomainLockUtils { new BillingEvent.OneTime.Builder() .setReason(Reason.SERVER_STATUS) .setTargetId(domain.getForeignKey()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setCost(Registry.get(domain.getTld()).getRegistryLockOrUnlockBillingCost()) .setEventTime(now) .setBillingTime(now) diff --git a/core/src/main/java/google/registry/tools/EppToolCommand.java b/core/src/main/java/google/registry/tools/EppToolCommand.java index 3082c81be..388df64c4 100644 --- a/core/src/main/java/google/registry/tools/EppToolCommand.java +++ b/core/src/main/java/google/registry/tools/EppToolCommand.java @@ -101,7 +101,7 @@ abstract class EppToolCommand extends ConfirmingCommand protected void addXmlCommand(String clientId, String xml) { checkArgumentPresent( - Registrar.loadByClientId(clientId), "Registrar with client ID %s not found", clientId); + Registrar.loadByRegistrarId(clientId), "Registrar with client ID %s not found", clientId); commands.add(new XmlEppParameters(clientId, xml)); } diff --git a/core/src/main/java/google/registry/tools/GetHistoryEntriesCommand.java b/core/src/main/java/google/registry/tools/GetHistoryEntriesCommand.java index fe5a1969f..7e4366d09 100644 --- a/core/src/main/java/google/registry/tools/GetHistoryEntriesCommand.java +++ b/core/src/main/java/google/registry/tools/GetHistoryEntriesCommand.java @@ -68,7 +68,7 @@ final class GetHistoryEntriesCommand implements CommandWithRemoteApi { for (HistoryEntry entry : historyEntries) { System.out.printf( "Client: %s\nTime: %s\nClient TRID: %s\nServer TRID: %s\n%s\n", - entry.getClientId(), + entry.getRegistrarId(), entry.getModificationTime(), (entry.getTrid() == null) ? null : entry.getTrid().getClientTransactionId().orElse(null), (entry.getTrid() == null) ? null : entry.getTrid().getServerTransactionId(), diff --git a/core/src/main/java/google/registry/tools/GetRegistrarCommand.java b/core/src/main/java/google/registry/tools/GetRegistrarCommand.java index 47f08a0e8..e70d3a100 100644 --- a/core/src/main/java/google/registry/tools/GetRegistrarCommand.java +++ b/core/src/main/java/google/registry/tools/GetRegistrarCommand.java @@ -35,7 +35,9 @@ final class GetRegistrarCommand implements CommandWithRemoteApi { for (String clientId : mainParameters) { Registrar registrar = checkArgumentPresent( - Registrar.loadByClientId(clientId), "Registrar with id %s does not exist", clientId); + Registrar.loadByRegistrarId(clientId), + "Registrar with id %s does not exist", + clientId); System.out.println(registrar); } } diff --git a/core/src/main/java/google/registry/tools/LoadTestCommand.java b/core/src/main/java/google/registry/tools/LoadTestCommand.java index 0dac8962a..131bd8f18 100644 --- a/core/src/main/java/google/registry/tools/LoadTestCommand.java +++ b/core/src/main/java/google/registry/tools/LoadTestCommand.java @@ -96,7 +96,7 @@ class LoadTestCommand extends ConfirmingCommand System.err.printf("No such TLD: %s\n", tld); return false; } - if (!Registrar.loadByClientId(clientId).isPresent()) { + if (!Registrar.loadByRegistrarId(clientId).isPresent()) { System.err.printf("No such client: %s\n", clientId); return false; } diff --git a/core/src/main/java/google/registry/tools/RegistrarContactCommand.java b/core/src/main/java/google/registry/tools/RegistrarContactCommand.java index 9012ad2ae..2c1a58c1e 100644 --- a/core/src/main/java/google/registry/tools/RegistrarContactCommand.java +++ b/core/src/main/java/google/registry/tools/RegistrarContactCommand.java @@ -165,7 +165,7 @@ final class RegistrarContactCommand extends MutatingCommand { String clientId = mainParameters.get(0); Registrar registrar = checkArgumentPresent( - Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); + Registrar.loadByRegistrarId(clientId), "Registrar %s not found", clientId); // If the contact_type parameter is not specified, we should not make any changes. if (contactTypeNames == null) { contactTypes = null; diff --git a/core/src/main/java/google/registry/tools/RenewDomainCommand.java b/core/src/main/java/google/registry/tools/RenewDomainCommand.java index 54533795e..a7bd2fd82 100644 --- a/core/src/main/java/google/registry/tools/RenewDomainCommand.java +++ b/core/src/main/java/google/registry/tools/RenewDomainCommand.java @@ -71,7 +71,7 @@ final class RenewDomainCommand extends MutatingEppToolCommand { setSoyTemplate(DomainRenewSoyInfo.getInstance(), DomainRenewSoyInfo.RENEWDOMAIN); DomainBase domain = domainOptional.get(); addSoyRecord( - isNullOrEmpty(clientId) ? domain.getCurrentSponsorClientId() : clientId, + isNullOrEmpty(clientId) ? domain.getCurrentSponsorRegistrarId() : clientId, new SoyMapData( "domainName", domain.getDomainName(), "expirationDate", domain.getRegistrationExpirationTime().toString(DATE_FORMATTER), diff --git a/core/src/main/java/google/registry/tools/SetupOteCommand.java b/core/src/main/java/google/registry/tools/SetupOteCommand.java index fcd9e5fd7..50a05ae7b 100644 --- a/core/src/main/java/google/registry/tools/SetupOteCommand.java +++ b/core/src/main/java/google/registry/tools/SetupOteCommand.java @@ -86,7 +86,7 @@ final class SetupOteCommand extends ConfirmingCommand implements CommandWithRemo password = passwordGenerator.createString(PASSWORD_LENGTH); oteAccountBuilder = - OteAccountBuilder.forClientId(registrar) + OteAccountBuilder.forRegistrarId(registrar) .addContact(email) .setPassword(password) .setIpAllowList(ipAllowList) @@ -100,7 +100,7 @@ final class SetupOteCommand extends ConfirmingCommand implements CommandWithRemo @Override protected String prompt() { - ImmutableMap registrarToTldMap = oteAccountBuilder.getClientIdToTldMap(); + ImmutableMap registrarToTldMap = oteAccountBuilder.getRegistrarIdToTldMap(); StringBuilder builder = new StringBuilder(); builder.append("Creating TLDs:"); registrarToTldMap.values().forEach(tld -> builder.append("\n ").append(tld)); diff --git a/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java b/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java index 207f32e98..409f8e240 100644 --- a/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java +++ b/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java @@ -189,14 +189,14 @@ class UnrenewDomainCommand extends ConfirmingCommand implements CommandWithRemot .setModificationTime(now) .setBySuperuser(true) .setType(Type.SYNTHETIC) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setReason("Domain unrenewal") .setPeriod(Period.create(period, Unit.YEARS)) .setRequestedByRegistrar(false) .build(); PollMessage oneTimePollMessage = new PollMessage.OneTime.Builder() - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setMsg( String.format( "Domain %s was unrenewed by %d years; now expires at %s.", @@ -222,7 +222,7 @@ class UnrenewDomainCommand extends ConfirmingCommand implements CommandWithRemot .asBuilder() .setRegistrationExpirationTime(newExpirationTime) .setLastEppUpdateTime(now) - .setLastEppUpdateClientId(domain.getCurrentSponsorClientId()) + .setLastEppUpdateRegistrarId(domain.getCurrentSponsorRegistrarId()) .setAutorenewBillingEvent(newAutorenewEvent.createVKey()) .setAutorenewPollMessage(newAutorenewPollMessage.createVKey()) .build(); diff --git a/core/src/main/java/google/registry/tools/UpdateRegistrarCommand.java b/core/src/main/java/google/registry/tools/UpdateRegistrarCommand.java index 04beffd87..4d4b23fa2 100644 --- a/core/src/main/java/google/registry/tools/UpdateRegistrarCommand.java +++ b/core/src/main/java/google/registry/tools/UpdateRegistrarCommand.java @@ -29,7 +29,7 @@ final class UpdateRegistrarCommand extends CreateOrUpdateRegistrarCommand { @Override Registrar getOldRegistrar(String clientId) { return checkArgumentPresent( - Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); + Registrar.loadByRegistrarId(clientId), "Registrar %s not found", clientId); } @Override diff --git a/core/src/main/java/google/registry/tools/ValidateLoginCredentialsCommand.java b/core/src/main/java/google/registry/tools/ValidateLoginCredentialsCommand.java index 32453b0ef..ff5d57e44 100644 --- a/core/src/main/java/google/registry/tools/ValidateLoginCredentialsCommand.java +++ b/core/src/main/java/google/registry/tools/ValidateLoginCredentialsCommand.java @@ -82,7 +82,7 @@ final class ValidateLoginCredentialsCommand implements CommandWithRemoteApi { } Registrar registrar = checkArgumentPresent( - Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); + Registrar.loadByRegistrarId(clientId), "Registrar %s not found", clientId); new TlsCredentials( true, Optional.ofNullable(clientCertificateHash), diff --git a/core/src/main/java/google/registry/tools/VerifyOteCommand.java b/core/src/main/java/google/registry/tools/VerifyOteCommand.java index 5dadfec63..ff9dd939b 100644 --- a/core/src/main/java/google/registry/tools/VerifyOteCommand.java +++ b/core/src/main/java/google/registry/tools/VerifyOteCommand.java @@ -16,7 +16,7 @@ package google.registry.tools; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.ImmutableSet.toImmutableSet; -import static google.registry.model.registrar.Registrar.loadByClientId; +import static google.registry.model.registrar.Registrar.loadByRegistrarId; import static google.registry.util.PreconditionsUtils.checkArgumentPresent; import com.beust.jcommander.Parameter; @@ -80,12 +80,12 @@ final class VerifyOteCommand implements CommandWithConnection, CommandWithRemote checkArgument( mainParameters.isEmpty() == checkAll, "Must provide at least one registrar name, or supply --check_all with no names."); - for (String clientId : mainParameters) { + for (String registrarId : mainParameters) { // OT&E registrars are created with clientIDs of registrarName-[1-4], but this command is // passed registrarName. So check the existence of the first persisted registrar to see if // the input is valid. checkArgumentPresent( - loadByClientId(clientId + "-1"), "Registrar %s does not exist.", clientId); + loadByRegistrarId(registrarId + "-1"), "Registrar %s does not exist.", registrarId); } Collection registrars = mainParameters.isEmpty() ? getAllRegistrarNames() : mainParameters; @@ -116,7 +116,7 @@ final class VerifyOteCommand implements CommandWithConnection, CommandWithRemote if (!registrar.isLive()) { return null; } - String name = registrar.getClientId(); + String name = registrar.getRegistrarId(); // Look for names of the form "regname-1", "regname-2", etc. and strip the -# suffix. String replacedName = name.replaceFirst("^(.*)-[1234]$", "$1"); // Check if any replacement happened, and thus whether the name matches the format. diff --git a/core/src/main/java/google/registry/tools/javascrap/CreateSyntheticHistoryEntriesAction.java b/core/src/main/java/google/registry/tools/javascrap/CreateSyntheticHistoryEntriesAction.java index 89d704d9e..834561423 100644 --- a/core/src/main/java/google/registry/tools/javascrap/CreateSyntheticHistoryEntriesAction.java +++ b/core/src/main/java/google/registry/tools/javascrap/CreateSyntheticHistoryEntriesAction.java @@ -114,7 +114,7 @@ public class CreateSyntheticHistoryEntriesAction implements Runnable { EppResource eppResource = auditedOfy().load().key(resourceKey).now(); tm().put( HistoryEntry.createBuilderForResource(eppResource) - .setClientId(registryAdminRegistrarId) + .setRegistrarId(registryAdminRegistrarId) .setBySuperuser(true) .setRequestedByRegistrar(false) .setModificationTime(tm().getTransactionTime()) diff --git a/core/src/main/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java b/core/src/main/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java index 227e795cf..09ac09c9e 100644 --- a/core/src/main/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java +++ b/core/src/main/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java @@ -39,7 +39,7 @@ public class PopulateNullRegistrarFieldsCommand extends MutatingCommand { for (Registrar registrar : Registrar.loadAll()) { Registrar.Builder changeBuilder = registrar.asBuilder(); changeBuilder.setRegistrarName( - firstNonNull(registrar.getRegistrarName(), registrar.getClientId())); + firstNonNull(registrar.getRegistrarName(), registrar.getRegistrarId())); RegistrarAddress address = registrar.getLocalizedAddress(); if (address == null) { diff --git a/core/src/main/java/google/registry/tools/server/CreateGroupsAction.java b/core/src/main/java/google/registry/tools/server/CreateGroupsAction.java index 9b56db4b9..a120524ca 100644 --- a/core/src/main/java/google/registry/tools/server/CreateGroupsAction.java +++ b/core/src/main/java/google/registry/tools/server/CreateGroupsAction.java @@ -76,7 +76,7 @@ public class CreateGroupsAction implements Runnable { try { String groupKey = getGroupEmailAddressForContactType( - registrar.getClientId(), type, gSuiteDomainName); + registrar.getRegistrarId(), type, gSuiteDomainName); String parentGroup = getGroupEmailAddressForContactType("registrar", type, gSuiteDomainName); // Creates the group, then adds it as a member to the global registrar group for @@ -118,7 +118,7 @@ public class CreateGroupsAction implements Runnable { if (!clientId.isPresent()) { respondToBadRequest("Error creating Google Groups, missing parameter: clientId"); } - Optional registrar = Registrar.loadByClientId(clientId.get()); + Optional registrar = Registrar.loadByRegistrarId(clientId.get()); if (!registrar.isPresent()) { respondToBadRequest(String.format( "Error creating Google Groups; could not find registrar with id %s", clientId.get())); diff --git a/core/src/main/java/google/registry/ui/server/registrar/ConsoleOteSetupAction.java b/core/src/main/java/google/registry/ui/server/registrar/ConsoleOteSetupAction.java index 86204b029..a92dd02c8 100644 --- a/core/src/main/java/google/registry/ui/server/registrar/ConsoleOteSetupAction.java +++ b/core/src/main/java/google/registry/ui/server/registrar/ConsoleOteSetupAction.java @@ -131,7 +131,7 @@ public final class ConsoleOteSetupAction extends HtmlAction { String password = optionalPassword.orElse(passwordGenerator.createString(PASSWORD_LENGTH)); ImmutableMap clientIdToTld = - OteAccountBuilder.forClientId(clientId.get()) + OteAccountBuilder.forRegistrarId(clientId.get()) .addContact(email.get()) .setPassword(password) .buildAndPersist(); diff --git a/core/src/main/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java b/core/src/main/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java index 04f94b281..37b8a3d37 100644 --- a/core/src/main/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java +++ b/core/src/main/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java @@ -203,7 +203,7 @@ public final class ConsoleRegistrarCreatorAction extends HtmlAction { optionalPasscode.orElse(passcodeGenerator.createString(PASSCODE_LENGTH)); Registrar registrar = new Registrar.Builder() - .setClientId(clientId.get()) + .setRegistrarId(clientId.get()) .setRegistrarName(name.get()) .setBillingAccountMap(parseBillingAccount(billingAccount.get())) .setIanaIdentifier(Long.valueOf(ianaId.get())) @@ -237,9 +237,9 @@ public final class ConsoleRegistrarCreatorAction extends HtmlAction { tm().transact( () -> { checkState( - !Registrar.loadByClientId(registrar.getClientId()).isPresent(), + !Registrar.loadByRegistrarId(registrar.getRegistrarId()).isPresent(), "Registrar with client ID %s already exists", - registrar.getClientId()); + registrar.getRegistrarId()); tm().putAll(registrar, contact); }); data.put("password", password); diff --git a/core/src/main/java/google/registry/ui/server/registrar/OteStatusAction.java b/core/src/main/java/google/registry/ui/server/registrar/OteStatusAction.java index 172a2aaa0..40cc2db2c 100644 --- a/core/src/main/java/google/registry/ui/server/registrar/OteStatusAction.java +++ b/core/src/main/java/google/registry/ui/server/registrar/OteStatusAction.java @@ -79,7 +79,7 @@ public final class OteStatusAction implements Runnable, JsonActionRunner.JsonAct checkArgument( !Strings.isNullOrEmpty(oteClientId), "Missing key for OT&E client: %s", CLIENT_ID_PARAM); - String baseClientId = OteAccountBuilder.getBaseClientId(oteClientId); + String baseClientId = OteAccountBuilder.getBaseRegistrarId(oteClientId); Registrar oteRegistrar = registrarAccessor.getRegistrar(oteClientId); verifyOteAccess(baseClientId); checkArgument( @@ -99,7 +99,7 @@ public final class OteStatusAction implements Runnable, JsonActionRunner.JsonAct } private void verifyOteAccess(String baseClientId) throws RegistrarAccessDeniedException { - for (String oteClientId : OteAccountBuilder.createClientIdToTldMap(baseClientId).keySet()) { + for (String oteClientId : OteAccountBuilder.createRegistrarIdToTldMap(baseClientId).keySet()) { registrarAccessor.verifyAccess(oteClientId); } } diff --git a/core/src/main/java/google/registry/ui/server/registrar/RegistrarSettingsAction.java b/core/src/main/java/google/registry/ui/server/registrar/RegistrarSettingsAction.java index 4f1287e8f..338788106 100644 --- a/core/src/main/java/google/registry/ui/server/registrar/RegistrarSettingsAction.java +++ b/core/src/main/java/google/registry/ui/server/registrar/RegistrarSettingsAction.java @@ -113,8 +113,8 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA throw new BadRequestException("Malformed JSON"); } - String clientId = (String) input.get(ID_PARAM); - if (Strings.isNullOrEmpty(clientId)) { + String registrarId = (String) input.get(ID_PARAM); + if (Strings.isNullOrEmpty(registrarId)) { throw new BadRequestException(String.format("Missing key for resource ID: %s", ID_PARAM)); } @@ -126,20 +126,21 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA (Map) Optional.ofNullable(input.get(ARGS_PARAM)).orElse(ImmutableMap.of()); - logger.atInfo().log("Received request '%s' on registrar '%s' with args %s", op, clientId, args); + logger.atInfo().log( + "Received request '%s' on registrar '%s' with args %s", op, registrarId, args); String status = "SUCCESS"; try { switch (op) { case "update": - return update(args, clientId).toJsonResponse(); + return update(args, registrarId).toJsonResponse(); case "read": - return read(clientId).toJsonResponse(); + return read(registrarId).toJsonResponse(); default: throw new IllegalArgumentException("Unknown or unsupported operation: " + op); } } catch (Throwable e) { logger.atWarning().withCause(e).log( - "Failed to perform operation '%s' on registrar '%s' for args %s", op, clientId, args); + "Failed to perform operation '%s' on registrar '%s' for args %s", op, registrarId, args); status = "ERROR: " + e.getClass().getSimpleName(); if (e instanceof FormFieldException) { FormFieldException formFieldException = (FormFieldException) e; @@ -150,7 +151,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA ERROR, Optional.ofNullable(e.getMessage()).orElse("Unspecified error")); } finally { registrarConsoleMetrics.registerSettingsRequest( - clientId, op, registrarAccessor.getRolesForRegistrar(clientId), status); + registrarId, op, registrarAccessor.getRolesForRegistrar(registrarId), status); } } @@ -169,8 +170,8 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA } } - private RegistrarResult read(String clientId) { - return RegistrarResult.create("Success", loadRegistrarUnchecked(clientId)); + private RegistrarResult read(String registrarId) { + return RegistrarResult.create("Success", loadRegistrarUnchecked(registrarId)); } private Registrar loadRegistrarUnchecked(String registrarId) { @@ -181,13 +182,13 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA } } - private RegistrarResult update(final Map args, String clientId) { + private RegistrarResult update(final Map args, String registrarId) { tm().transact( () -> { // We load the registrar here rather than outside of the transaction - to make // sure we have the latest version. This one is loaded inside the transaction, so it's // guaranteed to not change before we update it. - Registrar registrar = loadRegistrarUnchecked(clientId); + Registrar registrar = loadRegistrarUnchecked(registrarId); // Detach the registrar to avoid Hibernate object-updates, since we wish to email // out the diffs between the existing and updated registrar objects if (!tm().isOfy()) { @@ -226,7 +227,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA // Save the updated contacts if (!updatedContacts.equals(contacts)) { - if (!registrarAccessor.hasRoleOnRegistrar(Role.OWNER, registrar.getClientId())) { + if (!registrarAccessor.hasRoleOnRegistrar(Role.OWNER, registrar.getRegistrarId())) { throw new ForbiddenException("Only OWNERs can update the contacts"); } checkContactRequirements(contacts, updatedContacts); @@ -245,7 +246,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA registrar, contacts, updatedRegistrar, updatedContacts); }); // Reload the result outside of the transaction to get the most recent version - return RegistrarResult.create("Saved " + clientId, loadRegistrarUnchecked(clientId)); + return RegistrarResult.create("Saved " + registrarId, loadRegistrarUnchecked(registrarId)); } private Map expandRegistrarWithContacts( @@ -397,11 +398,11 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA return updatedRegistrar; } checkArgument( - updatedRegistrar.getClientId().equals(originalRegistrar.getClientId()), + updatedRegistrar.getRegistrarId().equals(originalRegistrar.getRegistrarId()), "Can't change clientId (%s -> %s)", - originalRegistrar.getClientId(), - updatedRegistrar.getClientId()); - if (registrarAccessor.hasRoleOnRegistrar(allowedRole, originalRegistrar.getClientId())) { + originalRegistrar.getRegistrarId(), + updatedRegistrar.getRegistrarId()); + if (registrarAccessor.hasRoleOnRegistrar(allowedRole, originalRegistrar.getRegistrarId())) { return updatedRegistrar; } Map diffs = @@ -598,12 +599,12 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA sendEmailUtils.sendEmail( String.format( "Registrar %s (%s) updated in registry %s environment", - existingRegistrar.getRegistrarName(), existingRegistrar.getClientId(), environment), + existingRegistrar.getRegistrarName(), existingRegistrar.getRegistrarId(), environment), String.format( "The following changes were made in registry %s environment to " + "the registrar %s by %s:\n\n%s", environment, - existingRegistrar.getClientId(), + existingRegistrar.getRegistrarId(), authResult.userIdForLogging(), DiffUtils.prettyPrintDiffedMap(diffs, null)), existingContacts.stream() diff --git a/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java b/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java index 331f9471a..c1ef32846 100644 --- a/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java +++ b/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java @@ -147,13 +147,13 @@ public final class RegistryLockGetAction implements JsonGetAction { return registrar; } - private ImmutableMap getLockedDomainsMap(String clientId) + private ImmutableMap getLockedDomainsMap(String registrarId) throws RegistrarAccessDeniedException { // Note: admins always have access to the locks page checkArgument(authResult.userAuthInfo().isPresent(), "User auth info must be present"); boolean isAdmin = registrarAccessor.isAdmin(); - Registrar registrar = getRegistrarAndVerifyLockAccess(registrarAccessor, clientId, isAdmin); + Registrar registrar = getRegistrarAndVerifyLockAccess(registrarAccessor, registrarId, isAdmin); User user = authResult.userAuthInfo().get().user(); Optional contactOptional = getContactMatchingLogin(user, registrar); @@ -171,17 +171,17 @@ public final class RegistryLockGetAction implements JsonGetAction { EMAIL_PARAM, relevantEmail, PARAM_CLIENT_ID, - registrar.getClientId(), + registrar.getRegistrarId(), LOCKS_PARAM, - getLockedDomains(clientId, isAdmin)); + getLockedDomains(registrarId, isAdmin)); } private ImmutableList> getLockedDomains( - String clientId, boolean isAdmin) { + String registrarId, boolean isAdmin) { return jpaTm() .transact( () -> - RegistryLockDao.getLocksByRegistrarId(clientId).stream() + RegistryLockDao.getLocksByRegistrarId(registrarId).stream() .filter(lock -> !lock.isLockRequestExpired(jpaTm().getTransactionTime())) .map(lock -> lockToMap(lock, isAdmin)) .collect(toImmutableList())); diff --git a/core/src/main/java/google/registry/whois/DomainWhoisResponse.java b/core/src/main/java/google/registry/whois/DomainWhoisResponse.java index 82943c5a1..554f94c1e 100644 --- a/core/src/main/java/google/registry/whois/DomainWhoisResponse.java +++ b/core/src/main/java/google/registry/whois/DomainWhoisResponse.java @@ -74,11 +74,11 @@ final class DomainWhoisResponse extends WhoisResponseImpl { @Override public WhoisResponseResults getResponse(final boolean preferUnicode, String disclaimer) { Optional registrarOptional = - Registrar.loadByClientIdCached(domain.getCurrentSponsorClientId()); + Registrar.loadByRegistrarIdCached(domain.getCurrentSponsorRegistrarId()); checkState( registrarOptional.isPresent(), "Could not load registrar %s", - domain.getCurrentSponsorClientId()); + domain.getCurrentSponsorRegistrarId()); Registrar registrar = registrarOptional.get(); Optional abuseContact = registrar diff --git a/core/src/main/java/google/registry/whois/NameserverWhoisResponse.java b/core/src/main/java/google/registry/whois/NameserverWhoisResponse.java index 3cfbc359c..d272425ad 100644 --- a/core/src/main/java/google/registry/whois/NameserverWhoisResponse.java +++ b/core/src/main/java/google/registry/whois/NameserverWhoisResponse.java @@ -47,14 +47,14 @@ final class NameserverWhoisResponse extends WhoisResponseImpl { BasicEmitter emitter = new BasicEmitter(); for (int i = 0; i < hosts.size(); i++) { HostResource host = hosts.get(i); - String clientId = + String registrarId = host.isSubordinate() ? tm().loadByKey(host.getSuperordinateDomain()) .cloneProjectedAtTime(getTimestamp()) - .getCurrentSponsorClientId() - : host.getPersistedCurrentSponsorClientId(); - Optional registrar = Registrar.loadByClientIdCached(clientId); - checkState(registrar.isPresent(), "Could not load registrar %s", clientId); + .getCurrentSponsorRegistrarId() + : host.getPersistedCurrentSponsorRegistrarId(); + Optional registrar = Registrar.loadByRegistrarIdCached(registrarId); + checkState(registrar.isPresent(), "Could not load registrar %s", registrarId); emitter .emitField("Server Name", maybeFormatHostname(host.getHostName(), preferUnicode)) .emitSet("IP Address", host.getInetAddresses(), InetAddresses::toAddrString) diff --git a/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java b/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java index 4102f9986..91df02f94 100644 --- a/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java +++ b/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java @@ -890,14 +890,14 @@ public class DeleteContactsAndHostsActionTest */ private static void assertPollMessageFor( HistoryEntry historyEntry, - String clientId, + String registrarId, String msg, boolean expectedActionResult, EppResource resource, Optional clientTrid) { PollMessage.OneTime pollMessage = (OneTime) getOnlyPollMessageForHistoryEntry(historyEntry); assertThat(pollMessage.getMsg()).isEqualTo(msg); - assertThat(pollMessage.getClientId()).isEqualTo(clientId); + assertThat(pollMessage.getRegistrarId()).isEqualTo(registrarId); ImmutableList pollResponses = pollMessage.getResponseData(); assertThat(pollResponses).hasSize(1); diff --git a/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java b/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java index 5a4494b2e..b7a9af9ff 100644 --- a/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java +++ b/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java @@ -181,7 +181,7 @@ class DeleteExpiredDomainsActionTest { .setType(DOMAIN_CREATE) .setDomain(pendingExpirationDomain) .setModificationTime(clock.nowUtc().minusMonths(9)) - .setClientId(pendingExpirationDomain.getCreationClientId()) + .setRegistrarId(pendingExpirationDomain.getCreationRegistrarId()) .build()); BillingEvent.Recurring autorenewBillingEvent = persistResource(createAutorenewBillingEvent(createHistoryEntry).build()); @@ -205,7 +205,7 @@ class DeleteExpiredDomainsActionTest { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId("fizz.tld") - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(clock.nowUtc().plusYears(1)) .setRecurrenceEndTime(END_OF_TIME) .setParent(createHistoryEntry); @@ -215,7 +215,7 @@ class DeleteExpiredDomainsActionTest { HistoryEntry createHistoryEntry) { return new PollMessage.Autorenew.Builder() .setTargetId("fizz.tld") - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(clock.nowUtc().plusYears(1)) .setAutorenewEndTime(END_OF_TIME) .setParent(createHistoryEntry); diff --git a/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java b/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java index 5f48f9923..dd410b9d4 100644 --- a/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java +++ b/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java @@ -293,26 +293,27 @@ class DeleteProberDataActionTest extends MapreduceTestCase builder = diff --git a/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java b/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java index 0ff7320dc..924ae4c87 100644 --- a/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java +++ b/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java @@ -107,7 +107,7 @@ public class ExpandRecurringBillingEventsActionTest historyEntry = persistResource( new DomainHistory.Builder() - .setClientId(domain.getCreationClientId()) + .setRegistrarId(domain.getCreationRegistrarId()) .setType(HistoryEntry.Type.DOMAIN_CREATE) .setModificationTime(DateTime.parse("1999-01-05T00:00:00Z")) .setDomain(domain) @@ -115,7 +115,7 @@ public class ExpandRecurringBillingEventsActionTest recurring = new BillingEvent.Recurring.Builder() .setParent(historyEntry) - .setClientId(domain.getCreationClientId()) + .setRegistrarId(domain.getCreationRegistrarId()) .setEventTime(DateTime.parse("2000-01-05T00:00:00Z")) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setId(2L) @@ -152,11 +152,11 @@ public class ExpandRecurringBillingEventsActionTest private void assertHistoryEntryMatches( DomainBase domain, HistoryEntry actual, - String clientId, + String registrarId, DateTime billingTime, boolean shouldHaveTxRecord) { assertThat(actual.getBySuperuser()).isFalse(); - assertThat(actual.getClientId()).isEqualTo(clientId); + assertThat(actual.getRegistrarId()).isEqualTo(registrarId); assertThat(actual.getParent()).isEqualTo(Key.create(domain)); assertThat(actual.getPeriod()).isEqualTo(Period.create(1, YEARS)); assertThat(actual.getReason()) @@ -176,7 +176,7 @@ public class ExpandRecurringBillingEventsActionTest private OneTime.Builder defaultOneTimeBuilder() { return new BillingEvent.OneTime.Builder() .setBillingTime(DateTime.parse("2000-02-19T00:00:00Z")) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setCost(Money.of(USD, 11)) .setEventTime(DateTime.parse("2000-01-05T00:00:00Z")) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW, Flag.SYNTHETIC)) @@ -209,7 +209,7 @@ public class ExpandRecurringBillingEventsActionTest persistResource( new DomainHistory.Builder() .setDomain(deletedDomain) - .setClientId(deletedDomain.getCreationClientId()) + .setRegistrarId(deletedDomain.getCreationRegistrarId()) .setModificationTime(deletedDomain.getCreationTime()) .setType(DOMAIN_CREATE) .build()); @@ -217,7 +217,7 @@ public class ExpandRecurringBillingEventsActionTest persistResource( new BillingEvent.Recurring.Builder() .setParent(historyEntry) - .setClientId(deletedDomain.getCreationClientId()) + .setRegistrarId(deletedDomain.getCreationRegistrarId()) .setEventTime(DateTime.parse("2000-01-05T00:00:00Z")) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setId(2L) diff --git a/core/src/test/java/google/registry/batch/RelockDomainActionTest.java b/core/src/test/java/google/registry/batch/RelockDomainActionTest.java index 94a9f3c0f..8cfae45a9 100644 --- a/core/src/test/java/google/registry/batch/RelockDomainActionTest.java +++ b/core/src/test/java/google/registry/batch/RelockDomainActionTest.java @@ -197,7 +197,8 @@ public class RelockDomainActionTest { @TestOfyAndSql void testFailure_domainTransferred() throws Exception { - persistResource(domain.asBuilder().setPersistedCurrentSponsorClientId("NewRegistrar").build()); + persistResource( + domain.asBuilder().setPersistedCurrentSponsorRegistrarId("NewRegistrar").build()); action.run(); String expectedFailureMessage = "Domain example.tld has been transferred from registrar TheRegistrar to registrar " diff --git a/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java b/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java index cbc3a0ad1..be2a8f1cc 100644 --- a/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java +++ b/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java @@ -109,10 +109,10 @@ public class ResaveEntityActionTest { DateTime.parse("2016-02-11T10:00:00Z"), DateTime.parse("2017-01-02T10:11:00Z")); clock.advanceOneMilli(); - assertThat(domain.getCurrentSponsorClientId()).isEqualTo("TheRegistrar"); + assertThat(domain.getCurrentSponsorRegistrarId()).isEqualTo("TheRegistrar"); runAction(Key.create(domain), DateTime.parse("2016-02-06T10:00:01Z"), ImmutableSortedSet.of()); DomainBase resavedDomain = loadByEntity(domain); - assertThat(resavedDomain.getCurrentSponsorClientId()).isEqualTo("NewRegistrar"); + assertThat(resavedDomain.getCurrentSponsorRegistrarId()).isEqualTo("NewRegistrar"); verify(response).setPayload("Entity re-saved."); } diff --git a/core/src/test/java/google/registry/batch/SendExpiringCertificateNotificationEmailActionTest.java b/core/src/test/java/google/registry/batch/SendExpiringCertificateNotificationEmailActionTest.java index 8be15db8b..de3cb6b4b 100644 --- a/core/src/test/java/google/registry/batch/SendExpiringCertificateNotificationEmailActionTest.java +++ b/core/src/test/java/google/registry/batch/SendExpiringCertificateNotificationEmailActionTest.java @@ -140,7 +140,7 @@ class SendExpiringCertificateNotificationEmailActionTest { /** Returns a sample registrar with a customized registrar name, client id and certificate* */ private Registrar.Builder createRegistrar( - String clientId, + String registrarId, String registrarName, @Nullable X509Certificate certificate, @Nullable X509Certificate failOverCertificate) @@ -148,7 +148,7 @@ class SendExpiringCertificateNotificationEmailActionTest { // set up only required fields sample test data Registrar.Builder builder = new Registrar.Builder() - .setClientId(clientId) + .setRegistrarId(registrarId) .setRegistrarName(registrarName) .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) diff --git a/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java b/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java index 632b56a71..2efffa15d 100644 --- a/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java +++ b/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java @@ -165,23 +165,23 @@ public class RegistryJpaReadTest { Registrar registrar = makeRegistrar1() .asBuilder() - .setClientId("registrar1") + .setRegistrarId("registrar1") .setEmailAddress("me@google.com") .build(); ContactResource contact = new ContactResource.Builder() .setRepoId("contactid_1") - .setCreationClientId(registrar.getClientId()) + .setCreationRegistrarId(registrar.getRegistrarId()) .setTransferData(new ContactTransferData.Builder().build()) - .setPersistedCurrentSponsorClientId(registrar.getClientId()) + .setPersistedCurrentSponsorRegistrarId(registrar.getRegistrarId()) .build(); DomainBase domain = new DomainBase.Builder() .setDomainName("example.com") .setRepoId("4-COM") - .setCreationClientId(registrar.getClientId()) + .setCreationRegistrarId(registrar.getRegistrarId()) .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId(registrar.getClientId()) + .setLastEppUpdateRegistrarId(registrar.getRegistrarId()) .setLastTransferTime(fakeClock.nowUtc()) .setStatusValues( ImmutableSet.of( @@ -194,7 +194,7 @@ public class RegistryJpaReadTest { .setRegistrant(contact.createVKey()) .setContacts(ImmutableSet.of()) .setSubordinateHosts(ImmutableSet.of("ns1.example.com")) - .setPersistedCurrentSponsorClientId(registrar.getClientId()) + .setPersistedCurrentSponsorRegistrarId(registrar.getRegistrarId()) .setRegistrationExpirationTime(fakeClock.nowUtc().plusYears(1)) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password"))) .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) @@ -206,7 +206,7 @@ public class RegistryJpaReadTest { GracePeriodStatus.ADD, "4-COM", END_OF_TIME, - registrar.getClientId(), + registrar.getRegistrarId(), null, 100L)) .build(); diff --git a/core/src/test/java/google/registry/beam/initsql/DomainBaseUtilTest.java b/core/src/test/java/google/registry/beam/initsql/DomainBaseUtilTest.java index ce228cf28..d18001dfb 100644 --- a/core/src/test/java/google/registry/beam/initsql/DomainBaseUtilTest.java +++ b/core/src/test/java/google/registry/beam/initsql/DomainBaseUtilTest.java @@ -106,7 +106,7 @@ public class DomainBaseUtilTest { new DomainHistory.Builder() .setDomainRepoId(domainKey.getName()) .setType(HistoryEntry.Type.DOMAIN_CREATE) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setModificationTime(fakeClock.nowUtc().minusYears(1)) .build())); oneTimeBillKey = Key.create(historyEntryKey, BillingEvent.OneTime.class, 1); @@ -122,9 +122,9 @@ public class DomainBaseUtilTest { new DomainBase.Builder() .setDomainName("example.com") .setRepoId("4-COM") - .setCreationClientId("a registrar") + .setCreationRegistrarId("a registrar") .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId("AnotherRegistrar") + .setLastEppUpdateRegistrarId("AnotherRegistrar") .setLastTransferTime(fakeClock.nowUtc()) .setStatusValues( ImmutableSet.of( @@ -140,7 +140,7 @@ public class DomainBaseUtilTest { DesignatedContact.create(DesignatedContact.Type.ADMIN, contact2Key))) .setNameservers(ImmutableSet.of(hostKey)) .setSubordinateHosts(ImmutableSet.of("ns1.example.com")) - .setPersistedCurrentSponsorClientId("losing") + .setPersistedCurrentSponsorRegistrarId("losing") .setRegistrationExpirationTime(fakeClock.nowUtc().plusYears(1)) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password"))) .setDsData( @@ -149,8 +149,8 @@ public class DomainBaseUtilTest { LaunchNotice.create("tcnid", "validatorId", START_OF_TIME, START_OF_TIME)) .setTransferData( new DomainTransferData.Builder() - .setGainingClientId("gaining") - .setLosingClientId("losing") + .setGainingRegistrarId("gaining") + .setLosingRegistrarId("losing") .setPendingTransferExpirationTime(fakeClock.nowUtc()) .setServerApproveEntities( ImmutableSet.of( diff --git a/core/src/test/java/google/registry/beam/initsql/InitSqlPipelineTest.java b/core/src/test/java/google/registry/beam/initsql/InitSqlPipelineTest.java index 733b22ed5..5fa504009 100644 --- a/core/src/test/java/google/registry/beam/initsql/InitSqlPipelineTest.java +++ b/core/src/test/java/google/registry/beam/initsql/InitSqlPipelineTest.java @@ -147,24 +147,24 @@ class InitSqlPipelineTest { .setHostName("ns1.example.com") .setSuperordinateDomain(VKey.from(domainKey)) .setRepoId("1-COM") - .setCreationClientId(registrar1.getClientId()) - .setPersistedCurrentSponsorClientId(registrar2.getClientId()) + .setCreationRegistrarId(registrar1.getRegistrarId()) + .setPersistedCurrentSponsorRegistrarId(registrar2.getRegistrarId()) .build()); contact1 = persistResource( new ContactResource.Builder() .setContactId("contact_id1") .setRepoId("2-COM") - .setCreationClientId(registrar1.getClientId()) - .setPersistedCurrentSponsorClientId(registrar2.getClientId()) + .setCreationRegistrarId(registrar1.getRegistrarId()) + .setPersistedCurrentSponsorRegistrarId(registrar2.getRegistrarId()) .build()); contact2 = persistResource( new ContactResource.Builder() .setContactId("contact_id2") .setRepoId("3-COM") - .setCreationClientId(registrar1.getClientId()) - .setPersistedCurrentSponsorClientId(registrar1.getClientId()) + .setCreationRegistrarId(registrar1.getRegistrarId()) + .setPersistedCurrentSponsorRegistrarId(registrar1.getRegistrarId()) .build()); persistSimpleResource( new RegistrarContact.Builder() @@ -182,7 +182,7 @@ class InitSqlPipelineTest { new DomainHistory.Builder() .setDomainRepoId(domainKey.getName()) .setModificationTime(fakeClock.nowUtc()) - .setClientId(registrar1.getClientId()) + .setRegistrarId(registrar1.getRegistrarId()) .setType(HistoryEntry.Type.DOMAIN_CREATE) .build()); persistResource( @@ -193,7 +193,7 @@ class InitSqlPipelineTest { .setId(1) .setReason(Reason.RENEW) .setTargetId("example.com") - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setCost(Money.parse("USD 44.00")) .setPeriodYears(4) .setEventTime(fakeClock.nowUtc()) @@ -208,7 +208,7 @@ class InitSqlPipelineTest { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId("example.com") - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(fakeClock.nowUtc()) .setRecurrenceEndTime(END_OF_TIME) .setParent(historyEntryKey) @@ -219,7 +219,7 @@ class InitSqlPipelineTest { new PollMessage.Autorenew.Builder() .setId(3L) .setTargetId("example.com") - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(fakeClock.nowUtc()) .setMsg("Domain was auto-renewed.") .setParent(historyEntry) @@ -231,7 +231,7 @@ class InitSqlPipelineTest { .setId(1L) .setParent(historyEntry) .setEventTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setMsg(DomainFlowUtils.COLLISION_MESSAGE) .build(); persistResource(oneTimePollMessage); @@ -241,9 +241,9 @@ class InitSqlPipelineTest { new DomainBase.Builder() .setDomainName("example.com") .setRepoId("4-COM") - .setCreationClientId(registrar1.getClientId()) + .setCreationRegistrarId(registrar1.getRegistrarId()) .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId(registrar2.getClientId()) + .setLastEppUpdateRegistrarId(registrar2.getRegistrarId()) .setLastTransferTime(fakeClock.nowUtc()) .setStatusValues( ImmutableSet.of( @@ -260,7 +260,7 @@ class InitSqlPipelineTest { DesignatedContact.Type.ADMIN, contact2.createVKey()))) .setNameservers(ImmutableSet.of(hostResource.createVKey())) .setSubordinateHosts(ImmutableSet.of("ns1.example.com")) - .setPersistedCurrentSponsorClientId(registrar2.getClientId()) + .setPersistedCurrentSponsorRegistrarId(registrar2.getRegistrarId()) .setRegistrationExpirationTime(fakeClock.nowUtc().plusYears(1)) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password"))) .setDsData( @@ -269,8 +269,8 @@ class InitSqlPipelineTest { LaunchNotice.create("tcnid", "validatorId", START_OF_TIME, START_OF_TIME)) .setTransferData( new DomainTransferData.Builder() - .setGainingClientId(registrar1.getClientId()) - .setLosingClientId(registrar2.getClientId()) + .setGainingRegistrarId(registrar1.getRegistrarId()) + .setLosingRegistrarId(registrar2.getRegistrarId()) .setPendingTransferExpirationTime(fakeClock.nowUtc()) .setServerApproveEntities( ImmutableSet.of( @@ -298,7 +298,7 @@ class InitSqlPipelineTest { new BillingEvent.Cancellation.Builder() .setReason(Reason.RENEW) .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setEventTime(fakeClock.nowUtc()) .setBillingTime(fakeClock.nowUtc()) .setRecurringEventKey(recurringBillEvent.createVKey()) diff --git a/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java b/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java index 14ec458df..c1edceb8c 100644 --- a/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java +++ b/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java @@ -480,7 +480,7 @@ class InvoicingPipelineTest { new Cancellation() .asBuilder() .setId(1) - .setClientId(registrar1.getClientId()) + .setRegistrarId(registrar1.getRegistrarId()) .setDomainHistoryRevisionId(domainHistory.getId()) .setEventTime(DateTime.parse("2017-10-05T00:00:00.0Z")) .setBillingTime(DateTime.parse("2017-10-04T00:00:00.0Z")) @@ -498,7 +498,7 @@ class InvoicingPipelineTest { Recurring recurring = new Recurring() .asBuilder() - .setClientId(registrar1.getClientId()) + .setRegistrarId(registrar1.getRegistrarId()) .setRecurrenceEndTime(END_OF_TIME) .setId(1) .setParent(domainHistoryRecurring) @@ -523,7 +523,7 @@ class InvoicingPipelineTest { new Cancellation() .asBuilder() .setId(2) - .setClientId(registrar1.getClientId()) + .setRegistrarId(registrar1.getRegistrarId()) .setDomainHistoryRevisionId(domainHistoryRecurring.getId()) .setEventTime(DateTime.parse("2017-10-05T00:00:00.0Z")) .setBillingTime(DateTime.parse("2017-10-04T00:00:00.0Z")) @@ -541,7 +541,7 @@ class InvoicingPipelineTest { .setType(HistoryEntry.Type.DOMAIN_RENEW) .setModificationTime(DateTime.parse("2017-10-04T00:00:00.0Z")) .setDomain(domainBase) - .setClientId(registrar.getClientId()) + .setRegistrarId(registrar.getRegistrarId()) .build(); return persistResource(domainHistory); } @@ -575,7 +575,7 @@ class InvoicingPipelineTest { .setId(id) .setBillingTime(billingTime) .setEventTime(eventTime) - .setClientId(registrar.getClientId()) + .setRegistrarId(registrar.getRegistrarId()) .setReason(reason) .setTargetId(domainBase.getDomainName()) .setDomainRepoId("REPO-ID") diff --git a/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java b/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java index b10aaef14..a63e22a09 100644 --- a/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java +++ b/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java @@ -239,21 +239,21 @@ class Spec11PipelineTest { persistResource( makeRegistrar1() .asBuilder() - .setClientId("hello-registrar") + .setRegistrarId("hello-registrar") .setEmailAddress("email@hello.net") .build()); Registrar registrar2 = persistResource( makeRegistrar1() .asBuilder() - .setClientId("kitty-registrar") + .setRegistrarId("kitty-registrar") .setEmailAddress("contact@kit.ty") .build()); Registrar registrar3 = persistResource( makeRegistrar1() .asBuilder() - .setClientId("cool-registrar") + .setRegistrarId("cool-registrar") .setEmailAddress("cool@aid.net") .build()); @@ -262,9 +262,9 @@ class Spec11PipelineTest { createTld("bank"); createTld("dev"); - ContactResource contact1 = persistActiveContact(registrar1.getClientId()); - ContactResource contact2 = persistActiveContact(registrar2.getClientId()); - ContactResource contact3 = persistActiveContact(registrar3.getClientId()); + ContactResource contact1 = persistActiveContact(registrar1.getRegistrarId()); + ContactResource contact2 = persistActiveContact(registrar2.getRegistrarId()); + ContactResource contact3 = persistActiveContact(registrar3.getRegistrarId()); persistResource(createDomain("111.com", "123456789-COM", registrar1, contact1)); persistResource(createDomain("party-night.net", "2244AABBC-NET", registrar2, contact2)); @@ -306,12 +306,12 @@ class Spec11PipelineTest { return new DomainBase.Builder() .setDomainName(domainName) .setRepoId(repoId) - .setCreationClientId(registrar.getClientId()) + .setCreationRegistrarId(registrar.getRegistrarId()) .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId(registrar.getClientId()) + .setLastEppUpdateRegistrarId(registrar.getRegistrarId()) .setLastTransferTime(fakeClock.nowUtc()) .setRegistrant(contact.createVKey()) - .setPersistedCurrentSponsorClientId(registrar.getClientId()) + .setPersistedCurrentSponsorRegistrarId(registrar.getRegistrarId()) .setRegistrationExpirationTime(fakeClock.nowUtc().plusYears(1)) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password"))) .build(); diff --git a/core/src/test/java/google/registry/export/sheet/SyncRegistrarsSheetTest.java b/core/src/test/java/google/registry/export/sheet/SyncRegistrarsSheetTest.java index e6dd08b01..7d5d421ab 100644 --- a/core/src/test/java/google/registry/export/sheet/SyncRegistrarsSheetTest.java +++ b/core/src/test/java/google/registry/export/sheet/SyncRegistrarsSheetTest.java @@ -107,39 +107,40 @@ public class SyncRegistrarsSheetTest { @TestOfyAndSql void testRun() throws Exception { - persistResource(new Registrar.Builder() - .setClientId("anotherregistrar") - .setRegistrarName("Another Registrar LLC") - .setType(Registrar.Type.REAL) - .setIanaIdentifier(1L) - .setState(Registrar.State.ACTIVE) - .setInternationalizedAddress(new RegistrarAddress.Builder() - .setStreet(ImmutableList.of("I will get ignored :'(")) - .setCity("Williamsburg") - .setState("NY") - .setZip("11211") - .setCountryCode("US") - .build()) - .setLocalizedAddress(new RegistrarAddress.Builder() - .setStreet(ImmutableList.of( - "123 Main St", - "Suite 100")) - .setCity("Smalltown") - .setState("NY") - .setZip("11211") - .setCountryCode("US") - .build()) - .setPhoneNumber("+1.2125551212") - .setFaxNumber("+1.2125551213") - .setEmailAddress("contact-us@example.com") - .setWhoisServer("whois.example.com") - .setUrl("http://www.example.org/another_registrar") - .setIcannReferralEmail("jim@example.net") - .build()); + persistResource( + new Registrar.Builder() + .setRegistrarId("anotherregistrar") + .setRegistrarName("Another Registrar LLC") + .setType(Registrar.Type.REAL) + .setIanaIdentifier(1L) + .setState(Registrar.State.ACTIVE) + .setInternationalizedAddress( + new RegistrarAddress.Builder() + .setStreet(ImmutableList.of("I will get ignored :'(")) + .setCity("Williamsburg") + .setState("NY") + .setZip("11211") + .setCountryCode("US") + .build()) + .setLocalizedAddress( + new RegistrarAddress.Builder() + .setStreet(ImmutableList.of("123 Main St", "Suite 100")) + .setCity("Smalltown") + .setState("NY") + .setZip("11211") + .setCountryCode("US") + .build()) + .setPhoneNumber("+1.2125551212") + .setFaxNumber("+1.2125551213") + .setEmailAddress("contact-us@example.com") + .setWhoisServer("whois.example.com") + .setUrl("http://www.example.org/another_registrar") + .setIcannReferralEmail("jim@example.net") + .build()); Registrar registrar = new Registrar.Builder() - .setClientId("aaaregistrar") + .setRegistrarId("aaaregistrar") .setRegistrarName("AAA Registrar Inc.") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) diff --git a/core/src/test/java/google/registry/flows/EppControllerTest.java b/core/src/test/java/google/registry/flows/EppControllerTest.java index 227e924dd..51aa72869 100644 --- a/core/src/test/java/google/registry/flows/EppControllerTest.java +++ b/core/src/test/java/google/registry/flows/EppControllerTest.java @@ -99,7 +99,7 @@ class EppControllerTest { void beforeEach() throws Exception { loggerToIntercept.addHandler(logHandler); - when(sessionMetadata.getClientId()).thenReturn("some-client"); + when(sessionMetadata.getRegistrarId()).thenReturn("some-client"); when(flowComponentBuilder.flowModule(ArgumentMatchers.any())).thenReturn(flowComponentBuilder); when(flowComponentBuilder.build()).thenReturn(flowComponent); when(flowComponent.flowRunner()).thenReturn(flowRunner); @@ -137,7 +137,7 @@ class EppControllerTest { // actually get values. EppMetric.Builder metricBuilder = EppMetric.builderForRequest(clock) - .setClientId("some-client") + .setRegistrarId("some-client") .setStatus(Code.SUCCESS_WITH_NO_MESSAGES) .setTld("tld"); eppController.handleEppCommand( diff --git a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java index 761ad4fdf..fa1667f46 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java @@ -545,7 +545,7 @@ class EppLifecycleDomainTest extends EppTestCase { new BillingEvent.OneTime.Builder() .setReason(Reason.FEE_EARLY_ACCESS) .setTargetId("example.tld") - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setPeriodYears(1) .setCost(Money.parse("USD 100.00")) .setEventTime(createTime) diff --git a/core/src/test/java/google/registry/flows/EppPointInTimeTest.java b/core/src/test/java/google/registry/flows/EppPointInTimeTest.java index 31b087746..5e85bba93 100644 --- a/core/src/test/java/google/registry/flows/EppPointInTimeTest.java +++ b/core/src/test/java/google/registry/flows/EppPointInTimeTest.java @@ -70,7 +70,7 @@ class EppPointInTimeTest { private void runFlow() throws Exception { SessionMetadata sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()); - sessionMetadata.setClientId("TheRegistrar"); + sessionMetadata.setRegistrarId("TheRegistrar"); DaggerEppTestComponent.builder() .fakesAndMocksModule(FakesAndMocksModule.create(clock, EppMetric.builderForRequest(clock))) .build() diff --git a/core/src/test/java/google/registry/flows/EppTestCase.java b/core/src/test/java/google/registry/flows/EppTestCase.java index 6331d68aa..d85546c33 100644 --- a/core/src/test/java/google/registry/flows/EppTestCase.java +++ b/core/src/test/java/google/registry/flows/EppTestCase.java @@ -136,13 +136,13 @@ public class EppTestCase { return new CommandAsserter(inputFilename, inputSubstitutions); } - CommandAsserter assertThatLogin(String clientId, String password) { - return assertThatCommand("login.xml", ImmutableMap.of("CLID", clientId, "PW", password)) + CommandAsserter assertThatLogin(String registrarId, String password) { + return assertThatCommand("login.xml", ImmutableMap.of("CLID", registrarId, "PW", password)) .atTime(clock.nowUtc()); } - protected void assertThatLoginSucceeds(String clientId, String password) throws Exception { - assertThatLogin(clientId, password).atTime(clock.nowUtc()).hasSuccessfulLogin(); + protected void assertThatLoginSucceeds(String registrarId, String password) throws Exception { + assertThatLogin(registrarId, password).atTime(clock.nowUtc()).hasSuccessfulLogin(); } protected void assertThatLogoutSucceeds() throws Exception { @@ -320,7 +320,7 @@ public class EppTestCase { return new BillingEvent.OneTime.Builder() .setReason(Reason.CREATE) .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setCost(Money.parse("USD 26.00")) .setPeriodYears(2) .setEventTime(createTime) @@ -334,7 +334,7 @@ public class EppTestCase { return new BillingEvent.OneTime.Builder() .setReason(Reason.RENEW) .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setCost(Money.parse("USD 33.00")) .setPeriodYears(3) .setEventTime(renewTime) @@ -370,7 +370,7 @@ public class EppTestCase { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setEventTime(eventTime) .setRecurrenceEndTime(endTime) .setParent(historyEntry) @@ -382,7 +382,7 @@ public class EppTestCase { DomainBase domain, OneTime billingEventToCancel, DateTime createTime, DateTime deleteTime) { return new BillingEvent.Cancellation.Builder() .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setEventTime(deleteTime) .setOneTimeEventKey(VKey.from(findKeyToActualOneTimeBillingEvent(billingEventToCancel))) .setBillingTime(createTime.plus(Registry.get(domain.getTld()).getAddGracePeriodLength())) @@ -396,7 +396,7 @@ public class EppTestCase { DomainBase domain, OneTime billingEventToCancel, DateTime renewTime, DateTime deleteTime) { return new BillingEvent.Cancellation.Builder() .setTargetId(domain.getDomainName()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setEventTime(deleteTime) .setOneTimeEventKey(VKey.from(findKeyToActualOneTimeBillingEvent(billingEventToCancel))) .setBillingTime(renewTime.plus(Registry.get(domain.getTld()).getRenewGracePeriodLength())) diff --git a/core/src/test/java/google/registry/flows/EppTlsActionTest.java b/core/src/test/java/google/registry/flows/EppTlsActionTest.java index af8e80359..33cb52ccd 100644 --- a/core/src/test/java/google/registry/flows/EppTlsActionTest.java +++ b/core/src/test/java/google/registry/flows/EppTlsActionTest.java @@ -37,7 +37,7 @@ class EppTlsActionTest { action.inputXmlBytes = INPUT_XML_BYTES; action.tlsCredentials = mock(TlsCredentials.class); action.session = new FakeHttpSession(); - action.session.setAttribute("CLIENT_ID", "ClientIdentifier"); + action.session.setAttribute("REGISTRAR_ID", "ClientIdentifier"); action.eppRequestHandler = mock(EppRequestHandler.class); action.run(); ArgumentCaptor captor = ArgumentCaptor.forClass(SessionMetadata.class); @@ -48,6 +48,6 @@ class EppTlsActionTest { eq(false), eq(false), eq(INPUT_XML_BYTES)); - assertThat(captor.getValue().getClientId()).isEqualTo("ClientIdentifier"); + assertThat(captor.getValue().getRegistrarId()).isEqualTo("ClientIdentifier"); } } diff --git a/core/src/test/java/google/registry/flows/EppToolActionTest.java b/core/src/test/java/google/registry/flows/EppToolActionTest.java index 9580a4333..dd4ed9329 100644 --- a/core/src/test/java/google/registry/flows/EppToolActionTest.java +++ b/core/src/test/java/google/registry/flows/EppToolActionTest.java @@ -29,7 +29,7 @@ class EppToolActionTest { private void doTest(boolean isDryRun, boolean isSuperuser) { EppToolAction action = new EppToolAction(); - action.clientId = "ClientIdentifier"; + action.registrarId = "ClientIdentifier"; action.isDryRun = isDryRun; action.isSuperuser = isSuperuser; action.eppRequestHandler = mock(EppRequestHandler.class); @@ -43,7 +43,7 @@ class EppToolActionTest { eq(isDryRun), eq(isSuperuser), eq(action.xml.getBytes(UTF_8))); - assertThat(captor.getValue().getClientId()).isEqualTo("ClientIdentifier"); + assertThat(captor.getValue().getRegistrarId()).isEqualTo("ClientIdentifier"); } @Test diff --git a/core/src/test/java/google/registry/flows/ExtensionManagerTest.java b/core/src/test/java/google/registry/flows/ExtensionManagerTest.java index 81afe37a0..f8fda2a92 100644 --- a/core/src/test/java/google/registry/flows/ExtensionManagerTest.java +++ b/core/src/test/java/google/registry/flows/ExtensionManagerTest.java @@ -221,7 +221,7 @@ class ExtensionManagerTest { ExtensionManager build() { manager.flowClass = HelloFlow.class; - manager.clientId = manager.sessionMetadata.getClientId(); + manager.registrarId = manager.sessionMetadata.getRegistrarId(); return manager; } } diff --git a/core/src/test/java/google/registry/flows/FlowReporterTest.java b/core/src/test/java/google/registry/flows/FlowReporterTest.java index a1d866b68..65cb8fc1a 100644 --- a/core/src/test/java/google/registry/flows/FlowReporterTest.java +++ b/core/src/test/java/google/registry/flows/FlowReporterTest.java @@ -60,7 +60,7 @@ class FlowReporterTest { void beforeEach() { LoggerConfig.getConfig(FlowReporter.class).addHandler(handler); flowReporter.trid = Trid.create("client-123", "server-456"); - flowReporter.clientId = "TheRegistrar"; + flowReporter.registrarId = "TheRegistrar"; flowReporter.inputXmlBytes = "".getBytes(UTF_8); flowReporter.flowClass = TestCommandFlow.class; flowReporter.eppInput = mock(EppInput.class); @@ -101,7 +101,7 @@ class FlowReporterTest { @Test void testRecordToLogs_metadata_noClientId() throws Exception { - flowReporter.clientId = ""; + flowReporter.registrarId = ""; flowReporter.recordToLogs(); Map json = parseJsonMap(findFirstLogMessageByPrefix(handler, "FLOW-LOG-SIGNATURE-METADATA: ")); diff --git a/core/src/test/java/google/registry/flows/FlowRunnerTest.java b/core/src/test/java/google/registry/flows/FlowRunnerTest.java index 71695de75..b1cc4ad96 100644 --- a/core/src/test/java/google/registry/flows/FlowRunnerTest.java +++ b/core/src/test/java/google/registry/flows/FlowRunnerTest.java @@ -80,7 +80,7 @@ class FlowRunnerTest { @BeforeEach void beforeEach() { LoggerConfig.getConfig(FlowRunner.class).addHandler(handler); - flowRunner.clientId = "TheRegistrar"; + flowRunner.registrarId = "TheRegistrar"; flowRunner.credentials = new PasswordOnlyTransportCredentials(); flowRunner.eppRequestSource = EppRequestSource.UNIT_TEST; flowRunner.flowProvider = TestCommandFlow::new; @@ -143,7 +143,7 @@ class FlowRunnerTest { @Test void testRun_loggingStatement_httpSessionMetadata() throws Exception { flowRunner.sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()); - flowRunner.sessionMetadata.setClientId("TheRegistrar"); + flowRunner.sessionMetadata.setRegistrarId("TheRegistrar"); flowRunner.run(eppMetricBuilder); assertThat(Splitter.on("\n\t").split(findFirstLogMessageByPrefix(handler, "EPP Command\n\t"))) .contains( diff --git a/core/src/test/java/google/registry/flows/FlowTestCase.java b/core/src/test/java/google/registry/flows/FlowTestCase.java index 33a8447b4..8eb2c0442 100644 --- a/core/src/test/java/google/registry/flows/FlowTestCase.java +++ b/core/src/test/java/google/registry/flows/FlowTestCase.java @@ -111,7 +111,7 @@ public abstract class FlowTestCase { @BeforeEach public void beforeEachFlowTestCase() { sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()); - sessionMetadata.setClientId("TheRegistrar"); + sessionMetadata.setRegistrarId("TheRegistrar"); sessionMetadata.setServiceExtensionUris(ProtocolDefinition.getVisibleServiceExtensionUris()); } @@ -151,14 +151,14 @@ public abstract class FlowTestCase { return eppLoader.getEpp().getCommandWrapper().getClTrid().orElse(null); } - /** Gets the client ID that the flow will run as. */ - protected String getClientIdForFlow() { - return sessionMetadata.getClientId(); + /** Gets the ID of the registrar that the flow will run as. */ + protected String getRegistrarIdForFlow() { + return sessionMetadata.getRegistrarId(); } - /** Sets the client ID that the flow will run as. */ - protected void setClientIdForFlow(String clientId) { - sessionMetadata.setClientId(clientId); + /** Sets the ID of the registrar that the flow will run as. */ + protected void setRegistrarIdForFlow(String registrarId) { + sessionMetadata.setRegistrarId(registrarId); } public void assertTransactionalFlow(boolean isTransactional) throws Exception { @@ -192,7 +192,7 @@ public abstract class FlowTestCase { entry.getKey().getType(), entry.getKey().getDomainRepoId(), entry.getKey().getExpirationTime(), - entry.getKey().getClientId(), + entry.getKey().getRegistrarId(), null, 1L), stripBillingEventId(entry.getValue())); diff --git a/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java b/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java index 53caec8f4..6d6a7dcc8 100644 --- a/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java @@ -122,7 +122,7 @@ public abstract class ResourceFlowTestCase tls.validateCertificateHash(Registrar.loadByClientId("TheRegistrar").get())); + () -> tls.validateCertificateHash(Registrar.loadByRegistrarId("TheRegistrar").get())); } @Test @@ -91,7 +91,7 @@ final class TlsCredentialsTest { .build()); assertThrows( BadRegistrarIpAddressException.class, - () -> tls.validate(Registrar.loadByClientId("TheRegistrar").get(), "password")); + () -> tls.validate(Registrar.loadByRegistrarId("TheRegistrar").get(), "password")); } @Test @@ -102,7 +102,7 @@ final class TlsCredentialsTest { persistResource(loadRegistrar("TheRegistrar").asBuilder().build()); assertThrows( RegistrarCertificateNotConfiguredException.class, - () -> tls.validateCertificateHash(Registrar.loadByClientId("TheRegistrar").get())); + () -> tls.validateCertificateHash(Registrar.loadByRegistrarId("TheRegistrar").get())); } @Test @@ -117,6 +117,6 @@ final class TlsCredentialsTest { .setFailoverClientCertificate(null, clock.nowUtc()) .build()); // This would throw a RegistrarCertificateNotConfiguredException if cert hashes wren't bypassed. - tls.validateCertificateHash(Registrar.loadByClientId("TheRegistrar").get()); + tls.validateCertificateHash(Registrar.loadByRegistrarId("TheRegistrar").get()); } } diff --git a/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java index 95a93a0b2..1571cd893 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java @@ -100,7 +100,7 @@ class ContactCreateFlowTest extends ResourceFlowTestCase doFailingTest("contact_transfer_approve.xml")); @@ -226,7 +228,7 @@ class ContactTransferApproveFlowTest @TestOfyAndSql void testFailure_unrelatedClient() { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); EppException thrown = assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_approve.xml")); diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java index 6a456d097..76053eed3 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java @@ -56,7 +56,7 @@ class ContactTransferCancelFlowTest @BeforeEach void setUp() { this.setEppInput("contact_transfer_cancel.xml"); - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); setupContactWithPendingTransfer(); clock.advanceOneMilli(); } @@ -76,12 +76,14 @@ class ContactTransferCancelFlowTest // Transfer should have been cancelled. Verify correct fields were set. contact = reloadResourceByForeignKey(); - assertAboutContacts().that(contact) - .hasCurrentSponsorClientId("TheRegistrar").and() - .hasLastTransferTimeNotEqualTo(clock.nowUtc()).and() + assertAboutContacts() + .that(contact) + .hasCurrentSponsorRegistrarId("TheRegistrar") + .and() + .hasLastTransferTimeNotEqualTo(clock.nowUtc()) + .and() .hasOneHistoryEntryEachOfTypes( - HistoryEntry.Type.CONTACT_TRANSFER_REQUEST, - HistoryEntry.Type.CONTACT_TRANSFER_CANCEL); + HistoryEntry.Type.CONTACT_TRANSFER_REQUEST, HistoryEntry.Type.CONTACT_TRANSFER_CANCEL); assertThat(contact.getTransferData()) .isEqualTo( originalTransferData.copyConstantFieldsToBuilder() @@ -203,7 +205,7 @@ class ContactTransferCancelFlowTest @TestOfyAndSql void testFailure_sponsoringClient() { - setClientIdForFlow("TheRegistrar"); + setRegistrarIdForFlow("TheRegistrar"); EppException thrown = assertThrows( NotTransferInitiatorException.class, @@ -213,7 +215,7 @@ class ContactTransferCancelFlowTest @TestOfyAndSql void testFailure_unrelatedClient() { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); EppException thrown = assertThrows( NotTransferInitiatorException.class, diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java b/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java index f25bed74e..8cfef6045 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java @@ -58,7 +58,8 @@ abstract class ContactTransferFlowTestCase doFailingTest("contact_transfer_reject.xml")); @@ -227,7 +229,7 @@ class ContactTransferRejectFlowTest @TestOfyAndSql void testFailure_unrelatedClient() { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); EppException thrown = assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_reject.xml")); diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java index dc7b304b6..74d898a41 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java @@ -75,7 +75,7 @@ class ContactTransferRequestFlowTest @BeforeEach void beforeEach() { setEppInput("contact_transfer_request.xml"); - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); contact = persistActiveContact("sh8013"); clock.advanceOneMilli(); } @@ -91,8 +91,10 @@ class ContactTransferRequestFlowTest // Transfer should have been requested. Verify correct fields were set. contact = reloadResourceByForeignKey(); - assertAboutContacts().that(contact) - .hasCurrentSponsorClientId("TheRegistrar").and() + assertAboutContacts() + .that(contact) + .hasCurrentSponsorRegistrarId("TheRegistrar") + .and() .hasOnlyOneHistoryEntryWhich() .hasType(HistoryEntry.Type.CONTACT_TRANSFER_REQUEST); Trid expectedTrid = @@ -104,8 +106,8 @@ class ContactTransferRequestFlowTest new ContactTransferData.Builder() .setTransferRequestTrid(expectedTrid) .setTransferRequestTime(clock.nowUtc()) - .setGainingClientId("NewRegistrar") - .setLosingClientId("TheRegistrar") + .setGainingRegistrarId("NewRegistrar") + .setLosingRegistrarId("TheRegistrar") .setTransferStatus(TransferStatus.PENDING) .setPendingTransferExpirationTime(afterTransfer) // Make the server-approve entities field a no-op comparison; it's easier to @@ -119,8 +121,9 @@ class ContactTransferRequestFlowTest getOnlyElement(getPollMessages("TheRegistrar", clock.nowUtc())); // If we fast forward AUTOMATIC_TRANSFER_DAYS the transfer should have happened. - assertAboutContacts().that(contact.cloneProjectedAtTime(afterTransfer)) - .hasCurrentSponsorClientId("NewRegistrar"); + assertAboutContacts() + .that(contact.cloneProjectedAtTime(afterTransfer)) + .hasCurrentSponsorRegistrarId("NewRegistrar"); assertThat(getPollMessages("NewRegistrar", afterTransfer)).hasSize(1); assertThat(getPollMessages("TheRegistrar", afterTransfer)).hasSize(2); PollMessage gainingApproveMessage = @@ -236,7 +239,7 @@ class ContactTransferRequestFlowTest @TestOfyAndSql void testFailure_sponsoringClient() { - setClientIdForFlow("TheRegistrar"); + setRegistrarIdForFlow("TheRegistrar"); EppException thrown = assertThrows( ObjectAlreadySponsoredException.class, diff --git a/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java index 64df99434..d6c963b0f 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java @@ -302,7 +302,7 @@ class ContactUpdateFlowTest extends ResourceFlowTestCase doFailingTest("domain_transfer_approve.xml")); @@ -512,7 +512,7 @@ class DomainTransferApproveFlowTest @TestOfyAndSql void testFailure_unrelatedClient() { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); EppException thrown = assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml")); @@ -608,7 +608,7 @@ class DomainTransferApproveFlowTest .setType(DOMAIN_TRANSFER_REQUEST) .setDomain(domain) .setModificationTime(clock.nowUtc().minusDays(4)) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setDomainTransactionRecords( ImmutableSet.of(previousSuccessRecord, notCancellableRecord)) .build()); diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java index c40237b8a..0c121e37d 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java @@ -76,7 +76,7 @@ class DomainTransferCancelFlowTest @BeforeEach void setUp() { setEppInput("domain_transfer_cancel.xml"); - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); setupDomainWithPendingTransfer("example", "tld"); } @@ -99,7 +99,7 @@ class DomainTransferCancelFlowTest "NewRegistrar", new PollMessage.Autorenew.Builder() .setTargetId(getUniqueIdFromCommand()) - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setEventTime(EXTENDED_REGISTRATION_EXPIRATION_TIME) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") @@ -151,7 +151,7 @@ class DomainTransferCancelFlowTest getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_CANCEL); assertAboutHistoryEntries() .that(historyEntryTransferCancel) - .hasClientId("NewRegistrar") + .hasRegistrarId("NewRegistrar") .and() .hasOtherClientId("TheRegistrar"); // The only billing event left should be the original autorenew event, now reopened. @@ -166,14 +166,14 @@ class DomainTransferCancelFlowTest "TheRegistrar", new PollMessage.Autorenew.Builder() .setTargetId(getUniqueIdFromCommand()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(originalExpirationTime) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") .setParent(getOnlyHistoryEntryOfType(domain, DOMAIN_CREATE)) .build(), new PollMessage.OneTime.Builder() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(clock.nowUtc()) .setResponseData( ImmutableList.of( @@ -181,8 +181,8 @@ class DomainTransferCancelFlowTest .setFullyQualifiedDomainName(getUniqueIdFromCommand()) .setTransferStatus(TransferStatus.CLIENT_CANCELLED) .setTransferRequestTime(TRANSFER_REQUEST_TIME) - .setGainingClientId("NewRegistrar") - .setLosingClientId("TheRegistrar") + .setGainingRegistrarId("NewRegistrar") + .setLosingRegistrarId("TheRegistrar") .setPendingTransferExpirationTime(clock.nowUtc()) .build())) .setMsg("Transfer cancelled.") @@ -312,7 +312,7 @@ class DomainTransferCancelFlowTest @TestOfyAndSql void testFailure_sponsoringClient() { - setClientIdForFlow("TheRegistrar"); + setRegistrarIdForFlow("TheRegistrar"); EppException thrown = assertThrows( NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml")); @@ -321,7 +321,7 @@ class DomainTransferCancelFlowTest @TestOfyAndSql void testFailure_unrelatedClient() { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); EppException thrown = assertThrows( NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml")); @@ -406,7 +406,7 @@ class DomainTransferCancelFlowTest .setType(DOMAIN_TRANSFER_REQUEST) .setDomain(domain) .setModificationTime(clock.nowUtc().minusDays(4)) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setDomainTransactionRecords( ImmutableSet.of(previousSuccessRecord, notCancellableRecord)) .build()); diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java b/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java index fc932c39e..b4ab520d6 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java @@ -85,7 +85,8 @@ abstract class DomainTransferFlowTestCase void beforeEachDomainTransferFlowTestCase() { // Registrar ClientZ is used in tests that need another registrar that definitely doesn't own // the resources in question. - persistResource(AppEngineExtension.makeRegistrar1().asBuilder().setClientId("ClientZ").build()); + persistResource( + AppEngineExtension.makeRegistrar1().asBuilder().setRegistrarId("ClientZ").build()); } static DomainBase persistWithPendingTransfer(DomainBase domain) { @@ -113,8 +114,8 @@ abstract class DomainTransferFlowTestCase new HostResource.Builder() .setRepoId("2-".concat(Ascii.toUpperCase(tld))) .setHostName("ns1." + label + "." + tld) - .setPersistedCurrentSponsorClientId("TheRegistrar") - .setCreationClientId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") .setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z")) .setSuperordinateDomain(domain.createVKey()) .build()); @@ -139,7 +140,7 @@ abstract class DomainTransferFlowTestCase .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(domain.getDomainName()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(REGISTRATION_EXPIRATION_TIME) .setRecurrenceEndTime(TRANSFER_EXPIRATION_TIME) .setParent(historyEntryDomainCreate) @@ -152,7 +153,7 @@ abstract class DomainTransferFlowTestCase .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(domain.getDomainName()) - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setEventTime(EXTENDED_REGISTRATION_EXPIRATION_TIME) .setRecurrenceEndTime(END_OF_TIME) .setParent( @@ -163,9 +164,11 @@ abstract class DomainTransferFlowTestCase void assertTransferFailed( DomainBase domain, TransferStatus status, TransferData oldTransferData) { - assertAboutDomains().that(domain) - .doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER).and() - .hasCurrentSponsorClientId("TheRegistrar"); + assertAboutDomains() + .that(domain) + .doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER) + .and() + .hasCurrentSponsorRegistrarId("TheRegistrar"); // The domain TransferData should reflect the failed transfer as we expect, with // all the speculative server-approve fields nulled out. assertThat(domain.getTransferData()) diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java index c7d8c61a4..4f60ac9b0 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java @@ -53,7 +53,7 @@ class DomainTransferQueryFlowTest @BeforeEach void beforeEach() { setEppInput("domain_transfer_query.xml"); - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); setupDomainWithPendingTransfer("example", "tld"); } @@ -95,20 +95,20 @@ class DomainTransferQueryFlowTest @TestOfyAndSql void testSuccess_sponsoringClient() throws Exception { - setClientIdForFlow("TheRegistrar"); + setRegistrarIdForFlow("TheRegistrar"); doSuccessfulTest("domain_transfer_query.xml", "domain_transfer_query_response.xml", 1); } @TestOfyAndSql void testSuccess_domainAuthInfo() throws Exception { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); doSuccessfulTest( "domain_transfer_query_domain_authinfo.xml", "domain_transfer_query_response.xml", 1); } @TestOfyAndSql void testSuccess_contactAuthInfo() throws Exception { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); doSuccessfulTest( "domain_transfer_query_contact_authinfo.xml", "domain_transfer_query_response.xml", 1); } @@ -214,7 +214,7 @@ class DomainTransferQueryFlowTest @TestOfyAndSql void testFailure_unrelatedClient() { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); EppException thrown = assertThrows( NotAuthorizedToViewTransferException.class, diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java index 44e24798a..d297dee69 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java @@ -78,7 +78,7 @@ class DomainTransferRejectFlowTest @BeforeEach void setUp() { setEppInput("domain_transfer_reject.xml"); - setClientIdForFlow("TheRegistrar"); + setRegistrarIdForFlow("TheRegistrar"); setupDomainWithPendingTransfer("example", "tld"); clock.advanceOneMilli(); } @@ -295,7 +295,7 @@ class DomainTransferRejectFlowTest @TestOfyAndSql void testFailure_gainingClient() { - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); EppException thrown = assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml")); @@ -304,7 +304,7 @@ class DomainTransferRejectFlowTest @TestOfyAndSql void testFailure_unrelatedClient() { - setClientIdForFlow("ClientZ"); + setRegistrarIdForFlow("ClientZ"); EppException thrown = assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml")); @@ -372,7 +372,7 @@ class DomainTransferRejectFlowTest .setType(DOMAIN_TRANSFER_REQUEST) .setDomain(domain) .setModificationTime(clock.nowUtc().minusDays(4)) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setDomainTransactionRecords( ImmutableSet.of(previousSuccessRecord, notCancellableRecord)) .build()); diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java index 4d0fc8a78..e582b28d5 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java @@ -166,7 +166,7 @@ class DomainTransferRequestFlowTest @BeforeEach void setUp() { setEppInput("domain_transfer_request.xml"); - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); } private void assertTransferRequested( @@ -177,7 +177,7 @@ class DomainTransferRequestFlowTest throws Exception { assertAboutDomains() .that(domain) - .hasCurrentSponsorClientId("TheRegistrar") + .hasCurrentSponsorRegistrarId("TheRegistrar") .and() .hasStatusValue(StatusValue.PENDING_TRANSFER) .and() @@ -196,8 +196,8 @@ class DomainTransferRequestFlowTest domain .getTransferData() .asBuilder() - .setGainingClientId("NewRegistrar") - .setLosingClientId("TheRegistrar") + .setGainingRegistrarId("NewRegistrar") + .setLosingRegistrarId("TheRegistrar") .setTransferRequestTrid(expectedTrid) .setTransferRequestTime(clock.nowUtc()) .setTransferPeriod(expectedPeriod) @@ -214,7 +214,7 @@ class DomainTransferRequestFlowTest throws Exception { assertAboutDomains() .that(domain) - .hasCurrentSponsorClientId("NewRegistrar") + .hasCurrentSponsorRegistrarId("NewRegistrar") .and() .hasLastTransferTime(automaticTransferTime) .and() @@ -226,8 +226,8 @@ class DomainTransferRequestFlowTest assertThat(domain.getTransferData()) .isEqualTo( new DomainTransferData.Builder() - .setGainingClientId("NewRegistrar") - .setLosingClientId("TheRegistrar") + .setGainingRegistrarId("NewRegistrar") + .setLosingRegistrarId("TheRegistrar") .setTransferRequestTrid(expectedTrid) .setTransferRequestTime(clock.nowUtc()) .setTransferPeriod(expectedPeriod) @@ -268,7 +268,7 @@ class DomainTransferRequestFlowTest .setEventTime(implicitTransferTime) .setBillingTime( implicitTransferTime.plus(registry.getTransferGracePeriodLength())) - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setCost(transferCost.orElse(Money.of(USD, 11))) .setPeriodYears(1) .setParent(historyEntryTransferRequest) @@ -323,7 +323,7 @@ class DomainTransferRequestFlowTest Sets.union(expectedServeApproveBillingEvents, extraBillingEvents)); // The domain's autorenew billing event should still point to the losing client's event. BillingEvent.Recurring domainAutorenewEvent = loadByKey(domain.getAutorenewBillingEvent()); - assertThat(domainAutorenewEvent.getClientId()).isEqualTo("TheRegistrar"); + assertThat(domainAutorenewEvent.getRegistrarId()).isEqualTo("TheRegistrar"); assertThat(domainAutorenewEvent.getRecurrenceEndTime()).isEqualTo(implicitTransferTime); // The original grace periods should remain untouched. assertThat(domain.getGracePeriods()).containsExactlyElementsIn(originalGracePeriods); @@ -804,7 +804,7 @@ class DomainTransferRequestFlowTest setupDomain("example", "tld"); clock.advanceOneMilli(); persistResource( - Registrar.loadByClientId("NewRegistrar") + Registrar.loadByRegistrarId("NewRegistrar") .get() .asBuilder() .setState(State.SUSPENDED) @@ -821,7 +821,7 @@ class DomainTransferRequestFlowTest setupDomain("example", "tld"); clock.advanceOneMilli(); persistResource( - Registrar.loadByClientId("NewRegistrar") + Registrar.loadByRegistrarId("NewRegistrar") .get() .asBuilder() .setState(State.PENDING) @@ -868,7 +868,7 @@ class DomainTransferRequestFlowTest setupDomain("example", "tld"); clock.advanceOneMilli(); persistResource( - Registrar.loadByClientId("TheRegistrar") + Registrar.loadByRegistrarId("TheRegistrar") .get() .asBuilder() .setState(State.SUSPENDED) @@ -1129,7 +1129,7 @@ class DomainTransferRequestFlowTest new BillingEvent.Cancellation.Builder() .setReason(Reason.RENEW) .setTargetId("example.tld") - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") // The cancellation happens at the moment of transfer. .setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength())) .setBillingTime(autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength())) @@ -1156,7 +1156,7 @@ class DomainTransferRequestFlowTest new BillingEvent.Cancellation.Builder() .setReason(Reason.RENEW) .setTargetId("example.tld") - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") // The cancellation happens at the moment of transfer. .setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength())) .setBillingTime( @@ -1421,7 +1421,7 @@ class DomainTransferRequestFlowTest @TestOfyAndSql void testFailure_sponsoringClient() { setupDomain("example", "tld"); - setClientIdForFlow("TheRegistrar"); + setRegistrarIdForFlow("TheRegistrar"); EppException thrown = assertThrows( ObjectAlreadySponsoredException.class, diff --git a/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java index 12df3b101..36a949945 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java @@ -157,7 +157,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase checkDomainsWithToken( ImmutableList domainNames, AllocationToken tokenEntity, - String clientId, + String registrarId, DateTime now) { throw new IllegalStateException("failed for tests"); } @@ -325,7 +325,7 @@ class AllocationTokenFlowUtilsTest { public ImmutableMap checkDomainsWithToken( ImmutableList domainNames, AllocationToken tokenEntity, - String clientId, + String registrarId, DateTime now) { return Maps.toMap(domainNames, domain -> domain.toString().contains("bunny") ? "fufu" : ""); } diff --git a/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java b/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java index 6e0898fce..7cf53c3a6 100644 --- a/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java @@ -230,7 +230,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase new HostResource.Builder() .setHostName(getUniqueIdFromCommand()) .setRepoId("1FF-FOOBAR") - .setPersistedCurrentSponsorClientId("my sponsor") + .setPersistedCurrentSponsorRegistrarId("my sponsor") .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .setInetAddresses( ImmutableSet.of( InetAddresses.forString("192.0.2.2"), InetAddresses.forString("1080:0:0:0:8:800:200C:417A"), InetAddresses.forString("192.0.2.29"))) - .setPersistedCurrentSponsorClientId("TheRegistrar") - .setCreationClientId("NewRegistrar") - .setLastEppUpdateClientId("NewRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") + .setCreationRegistrarId("NewRegistrar") + .setLastEppUpdateRegistrarId("NewRegistrar") .setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z")) .setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z")) .setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z")) @@ -123,7 +123,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase .asBuilder() .setRepoId("BEEF-FOOBAR") .setLastTransferTime(domainTransferTime) - .setPersistedCurrentSponsorClientId("superclientid") + .setPersistedCurrentSponsorRegistrarId("superclientid") .build()); HostResource firstHost = persistHostResource(); persistResource( diff --git a/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java b/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java index 49fa25ea6..d2911941b 100644 --- a/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java +++ b/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java @@ -125,14 +125,14 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); - sessionMetadata.setClientId("TheRegistrar"); + sessionMetadata.setRegistrarId("TheRegistrar"); createTld("foo"); createTld("tld"); persistResource( newDomainBase("example.tld") .asBuilder() - .setPersistedCurrentSponsorClientId("NewRegistrar") + .setPersistedCurrentSponsorRegistrarId("NewRegistrar") .build()); HostResource host = persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo")); - assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar"); + assertAboutHosts().that(host).hasPersistedCurrentSponsorRegistrarId("TheRegistrar"); EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1216,15 +1216,15 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); - sessionMetadata.setClientId("TheRegistrar"); + sessionMetadata.setRegistrarId("TheRegistrar"); createTld("foo"); createTld("tld"); HostResource host = persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo")); // The domain will belong to NewRegistrar after cloneProjectedAtTime is called. DomainBase domain = persistResource(createDomainWithServerApprovedTransfer("example.tld")); - assertAboutDomains().that(domain).hasPersistedCurrentSponsorClientId("TheRegistrar"); - assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar"); + assertAboutDomains().that(domain).hasPersistedCurrentSponsorRegistrarId("TheRegistrar"); + assertAboutHosts().that(host).hasPersistedCurrentSponsorRegistrarId("TheRegistrar"); EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1234,7 +1234,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); - sessionMetadata.setClientId("NewRegistrar"); + sessionMetadata.setRegistrarId("NewRegistrar"); createTld("foo"); createTld("tld"); // The domain will belong to NewRegistrar after cloneProjectedAtTime is called. @@ -1243,14 +1243,14 @@ class HostUpdateFlowTest extends ResourceFlowTestCase { @BeforeEach void setUp() { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2011")); - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); createTld("example"); contact = persistActiveContact("jd1234"); domain = persistResource(newDomainBase("test.example", contact)); @@ -72,7 +72,7 @@ class PollAckFlowTest extends FlowTestCase { persistResource( new PollMessage.OneTime.Builder() .setId(messageId) - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Some poll message.") .setParent(createHistoryEntryForEppResource(domain)) @@ -83,7 +83,7 @@ class PollAckFlowTest extends FlowTestCase { persistResource( new PollMessage.Autorenew.Builder() .setId(MESSAGE_ID) - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(eventTime) .setAutorenewEndTime(endTime) .setMsg("Domain was auto-renewed.") @@ -104,7 +104,7 @@ class PollAckFlowTest extends FlowTestCase { persistResource( new PollMessage.OneTime.Builder() .setId(MESSAGE_ID) - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Some poll message.") .setParent(createHistoryEntryForEppResource(contact)) @@ -119,7 +119,7 @@ class PollAckFlowTest extends FlowTestCase { persistResource( new PollMessage.OneTime.Builder() .setId(MESSAGE_ID) - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Some poll message.") .setParent(createHistoryEntryForEppResource(contact)) @@ -207,7 +207,7 @@ class PollAckFlowTest extends FlowTestCase { persistResource( new PollMessage.OneTime.Builder() .setId(MESSAGE_ID) - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Some poll message.") .setParent(createHistoryEntryForEppResource(contact)) @@ -242,7 +242,7 @@ class PollAckFlowTest extends FlowTestCase { persistResource( new PollMessage.OneTime.Builder() .setId(MESSAGE_ID) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Some poll message.") .setParent(createHistoryEntryForEppResource(domain)) @@ -256,7 +256,7 @@ class PollAckFlowTest extends FlowTestCase { persistResource( new PollMessage.OneTime.Builder() .setId(MESSAGE_ID) - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().plusDays(1)) .setMsg("Some poll message.") .setParent(createHistoryEntryForEppResource(domain)) diff --git a/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java b/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java index df40b36b6..787c63895 100644 --- a/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java @@ -67,7 +67,7 @@ class PollRequestFlowTest extends FlowTestCase { @BeforeEach void setUp() { setEppInput("poll.xml"); - setClientIdForFlow("NewRegistrar"); + setRegistrarIdForFlow("NewRegistrar"); createTld("example"); persistNewRegistrar("BadRegistrar"); contact = persistActiveContact("jd1234"); @@ -78,7 +78,7 @@ class PollRequestFlowTest extends FlowTestCase { private void persistPendingTransferPollMessage() { persistResource( new PollMessage.OneTime.Builder() - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Transfer approved.") .setResponseData( @@ -86,9 +86,9 @@ class PollRequestFlowTest extends FlowTestCase { new DomainTransferResponse.Builder() .setFullyQualifiedDomainName("test.example") .setTransferStatus(TransferStatus.SERVER_APPROVED) - .setGainingClientId(getClientIdForFlow()) + .setGainingRegistrarId(getRegistrarIdForFlow()) .setTransferRequestTime(clock.nowUtc().minusDays(5)) - .setLosingClientId("TheRegistrar") + .setLosingRegistrarId("TheRegistrar") .setPendingTransferExpirationTime(clock.nowUtc().minusDays(1)) .setExtendedRegistrationExpirationTime(clock.nowUtc().plusYears(1)) .build())) @@ -113,21 +113,23 @@ class PollRequestFlowTest extends FlowTestCase { @TestOfyAndSql void testSuccess_contactTransferPending() throws Exception { - setClientIdForFlow("TheRegistrar"); + setRegistrarIdForFlow("TheRegistrar"); persistResource( new PollMessage.OneTime.Builder() .setId(3L) - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(5)) .setMsg("Transfer requested.") - .setResponseData(ImmutableList.of(new ContactTransferResponse.Builder() - .setContactId("sh8013") - .setTransferStatus(TransferStatus.PENDING) - .setGainingClientId(getClientIdForFlow()) - .setTransferRequestTime(clock.nowUtc().minusDays(5)) - .setLosingClientId("NewRegistrar") - .setPendingTransferExpirationTime(clock.nowUtc()) - .build())) + .setResponseData( + ImmutableList.of( + new ContactTransferResponse.Builder() + .setContactId("sh8013") + .setTransferStatus(TransferStatus.PENDING) + .setGainingRegistrarId(getRegistrarIdForFlow()) + .setTransferRequestTime(clock.nowUtc().minusDays(5)) + .setLosingRegistrarId("NewRegistrar") + .setPendingTransferExpirationTime(clock.nowUtc()) + .build())) .setParent(createHistoryEntryForEppResource(contact)) .build()); assertTransactionalFlow(false); @@ -138,11 +140,16 @@ class PollRequestFlowTest extends FlowTestCase { void testSuccess_domainPendingActionComplete() throws Exception { persistResource( new PollMessage.OneTime.Builder() - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Domain deleted.") - .setResponseData(ImmutableList.of(DomainPendingActionNotificationResponse.create( - "test.example", true, Trid.create("ABC-12345", "other-trid"), clock.nowUtc()))) + .setResponseData( + ImmutableList.of( + DomainPendingActionNotificationResponse.create( + "test.example", + true, + Trid.create("ABC-12345", "other-trid"), + clock.nowUtc()))) .setParent(createHistoryEntryForEppResource(domain)) .build()); assertTransactionalFlow(false); @@ -153,7 +160,7 @@ class PollRequestFlowTest extends FlowTestCase { void testSuccess_domainAutorenewMessage() throws Exception { persistResource( new PollMessage.Autorenew.Builder() - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Domain was auto-renewed.") .setTargetId("test.example") @@ -172,7 +179,7 @@ class PollRequestFlowTest extends FlowTestCase { void testSuccess_wrongRegistrar() throws Exception { persistResource( new PollMessage.OneTime.Builder() - .setClientId("BadRegistrar") + .setRegistrarId("BadRegistrar") .setEventTime(clock.nowUtc().minusDays(1)) .setMsg("Poll message") .setParent(createHistoryEntryForEppResource(domain)) @@ -184,7 +191,7 @@ class PollRequestFlowTest extends FlowTestCase { void testSuccess_futurePollMessage() throws Exception { persistResource( new PollMessage.OneTime.Builder() - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().plusDays(1)) .setMsg("Poll message") .setParent(createHistoryEntryForEppResource(domain)) @@ -196,7 +203,7 @@ class PollRequestFlowTest extends FlowTestCase { void testSuccess_futureAutorenew() throws Exception { persistResource( new PollMessage.Autorenew.Builder() - .setClientId(getClientIdForFlow()) + .setRegistrarId(getRegistrarIdForFlow()) .setEventTime(clock.nowUtc().plusDays(1)) .setMsg("Domain was auto-renewed.") .setTargetId("target.example") @@ -213,14 +220,14 @@ class PollRequestFlowTest extends FlowTestCase { HistoryEntry historyEntry = persistResource( new ContactHistory.Builder() - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setModificationTime(clock.nowUtc().minusDays(1)) .setType(HistoryEntry.Type.CONTACT_DELETE) .setContact(contact) .build()); persistResource( new PollMessage.OneTime.Builder() - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setMsg("Deleted contact jd1234") .setParent(historyEntry) .setEventTime(clock.nowUtc().minusDays(1)) @@ -236,14 +243,14 @@ class PollRequestFlowTest extends FlowTestCase { HistoryEntry historyEntry = persistResource( new HostHistory.Builder() - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setModificationTime(clock.nowUtc().minusDays(1)) .setType(HistoryEntry.Type.HOST_DELETE) .setHost(host) .build()); persistResource( new PollMessage.OneTime.Builder() - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setMsg("Deleted host ns1.test.example") .setParent(historyEntry) .setEventTime(clock.nowUtc().minusDays(1)) diff --git a/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java b/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java index cc9aeb86a..deb09925b 100644 --- a/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java @@ -28,7 +28,7 @@ import google.registry.flows.EppException.UnimplementedProtocolVersionException; import google.registry.flows.FlowTestCase; import google.registry.flows.TransportCredentials.BadRegistrarPasswordException; import google.registry.flows.session.LoginFlow.AlreadyLoggedInException; -import google.registry.flows.session.LoginFlow.BadRegistrarClientIdException; +import google.registry.flows.session.LoginFlow.BadRegistrarIdException; import google.registry.flows.session.LoginFlow.PasswordChangesNotSupportedException; import google.registry.flows.session.LoginFlow.RegistrarAccountNotActiveException; import google.registry.flows.session.LoginFlow.TooManyFailedLoginsException; @@ -47,7 +47,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase { @BeforeEach void beforeEachLoginFlowTestCase() { - sessionMetadata.setClientId(null); // Don't implicitly log in (all other flows need to). + sessionMetadata.setRegistrarId(null); // Don't implicitly log in (all other flows need to). registrar = loadRegistrar("NewRegistrar"); registrarBuilder = registrar.asBuilder(); } @@ -124,7 +124,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase { @Test void testFailure_unknownRegistrar() { deleteResource(getRegistrarBuilder().build()); - doFailingTest("login_valid.xml", BadRegistrarClientIdException.class); + doFailingTest("login_valid.xml", BadRegistrarIdException.class); } @Test @@ -156,7 +156,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase { @Test void testFailure_alreadyLoggedIn() { - sessionMetadata.setClientId("something"); + sessionMetadata.setRegistrarId("something"); doFailingTest("login_valid.xml", AlreadyLoggedInException.class); } } diff --git a/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java b/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java index a4128fc61..1ab2e18ba 100644 --- a/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java +++ b/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java @@ -45,7 +45,7 @@ class LogoutFlowTest extends FlowTestCase { @Test void testFailure() { - sessionMetadata.setClientId(null); // Turn off the implicit login + sessionMetadata.setRegistrarId(null); // Turn off the implicit login EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/core/src/test/java/google/registry/mapreduce/inputs/ChildEntityInputTest.java b/core/src/test/java/google/registry/mapreduce/inputs/ChildEntityInputTest.java index 429e6e380..c8719812b 100644 --- a/core/src/test/java/google/registry/mapreduce/inputs/ChildEntityInputTest.java +++ b/core/src/test/java/google/registry/mapreduce/inputs/ChildEntityInputTest.java @@ -85,7 +85,7 @@ class ChildEntityInputTest { .setType(HistoryEntry.Type.DOMAIN_CREATE) .setDomain(domainA) .setModificationTime(now) - .setClientId(domainA.getCreationClientId()) + .setRegistrarId(domainA.getCreationRegistrarId()) .build()); contactHistoryEntry = persistResource( @@ -94,7 +94,7 @@ class ChildEntityInputTest { .setType(HistoryEntry.Type.CONTACT_CREATE) .setContact(contact) .setModificationTime(now) - .setClientId(contact.getCreationClientId()) + .setRegistrarId(contact.getCreationRegistrarId()) .build()); oneTimeA = persistResource( @@ -106,7 +106,7 @@ class ChildEntityInputTest { .setCost(Money.of(USD, 1)) .setEventTime(now) .setBillingTime(now.plusDays(5)) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTargetId("a.tld") .build()); recurringA = @@ -116,7 +116,7 @@ class ChildEntityInputTest { .setReason(Reason.RENEW) .setEventTime(now.plusYears(1)) .setRecurrenceEndTime(END_OF_TIME) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTargetId("a.tld") .build()); } @@ -130,7 +130,7 @@ class ChildEntityInputTest { .setType(HistoryEntry.Type.DOMAIN_CREATE) .setDomain(domainB) .setModificationTime(now) - .setClientId(domainB.getCreationClientId()) + .setRegistrarId(domainB.getCreationRegistrarId()) .build()); oneTimeB = persistResource( @@ -142,7 +142,7 @@ class ChildEntityInputTest { .setCost(Money.of(USD, 1)) .setEventTime(now) .setBillingTime(now.plusDays(5)) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTargetId("a.tld") .build()); recurringB = @@ -152,7 +152,7 @@ class ChildEntityInputTest { .setReason(Reason.RENEW) .setEventTime(now.plusYears(1)) .setRecurrenceEndTime(END_OF_TIME) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTargetId("a.tld") .build()); } @@ -315,7 +315,7 @@ class ChildEntityInputTest { .setDomain(domain) .setType(HistoryEntry.Type.DOMAIN_CREATE) .setModificationTime(now) - .setClientId(domain.getCreationClientId()) + .setRegistrarId(domain.getCreationRegistrarId()) .build()) .asHistoryEntry()); persistResource(EppResourceIndex.create(getBucketKey(i), Key.create(domain))); diff --git a/core/src/test/java/google/registry/model/EppResourceUtilsTest.java b/core/src/test/java/google/registry/model/EppResourceUtilsTest.java index a47358bf9..019c8e2b9 100644 --- a/core/src/test/java/google/registry/model/EppResourceUtilsTest.java +++ b/core/src/test/java/google/registry/model/EppResourceUtilsTest.java @@ -86,17 +86,18 @@ class EppResourceUtilsTest { persistNewRegistrars("OLD", "NEW"); clock.advanceOneMilli(); // Save resource with a commit log that we can read in later as a revisions map value. - HostResource oldHost = persistResourceWithCommitLog( - newHostResource("ns1.cat.tld").asBuilder() - .setCreationTimeForTest(START_OF_TIME) - .setPersistedCurrentSponsorClientId("OLD") - .build()); + HostResource oldHost = + persistResourceWithCommitLog( + newHostResource("ns1.cat.tld") + .asBuilder() + .setCreationTimeForTest(START_OF_TIME) + .setPersistedCurrentSponsorRegistrarId("OLD") + .build()); // Advance a day so that the next created revision entry doesn't overwrite the existing one. clock.advanceBy(Duration.standardDays(1)); // Overwrite the current host with one that has different data. - HostResource currentHost = persistResource(oldHost.asBuilder() - .setPersistedCurrentSponsorClientId("NEW") - .build()); + HostResource currentHost = + persistResource(oldHost.asBuilder().setPersistedCurrentSponsorRegistrarId("NEW").build()); // Load at the point in time just before the latest update; the floor entry of the revisions // map should point to the manifest for the first save, so we should get the old host. assertThat(loadAtPointInTime(currentHost, clock.nowUtc().minusMillis(1))).isEqualTo(oldHost); @@ -105,17 +106,18 @@ class EppResourceUtilsTest { @TestOfyOnly void testLoadAtPointInTime_brokenRevisionHistory_returnsResourceAsIs() { // Don't save a commit log since we want to test the handling of a broken revisions key. - HostResource oldHost = persistResource( - newHostResource("ns1.cat.tld").asBuilder() - .setCreationTimeForTest(START_OF_TIME) - .setPersistedCurrentSponsorClientId("OLD") - .build()); + HostResource oldHost = + persistResource( + newHostResource("ns1.cat.tld") + .asBuilder() + .setCreationTimeForTest(START_OF_TIME) + .setPersistedCurrentSponsorRegistrarId("OLD") + .build()); // Advance a day so that the next created revision entry doesn't overwrite the existing one. clock.advanceBy(Duration.standardDays(1)); // Overwrite the existing resource to force revisions map use. - HostResource host = persistResource(oldHost.asBuilder() - .setPersistedCurrentSponsorClientId("NEW") - .build()); + HostResource host = + persistResource(oldHost.asBuilder().setPersistedCurrentSponsorRegistrarId("NEW").build()); // Load at the point in time just before the latest update; the old host is not recoverable // (revisions map link is broken, and guessing using the oldest revision map entry finds the // same broken link), so just returns the current host. @@ -126,17 +128,18 @@ class EppResourceUtilsTest { void testLoadAtPointInTime_fallback_returnsMutationValueForOldestRevision() { clock.advanceOneMilli(); // Save a commit log that we can fall back to. - HostResource oldHost = persistResourceWithCommitLog( - newHostResource("ns1.cat.tld").asBuilder() - .setCreationTimeForTest(START_OF_TIME) - .setPersistedCurrentSponsorClientId("OLD") - .build()); + HostResource oldHost = + persistResourceWithCommitLog( + newHostResource("ns1.cat.tld") + .asBuilder() + .setCreationTimeForTest(START_OF_TIME) + .setPersistedCurrentSponsorRegistrarId("OLD") + .build()); // Advance a day so that the next created revision entry doesn't overwrite the existing one. clock.advanceBy(Duration.standardDays(1)); // Overwrite the current host with one that has different data. - HostResource currentHost = persistResource(oldHost.asBuilder() - .setPersistedCurrentSponsorClientId("NEW") - .build()); + HostResource currentHost = + persistResource(oldHost.asBuilder().setPersistedCurrentSponsorRegistrarId("NEW").build()); // Load at the point in time before the first update; there will be no floor entry for the // revisions map, so give up and return the oldest revision entry's mutation value (the old host // data). @@ -147,11 +150,13 @@ class EppResourceUtilsTest { void testLoadAtPointInTime_ultimateFallback_onlyOneRevision_returnsCurrentResource() { clock.advanceOneMilli(); // Don't save a commit log; we want to test that we load from the current resource. - HostResource host = persistResource( - newHostResource("ns1.cat.tld").asBuilder() - .setCreationTimeForTest(START_OF_TIME) - .setPersistedCurrentSponsorClientId("OLD") - .build()); + HostResource host = + persistResource( + newHostResource("ns1.cat.tld") + .asBuilder() + .setCreationTimeForTest(START_OF_TIME) + .setPersistedCurrentSponsorRegistrarId("OLD") + .build()); // Load at the point in time before the first save; there will be no floor entry for the // revisions map. Since the oldest revision entry is the only (i.e. current) revision, return // the resource. diff --git a/core/src/test/java/google/registry/model/OteAccountBuilderTest.java b/core/src/test/java/google/registry/model/OteAccountBuilderTest.java index fe7a2f7da..9cb2eb202 100644 --- a/core/src/test/java/google/registry/model/OteAccountBuilderTest.java +++ b/core/src/test/java/google/registry/model/OteAccountBuilderTest.java @@ -54,7 +54,7 @@ public final class OteAccountBuilderTest { @TestOfyAndSql void testGetRegistrarToTldMap() { - assertThat(OteAccountBuilder.forClientId("myclientid").getClientIdToTldMap()) + assertThat(OteAccountBuilder.forRegistrarId("myclientid").getRegistrarIdToTldMap()) .containsExactly( "myclientid-1", "myclientid-sunrise", "myclientid-3", "myclientid-ga", @@ -83,16 +83,16 @@ public final class OteAccountBuilderTest { .isEqualTo(eapFee.getAmount()); } - private void assertRegistrarExists(String clientId, String tld) { - Registrar registrar = Registrar.loadByClientId(clientId).orElse(null); + private void assertRegistrarExists(String registrarId, String tld) { + Registrar registrar = Registrar.loadByRegistrarId(registrarId).orElse(null); assertThat(registrar).isNotNull(); assertThat(registrar.getType()).isEqualTo(Registrar.Type.OTE); assertThat(registrar.getState()).isEqualTo(Registrar.State.ACTIVE); assertThat(registrar.getAllowedTlds()).containsExactly(tld); } - private void assertContactExists(String clientId, String email) { - Registrar registrar = Registrar.loadByClientId(clientId).get(); + private void assertContactExists(String registrarId, String email) { + Registrar registrar = Registrar.loadByRegistrarId(registrarId).get(); assertThat(registrar.getContacts().stream().map(RegistrarContact::getEmailAddress)) .contains(email); RegistrarContact contact = @@ -106,7 +106,9 @@ public final class OteAccountBuilderTest { @TestOfyAndSql void testCreateOteEntities_success() { - OteAccountBuilder.forClientId("myclientid").addContact("email@example.com").buildAndPersist(); + OteAccountBuilder.forRegistrarId("myclientid") + .addContact("email@example.com") + .buildAndPersist(); assertTldExists("myclientid-sunrise", START_DATE_SUNRISE, Money.zero(USD)); assertTldExists("myclientid-ga", GENERAL_AVAILABILITY, Money.zero(USD)); @@ -123,7 +125,7 @@ public final class OteAccountBuilderTest { @TestOfyAndSql void testCreateOteEntities_multipleContacts_success() { - OteAccountBuilder.forClientId("myclientid") + OteAccountBuilder.forRegistrarId("myclientid") .addContact("email@example.com") .addContact("other@example.com") .addContact("someone@example.com") @@ -152,39 +154,39 @@ public final class OteAccountBuilderTest { @TestOfyAndSql void testCreateOteEntities_setPassword() { - OteAccountBuilder.forClientId("myclientid").setPassword("myPassword").buildAndPersist(); + OteAccountBuilder.forRegistrarId("myclientid").setPassword("myPassword").buildAndPersist(); - assertThat(Registrar.loadByClientId("myclientid-3").get().verifyPassword("myPassword")) + assertThat(Registrar.loadByRegistrarId("myclientid-3").get().verifyPassword("myPassword")) .isTrue(); } @TestOfyAndSql void testCreateOteEntities_setCertificate() { - OteAccountBuilder.forClientId("myclientid") + OteAccountBuilder.forRegistrarId("myclientid") .setCertificate(SAMPLE_CERT, new SystemClock().nowUtc()) .buildAndPersist(); - assertThat(Registrar.loadByClientId("myclientid-3").get().getClientCertificateHash()) + assertThat(Registrar.loadByRegistrarId("myclientid-3").get().getClientCertificateHash()) .hasValue(SAMPLE_CERT_HASH); - assertThat(Registrar.loadByClientId("myclientid-3").get().getClientCertificate()) + assertThat(Registrar.loadByRegistrarId("myclientid-3").get().getClientCertificate()) .hasValue(SAMPLE_CERT); } @TestOfyAndSql void testCreateOteEntities_setIpAllowList() { - OteAccountBuilder.forClientId("myclientid") + OteAccountBuilder.forRegistrarId("myclientid") .setIpAllowList(ImmutableList.of("1.1.1.0/24")) .buildAndPersist(); - assertThat(Registrar.loadByClientId("myclientid-3").get().getIpAddressAllowList()) + assertThat(Registrar.loadByRegistrarId("myclientid-3").get().getIpAddressAllowList()) .containsExactly(CidrAddressBlock.create("1.1.1.0/24")); } @TestOfyAndSql - void testCreateOteEntities_invalidClientId_fails() { + void testCreateOteEntities_invalidRegistrarId_fails() { assertThat( assertThrows( - IllegalArgumentException.class, () -> OteAccountBuilder.forClientId("3blo-bio"))) + IllegalArgumentException.class, () -> OteAccountBuilder.forRegistrarId("3blo-bio"))) .hasMessageThat() .isEqualTo("Invalid registrar name: 3blo-bio"); } @@ -192,7 +194,8 @@ public final class OteAccountBuilderTest { @TestOfyAndSql void testCreateOteEntities_clientIdTooShort_fails() { assertThat( - assertThrows(IllegalArgumentException.class, () -> OteAccountBuilder.forClientId("bl"))) + assertThrows( + IllegalArgumentException.class, () -> OteAccountBuilder.forRegistrarId("bl"))) .hasMessageThat() .isEqualTo("Invalid registrar name: bl"); } @@ -202,7 +205,7 @@ public final class OteAccountBuilderTest { assertThat( assertThrows( IllegalArgumentException.class, - () -> OteAccountBuilder.forClientId("blobiotoooolong"))) + () -> OteAccountBuilder.forRegistrarId("blobiotoooolong"))) .hasMessageThat() .isEqualTo("Invalid registrar name: blobiotoooolong"); } @@ -211,16 +214,16 @@ public final class OteAccountBuilderTest { void testCreateOteEntities_clientIdBadCharacter_fails() { assertThat( assertThrows( - IllegalArgumentException.class, () -> OteAccountBuilder.forClientId("blo#bio"))) + IllegalArgumentException.class, () -> OteAccountBuilder.forRegistrarId("blo#bio"))) .hasMessageThat() .isEqualTo("Invalid registrar name: blo#bio"); } @TestOfyAndSql void testCreateOteEntities_registrarExists_failsWhenNotReplaceExisting() { - persistSimpleResource(makeRegistrar1().asBuilder().setClientId("myclientid-1").build()); + persistSimpleResource(makeRegistrar1().asBuilder().setRegistrarId("myclientid-1").build()); - OteAccountBuilder oteSetupHelper = OteAccountBuilder.forClientId("myclientid"); + OteAccountBuilder oteSetupHelper = OteAccountBuilder.forRegistrarId("myclientid"); assertThat(assertThrows(IllegalStateException.class, () -> oteSetupHelper.buildAndPersist())) .hasMessageThat() @@ -231,7 +234,7 @@ public final class OteAccountBuilderTest { void testCreateOteEntities_tldExists_failsWhenNotReplaceExisting() { createTld("myclientid-ga", START_DATE_SUNRISE); - OteAccountBuilder oteSetupHelper = OteAccountBuilder.forClientId("myclientid"); + OteAccountBuilder oteSetupHelper = OteAccountBuilder.forRegistrarId("myclientid"); assertThat(assertThrows(IllegalStateException.class, () -> oteSetupHelper.buildAndPersist())) .hasMessageThat() @@ -240,11 +243,11 @@ public final class OteAccountBuilderTest { @TestOfyAndSql void testCreateOteEntities_entitiesExist_succeedsWhenReplaceExisting() { - persistSimpleResource(makeRegistrar1().asBuilder().setClientId("myclientid-1").build()); + persistSimpleResource(makeRegistrar1().asBuilder().setRegistrarId("myclientid-1").build()); // we intentionally create the -ga TLD with the wrong state, to make sure it's overwritten. createTld("myclientid-ga", START_DATE_SUNRISE); - OteAccountBuilder.forClientId("myclientid").setReplaceExisting(true).buildAndPersist(); + OteAccountBuilder.forRegistrarId("myclientid").setReplaceExisting(true).buildAndPersist(); // Just checking a sample of the resulting entities to make sure it indeed succeeded. The full // entities are checked in other tests @@ -255,33 +258,35 @@ public final class OteAccountBuilderTest { @TestOfyAndSql void testCreateOteEntities_doubleCreation_actuallyReplaces() { - OteAccountBuilder.forClientId("myclientid") + OteAccountBuilder.forRegistrarId("myclientid") .setPassword("oldPassword") .addContact("email@example.com") .buildAndPersist(); - assertThat(Registrar.loadByClientId("myclientid-3").get().verifyPassword("oldPassword")) + assertThat(Registrar.loadByRegistrarId("myclientid-3").get().verifyPassword("oldPassword")) .isTrue(); - OteAccountBuilder.forClientId("myclientid") + OteAccountBuilder.forRegistrarId("myclientid") .setPassword("newPassword") .addContact("email@example.com") .setReplaceExisting(true) .buildAndPersist(); - assertThat(Registrar.loadByClientId("myclientid-3").get().verifyPassword("oldPassword")) + assertThat(Registrar.loadByRegistrarId("myclientid-3").get().verifyPassword("oldPassword")) .isFalse(); - assertThat(Registrar.loadByClientId("myclientid-3").get().verifyPassword("newPassword")) + assertThat(Registrar.loadByRegistrarId("myclientid-3").get().verifyPassword("newPassword")) .isTrue(); } @TestOfyAndSql void testCreateOteEntities_doubleCreation_keepsOldContacts() { - OteAccountBuilder.forClientId("myclientid").addContact("email@example.com").buildAndPersist(); + OteAccountBuilder.forRegistrarId("myclientid") + .addContact("email@example.com") + .buildAndPersist(); assertContactExists("myclientid-3", "email@example.com"); - OteAccountBuilder.forClientId("myclientid") + OteAccountBuilder.forRegistrarId("myclientid") .addContact("other@example.com") .setReplaceExisting(true) .buildAndPersist(); @@ -291,8 +296,8 @@ public final class OteAccountBuilderTest { } @TestOfyAndSql - void testCreateClientIdToTldMap_validEntries() { - assertThat(OteAccountBuilder.createClientIdToTldMap("myclientid")) + void testCreateRegistrarIdToTldMap_validEntries() { + assertThat(OteAccountBuilder.createRegistrarIdToTldMap("myclientid")) .containsExactly( "myclientid-1", "myclientid-sunrise", "myclientid-3", "myclientid-ga", @@ -301,35 +306,35 @@ public final class OteAccountBuilderTest { } @TestOfyAndSql - void testCreateClientIdToTldMap_invalidId() { + void testCreateRegistrarIdToTldMap_invalidId() { IllegalArgumentException exception = assertThrows( - IllegalArgumentException.class, () -> OteAccountBuilder.createClientIdToTldMap("a")); + IllegalArgumentException.class, () -> OteAccountBuilder.createRegistrarIdToTldMap("a")); assertThat(exception).hasMessageThat().isEqualTo("Invalid registrar name: a"); } @TestOfyAndSql - void testGetBaseClientId_validOteId() { - assertThat(OteAccountBuilder.getBaseClientId("myclientid-4")).isEqualTo("myclientid"); + void testGetBaseRegistrarId_validOteId() { + assertThat(OteAccountBuilder.getBaseRegistrarId("myclientid-4")).isEqualTo("myclientid"); } @TestOfyAndSql - void testGetBaseClientId_invalidInput_malformed() { + void testGetBaseRegistrarId_invalidInput_malformed() { assertThat( assertThrows( IllegalArgumentException.class, - () -> OteAccountBuilder.getBaseClientId("myclientid"))) + () -> OteAccountBuilder.getBaseRegistrarId("myclientid"))) .hasMessageThat() - .isEqualTo("Invalid OT&E client ID: myclientid"); + .isEqualTo("Invalid OT&E registrar ID: myclientid"); } @TestOfyAndSql - void testGetBaseClientId_invalidInput_wrongForBase() { + void testGetBaseRegistrarId_invalidInput_wrongForBase() { assertThat( assertThrows( IllegalArgumentException.class, - () -> OteAccountBuilder.getBaseClientId("myclientid-7"))) + () -> OteAccountBuilder.getBaseRegistrarId("myclientid-7"))) .hasMessageThat() - .isEqualTo("ID myclientid-7 is not one of the OT&E client IDs for base myclientid"); + .isEqualTo("ID myclientid-7 is not one of the OT&E registrar IDs for base myclientid"); } } diff --git a/core/src/test/java/google/registry/model/OteStatsTestHelper.java b/core/src/test/java/google/registry/model/OteStatsTestHelper.java index 8876a2354..85ece590f 100644 --- a/core/src/test/java/google/registry/model/OteStatsTestHelper.java +++ b/core/src/test/java/google/registry/model/OteStatsTestHelper.java @@ -42,7 +42,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("xn--abc-873b2e7eb1k8a4lpjvv.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_CREATE) .setXmlBytes(getBytes("domain_create_idn.xml")) .setModificationTime(now) @@ -50,7 +50,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_RESTORE) .setXmlBytes(getBytes("domain_restore.xml")) .setModificationTime(now) @@ -58,7 +58,7 @@ public final class OteStatsTestHelper { persistResource( new HostHistory.Builder() .setHostRepoId(persistDeletedHost("ns1.example.tld", now).getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.HOST_DELETE) .setXmlBytes(getBytes("host_delete.xml")) .setModificationTime(now) @@ -79,13 +79,15 @@ public final class OteStatsTestHelper { public static void setupIncompleteOte(String baseClientId) throws IOException { createTld("tld"); persistPremiumList("default_sandbox_list", USD, "sandbox,USD 1000"); - OteAccountBuilder.forClientId(baseClientId).addContact("email@example.com").buildAndPersist(); + OteAccountBuilder.forRegistrarId(baseClientId) + .addContact("email@example.com") + .buildAndPersist(); String oteAccount1 = String.format("%s-1", baseClientId); DateTime now = DateTime.now(DateTimeZone.UTC); persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("exampleone.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_CREATE) .setXmlBytes(getBytes("domain_create_sunrise.xml")) .setModificationTime(now) @@ -93,7 +95,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example-one.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_CREATE) .setXmlBytes(getBytes("domain_create_claim_notice.xml")) .setModificationTime(now) @@ -101,7 +103,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_CREATE) .setXmlBytes(getBytes("domain_create_anchor_tenant_fee_standard.xml")) .setModificationTime(now) @@ -109,7 +111,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_CREATE) .setXmlBytes(getBytes("domain_create_dsdata.xml")) .setModificationTime(now) @@ -117,7 +119,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistDeletedDomain("example.tld", now).getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_DELETE) .setXmlBytes(getBytes("domain_delete.xml")) .setModificationTime(now) @@ -125,7 +127,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_TRANSFER_APPROVE) .setXmlBytes(getBytes("domain_transfer_approve.xml")) .setModificationTime(now) @@ -133,7 +135,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_TRANSFER_CANCEL) .setXmlBytes(getBytes("domain_transfer_cancel.xml")) .setModificationTime(now) @@ -141,7 +143,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_TRANSFER_REJECT) .setXmlBytes(getBytes("domain_transfer_reject.xml")) .setModificationTime(now) @@ -149,7 +151,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_TRANSFER_REQUEST) .setXmlBytes(getBytes("domain_transfer_request.xml")) .setModificationTime(now) @@ -157,7 +159,7 @@ public final class OteStatsTestHelper { persistResource( new DomainHistory.Builder() .setDomainRepoId(persistActiveDomain("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.DOMAIN_UPDATE) .setXmlBytes(getBytes("domain_update_with_secdns.xml")) .setModificationTime(now) @@ -165,7 +167,7 @@ public final class OteStatsTestHelper { persistResource( new HostHistory.Builder() .setHostRepoId(persistActiveHost("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.HOST_CREATE) .setXmlBytes(getBytes("host_create_complete.xml")) .setModificationTime(now) @@ -177,7 +179,7 @@ public final class OteStatsTestHelper { persistResource( new HostHistory.Builder() .setHostRepoId(persistActiveHost("example.tld").getRepoId()) - .setClientId(oteAccount1) + .setRegistrarId(oteAccount1) .setType(Type.HOST_UPDATE) .setXmlBytes(getBytes("host_update.xml")) .setTrid(Trid.create(null, String.format("blahtrid-%d", i))) diff --git a/core/src/test/java/google/registry/model/billing/BillingEventTest.java b/core/src/test/java/google/registry/model/billing/BillingEventTest.java index 184bfa903..610224ffe 100644 --- a/core/src/test/java/google/registry/model/billing/BillingEventTest.java +++ b/core/src/test/java/google/registry/model/billing/BillingEventTest.java @@ -80,7 +80,7 @@ public class BillingEventTest extends EntityTestCase { .setDomain(domain) .setModificationTime(now) .setRequestedByRegistrar(false) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setType(HistoryEntry.Type.DOMAIN_CREATE) .setXmlBytes(new byte[0]) .build()); @@ -90,7 +90,7 @@ public class BillingEventTest extends EntityTestCase { .setDomain(domain) .setModificationTime(now.plusDays(1)) .setRequestedByRegistrar(false) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setType(HistoryEntry.Type.DOMAIN_CREATE) .setXmlBytes(new byte[0]) .build()); @@ -181,7 +181,7 @@ public class BillingEventTest extends EntityTestCase { } private > E commonInit(B builder) { - return builder.setClientId("TheRegistrar").setTargetId("foo.tld").build(); + return builder.setRegistrarId("TheRegistrar").setTargetId("foo.tld").build(); } @TestOfyAndSql diff --git a/core/src/test/java/google/registry/model/contact/ContactResourceTest.java b/core/src/test/java/google/registry/model/contact/ContactResourceTest.java index ec77e0ac0..12dd2e703 100644 --- a/core/src/test/java/google/registry/model/contact/ContactResourceTest.java +++ b/core/src/test/java/google/registry/model/contact/ContactResourceTest.java @@ -65,11 +65,11 @@ public class ContactResourceTest extends EntityTestCase { new ContactResource.Builder() .setContactId("contact_id") .setRepoId("1-FOOBAR") - .setCreationClientId("registrar1") + .setCreationRegistrarId("registrar1") .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId("registrar2") + .setLastEppUpdateRegistrarId("registrar2") .setLastTransferTime(fakeClock.nowUtc()) - .setPersistedCurrentSponsorClientId("registrar3") + .setPersistedCurrentSponsorRegistrarId("registrar3") .setLocalizedPostalInfo( new PostalInfo.Builder() .setType(Type.LOCALIZED) @@ -115,8 +115,8 @@ public class ContactResourceTest extends EntityTestCase { .setStatusValues(ImmutableSet.of(StatusValue.OK)) .setTransferData( new ContactTransferData.Builder() - .setGainingClientId("gaining") - .setLosingClientId("losing") + .setGainingRegistrarId("gaining") + .setLosingRegistrarId("losing") .setPendingTransferExpirationTime(fakeClock.nowUtc()) .setTransferRequestTime(fakeClock.nowUtc()) .setTransferStatus(TransferStatus.SERVER_APPROVED) @@ -258,13 +258,13 @@ public class ContactResourceTest extends EntityTestCase { .asBuilder() .setTransferStatus(TransferStatus.PENDING) .setPendingTransferExpirationTime(fakeClock.nowUtc().plusDays(1)) - .setGainingClientId("winner") + .setGainingRegistrarId("winner") .build()) .build() .cloneProjectedAtTime(fakeClock.nowUtc().plusDays(1)); assertThat(afterTransfer.getTransferData().getTransferStatus()) .isEqualTo(TransferStatus.SERVER_APPROVED); - assertThat(afterTransfer.getCurrentSponsorClientId()).isEqualTo("winner"); + assertThat(afterTransfer.getCurrentSponsorRegistrarId()).isEqualTo("winner"); assertThat(afterTransfer.getLastTransferTime()).isEqualTo(fakeClock.nowUtc().plusDays(1)); } diff --git a/core/src/test/java/google/registry/model/domain/DomainBaseSqlTest.java b/core/src/test/java/google/registry/model/domain/DomainBaseSqlTest.java index 0e1957818..f38eb6b50 100644 --- a/core/src/test/java/google/registry/model/domain/DomainBaseSqlTest.java +++ b/core/src/test/java/google/registry/model/domain/DomainBaseSqlTest.java @@ -97,9 +97,9 @@ public class DomainBaseSqlTest { new DomainBase.Builder() .setDomainName("example.com") .setRepoId("4-COM") - .setCreationClientId("registrar1") + .setCreationRegistrarId("registrar1") .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId("registrar2") + .setLastEppUpdateRegistrarId("registrar2") .setLastTransferTime(fakeClock.nowUtc()) .setNameservers(host1VKey) .setStatusValues( @@ -113,7 +113,7 @@ public class DomainBaseSqlTest { .setRegistrant(contactKey) .setContacts(ImmutableSet.of(DesignatedContact.create(Type.ADMIN, contact2Key))) .setSubordinateHosts(ImmutableSet.of("ns1.example.com")) - .setPersistedCurrentSponsorClientId("registrar3") + .setPersistedCurrentSponsorRegistrarId("registrar3") .setRegistrationExpirationTime(fakeClock.nowUtc().plusYears(1)) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password"))) .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) @@ -129,8 +129,8 @@ public class DomainBaseSqlTest { new HostResource.Builder() .setRepoId("host1") .setHostName("ns1.example.com") - .setCreationClientId("registrar1") - .setPersistedCurrentSponsorClientId("registrar2") + .setCreationRegistrarId("registrar1") + .setPersistedCurrentSponsorRegistrarId("registrar2") .build(); contact = makeContact("contact_id1"); contact2 = makeContact("contact_id2"); @@ -402,9 +402,9 @@ public class DomainBaseSqlTest { static ContactResource makeContact(String repoId) { return new ContactResource.Builder() .setRepoId(repoId) - .setCreationClientId("registrar1") + .setCreationRegistrarId("registrar1") .setTransferData(new ContactTransferData.Builder().build()) - .setPersistedCurrentSponsorClientId("registrar1") + .setPersistedCurrentSponsorRegistrarId("registrar1") .build(); } @@ -442,7 +442,7 @@ public class DomainBaseSqlTest { .setPeriod(Period.create(1, Period.Unit.YEARS)) .setModificationTime(DateTime.now(UTC)) .setDomainRepoId("4-COM") - .setClientId("registrar1") + .setRegistrarId("registrar1") // These are non-null, but I don't think some tests set them. .setReason("felt like it") .setRequestedByRegistrar(false) @@ -454,7 +454,7 @@ public class DomainBaseSqlTest { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId("example.com") - .setClientId("registrar1") + .setRegistrarId("registrar1") .setDomainRepoId("4-COM") .setDomainHistoryRevisionId(1L) .setEventTime(DateTime.now(UTC).plusYears(1)) @@ -464,14 +464,14 @@ public class DomainBaseSqlTest { PollMessage.Autorenew autorenewPollMessage = new PollMessage.Autorenew.Builder() .setId(300L) - .setClientId("registrar1") + .setRegistrarId("registrar1") .setEventTime(DateTime.now(UTC).plusYears(1)) .setParent(historyEntry) .build(); PollMessage.OneTime deletePollMessage = new PollMessage.OneTime.Builder() .setId(400L) - .setClientId("registrar1") + .setRegistrarId("registrar1") .setEventTime(DateTime.now(UTC).plusYears(1)) .setParent(historyEntry) .build(); @@ -481,7 +481,7 @@ public class DomainBaseSqlTest { // Use SERVER_STATUS so we don't have to add a period. .setReason(Reason.SERVER_STATUS) .setTargetId("example.com") - .setClientId("registrar1") + .setRegistrarId("registrar1") .setDomainRepoId("4-COM") .setBillingTime(DateTime.now(UTC)) .setCost(Money.of(USD, 100)) @@ -572,7 +572,7 @@ public class DomainBaseSqlTest { .setPeriod(Period.create(1, Period.Unit.YEARS)) .setModificationTime(DateTime.now(UTC)) .setDomainRepoId("4-COM") - .setClientId("registrar1") + .setRegistrarId("registrar1") // These are non-null, but I don't think some tests set them. .setReason("felt like it") .setRequestedByRegistrar(false) @@ -584,7 +584,7 @@ public class DomainBaseSqlTest { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId("example.com") - .setClientId("registrar1") + .setRegistrarId("registrar1") .setDomainRepoId("4-COM") .setDomainHistoryRevisionId(1L) .setEventTime(DateTime.now(UTC).plusYears(1)) @@ -594,14 +594,14 @@ public class DomainBaseSqlTest { PollMessage.Autorenew autorenewPollMessage = new PollMessage.Autorenew.Builder() .setId(300L) - .setClientId("registrar1") + .setRegistrarId("registrar1") .setEventTime(DateTime.now(UTC).plusYears(1)) .setParent(historyEntry) .build(); PollMessage.OneTime deletePollMessage = new PollMessage.OneTime.Builder() .setId(400L) - .setClientId("registrar1") + .setRegistrarId("registrar1") .setEventTime(DateTime.now(UTC).plusYears(1)) .setParent(historyEntry) .build(); @@ -611,7 +611,7 @@ public class DomainBaseSqlTest { // Use SERVER_STATUS so we don't have to add a period. .setReason(Reason.SERVER_STATUS) .setTargetId("example.com") - .setClientId("registrar1") + .setRegistrarId("registrar1") .setDomainRepoId("4-COM") .setBillingTime(DateTime.now(UTC)) .setCost(Money.of(USD, 100)) @@ -623,8 +623,8 @@ public class DomainBaseSqlTest { new DomainTransferData.Builder() .setTransferRequestTrid(Trid.create("foo", "bar")) .setTransferRequestTime(fakeClock.nowUtc()) - .setGainingClientId("registrar2") - .setLosingClientId("registrar1") + .setGainingRegistrarId("registrar2") + .setLosingRegistrarId("registrar1") .setPendingTransferExpirationTime(fakeClock.nowUtc().plusDays(1)), ImmutableSet.of(oneTimeBillingEvent, billEvent, autorenewPollMessage), Period.create(0, Unit.YEARS)); diff --git a/core/src/test/java/google/registry/model/domain/DomainBaseTest.java b/core/src/test/java/google/registry/model/domain/DomainBaseTest.java index 91b699d2f..ce371779a 100644 --- a/core/src/test/java/google/registry/model/domain/DomainBaseTest.java +++ b/core/src/test/java/google/registry/model/domain/DomainBaseTest.java @@ -109,7 +109,7 @@ public class DomainBaseTest extends EntityTestCase { .setDomainRepoId(domainKey.getOfyKey().getName()) .setModificationTime(fakeClock.nowUtc()) .setType(HistoryEntry.Type.DOMAIN_CREATE) - .setClientId("aregistrar") + .setRegistrarId("aregistrar") .build())); oneTimeBillKey = VKey.from(Key.create(historyEntryKey, BillingEvent.OneTime.class, 1)); recurringBillKey = VKey.from(Key.create(historyEntryKey, BillingEvent.Recurring.class, 2)); @@ -124,9 +124,9 @@ public class DomainBaseTest extends EntityTestCase { new DomainBase.Builder() .setDomainName("example.com") .setRepoId("4-COM") - .setCreationClientId("aregistrar") + .setCreationRegistrarId("aregistrar") .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId("AnotherRegistrar") + .setLastEppUpdateRegistrarId("AnotherRegistrar") .setLastTransferTime(fakeClock.nowUtc()) .setStatusValues( ImmutableSet.of( @@ -140,7 +140,7 @@ public class DomainBaseTest extends EntityTestCase { .setContacts(ImmutableSet.of(DesignatedContact.create(Type.ADMIN, contact2Key))) .setNameservers(ImmutableSet.of(hostKey)) .setSubordinateHosts(ImmutableSet.of("ns1.example.com")) - .setPersistedCurrentSponsorClientId("losing") + .setPersistedCurrentSponsorRegistrarId("losing") .setRegistrationExpirationTime(fakeClock.nowUtc().plusYears(1)) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password"))) .setDsData( @@ -149,8 +149,8 @@ public class DomainBaseTest extends EntityTestCase { LaunchNotice.create("tcnid", "validatorId", START_OF_TIME, START_OF_TIME)) .setTransferData( new DomainTransferData.Builder() - .setGainingClientId("gaining") - .setLosingClientId("losing") + .setGainingRegistrarId("gaining") + .setLosingRegistrarId("losing") .setPendingTransferExpirationTime(fakeClock.nowUtc()) .setServerApproveEntities( ImmutableSet.of(oneTimeBillKey, recurringBillKey, autorenewPollKey)) @@ -224,23 +224,23 @@ public class DomainBaseTest extends EntityTestCase { assertThat( newDomainBase("example.com") .asBuilder() - .setPersistedCurrentSponsorClientId(null) + .setPersistedCurrentSponsorRegistrarId(null) .build() - .getCurrentSponsorClientId()) + .getCurrentSponsorRegistrarId()) .isNull(); assertThat( newDomainBase("example.com") .asBuilder() - .setPersistedCurrentSponsorClientId("") + .setPersistedCurrentSponsorRegistrarId("") .build() - .getCurrentSponsorClientId()) + .getCurrentSponsorRegistrarId()) .isNull(); assertThat( newDomainBase("example.com") .asBuilder() - .setPersistedCurrentSponsorClientId(" ") + .setPersistedCurrentSponsorRegistrarId(" ") .build() - .getCurrentSponsorClientId()) + .getCurrentSponsorRegistrarId()) .isNotNull(); } @@ -369,7 +369,7 @@ public class DomainBaseTest extends EntityTestCase { VKey newAutorenewEvent) { assertThat(domain.getTransferData().getTransferStatus()) .isEqualTo(TransferStatus.SERVER_APPROVED); - assertThat(domain.getCurrentSponsorClientId()).isEqualTo("winner"); + assertThat(domain.getCurrentSponsorRegistrarId()).isEqualTo("winner"); assertThat(domain.getLastTransferTime()).isEqualTo(fakeClock.nowUtc().plusDays(1)); assertThat(domain.getRegistrationExpirationTime()).isEqualTo(newExpirationTime); assertThat(domain.getAutorenewBillingEvent()).isEqualTo(newAutorenewEvent); @@ -380,14 +380,14 @@ public class DomainBaseTest extends EntityTestCase { new DomainHistory.Builder() .setDomain(domain) .setModificationTime(fakeClock.nowUtc()) - .setClientId(domain.getCurrentSponsorClientId()) + .setRegistrarId(domain.getCurrentSponsorRegistrarId()) .setType(HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST) .build(); BillingEvent.OneTime transferBillingEvent = persistResource( new BillingEvent.OneTime.Builder() .setReason(Reason.TRANSFER) - .setClientId("winner") + .setRegistrarId("winner") .setTargetId("example.com") .setEventTime(fakeClock.nowUtc()) .setBillingTime( @@ -410,7 +410,7 @@ public class DomainBaseTest extends EntityTestCase { .setTransferStatus(TransferStatus.PENDING) .setTransferRequestTime(fakeClock.nowUtc().minusDays(4)) .setPendingTransferExpirationTime(fakeClock.nowUtc().plusDays(1)) - .setGainingClientId("winner") + .setGainingRegistrarId("winner") .setServerApproveBillingEvent(transferBillingEvent.createVKey()) .setServerApproveEntities(ImmutableSet.of(transferBillingEvent.createVKey())) .build()) @@ -480,7 +480,7 @@ public class DomainBaseTest extends EntityTestCase { .setPendingTransferExpirationTime(transferSuccessTime) .build()) .setLastEppUpdateTime(transferRequestTime) - .setLastEppUpdateClientId(domain.getTransferData().getGainingClientId()) + .setLastEppUpdateRegistrarId(domain.getTransferData().getGainingRegistrarId()) .build(); } @@ -494,13 +494,13 @@ public class DomainBaseTest extends EntityTestCase { DomainBase beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); assertThat(beforeAutoRenew.getLastEppUpdateTime()).isEqualTo(transferRequestDateTime); - assertThat(beforeAutoRenew.getLastEppUpdateClientId()).isEqualTo("gaining"); + assertThat(beforeAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("gaining"); // If autorenew happens before transfer succeeds(before transfer grace period starts as well), // lastEppUpdateClientId should still be the current sponsor client id DomainBase afterAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.plusDays(1)); assertThat(afterAutoRenew.getLastEppUpdateTime()).isEqualTo(autorenewDateTime); - assertThat(afterAutoRenew.getLastEppUpdateClientId()).isEqualTo("losing"); + assertThat(afterAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("losing"); } @Test @@ -513,12 +513,12 @@ public class DomainBaseTest extends EntityTestCase { DomainBase beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); assertThat(beforeAutoRenew.getLastEppUpdateTime()).isEqualTo(transferRequestDateTime); - assertThat(beforeAutoRenew.getLastEppUpdateClientId()).isEqualTo("gaining"); + assertThat(beforeAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("gaining"); DomainBase afterTransferSuccess = domain.cloneProjectedAtTime(transferSuccessDateTime.plusDays(1)); assertThat(afterTransferSuccess.getLastEppUpdateTime()).isEqualTo(transferSuccessDateTime); - assertThat(afterTransferSuccess.getLastEppUpdateClientId()).isEqualTo("gaining"); + assertThat(afterTransferSuccess.getLastEppUpdateRegistrarId()).isEqualTo("gaining"); } private void setupUnmodifiedDomain(DateTime oldExpirationTime) { @@ -529,7 +529,7 @@ public class DomainBaseTest extends EntityTestCase { .setTransferData(DomainTransferData.EMPTY) .setGracePeriods(ImmutableSet.of()) .setLastEppUpdateTime(null) - .setLastEppUpdateClientId(null) + .setLastEppUpdateRegistrarId(null) .build(); } @@ -541,11 +541,11 @@ public class DomainBaseTest extends EntityTestCase { DomainBase beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); assertThat(beforeAutoRenew.getLastEppUpdateTime()).isEqualTo(null); - assertThat(beforeAutoRenew.getLastEppUpdateClientId()).isEqualTo(null); + assertThat(beforeAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo(null); DomainBase afterAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.plusDays(1)); assertThat(afterAutoRenew.getLastEppUpdateTime()).isEqualTo(autorenewDateTime); - assertThat(afterAutoRenew.getLastEppUpdateClientId()).isEqualTo("losing"); + assertThat(afterAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("losing"); } @Test @@ -679,7 +679,7 @@ public class DomainBaseTest extends EntityTestCase { oldExpirationTime .plusYears(2) .plus(Registry.get("com").getAutoRenewGracePeriodLength()), - renewedThreeTimes.getCurrentSponsorClientId(), + renewedThreeTimes.getCurrentSponsorRegistrarId(), renewedThreeTimes.autorenewBillingEvent, renewedThreeTimes.getGracePeriods().iterator().next().getGracePeriodId())); } @@ -751,7 +751,7 @@ public class DomainBaseTest extends EntityTestCase { new DomainTransferData.Builder() .setPendingTransferExpirationTime(transferExpirationTime) .setTransferStatus(TransferStatus.PENDING) - .setGainingClientId("TheRegistrar") + .setGainingRegistrarId("TheRegistrar") .build(); Period extensionPeriod = transferData.getTransferPeriod(); DateTime newExpiration = previousExpiration.plusYears(extensionPeriod.getValue()); @@ -779,7 +779,7 @@ public class DomainBaseTest extends EntityTestCase { new DomainTransferData.Builder() .setPendingTransferExpirationTime(transferExpirationTime) .setTransferStatus(TransferStatus.PENDING) - .setGainingClientId("TheRegistrar") + .setGainingRegistrarId("TheRegistrar") .build(); Period extensionPeriod = transferData.getTransferPeriod(); DateTime newExpiration = previousExpiration.plusYears(extensionPeriod.getValue()); @@ -806,7 +806,7 @@ public class DomainBaseTest extends EntityTestCase { new DomainTransferData.Builder() .setPendingTransferExpirationTime(transferExpirationTime) .setTransferStatus(TransferStatus.PENDING) - .setGainingClientId("TheRegistrar") + .setGainingRegistrarId("TheRegistrar") .build(); domain = persistResource( @@ -832,7 +832,7 @@ public class DomainBaseTest extends EntityTestCase { new DomainTransferData.Builder() .setPendingTransferExpirationTime(transferExpirationTime) .setTransferStatus(TransferStatus.PENDING) - .setGainingClientId("TheRegistrar") + .setGainingRegistrarId("TheRegistrar") .setServerApproveAutorenewEvent(recurringBillKey) .setServerApproveBillingEvent(oneTimeBillKey) .build(); diff --git a/core/src/test/java/google/registry/model/domain/GracePeriodTest.java b/core/src/test/java/google/registry/model/domain/GracePeriodTest.java index 1c08c1e68..b58e6aaae 100644 --- a/core/src/test/java/google/registry/model/domain/GracePeriodTest.java +++ b/core/src/test/java/google/registry/model/domain/GracePeriodTest.java @@ -52,7 +52,7 @@ public class GracePeriodTest { new BillingEvent.OneTime.Builder() .setEventTime(now) .setBillingTime(now.plusDays(1)) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setCost(Money.of(CurrencyUnit.USD, 42)) .setParent( Key.create(Key.create(DomainBase.class, "domain"), DomainHistory.class, 12345)) @@ -77,7 +77,7 @@ public class GracePeriodTest { assertThat(gracePeriod.getDomainRepoId()).isEqualTo("1-TEST"); assertThat(gracePeriod.getOneTimeBillingEvent()).isEqualTo(onetime.createVKey()); assertThat(gracePeriod.getRecurringBillingEvent()).isNull(); - assertThat(gracePeriod.getClientId()).isEqualTo("TheRegistrar"); + assertThat(gracePeriod.getRegistrarId()).isEqualTo("TheRegistrar"); assertThat(gracePeriod.getExpirationTime()).isEqualTo(now.plusDays(1)); assertThat(gracePeriod.hasBillingEvent()).isTrue(); } @@ -91,7 +91,7 @@ public class GracePeriodTest { assertThat(gracePeriod.getDomainRepoId()).isEqualTo("1-TEST"); assertThat(gracePeriod.getOneTimeBillingEvent()).isNull(); assertThat(gracePeriod.getRecurringBillingEvent()).isEqualTo(recurringKey); - assertThat(gracePeriod.getClientId()).isEqualTo("TheRegistrar"); + assertThat(gracePeriod.getRegistrarId()).isEqualTo("TheRegistrar"); assertThat(gracePeriod.getExpirationTime()).isEqualTo(now.plusDays(1)); assertThat(gracePeriod.hasBillingEvent()).isTrue(); } @@ -105,7 +105,7 @@ public class GracePeriodTest { assertThat(gracePeriod.getDomainRepoId()).isEqualTo("1-TEST"); assertThat(gracePeriod.getOneTimeBillingEvent()).isNull(); assertThat(gracePeriod.getRecurringBillingEvent()).isNull(); - assertThat(gracePeriod.getClientId()).isEqualTo("TheRegistrar"); + assertThat(gracePeriod.getRegistrarId()).isEqualTo("TheRegistrar"); assertThat(gracePeriod.getExpirationTime()).isEqualTo(now); assertThat(gracePeriod.hasBillingEvent()).isFalse(); } diff --git a/core/src/test/java/google/registry/model/history/ContactHistoryTest.java b/core/src/test/java/google/registry/model/history/ContactHistoryTest.java index 82a75b695..e3555aa5f 100644 --- a/core/src/test/java/google/registry/model/history/ContactHistoryTest.java +++ b/core/src/test/java/google/registry/model/history/ContactHistoryTest.java @@ -113,7 +113,7 @@ public class ContactHistoryTest extends EntityTestCase { .setType(HistoryEntry.Type.HOST_CREATE) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") @@ -140,7 +140,7 @@ public class ContactHistoryTest extends EntityTestCase { .setType(HistoryEntry.Type.HOST_CREATE) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") diff --git a/core/src/test/java/google/registry/model/history/DomainHistoryTest.java b/core/src/test/java/google/registry/model/history/DomainHistoryTest.java index a9ef90ddd..8c52e9769 100644 --- a/core/src/test/java/google/registry/model/history/DomainHistoryTest.java +++ b/core/src/test/java/google/registry/model/history/DomainHistoryTest.java @@ -200,13 +200,13 @@ public class DomainHistoryTest extends EntityTestCase { .setType(HistoryEntry.Type.DOMAIN_CREATE) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") .setRequestedByRegistrar(true) .setDomainRepoId(domain.getRepoId()) - .setOtherClientId("otherClient") + .setOtherRegistrarId("otherClient") .setPeriod(Period.create(1, Period.Unit.YEARS)) .build(); jpaTm() @@ -216,7 +216,7 @@ public class DomainHistoryTest extends EntityTestCase { .put( domain .asBuilder() - .setPersistedCurrentSponsorClientId("NewRegistrar") + .setPersistedCurrentSponsorRegistrarId("NewRegistrar") .build()); historyWithoutResource.beforeSqlSaveOnReplay(); jpaTm().put(historyWithoutResource); @@ -290,7 +290,7 @@ public class DomainHistoryTest extends EntityTestCase { .setType(HistoryEntry.Type.DOMAIN_CREATE) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") @@ -298,7 +298,7 @@ public class DomainHistoryTest extends EntityTestCase { .setDomain(domain) .setDomainRepoId(domain.getRepoId()) .setDomainTransactionRecords(ImmutableSet.of(transactionRecord)) - .setOtherClientId("otherClient") + .setOtherRegistrarId("otherClient") .setPeriod(Period.create(1, Period.Unit.YEARS)) .build(); } diff --git a/core/src/test/java/google/registry/model/history/HostHistoryTest.java b/core/src/test/java/google/registry/model/history/HostHistoryTest.java index 70cc8cd4c..d60b6ed90 100644 --- a/core/src/test/java/google/registry/model/history/HostHistoryTest.java +++ b/core/src/test/java/google/registry/model/history/HostHistoryTest.java @@ -113,7 +113,7 @@ public class HostHistoryTest extends EntityTestCase { .setType(HistoryEntry.Type.HOST_CREATE) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") @@ -147,7 +147,7 @@ public class HostHistoryTest extends EntityTestCase { .setType(HistoryEntry.Type.HOST_CREATE) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") diff --git a/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java b/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java index 4f5254fec..264278fdc 100644 --- a/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java +++ b/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java @@ -195,7 +195,7 @@ public class LegacyHistoryObjectTest extends EntityTestCase { return historyEntryBuilderFor(domain) .setPeriod(Period.create(1, Period.Unit.YEARS)) .setDomainTransactionRecords(ImmutableSet.of(transactionRecord)) - .setOtherClientId("TheRegistrar") + .setOtherRegistrarId("TheRegistrar") .build(); } @@ -204,7 +204,7 @@ public class LegacyHistoryObjectTest extends EntityTestCase { .setType(HistoryEntry.Type.DOMAIN_CREATE) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") diff --git a/core/src/test/java/google/registry/model/host/HostResourceTest.java b/core/src/test/java/google/registry/model/host/HostResourceTest.java index 1a6e7d056..eee2ed4e0 100644 --- a/core/src/test/java/google/registry/model/host/HostResourceTest.java +++ b/core/src/test/java/google/registry/model/host/HostResourceTest.java @@ -71,8 +71,8 @@ class HostResourceTest extends EntityTestCase { .setRepoId("1-COM") .setTransferData( new DomainTransferData.Builder() - .setGainingClientId("gaining") - .setLosingClientId("losing") + .setGainingRegistrarId("gaining") + .setLosingRegistrarId("losing") .setPendingTransferExpirationTime(fakeClock.nowUtc()) .setTransferRequestTime(fakeClock.nowUtc()) .setTransferStatus(TransferStatus.SERVER_APPROVED) @@ -85,9 +85,9 @@ class HostResourceTest extends EntityTestCase { new HostResource.Builder() .setRepoId("DEADBEEF-COM") .setHostName("ns1.example.com") - .setCreationClientId("thisRegistrar") + .setCreationRegistrarId("thisRegistrar") .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId("thatRegistrar") + .setLastEppUpdateRegistrarId("thatRegistrar") .setLastTransferTime(fakeClock.nowUtc()) .setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1"))) .setStatusValues(ImmutableSet.of(StatusValue.OK)) @@ -134,21 +134,21 @@ class HostResourceTest extends EntityTestCase { void testEmptyStringsBecomeNull() { assertThat( new HostResource.Builder() - .setPersistedCurrentSponsorClientId(null) + .setPersistedCurrentSponsorRegistrarId(null) .build() - .getPersistedCurrentSponsorClientId()) + .getPersistedCurrentSponsorRegistrarId()) .isNull(); assertThat( new HostResource.Builder() - .setPersistedCurrentSponsorClientId("") + .setPersistedCurrentSponsorRegistrarId("") .build() - .getPersistedCurrentSponsorClientId()) + .getPersistedCurrentSponsorRegistrarId()) .isNull(); assertThat( new HostResource.Builder() - .setPersistedCurrentSponsorClientId(" ") + .setPersistedCurrentSponsorRegistrarId(" ") .build() - .getPersistedCurrentSponsorClientId()) + .getPersistedCurrentSponsorRegistrarId()) .isNotNull(); } @@ -247,9 +247,9 @@ class HostResourceTest extends EntityTestCase { .setCreationTime(day2) .setRepoId("DEADBEEF-COM") .setHostName("ns1.example.com") - .setCreationClientId("thisRegistrar") + .setCreationRegistrarId("thisRegistrar") .setLastEppUpdateTime(fakeClock.nowUtc()) - .setLastEppUpdateClientId("thatRegistrar") + .setLastEppUpdateRegistrarId("thatRegistrar") .setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1"))) .setStatusValues(ImmutableSet.of(StatusValue.OK)) .setSuperordinateDomain(domain.createVKey()) diff --git a/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java b/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java index b4b4c21e2..b7b15ba6c 100644 --- a/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java +++ b/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java @@ -211,7 +211,10 @@ class ForeignKeyIndexTest extends EntityTestCase { .containsExactly("ns1.example.com", originalFki); HostResource modifiedHost = persistResource( - originalHost.asBuilder().setPersistedCurrentSponsorClientId("OtherRegistrar").build()); + originalHost + .asBuilder() + .setPersistedCurrentSponsorRegistrarId("OtherRegistrar") + .build()); fakeClock.advanceOneMilli(); ForeignKeyIndex newFki = loadHostFki("ns1.example.com"); assertThat(newFki).isNotEqualTo(originalFki); diff --git a/core/src/test/java/google/registry/model/ofy/OfyTest.java b/core/src/test/java/google/registry/model/ofy/OfyTest.java index f8f6c1621..0b5c75bf1 100644 --- a/core/src/test/java/google/registry/model/ofy/OfyTest.java +++ b/core/src/test/java/google/registry/model/ofy/OfyTest.java @@ -76,7 +76,7 @@ public class OfyTest { createTld("tld"); someObject = new ContactHistory.Builder() - .setClientId("clientid") + .setRegistrarId("clientid") .setModificationTime(START_OF_TIME) .setType(HistoryEntry.Type.CONTACT_CREATE) .setContact(persistActiveContact("parentContact")) diff --git a/core/src/test/java/google/registry/model/poll/PollMessageExternalKeyConverterTest.java b/core/src/test/java/google/registry/model/poll/PollMessageExternalKeyConverterTest.java index 3b9faa9dd..615a35cc2 100644 --- a/core/src/test/java/google/registry/model/poll/PollMessageExternalKeyConverterTest.java +++ b/core/src/test/java/google/registry/model/poll/PollMessageExternalKeyConverterTest.java @@ -67,7 +67,7 @@ public class PollMessageExternalKeyConverterTest { .setPeriod(Period.create(1, Period.Unit.YEARS)) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(clock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") @@ -80,7 +80,7 @@ public class PollMessageExternalKeyConverterTest { PollMessage.OneTime pollMessage = persistResource( new PollMessage.OneTime.Builder() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(clock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) @@ -97,7 +97,7 @@ public class PollMessageExternalKeyConverterTest { PollMessage.OneTime pollMessage = persistResource( new PollMessage.OneTime.Builder() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(clock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) @@ -114,7 +114,7 @@ public class PollMessageExternalKeyConverterTest { PollMessage.OneTime pollMessage = persistResource( new PollMessage.OneTime.Builder() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(clock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) diff --git a/core/src/test/java/google/registry/model/poll/PollMessageTest.java b/core/src/test/java/google/registry/model/poll/PollMessageTest.java index 58662948c..e6dcd927b 100644 --- a/core/src/test/java/google/registry/model/poll/PollMessageTest.java +++ b/core/src/test/java/google/registry/model/poll/PollMessageTest.java @@ -63,7 +63,7 @@ public class PollMessageTest extends EntityTestCase { .setPeriod(Period.create(1, Period.Unit.YEARS)) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") @@ -73,7 +73,7 @@ public class PollMessageTest extends EntityTestCase { oneTime = new PollMessage.OneTime.Builder() .setId(100L) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(fakeClock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) @@ -81,7 +81,7 @@ public class PollMessageTest extends EntityTestCase { autoRenew = new PollMessage.Autorenew.Builder() .setId(200L) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(fakeClock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) @@ -113,7 +113,7 @@ public class PollMessageTest extends EntityTestCase { PollMessage.OneTime pollMessage = persistResource( new PollMessage.OneTime.Builder() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(fakeClock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) @@ -126,7 +126,7 @@ public class PollMessageTest extends EntityTestCase { PollMessage.Autorenew pollMessage = persistResource( new PollMessage.Autorenew.Builder() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(fakeClock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) @@ -141,7 +141,7 @@ public class PollMessageTest extends EntityTestCase { PollMessage.Autorenew pollMessage = persistResource( new PollMessage.Autorenew.Builder() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(fakeClock.nowUtc()) .setMsg("Test poll message") .setParent(historyEntry) diff --git a/core/src/test/java/google/registry/model/registrar/RegistrarTest.java b/core/src/test/java/google/registry/model/registrar/RegistrarTest.java index 572ae48b6..94ad9b3de 100644 --- a/core/src/test/java/google/registry/model/registrar/RegistrarTest.java +++ b/core/src/test/java/google/registry/model/registrar/RegistrarTest.java @@ -63,7 +63,7 @@ class RegistrarTest extends EntityTestCase { registrar = cloneAndSetAutoTimestamps( new Registrar.Builder() - .setClientId("registrar") + .setRegistrarId("registrar") .setRegistrarName("full registrar name") .setType(Type.REAL) .setState(State.PENDING) @@ -167,22 +167,23 @@ class RegistrarTest extends EntityTestCase { @TestOfyAndSql void testSuccess_clientId_bounds() { - registrar = registrar.asBuilder().setClientId("abc").build(); - assertThat(registrar.getClientId()).isEqualTo("abc"); - registrar = registrar.asBuilder().setClientId("abcdefghijklmnop").build(); - assertThat(registrar.getClientId()).isEqualTo("abcdefghijklmnop"); + registrar = registrar.asBuilder().setRegistrarId("abc").build(); + assertThat(registrar.getRegistrarId()).isEqualTo("abc"); + registrar = registrar.asBuilder().setRegistrarId("abcdefghijklmnop").build(); + assertThat(registrar.getRegistrarId()).isEqualTo("abcdefghijklmnop"); } @TestOfyAndSql void testFailure_clientId_tooShort() { - assertThrows(IllegalArgumentException.class, () -> new Registrar.Builder().setClientId("ab")); + assertThrows( + IllegalArgumentException.class, () -> new Registrar.Builder().setRegistrarId("ab")); } @TestOfyAndSql void testFailure_clientId_tooLong() { assertThrows( IllegalArgumentException.class, - () -> new Registrar.Builder().setClientId("abcdefghijklmnopq")); + () -> new Registrar.Builder().setRegistrarId("abcdefghijklmnopq")); } @TestOfyAndSql @@ -329,7 +330,10 @@ class RegistrarTest extends EntityTestCase { assertThrows( IllegalArgumentException.class, () -> - new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build()); + new Registrar.Builder() + .setRegistrarId("blahid") + .setType(Registrar.Type.TEST) + .build()); assertThat(thrown).hasMessageThat().contains("Registrar name cannot be null"); } @@ -340,7 +344,7 @@ class RegistrarTest extends EntityTestCase { IllegalArgumentException.class, () -> new Registrar.Builder() - .setClientId("blahid") + .setRegistrarId("blahid") .setType(Registrar.Type.TEST) .setRegistrarName("Blah Co") .build()); @@ -625,7 +629,7 @@ class RegistrarTest extends EntityTestCase { void testLoadByClientIdCached_isTransactionless() { tm().transact( () -> { - assertThat(Registrar.loadByClientIdCached("registrar")).isPresent(); + assertThat(Registrar.loadByRegistrarIdCached("registrar")).isPresent(); // Load something as a control to make sure we are seeing loaded keys in the // session cache. auditedOfy().load().entity(abuseAdminContact).now(); @@ -634,35 +638,35 @@ class RegistrarTest extends EntityTestCase { }); tm().clearSessionCache(); // Conversely, loads outside of a transaction should end up in the session cache. - assertThat(Registrar.loadByClientIdCached("registrar")).isPresent(); + assertThat(Registrar.loadByRegistrarIdCached("registrar")).isPresent(); assertThat(auditedOfy().getSessionKeys()).contains(Key.create(registrar)); } @TestOfyAndSql void testFailure_loadByClientId_clientIdIsNull() { IllegalArgumentException thrown = - assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null)); - assertThat(thrown).hasMessageThat().contains("clientId must be specified"); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByRegistrarId(null)); + assertThat(thrown).hasMessageThat().contains("registrarId must be specified"); } @TestOfyAndSql void testFailure_loadByClientId_clientIdIsEmpty() { IllegalArgumentException thrown = - assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId("")); - assertThat(thrown).hasMessageThat().contains("clientId must be specified"); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByRegistrarId("")); + assertThat(thrown).hasMessageThat().contains("registrarId must be specified"); } @TestOfyAndSql void testFailure_loadByClientIdCached_clientIdIsNull() { IllegalArgumentException thrown = - assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null)); - assertThat(thrown).hasMessageThat().contains("clientId must be specified"); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByRegistrarIdCached(null)); + assertThat(thrown).hasMessageThat().contains("registrarId must be specified"); } @TestOfyAndSql void testFailure_loadByClientIdCached_clientIdIsEmpty() { IllegalArgumentException thrown = - assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached("")); - assertThat(thrown).hasMessageThat().contains("clientId must be specified"); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByRegistrarIdCached("")); + assertThat(thrown).hasMessageThat().contains("registrarId must be specified"); } } diff --git a/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java b/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java index d80b0647d..5dbacab08 100644 --- a/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java +++ b/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java @@ -63,8 +63,8 @@ class HistoryEntryDaoTest extends EntityTestCase { .setPeriod(Period.create(1, Period.Unit.YEARS)) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") - .setOtherClientId("otherClient") + .setRegistrarId("TheRegistrar") + .setOtherRegistrarId("otherClient") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") diff --git a/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java b/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java index b93e74d39..e161bc28c 100644 --- a/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java +++ b/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java @@ -64,8 +64,8 @@ class HistoryEntryTest extends EntityTestCase { .setPeriod(Period.create(1, Period.Unit.YEARS)) .setXmlBytes("".getBytes(UTF_8)) .setModificationTime(fakeClock.nowUtc()) - .setClientId("TheRegistrar") - .setOtherClientId("otherClient") + .setRegistrarId("TheRegistrar") + .setOtherRegistrarId("otherClient") .setTrid(Trid.create("ABC-123", "server-trid")) .setBySuperuser(false) .setReason("reason") @@ -100,7 +100,7 @@ class HistoryEntryTest extends EntityTestCase { new ContactHistory.Builder() .setId(5L) .setModificationTime(DateTime.parse("1985-07-12T22:30:00Z")) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setReason("Reason") .build()); assertThat(thrown).hasMessageThat().isEqualTo("History entry type must be specified"); @@ -115,7 +115,7 @@ class HistoryEntryTest extends EntityTestCase { new ContactHistory.Builder() .setId(5L) .setType(HistoryEntry.Type.CONTACT_CREATE) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setReason("Reason") .build()); assertThat(thrown).hasMessageThat().isEqualTo("Modification time must be specified"); @@ -146,7 +146,7 @@ class HistoryEntryTest extends EntityTestCase { .setId(5L) .setType(HistoryEntry.Type.SYNTHETIC) .setModificationTime(DateTime.parse("1985-07-12T22:30:00Z")) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setReason("Reason") .setRequestedByRegistrar(true) .build()); diff --git a/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java b/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java index 3a446f41f..2aad2f643 100644 --- a/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java +++ b/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java @@ -66,8 +66,8 @@ public final class Spec11ThreatMatchTest extends EntityTestCase { domain = new DomainBase() .asBuilder() - .setCreationClientId(REGISTRAR_ID) - .setPersistedCurrentSponsorClientId(REGISTRAR_ID) + .setCreationRegistrarId(REGISTRAR_ID) + .setPersistedCurrentSponsorRegistrarId(REGISTRAR_ID) .setDomainName("foo.tld") .setRepoId(domainRepoId) .setNameservers(hostVKey) @@ -79,9 +79,9 @@ public final class Spec11ThreatMatchTest extends EntityTestCase { registrantContact = new ContactResource.Builder() .setRepoId("contact_id") - .setCreationClientId(REGISTRAR_ID) + .setCreationRegistrarId(REGISTRAR_ID) .setTransferData(new ContactTransferData.Builder().build()) - .setPersistedCurrentSponsorClientId(REGISTRAR_ID) + .setPersistedCurrentSponsorRegistrarId(REGISTRAR_ID) .build(); /** Create a host for the purpose of testing a foreign key reference in the Domain table. */ @@ -89,8 +89,8 @@ public final class Spec11ThreatMatchTest extends EntityTestCase { new HostResource.Builder() .setRepoId("host") .setHostName("ns1.example.com") - .setCreationClientId(REGISTRAR_ID) - .setPersistedCurrentSponsorClientId(REGISTRAR_ID) + .setCreationRegistrarId(REGISTRAR_ID) + .setPersistedCurrentSponsorRegistrarId(REGISTRAR_ID) .build(); threat = diff --git a/core/src/test/java/google/registry/model/transfer/TransferDataTest.java b/core/src/test/java/google/registry/model/transfer/TransferDataTest.java index 294ee4e80..ad98ab324 100644 --- a/core/src/test/java/google/registry/model/transfer/TransferDataTest.java +++ b/core/src/test/java/google/registry/model/transfer/TransferDataTest.java @@ -84,8 +84,8 @@ public class TransferDataTest { new DomainTransferData.Builder() .setTransferRequestTrid(Trid.create("server-trid", "client-trid")) .setTransferRequestTime(now) - .setGainingClientId("NewRegistrar") - .setLosingClientId("TheRegistrar") + .setGainingRegistrarId("NewRegistrar") + .setLosingRegistrarId("TheRegistrar") // Test must use a non-1-year period, since that's the default value. .setTransferPeriod(Period.create(5, Period.Unit.YEARS)) .build(); diff --git a/core/src/test/java/google/registry/rdap/RdapActionBaseTestCase.java b/core/src/test/java/google/registry/rdap/RdapActionBaseTestCase.java index 4cae71a04..c2cd26dca 100644 --- a/core/src/test/java/google/registry/rdap/RdapActionBaseTestCase.java +++ b/core/src/test/java/google/registry/rdap/RdapActionBaseTestCase.java @@ -89,8 +89,8 @@ abstract class RdapActionBaseTestCase { logout(); } - protected void login(String clientId) { - action.rdapAuthorization = RdapAuthorization.create(REGISTRAR, clientId); + protected void login(String registrarId) { + action.rdapAuthorization = RdapAuthorization.create(REGISTRAR, registrarId); action.rdapJsonFormatter.rdapAuthorization = action.rdapAuthorization; metricRole = REGISTRAR; } diff --git a/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java b/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java index a601aee88..bc4c5d801 100644 --- a/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java +++ b/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java @@ -95,7 +95,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { registrarLol) .asBuilder() .setCreationTimeForTest(clock.nowUtc().minusYears(3)) - .setCreationClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") .build()); // deleted domain in lol @@ -128,7 +128,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { registrarLol) .asBuilder() .setCreationTimeForTest(clock.nowUtc().minusYears(3)) - .setCreationClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") .setDeletionTime(clock.nowUtc().minusDays(1)) .build()); // cat.みんな @@ -168,7 +168,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { registrarIdn) .asBuilder() .setCreationTimeForTest(clock.nowUtc().minusYears(3)) - .setCreationClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") .build()); // 1.tld @@ -208,7 +208,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { registrar1Tld) .asBuilder() .setCreationTimeForTest(clock.nowUtc().minusYears(3)) - .setCreationClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") .build()); // history entries diff --git a/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java b/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java index dfc845908..25c4553ee 100644 --- a/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java +++ b/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java @@ -180,7 +180,7 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase HostResourceToXjcConverter.convertExternalHost( new HostResource.Builder() - .setCreationClientId("LawyerCat") + .setCreationRegistrarId("LawyerCat") .setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z")) - .setPersistedCurrentSponsorClientId("BusinessCat") + .setPersistedCurrentSponsorRegistrarId("BusinessCat") .setHostName("ns1.love.lol") .setInetAddresses(ImmutableSet.of(InetAddresses.forString("cafe::abba"))) .setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z")) - .setLastEppUpdateClientId("CeilingCat") + .setLastEppUpdateRegistrarId("CeilingCat") .setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z")) .setRepoId("2-LOL") .setStatusValues(ImmutableSet.of(StatusValue.SERVER_HOLD)) // <-- OOPS @@ -213,13 +213,13 @@ public class HostResourceToXjcConverterTest { XjcRdeHostElement bean = HostResourceToXjcConverter.convertExternal( new HostResource.Builder() - .setCreationClientId("LawyerCat") + .setCreationRegistrarId("LawyerCat") .setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z")) - .setPersistedCurrentSponsorClientId("BusinessCat") + .setPersistedCurrentSponsorRegistrarId("BusinessCat") .setHostName("ns1.love.lol") .setInetAddresses(ImmutableSet.of(InetAddresses.forString("cafe::abba"))) .setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z")) - .setLastEppUpdateClientId("CeilingCat") + .setLastEppUpdateRegistrarId("CeilingCat") .setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z")) .setRepoId("2-LOL") .setStatusValues(ImmutableSet.of(StatusValue.OK)) diff --git a/core/src/test/java/google/registry/rde/RdeFixtures.java b/core/src/test/java/google/registry/rde/RdeFixtures.java index d87e0df2b..ecbaf206d 100644 --- a/core/src/test/java/google/registry/rde/RdeFixtures.java +++ b/core/src/test/java/google/registry/rde/RdeFixtures.java @@ -72,7 +72,7 @@ final class RdeFixtures { .setDomain(domain) .setType(HistoryEntry.Type.DOMAIN_CREATE) .setModificationTime(clock.nowUtc()) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .build()); clock.advanceOneMilli(); BillingEvent.OneTime billingEvent = @@ -80,7 +80,7 @@ final class RdeFixtures { new BillingEvent.OneTime.Builder() .setReason(Reason.CREATE) .setTargetId("example." + tld) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setCost(Money.of(USD, 26)) .setPeriodYears(2) .setEventTime(DateTime.parse("1990-01-01T00:00:00Z")) @@ -109,15 +109,15 @@ final class RdeFixtures { "bird or fiend!? i shrieked upstarting", "bog@cat.みんな") .createVKey()))) - .setCreationClientId("TheRegistrar") - .setPersistedCurrentSponsorClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .setCreationTimeForTest(clock.nowUtc()) .setDsData( ImmutableSet.of( DelegationSignerData.create(123, 200, 230, base16().decode("1234567890")))) .setDomainName(Idn.toASCII("love." + tld)) .setLastTransferTime(DateTime.parse("1990-01-01T00:00:00Z")) - .setLastEppUpdateClientId("IntoTheTempest") + .setLastEppUpdateRegistrarId("IntoTheTempest") .setLastEppUpdateTime(clock.nowUtc()) .setIdnTableName("extended_latin") .setNameservers( @@ -134,7 +134,7 @@ final class RdeFixtures { new BillingEvent.OneTime.Builder() .setReason(Reason.RENEW) .setTargetId("love." + tld) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setCost(Money.of(USD, 456)) .setPeriodYears(2) .setEventTime(DateTime.parse("1992-01-01T00:00:00Z")) @@ -160,7 +160,7 @@ final class RdeFixtures { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(tld) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(END_OF_TIME) .setRecurrenceEndTime(END_OF_TIME) .setParent(historyEntry) @@ -170,7 +170,7 @@ final class RdeFixtures { persistSimpleResource( new PollMessage.Autorenew.Builder() .setTargetId(tld) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(END_OF_TIME) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") @@ -179,8 +179,8 @@ final class RdeFixtures { .createVKey()) .setTransferData( new DomainTransferData.Builder() - .setGainingClientId("gaining") - .setLosingClientId("losing") + .setGainingRegistrarId("gaining") + .setLosingRegistrarId("losing") .setPendingTransferExpirationTime(DateTime.parse("1993-04-20T00:00:00Z")) .setServerApproveBillingEvent(billingEvent.createVKey()) .setServerApproveAutorenewEvent( @@ -189,7 +189,7 @@ final class RdeFixtures { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId("example." + tld) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(END_OF_TIME) .setRecurrenceEndTime(END_OF_TIME) .setParent(historyEntry) @@ -199,7 +199,7 @@ final class RdeFixtures { persistResource( new Autorenew.Builder() .setTargetId("example." + tld) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(END_OF_TIME) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") @@ -227,8 +227,8 @@ final class RdeFixtures { .setRepoId(generateNewContactHostRoid()) .setEmailAddress(email) .setStatusValues(ImmutableSet.of(StatusValue.OK)) - .setPersistedCurrentSponsorClientId("GetTheeBack") - .setCreationClientId("GetTheeBack") + .setPersistedCurrentSponsorRegistrarId("GetTheeBack") + .setCreationRegistrarId("GetTheeBack") .setCreationTimeForTest(clock.nowUtc()) .setInternationalizedPostalInfo( new PostalInfo.Builder() @@ -255,13 +255,13 @@ final class RdeFixtures { return persistResourceWithCommitLog( new HostResource.Builder() .setRepoId(generateNewContactHostRoid()) - .setCreationClientId("LawyerCat") + .setCreationRegistrarId("LawyerCat") .setCreationTimeForTest(clock.nowUtc()) - .setPersistedCurrentSponsorClientId("BusinessCat") + .setPersistedCurrentSponsorRegistrarId("BusinessCat") .setHostName(Idn.toASCII(fqhn)) .setInetAddresses(ImmutableSet.of(InetAddresses.forString(ip))) .setLastTransferTime(DateTime.parse("1990-01-01T00:00:00Z")) - .setLastEppUpdateClientId("CeilingCat") + .setLastEppUpdateRegistrarId("CeilingCat") .setLastEppUpdateTime(clock.nowUtc()) .setStatusValues(ImmutableSet.of(StatusValue.OK)) .build()); diff --git a/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java b/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java index b6b17d1e0..c82719111 100644 --- a/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java +++ b/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java @@ -57,32 +57,35 @@ public class RegistrarToXjcConverterTest { @BeforeEach void beforeEach() { - registrar = new Registrar.Builder() - .setClientId("GoblinMarket") - .setRegistrarName("Maids heard the goblins cry: Come buy, come buy:") - .setType(Registrar.Type.REAL) - .setIanaIdentifier(8L) - .setState(Registrar.State.ACTIVE) - .setInternationalizedAddress(new RegistrarAddress.Builder() - .setStreet(ImmutableList.of("123 Detonation Boulevard")) - .setCity("Williamsburg") - .setState("NY") - .setZip("11211") - .setCountryCode("US") - .build()) - .setLocalizedAddress(new RegistrarAddress.Builder() - .setStreet(ImmutableList.of("123 Example Boulevard.")) - .setCity("Hipsterville") - .setState("NY") - .setZip("11211") - .setCountryCode("US") - .build()) - .setPhoneNumber("+1.2125551212") - .setFaxNumber("+1.2125551213") - .setEmailAddress("contact-us@goblinmen.example") - .setWhoisServer("whois.goblinmen.example") - .setUrl("http://www.goblinmen.example") - .build(); + registrar = + new Registrar.Builder() + .setRegistrarId("GoblinMarket") + .setRegistrarName("Maids heard the goblins cry: Come buy, come buy:") + .setType(Registrar.Type.REAL) + .setIanaIdentifier(8L) + .setState(Registrar.State.ACTIVE) + .setInternationalizedAddress( + new RegistrarAddress.Builder() + .setStreet(ImmutableList.of("123 Detonation Boulevard")) + .setCity("Williamsburg") + .setState("NY") + .setZip("11211") + .setCountryCode("US") + .build()) + .setLocalizedAddress( + new RegistrarAddress.Builder() + .setStreet(ImmutableList.of("123 Example Boulevard.")) + .setCity("Hipsterville") + .setState("NY") + .setZip("11211") + .setCountryCode("US") + .build()) + .setPhoneNumber("+1.2125551212") + .setFaxNumber("+1.2125551213") + .setEmailAddress("contact-us@goblinmen.example") + .setWhoisServer("whois.goblinmen.example") + .setUrl("http://www.goblinmen.example") + .build(); FakeClock clock = new FakeClock(DateTime.parse("2013-01-01T00:00:00Z")); inject.setStaticField(Ofy.class, "clock", clock); registrar = cloneAndSetAutoTimestamps(registrar); // Set the creation time in 2013. diff --git a/core/src/test/java/google/registry/request/auth/AuthenticatedRegistrarAccessorTest.java b/core/src/test/java/google/registry/request/auth/AuthenticatedRegistrarAccessorTest.java index 772525eb6..c2e4da18e 100644 --- a/core/src/test/java/google/registry/request/auth/AuthenticatedRegistrarAccessorTest.java +++ b/core/src/test/java/google/registry/request/auth/AuthenticatedRegistrarAccessorTest.java @@ -114,14 +114,14 @@ class AuthenticatedRegistrarAccessorTest { persistResource( loadRegistrar(REAL_CLIENT_ID_WITHOUT_CONTACT) .asBuilder() - .setClientId(OTE_CLIENT_ID_WITHOUT_CONTACT) + .setRegistrarId(OTE_CLIENT_ID_WITHOUT_CONTACT) .setType(Registrar.Type.OTE) .setIanaIdentifier(null) .build()); persistResource( loadRegistrar(REAL_CLIENT_ID_WITHOUT_CONTACT) .asBuilder() - .setClientId(ADMIN_CLIENT_ID) + .setRegistrarId(ADMIN_CLIENT_ID) .setType(Registrar.Type.OTE) .setIanaIdentifier(null) .build()); @@ -261,7 +261,7 @@ class AuthenticatedRegistrarAccessorTest { @TestOfyAndSql void testGetRegistrarForUser_registrarIsDisabled_isNotAdmin() { persistResource( - Registrar.loadByClientId("TheRegistrar") + Registrar.loadByRegistrarId("TheRegistrar") .get() .asBuilder() .setState(State.DISABLED) @@ -326,7 +326,7 @@ class AuthenticatedRegistrarAccessorTest { @TestOfyAndSql void testGetRegistrarForUser_registrarIsDisabled_isAdmin() throws Exception { persistResource( - Registrar.loadByClientId("NewRegistrar") + Registrar.loadByRegistrarId("NewRegistrar") .get() .asBuilder() .setState(State.DISABLED) @@ -358,19 +358,19 @@ class AuthenticatedRegistrarAccessorTest { verifyNoInteractions(lazyGroupsConnection); } - private void expectGetRegistrarSuccess(String clientId, AuthResult authResult, String message) + private void expectGetRegistrarSuccess(String registrarId, AuthResult authResult, String message) throws Exception { AuthenticatedRegistrarAccessor registrarAccessor = new AuthenticatedRegistrarAccessor( authResult, ADMIN_CLIENT_ID, SUPPORT_GROUP, lazyGroupsConnection); // make sure loading the registrar succeeds and returns a value - assertThat(registrarAccessor.getRegistrar(clientId)).isNotNull(); + assertThat(registrarAccessor.getRegistrar(registrarId)).isNotNull(); assertAboutLogs().that(testLogHandler).hasLogAtLevelWithMessage(Level.INFO, message); } private void expectGetRegistrarFailure( - String clientId, AuthResult authResult, String message) { + String registrarId, AuthResult authResult, String message) { AuthenticatedRegistrarAccessor registrarAccessor = new AuthenticatedRegistrarAccessor( authResult, ADMIN_CLIENT_ID, SUPPORT_GROUP, lazyGroupsConnection); @@ -378,7 +378,8 @@ class AuthenticatedRegistrarAccessorTest { // make sure getRegistrar fails RegistrarAccessDeniedException exception = assertThrows( - RegistrarAccessDeniedException.class, () -> registrarAccessor.getRegistrar(clientId)); + RegistrarAccessDeniedException.class, + () -> registrarAccessor.getRegistrar(registrarId)); assertThat(exception).hasMessageThat().contains(message); } diff --git a/core/src/test/java/google/registry/schema/registrar/RegistrarDaoTest.java b/core/src/test/java/google/registry/schema/registrar/RegistrarDaoTest.java index 802fde239..dd823167e 100644 --- a/core/src/test/java/google/registry/schema/registrar/RegistrarDaoTest.java +++ b/core/src/test/java/google/registry/schema/registrar/RegistrarDaoTest.java @@ -55,7 +55,7 @@ public class RegistrarDaoTest { testRegistrar = new Registrar.Builder() .setType(Registrar.Type.TEST) - .setClientId("registrarId") + .setRegistrarId("registrarId") .setRegistrarName("registrarName") .setLocalizedAddress( new RegistrarAddress.Builder() @@ -104,7 +104,7 @@ public class RegistrarDaoTest { jpaTm().transact(() -> jpaTm().insert(testRegistrar)); Registrar persisted = jpaTm().transact(() -> jpaTm().loadByKey(registrarKey)); - assertThat(persisted.getClientId()).isEqualTo("registrarId"); + assertThat(persisted.getRegistrarId()).isEqualTo("registrarId"); assertThat(persisted.getRegistrarName()).isEqualTo("registrarName"); assertThat(persisted.getCreationTime()).isEqualTo(fakeClock.nowUtc()); assertThat(persisted.getLocalizedAddress()) diff --git a/core/src/test/java/google/registry/testing/AbstractEppResourceSubject.java b/core/src/test/java/google/registry/testing/AbstractEppResourceSubject.java index 9cd1c522e..2aa6a86a1 100644 --- a/core/src/test/java/google/registry/testing/AbstractEppResourceSubject.java +++ b/core/src/test/java/google/registry/testing/AbstractEppResourceSubject.java @@ -161,16 +161,16 @@ abstract class AbstractEppResourceSubject< return andChainer(); } - public And hasLastEppUpdateClientId(String clientId) { - return hasValue(clientId, actual.getLastEppUpdateClientId(), "getLastEppUpdateClientId()"); + public And hasLastEppUpdateClientId(String registrarId) { + return hasValue( + registrarId, actual.getLastEppUpdateRegistrarId(), "getLastEppUpdateRegistrarId()"); } - - public And hasPersistedCurrentSponsorClientId(String clientId) { + public And hasPersistedCurrentSponsorRegistrarId(String registrarId) { return hasValue( - clientId, - actual.getPersistedCurrentSponsorClientId(), - "getPersistedCurrentSponsorClientId()"); + registrarId, + actual.getPersistedCurrentSponsorRegistrarId(), + "getPersistedCurrentSponsorRegistrarId()"); } public And isActiveAt(DateTime time) { diff --git a/core/src/test/java/google/registry/testing/AppEngineExtension.java b/core/src/test/java/google/registry/testing/AppEngineExtension.java index ff91d53ac..f024b95e1 100644 --- a/core/src/test/java/google/registry/testing/AppEngineExtension.java +++ b/core/src/test/java/google/registry/testing/AppEngineExtension.java @@ -290,7 +290,7 @@ public final class AppEngineExtension implements BeforeEachCallback, AfterEachCa /** Public factory for first Registrar to allow comparison against stored value in unit tests. */ public static Registrar makeRegistrar1() { return makeRegistrarCommon() - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setRegistrarName("New Registrar") .setEmailAddress("new.registrar@example.com") .setIanaIdentifier(8L) @@ -304,7 +304,7 @@ public final class AppEngineExtension implements BeforeEachCallback, AfterEachCa /** Public factory for second Registrar to allow comparison against stored value in unit tests. */ public static Registrar makeRegistrar2() { return makeRegistrarCommon() - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setRegistrarName("The Registrar") .setEmailAddress("the.registrar@example.com") .setIanaIdentifier(1L) diff --git a/core/src/test/java/google/registry/testing/ContactResourceSubject.java b/core/src/test/java/google/registry/testing/ContactResourceSubject.java index 1071bcc8e..72092f7a2 100644 --- a/core/src/test/java/google/registry/testing/ContactResourceSubject.java +++ b/core/src/test/java/google/registry/testing/ContactResourceSubject.java @@ -131,8 +131,9 @@ public final class ContactResourceSubject return doesNotHaveValue(lastTransferTime, actual.getLastTransferTime(), "lastTransferTime"); } - public And hasCurrentSponsorClientId(String clientId) { - return hasValue(clientId, actual.getCurrentSponsorClientId(), "has currentSponsorClientId"); + public And hasCurrentSponsorRegistrarId(String registrarId) { + return hasValue( + registrarId, actual.getCurrentSponsorRegistrarId(), "has currentSponsorRegistrarId"); } public static SimpleSubjectBuilder diff --git a/core/src/test/java/google/registry/testing/DatabaseHelper.java b/core/src/test/java/google/registry/testing/DatabaseHelper.java index 0821afc06..f61950667 100644 --- a/core/src/test/java/google/registry/testing/DatabaseHelper.java +++ b/core/src/test/java/google/registry/testing/DatabaseHelper.java @@ -169,8 +169,8 @@ public class DatabaseHelper { public static HostResource newHostResourceWithRoid(String hostName, String repoId) { return new HostResource.Builder() .setHostName(hostName) - .setCreationClientId("TheRegistrar") - .setPersistedCurrentSponsorClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .setCreationTimeForTest(START_OF_TIME) .setRepoId(repoId) .build(); @@ -198,8 +198,8 @@ public class DatabaseHelper { return new DomainBase.Builder() .setRepoId(repoId) .setDomainName(domainName) - .setCreationClientId("TheRegistrar") - .setPersistedCurrentSponsorClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .setCreationTimeForTest(START_OF_TIME) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR"))) .setRegistrant(contactKey) @@ -223,8 +223,8 @@ public class DatabaseHelper { return new ContactResource.Builder() .setRepoId(repoId) .setContactId(contactId) - .setCreationClientId("TheRegistrar") - .setPersistedCurrentSponsorClientId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("2fooBAR"))) .setCreationTimeForTest(START_OF_TIME) .build(); @@ -469,14 +469,14 @@ public class DatabaseHelper { }); } - public static void allowRegistrarAccess(String clientId, String tld) { - Registrar registrar = loadRegistrar(clientId); + public static void allowRegistrarAccess(String registrarId, String tld) { + Registrar registrar = loadRegistrar(registrarId); persistResource( registrar.asBuilder().setAllowedTlds(union(registrar.getAllowedTlds(), tld)).build()); } - public static void disallowRegistrarAccess(String clientId, String tld) { - Registrar registrar = loadRegistrar(clientId); + public static void disallowRegistrarAccess(String registrarId, String tld) { + Registrar registrar = loadRegistrar(registrarId); persistResource( registrar.asBuilder().setAllowedTlds(difference(registrar.getAllowedTlds(), tld)).build()); } @@ -485,9 +485,9 @@ public class DatabaseHelper { DateTime requestTime, DateTime expirationTime) { return new DomainTransferData.Builder() .setTransferStatus(TransferStatus.PENDING) - .setGainingClientId("NewRegistrar") + .setGainingRegistrarId("NewRegistrar") .setTransferRequestTime(requestTime) - .setLosingClientId("TheRegistrar") + .setLosingRegistrarId("TheRegistrar") .setPendingTransferExpirationTime(expirationTime); } @@ -495,16 +495,16 @@ public class DatabaseHelper { DateTime requestTime, DateTime expirationTime) { return new ContactTransferData.Builder() .setTransferStatus(TransferStatus.PENDING) - .setGainingClientId("NewRegistrar") + .setGainingRegistrarId("NewRegistrar") .setTransferRequestTime(requestTime) - .setLosingClientId("TheRegistrar") + .setLosingRegistrarId("TheRegistrar") .setPendingTransferExpirationTime(expirationTime); } public static PollMessage.OneTime createPollMessageForImplicitTransfer( EppResource resource, HistoryEntry historyEntry, - String clientId, + String registrarId, DateTime requestTime, DateTime expirationTime, @Nullable DateTime extendedRegistrationExpirationTime) { @@ -513,7 +513,7 @@ public class DatabaseHelper { .setTransferredRegistrationExpirationTime(extendedRegistrationExpirationTime) .build(); return new PollMessage.OneTime.Builder() - .setClientId(clientId) + .setRegistrarId(registrarId) .setEventTime(expirationTime) .setMsg("Transfer server approved.") .setResponseData(ImmutableList.of(createTransferResponse(resource, transferData))) @@ -529,7 +529,7 @@ public class DatabaseHelper { .setEventTime(eventTime) .setBillingTime( eventTime.plus(Registry.get(domain.getTld()).getTransferGracePeriodLength())) - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setPeriodYears(1) .setCost(getDomainRenewCost(domain.getDomainName(), costLookupTime, 1)) .setParent(historyEntry) @@ -544,13 +544,13 @@ public class DatabaseHelper { .setType(HistoryEntry.Type.CONTACT_TRANSFER_REQUEST) .setContact(persistResource(contact)) .setModificationTime(now) - .setClientId(contact.getCurrentSponsorClientId()) + .setRegistrarId(contact.getCurrentSponsorRegistrarId()) .build() .toChildHistoryEntity()); return persistResource( contact .asBuilder() - .setPersistedCurrentSponsorClientId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .addStatusValue(StatusValue.PENDING_TRANSFER) .setTransferData( createContactTransferDataBuilder(requestTime, expirationTime) @@ -596,8 +596,8 @@ public class DatabaseHelper { new DomainBase.Builder() .setRepoId(repoId) .setDomainName(domainName) - .setPersistedCurrentSponsorClientId("TheRegistrar") - .setCreationClientId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") + .setCreationRegistrarId("TheRegistrar") .setCreationTimeForTest(creationTime) .setRegistrationExpirationTime(expirationTime) .setRegistrant(contact.createVKey()) @@ -616,7 +616,7 @@ public class DatabaseHelper { .setType(HistoryEntry.Type.DOMAIN_CREATE) .setModificationTime(now) .setDomain(domain) - .setClientId(domain.getCreationClientId()) + .setRegistrarId(domain.getCreationRegistrarId()) .build()); BillingEvent.Recurring autorenewEvent = persistResource( @@ -624,7 +624,7 @@ public class DatabaseHelper { .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setTargetId(domainName) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(expirationTime) .setRecurrenceEndTime(END_OF_TIME) .setParent(historyEntryDomainCreate) @@ -633,7 +633,7 @@ public class DatabaseHelper { persistResource( new PollMessage.Autorenew.Builder() .setTargetId(domainName) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .setEventTime(expirationTime) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") @@ -658,7 +658,7 @@ public class DatabaseHelper { .setType(HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST) .setModificationTime(tm().transact(() -> tm().getTransactionTime())) .setDomain(domain) - .setClientId("TheRegistrar") + .setRegistrarId("TheRegistrar") .build()); BillingEvent.OneTime transferBillingEvent = persistResource( @@ -670,7 +670,7 @@ public class DatabaseHelper { .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setReason(Reason.RENEW) .setTargetId(domain.getDomainName()) - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setEventTime(extendedRegistrationExpirationTime) .setRecurrenceEndTime(END_OF_TIME) .setParent(historyEntryDomainTransfer) @@ -679,7 +679,7 @@ public class DatabaseHelper { persistResource( new PollMessage.Autorenew.Builder() .setTargetId(domain.getDomainName()) - .setClientId("NewRegistrar") + .setRegistrarId("NewRegistrar") .setEventTime(extendedRegistrationExpirationTime) .setAutorenewEndTime(END_OF_TIME) .setMsg("Domain was auto-renewed.") @@ -707,7 +707,7 @@ public class DatabaseHelper { return persistResource( domain .asBuilder() - .setPersistedCurrentSponsorClientId("TheRegistrar") + .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .addStatusValue(StatusValue.PENDING_TRANSFER) .setTransferData( transferDataBuilder @@ -748,10 +748,13 @@ public class DatabaseHelper { /** Persists and returns a {@link Registrar} with the specified attributes. */ public static Registrar persistNewRegistrar( - String clientId, String registrarName, Registrar.Type type, @Nullable Long ianaIdentifier) { + String registrarId, + String registrarName, + Registrar.Type type, + @Nullable Long ianaIdentifier) { return persistSimpleResource( new Registrar.Builder() - .setClientId(clientId) + .setRegistrarId(registrarId) .setRegistrarName(registrarName) .setType(type) .setIanaIdentifier(ianaIdentifier) @@ -861,8 +864,8 @@ public class DatabaseHelper { .containsExactlyElementsIn(expected); } - public static void assertPollMessages(String clientId, PollMessage... expected) { - assertPollMessagesEqual(getPollMessages(clientId), asList(expected)); + public static void assertPollMessages(String registrarId, PollMessage... expected) { + assertPollMessagesEqual(getPollMessages(registrarId), asList(expected)); } public static void assertPollMessages(PollMessage... expected) { @@ -877,11 +880,11 @@ public class DatabaseHelper { return ImmutableList.copyOf(transactIfJpaTm(() -> tm().loadAllOf(PollMessage.class))); } - public static ImmutableList getPollMessages(String clientId) { + public static ImmutableList getPollMessages(String registrarId) { return transactIfJpaTm( () -> tm().loadAllOf(PollMessage.class).stream() - .filter(pollMessage -> pollMessage.getClientId().equals(clientId)) + .filter(pollMessage -> pollMessage.getRegistrarId().equals(registrarId)) .collect(toImmutableList())); } @@ -895,18 +898,19 @@ public class DatabaseHelper { .collect(toImmutableList())); } - public static ImmutableList getPollMessages(String clientId, DateTime beforeOrAt) { + public static ImmutableList getPollMessages( + String registrarId, DateTime beforeOrAt) { return transactIfJpaTm( () -> tm().loadAllOf(PollMessage.class).stream() - .filter(pollMessage -> pollMessage.getClientId().equals(clientId)) + .filter(pollMessage -> pollMessage.getRegistrarId().equals(registrarId)) .filter(pollMessage -> isBeforeOrAt(pollMessage.getEventTime(), beforeOrAt)) .collect(toImmutableList())); } /** Gets all PollMessages associated with the given EppResource. */ public static ImmutableList getPollMessages( - EppResource resource, String clientId, DateTime now) { + EppResource resource, String registrarId, DateTime now) { return transactIfJpaTm( () -> tm().loadAllOf(PollMessage.class).stream() @@ -917,7 +921,7 @@ public class DatabaseHelper { .getParent() .getName() .equals(resource.getRepoId())) - .filter(pollMessage -> pollMessage.getClientId().equals(clientId)) + .filter(pollMessage -> pollMessage.getRegistrarId().equals(registrarId)) .filter( pollMessage -> pollMessage.getEventTime().isEqual(now) @@ -925,25 +929,28 @@ public class DatabaseHelper { .collect(toImmutableList())); } - public static PollMessage getOnlyPollMessage(String clientId) { - return Iterables.getOnlyElement(getPollMessages(clientId)); + public static PollMessage getOnlyPollMessage(String registrarId) { + return Iterables.getOnlyElement(getPollMessages(registrarId)); } - public static PollMessage getOnlyPollMessage(String clientId, DateTime now) { - return Iterables.getOnlyElement(getPollMessages(clientId, now)); + public static PollMessage getOnlyPollMessage(String registrarId, DateTime now) { + return Iterables.getOnlyElement(getPollMessages(registrarId, now)); } public static PollMessage getOnlyPollMessage( - String clientId, DateTime now, Class subType) { - return getPollMessages(clientId, now).stream() + String registrarId, DateTime now, Class subType) { + return getPollMessages(registrarId, now).stream() .filter(subType::isInstance) .map(subType::cast) .collect(onlyElement()); } public static PollMessage getOnlyPollMessage( - DomainContent domain, String clientId, DateTime now, Class subType) { - return getPollMessages(domain, clientId, now).stream() + DomainContent domain, + String registrarId, + DateTime now, + Class subType) { + return getPollMessages(domain, registrarId, now).stream() .filter(subType::isInstance) .map(subType::cast) .collect(onlyElement()); @@ -1083,7 +1090,7 @@ public class DatabaseHelper { tm().put(resource); tm().put( HistoryEntry.createBuilderForResource(resource) - .setClientId(resource.getCreationClientId()) + .setRegistrarId(resource.getCreationRegistrarId()) .setType(getHistoryEntryType(resource)) .setModificationTime(tm().getTransactionTime()) .build()); @@ -1183,7 +1190,7 @@ public class DatabaseHelper { HistoryEntry.createBuilderForResource(parentResource) .setType(getHistoryEntryType(parentResource)) .setModificationTime(DateTime.now(DateTimeZone.UTC)) - .setClientId(parentResource.getPersistedCurrentSponsorClientId()) + .setRegistrarId(parentResource.getPersistedCurrentSponsorRegistrarId()) .build()); } @@ -1249,11 +1256,11 @@ public class DatabaseHelper { } /** Loads and returns the registrar with the given client ID, or throws IAE if not present. */ - public static Registrar loadRegistrar(String clientId) { + public static Registrar loadRegistrar(String registrarId) { return checkArgumentPresent( - Registrar.loadByClientId(clientId), + Registrar.loadByRegistrarId(registrarId), "Error in tests: Registrar %s does not exist", - clientId); + registrarId); } /** diff --git a/core/src/test/java/google/registry/testing/DomainBaseSubject.java b/core/src/test/java/google/registry/testing/DomainBaseSubject.java index d4a73a314..0ce004183 100644 --- a/core/src/test/java/google/registry/testing/DomainBaseSubject.java +++ b/core/src/test/java/google/registry/testing/DomainBaseSubject.java @@ -67,8 +67,9 @@ public final class DomainBaseSubject return hasValue(pw, authInfo == null ? null : authInfo.getPw().getValue(), "has auth info pw"); } - public And hasCurrentSponsorClientId(String clientId) { - return hasValue(clientId, actual.getCurrentSponsorClientId(), "has currentSponsorClientId"); + public And hasCurrentSponsorRegistrarId(String registrarId) { + return hasValue( + registrarId, actual.getCurrentSponsorRegistrarId(), "has currentSponsorRegistrarId"); } public And hasRegistrationExpirationTime(DateTime expiration) { diff --git a/core/src/test/java/google/registry/testing/EppMetricSubject.java b/core/src/test/java/google/registry/testing/EppMetricSubject.java index 1e07497e8..3c4e6d5d0 100644 --- a/core/src/test/java/google/registry/testing/EppMetricSubject.java +++ b/core/src/test/java/google/registry/testing/EppMetricSubject.java @@ -41,7 +41,7 @@ public class EppMetricSubject extends Subject { } public And hasClientId(String clientId) { - return hasValue(clientId, actual.getClientId(), "getClientId()"); + return hasValue(clientId, actual.getRegistrarId(), "getClientId()"); } public And hasCommandName(String commandName) { diff --git a/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java b/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java index 13f7edc80..1c4d32447 100644 --- a/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java +++ b/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java @@ -50,40 +50,43 @@ import org.joda.time.DateTime; public final class FullFieldsTestEntityHelper { public static Registrar makeRegistrar( - String clientId, String registrarName, Registrar.State state) { - return makeRegistrar(clientId, registrarName, state, 1L); + String registrarId, String registrarName, Registrar.State state) { + return makeRegistrar(registrarId, registrarName, state, 1L); } public static Registrar makeRegistrar( - String clientId, String registrarName, Registrar.State state, Long ianaIdentifier) { + String registrarId, String registrarName, Registrar.State state, Long ianaIdentifier) { return new Registrar.Builder() - .setClientId(clientId) - .setRegistrarName(registrarName) - .setType(Registrar.Type.REAL) - .setIanaIdentifier(ianaIdentifier) - .setState(state) - .setInternationalizedAddress(new RegistrarAddress.Builder() - .setStreet(ImmutableList.of("123 Example Boulevard