From 4813ed392ba527b81d9402ad590d0a7a987d6451 Mon Sep 17 00:00:00 2001 From: mcilwain Date: Thu, 22 Sep 2016 08:31:00 -0700 Subject: [PATCH] Rename "clientIdentifier" to "clientId" almost everywhere It's best to be consistent and use the same thing everywhere. "clientId" was already used in more places and is shorter and no more ambiguous, so it's the logical one to win out. Note that this CL is almost solely a big Eclipse-assisted refactoring. There are two places that I did not change clientIdentifier -- the actual entity field on Registrar (though I did change all getters and setters), and the name of a column on the exported registrar spreadsheet. Both would require data migrations. Also fixes a few minor nits discovered in touched files, including an incorrect test in OfyFilterTest.java and some superfluous uses of String.format() when calling checkArgument(). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133956465 --- .../braintree/BraintreeRegistrarSyncer.java | 10 +++---- .../export/SyncGroupMembersAction.java | 6 ++-- .../export/sheet/SyncRegistrarsSheet.java | 4 +-- java/google/registry/flows/EppToolAction.java | 10 +++---- .../google/registry/flows/TlsCredentials.java | 8 ++--- .../flows/domain/DomainFlowUtils.java | 16 +++++----- .../flows/domain/RegistryExtraFlowLogic.java | 20 ++++++------- .../flows/domain/TldSpecificLogicProxy.java | 24 +++++++-------- .../registry/loadtest/LoadTestAction.java | 2 +- .../registry/model/registrar/Registrar.java | 8 ++--- .../registry/rde/RegistrarToXjcConverter.java | 2 +- .../tools/CreateAnchorTenantCommand.java | 4 +-- .../tools/CreateAuctionCreditsCommand.java | 2 +- .../registry/tools/CreateContactCommand.java | 4 +-- .../registry/tools/CreateDomainCommand.java | 4 +-- .../registry/tools/CreateHostCommand.java | 4 +-- .../tools/CreateOrUpdateRegistrarCommand.java | 10 +++---- .../tools/CreateRegistrarCommand.java | 27 ++++++++--------- .../tools/CreateRegistrarGroupsCommand.java | 6 ++-- .../registry/tools/DeleteDomainCommand.java | 4 +-- .../tools/DomainApplicationInfoCommand.java | 4 +-- .../tools/DomainCheckClaimsCommand.java | 4 +-- .../registry/tools/DomainCheckCommand.java | 4 +-- .../registry/tools/DomainCheckFeeCommand.java | 4 +-- .../google/registry/tools/EppToolCommand.java | 6 ++-- .../registry/tools/ExecuteEppCommand.java | 6 ++-- .../tools/GenerateAuctionDataCommand.java | 2 +- .../registry/tools/GetRegistrarCommand.java | 4 +-- .../registry/tools/ListCreditsCommand.java | 2 +- .../tools/RegistrarContactCommand.java | 6 ++-- .../tools/UpdateRegistrarCommand.java | 5 ++-- .../tools/UpdateServerLocksCommand.java | 4 +-- .../ValidateLoginCredentialsCommand.java | 4 +-- .../registry/tools/VerifyOteCommand.java | 2 +- .../tools/server/CreateGroupsAction.java | 2 +- .../ui/server/registrar/ConsoleUiAction.java | 2 +- .../registrar/RegistrarPaymentAction.java | 2 +- .../ui/server/registrar/SessionUtils.java | 2 +- .../export/sheet/SyncRegistrarsSheetTest.java | 8 ++--- .../registry/flows/EppToolActionTest.java | 2 +- .../contact/ContactTransferFlowTestCase.java | 2 +- .../domain/DomainApplicationInfoFlowTest.java | 2 +- .../flows/domain/DomainInfoFlowTest.java | 2 +- .../domain/DomainTransferFlowTestCase.java | 2 +- .../domain/TldSpecificLogicProxyTest.java | 16 +++++----- .../model/domain/TestExtraLogicManager.java | 22 +++++++------- .../registry/model/ofy/OfyFilterTest.java | 30 ++++++++++++------- .../model/registrar/RegistrarTest.java | 22 +++++++------- .../rde/RegistrarToXjcConverterTest.java | 2 +- .../registry/testing/AppEngineRule.java | 4 +-- .../registry/testing/DatastoreHelper.java | 2 +- .../testing/FullFieldsTestEntityHelper.java | 4 +-- .../tools/AllocateDomainCommandTest.java | 2 +- .../tools/CreateRegistrarCommandTest.java | 2 +- .../tools/EppToolCommandTestCase.java | 2 +- .../registry/tools/EppToolVerifier.java | 18 +++++------ .../registry/tools/MutatingCommandTest.java | 4 +-- .../registry/tools/SetupOteCommandTest.java | 2 +- .../UniformRapidSuspensionCommandTest.java | 10 +++---- .../UpdateApplicationStatusCommandTest.java | 2 +- .../whois/NameserverWhoisResponseTest.java | 2 +- .../whois/RegistrarWhoisResponseTest.java | 4 +-- 62 files changed, 208 insertions(+), 200 deletions(-) diff --git a/java/google/registry/braintree/BraintreeRegistrarSyncer.java b/java/google/registry/braintree/BraintreeRegistrarSyncer.java index 80d73a92d..67df9fcbb 100644 --- a/java/google/registry/braintree/BraintreeRegistrarSyncer.java +++ b/java/google/registry/braintree/BraintreeRegistrarSyncer.java @@ -41,7 +41,7 @@ public class BraintreeRegistrarSyncer { /** * Syncs {@code registrar} with Braintree customer entry, creating it if one doesn't exist. * - *

The customer ID will be the same as {@link Registrar#getClientIdentifier()}. + *

The customer ID will be the same as {@link Registrar#getClientId()}. * *

Creating a customer object in Braintree's database is a necessary step in order to associate * a payment with a registrar. The transaction will fail if the customer object doesn't exist. @@ -49,8 +49,8 @@ public class BraintreeRegistrarSyncer { * @throws IllegalArgumentException if {@code registrar} is not using BRAINTREE billing * @throws VerifyException if the Braintree API returned a failure response */ - public void sync(Registrar registrar) throws VerifyException { - String id = registrar.getClientIdentifier(); + public void sync(Registrar registrar) { + String id = registrar.getClientId(); checkArgument(registrar.getBillingMethod() == Registrar.BillingMethod.BRAINTREE, "Registrar (%s) billing method (%s) is not BRAINTREE", id, registrar.getBillingMethod()); CustomerRequest request = createRequest(registrar); @@ -67,8 +67,8 @@ public class BraintreeRegistrarSyncer { private CustomerRequest createRequest(Registrar registrar) { CustomerRequest result = new CustomerRequest() - .id(registrar.getClientIdentifier()) - .customerId(registrar.getClientIdentifier()) + .id(registrar.getClientId()) + .customerId(registrar.getClientId()) .company(registrar.getRegistrarName()); Optional contact = getBillingContact(registrar); if (contact.isPresent()) { diff --git a/java/google/registry/export/SyncGroupMembersAction.java b/java/google/registry/export/SyncGroupMembersAction.java index 254e07a31..59ccce35c 100644 --- a/java/google/registry/export/SyncGroupMembersAction.java +++ b/java/google/registry/export/SyncGroupMembersAction.java @@ -194,7 +194,7 @@ public final class SyncGroupMembersAction implements Runnable { long totalRemoved = 0; for (final RegistrarContact.Type type : RegistrarContact.Type.values()) { groupKey = getGroupEmailAddressForContactType( - registrar.getClientIdentifier(), type, publicDomainName); + registrar.getClientId(), type, publicDomainName); Set currentMembers = groupsConnection.getMembersOfGroup(groupKey); Set desiredMembers = FluentIterable.from(registrarContacts) .filter(new Predicate() { @@ -218,7 +218,7 @@ public final class SyncGroupMembersAction implements Runnable { } } logger.infofmt("Successfully synced contacts for registrar %s: added %d and removed %d", - registrar.getClientIdentifier(), + registrar.getClientId(), totalAdded, totalRemoved); } catch (IOException e) { @@ -227,7 +227,7 @@ public final class SyncGroupMembersAction implements Runnable { // job will run within an hour anyway and effectively resume where it left off if this was a // transient error. String msg = String.format("Couldn't sync contacts for registrar %s to group %s", - registrar.getClientIdentifier(), groupKey); + registrar.getClientId(), groupKey); throw new RuntimeException(msg, e); } } diff --git a/java/google/registry/export/sheet/SyncRegistrarsSheet.java b/java/google/registry/export/sheet/SyncRegistrarsSheet.java index dc80e1ad8..afe972b67 100644 --- a/java/google/registry/export/sheet/SyncRegistrarsSheet.java +++ b/java/google/registry/export/sheet/SyncRegistrarsSheet.java @@ -74,7 +74,7 @@ class SyncRegistrarsSheet { new Ordering() { @Override public int compare(Registrar left, Registrar right) { - return left.getClientIdentifier().compareTo(right.getClientIdentifier()); + return left.getClientId().compareTo(right.getClientId()); } }.immutableSortedCopy(Registrar.loadAll())) .filter( @@ -114,7 +114,7 @@ class SyncRegistrarsSheet { // and you'll need to remove deleted columns probably like a week after // deployment. // - builder.put("clientIdentifier", convert(registrar.getClientIdentifier())); + builder.put("clientIdentifier", convert(registrar.getClientId())); builder.put("registrarName", convert(registrar.getRegistrarName())); builder.put("state", convert(registrar.getState())); builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier())); diff --git a/java/google/registry/flows/EppToolAction.java b/java/google/registry/flows/EppToolAction.java index f44dcb98e..506e4906b 100644 --- a/java/google/registry/flows/EppToolAction.java +++ b/java/google/registry/flows/EppToolAction.java @@ -35,7 +35,7 @@ import javax.servlet.http.HttpServletRequest; method = Method.POST) public class EppToolAction implements Runnable { - @Inject @Parameter("clientIdentifier") String clientIdentifier; + @Inject @Parameter("clientId") String clientId; @Inject @Parameter("superuser") boolean isSuperuser; @Inject @Parameter("dryRun") boolean isDryRun; @Inject @Parameter("xml") String xml; @@ -46,7 +46,7 @@ public class EppToolAction implements Runnable { public void run() { eppRequestHandler.executeEpp( new StatelessRequestSessionMetadata( - clientIdentifier, + clientId, ProtocolDefinition.getVisibleServiceExtensionUris()), new PasswordOnlyTransportCredentials(), EppRequestSource.TOOL, @@ -75,9 +75,9 @@ public class EppToolAction implements Runnable { } @Provides - @Parameter("clientIdentifier") - static String provideClientIdentifier(HttpServletRequest req) { - return extractRequiredParameter(req, "clientIdentifier"); + @Parameter("clientId") + static String provideClientId(HttpServletRequest req) { + return extractRequiredParameter(req, "clientId"); } } } diff --git a/java/google/registry/flows/TlsCredentials.java b/java/google/registry/flows/TlsCredentials.java index be7a06bc7..f51a6fe90 100644 --- a/java/google/registry/flows/TlsCredentials.java +++ b/java/google/registry/flows/TlsCredentials.java @@ -103,7 +103,7 @@ public class TlsCredentials implements TransportCredentials { ImmutableList ipWhitelist = registrar.getIpAddressWhitelist(); if (ipWhitelist.isEmpty()) { logger.infofmt("Skipping IP whitelist check because %s doesn't have an IP whitelist", - registrar.getClientIdentifier()); + registrar.getClientId()); return; } for (CidrAddressBlock cidrAddressBlock : ipWhitelist) { @@ -113,7 +113,7 @@ public class TlsCredentials implements TransportCredentials { } } logger.infofmt("%s not in %s's CIDR whitelist: %s", - clientInetAddr, registrar.getClientIdentifier(), ipWhitelist); + clientInetAddr, registrar.getClientId(), ipWhitelist); throw new BadRegistrarIpAddressException(); } @@ -129,7 +129,7 @@ public class TlsCredentials implements TransportCredentials { && isNullOrEmpty(registrar.getFailoverClientCertificateHash())) { logger.infofmt( "Skipping SSL certificate check because %s doesn't have any certificate hashes on file", - registrar.getClientIdentifier()); + registrar.getClientId()); return; } if (isNullOrEmpty(clientCertificateHash)) { @@ -145,7 +145,7 @@ public class TlsCredentials implements TransportCredentials { && !clientCertificateHash.equals(registrar.getFailoverClientCertificateHash())) { logger.warningfmt("bad certificate hash (%s) for %s, wanted either %s or %s", clientCertificateHash, - registrar.getClientIdentifier(), + registrar.getClientId(), registrar.getClientCertificateHash(), registrar.getFailoverClientCertificateHash()); throw new BadRegistrarCertificateException(); diff --git a/java/google/registry/flows/domain/DomainFlowUtils.java b/java/google/registry/flows/domain/DomainFlowUtils.java index 724ba34ea..393a1775e 100644 --- a/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/java/google/registry/flows/domain/DomainFlowUtils.java @@ -402,11 +402,11 @@ public class DomainFlowUtils { * this registrar. */ static void verifyPremiumNameIsNotBlocked( - String domainName, DateTime priceTime, String clientIdentifier) throws EppException { + String domainName, DateTime priceTime, String clientId) throws EppException { if (getPricesForDomainName(domainName, priceTime).isPremium()) { // NB: The load of the Registar object is transactionless, which means that it should hit // memcache most of the time. - if (Registrar.loadByClientId(clientIdentifier).getBlockPremiumNames()) { + if (Registrar.loadByClientId(clientId).getBlockPremiumNames()) { throw new PremiumNameBlockedException(); } } @@ -577,7 +577,7 @@ public class DomainFlowUtils { FeeQueryCommandExtensionItem feeRequest, FeeQueryResponseExtensionItem.Builder builder, InternetDomainName domain, - String clientIdentifier, + String clientId, @Nullable CurrencyUnit topLevelCurrency, DateTime now, EppInput eppInput) throws EppException { @@ -611,13 +611,13 @@ public class DomainFlowUtils { } else { builder.setAvailIfSupported(true); builder.setFees(TldSpecificLogicProxy.getCreatePrice( - registry, domainNameString, clientIdentifier, now, years, eppInput).getFees()); + registry, domainNameString, clientId, now, years, eppInput).getFees()); } break; case RENEW: builder.setAvailIfSupported(true); builder.setFees(TldSpecificLogicProxy.getRenewPrice( - registry, domainNameString, clientIdentifier, now, years, eppInput).getFees()); + registry, domainNameString, clientId, now, years, eppInput).getFees()); break; case RESTORE: if (years != 1) { @@ -625,17 +625,17 @@ public class DomainFlowUtils { } builder.setAvailIfSupported(true); builder.setFees(TldSpecificLogicProxy.getRestorePrice( - registry, domainNameString, clientIdentifier, now, eppInput).getFees()); + registry, domainNameString, clientId, now, eppInput).getFees()); break; case TRANSFER: builder.setAvailIfSupported(true); builder.setFees(TldSpecificLogicProxy.getTransferPrice( - registry, domainNameString, clientIdentifier, now, years, eppInput).getFees()); + registry, domainNameString, clientId, now, years, eppInput).getFees()); break; case UPDATE: builder.setAvailIfSupported(true); builder.setFees(TldSpecificLogicProxy.getUpdatePrice( - registry, domainNameString, clientIdentifier, now, eppInput).getFees()); + registry, domainNameString, clientId, now, eppInput).getFees()); break; default: throw new UnknownFeeCommandException(feeRequest.getUnparsedCommandName()); diff --git a/java/google/registry/flows/domain/RegistryExtraFlowLogic.java b/java/google/registry/flows/domain/RegistryExtraFlowLogic.java index 0f2b7b4a0..59a1f7d7f 100644 --- a/java/google/registry/flows/domain/RegistryExtraFlowLogic.java +++ b/java/google/registry/flows/domain/RegistryExtraFlowLogic.java @@ -30,12 +30,12 @@ public interface RegistryExtraFlowLogic { /** Gets the flags to be used in the EPP flags extension. This is used for EPP info commands. */ public List getExtensionFlags( - DomainResource domainResource, String clientIdentifier, DateTime asOfDate); + DomainResource domainResource, String clientId, DateTime asOfDate); /** Computes the expected creation fee, for use in fee challenges and the like. */ public BaseFee getCreateFeeOrCredit( String domainName, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput) throws EppException; @@ -46,7 +46,7 @@ public interface RegistryExtraFlowLogic { */ public void performAdditionalDomainCreateLogic( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput, @@ -58,7 +58,7 @@ public interface RegistryExtraFlowLogic { */ public void performAdditionalDomainDeleteLogic( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput, HistoryEntry historyEntry) throws EppException; @@ -66,7 +66,7 @@ public interface RegistryExtraFlowLogic { /** Computes the expected renewal fee, for use in fee challenges and the like. */ public BaseFee getRenewFeeOrCredit( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput) throws EppException; @@ -77,7 +77,7 @@ public interface RegistryExtraFlowLogic { */ public void performAdditionalDomainRenewLogic( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput, @@ -89,7 +89,7 @@ public interface RegistryExtraFlowLogic { */ public void performAdditionalDomainRestoreLogic( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput, HistoryEntry historyEntry) throws EppException; @@ -100,7 +100,7 @@ public interface RegistryExtraFlowLogic { */ public void performAdditionalDomainTransferLogic( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput, @@ -109,7 +109,7 @@ public interface RegistryExtraFlowLogic { /** Computes the expected update fee, for use in fee challenges and the like. */ public BaseFee getUpdateFeeOrCredit( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput) throws EppException; @@ -119,7 +119,7 @@ public interface RegistryExtraFlowLogic { */ public void performAdditionalDomainUpdateLogic( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput, HistoryEntry historyEntry) throws EppException; diff --git a/java/google/registry/flows/domain/TldSpecificLogicProxy.java b/java/google/registry/flows/domain/TldSpecificLogicProxy.java index 476043c04..fe403aa80 100644 --- a/java/google/registry/flows/domain/TldSpecificLogicProxy.java +++ b/java/google/registry/flows/domain/TldSpecificLogicProxy.java @@ -138,7 +138,7 @@ public final class TldSpecificLogicProxy { public static EppCommandOperations getCreatePrice( Registry registry, String domainName, - String clientIdentifier, + String clientId, DateTime date, int years, EppInput eppInput) throws EppException { @@ -150,7 +150,7 @@ public final class TldSpecificLogicProxy { RegistryExtraFlowLogicProxy.newInstanceForTld(registry.getTldStr()); if (extraFlowLogic.isPresent()) { createFeeOrCredit = extraFlowLogic.get() - .getCreateFeeOrCredit(domainName, clientIdentifier, date, years, eppInput); + .getCreateFeeOrCredit(domainName, clientId, date, years, eppInput); } else { DomainPrices prices = getPricesForDomainName(domainName, date); createFeeOrCredit = @@ -173,7 +173,7 @@ public final class TldSpecificLogicProxy { static BaseFee getRenewFeeOrCredit( Registry registry, String domainName, - String clientIdentifier, + String clientId, DateTime date, int years, EppInput eppInput) throws EppException { @@ -186,7 +186,7 @@ public final class TldSpecificLogicProxy { throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName); } return - extraFlowLogic.get().getRenewFeeOrCredit(domain, clientIdentifier, date, years, eppInput); + extraFlowLogic.get().getRenewFeeOrCredit(domain, clientId, date, years, eppInput); } else { DomainPrices prices = getPricesForDomainName(domainName, date); return Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), FeeType.RENEW); @@ -197,25 +197,25 @@ public final class TldSpecificLogicProxy { public static EppCommandOperations getRenewPrice( Registry registry, String domainName, - String clientIdentifier, + String clientId, DateTime date, int years, EppInput eppInput) throws EppException { return new EppCommandOperations( registry.getCurrency(), - getRenewFeeOrCredit(registry, domainName, clientIdentifier, date, years, eppInput)); + getRenewFeeOrCredit(registry, domainName, clientId, date, years, eppInput)); } /** Returns a new restore price for the pricer. */ public static EppCommandOperations getRestorePrice( Registry registry, String domainName, - String clientIdentifier, + String clientId, DateTime date, EppInput eppInput) throws EppException { return new EppCommandOperations( registry.getCurrency(), - getRenewFeeOrCredit(registry, domainName, clientIdentifier, date, 1, eppInput), + getRenewFeeOrCredit(registry, domainName, clientId, date, 1, eppInput), Fee.create(registry.getStandardRestoreCost().getAmount(), FeeType.RESTORE)); } @@ -223,20 +223,20 @@ public final class TldSpecificLogicProxy { public static EppCommandOperations getTransferPrice( Registry registry, String domainName, - String clientIdentifier, + String clientId, DateTime transferDate, int years, EppInput eppInput) throws EppException { // Currently, all transfer prices = renew prices, so just pass through. return getRenewPrice( - registry, domainName, clientIdentifier, transferDate, years, eppInput); + registry, domainName, clientId, transferDate, years, eppInput); } /** Returns a new update price for the pricer. */ public static EppCommandOperations getUpdatePrice( Registry registry, String domainName, - String clientIdentifier, + String clientId, DateTime date, EppInput eppInput) throws EppException { CurrencyUnit currency = registry.getCurrency(); @@ -252,7 +252,7 @@ public final class TldSpecificLogicProxy { throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName); } feeOrCredit = - extraFlowLogic.get().getUpdateFeeOrCredit(domain, clientIdentifier, date, eppInput); + extraFlowLogic.get().getUpdateFeeOrCredit(domain, clientId, date, eppInput); } else { feeOrCredit = Fee.create(Money.zero(registry.getCurrency()).getAmount(), FeeType.UPDATE); } diff --git a/java/google/registry/loadtest/LoadTestAction.java b/java/google/registry/loadtest/LoadTestAction.java index 0928bc31d..c443d98a8 100644 --- a/java/google/registry/loadtest/LoadTestAction.java +++ b/java/google/registry/loadtest/LoadTestAction.java @@ -284,7 +284,7 @@ public class LoadTestAction implements Runnable { .payload( Joiner.on('&').withKeyValueSeparator("=").join( ImmutableMap.of( - "clientIdentifier", clientId, + "clientId", clientId, "superuser", false, "dryRun", false, "xml", urlEncode(xmls.get(i)))), diff --git a/java/google/registry/model/registrar/Registrar.java b/java/google/registry/model/registrar/Registrar.java index b97431d23..3d1741a74 100644 --- a/java/google/registry/model/registrar/Registrar.java +++ b/java/google/registry/model/registrar/Registrar.java @@ -353,7 +353,7 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable return salt; }}; - public String getClientIdentifier() { + public String getClientId() { return clientIdentifier; } @@ -570,12 +570,12 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable super(instance); } - public Builder setClientIdentifier(String clientIdentifier) { + public Builder setClientId(String clientId) { // Client 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(clientIdentifier.length() >= 3 && clientIdentifier.length() <= 16, + checkArgument(clientId.length() >= 3 && clientId.length() <= 16, "Client identifier must be 3-16 characters long."); - getInstance().clientIdentifier = clientIdentifier; + getInstance().clientIdentifier = clientId; return this; } diff --git a/java/google/registry/rde/RegistrarToXjcConverter.java b/java/google/registry/rde/RegistrarToXjcConverter.java index fa0517860..c1e3024dd 100644 --- a/java/google/registry/rde/RegistrarToXjcConverter.java +++ b/java/google/registry/rde/RegistrarToXjcConverter.java @@ -49,7 +49,7 @@ final class RegistrarToXjcConverter { // the registrar object. This has a superordinate relationship // to a subordinate , or of domain, contact and // host objects. - bean.setId(model.getClientIdentifier()); + bean.setId(model.getClientId()); // o An element that contains the name of the registrar. bean.setName(model.getRegistrarName()); diff --git a/java/google/registry/tools/CreateAnchorTenantCommand.java b/java/google/registry/tools/CreateAnchorTenantCommand.java index 0f08fc267..f4c376e34 100644 --- a/java/google/registry/tools/CreateAnchorTenantCommand.java +++ b/java/google/registry/tools/CreateAnchorTenantCommand.java @@ -41,7 +41,7 @@ final class CreateAnchorTenantCommand extends MutatingEppToolCommand implements names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( names = {"-n", "--domain_name"}, @@ -89,7 +89,7 @@ final class CreateAnchorTenantCommand extends MutatingEppToolCommand implements setSoyTemplate(CreateAnchorTenantSoyInfo.getInstance(), CreateAnchorTenantSoyInfo.CREATEANCHORTENANT); - addSoyRecord(clientIdentifier, new SoyMapData( + addSoyRecord(clientId, new SoyMapData( "domainName", domainName, "contactId", contact, "reason", reason, diff --git a/java/google/registry/tools/CreateAuctionCreditsCommand.java b/java/google/registry/tools/CreateAuctionCreditsCommand.java index 4baf76dcf..1739d02e0 100644 --- a/java/google/registry/tools/CreateAuctionCreditsCommand.java +++ b/java/google/registry/tools/CreateAuctionCreditsCommand.java @@ -190,7 +190,7 @@ final class CreateAuctionCreditsCommand extends MutatingCommand { Money totalAmount = BigMoney.total(currency, creditMap.get(registrar)).toMoney(RoundingMode.UP); System.out.printf("Total auction credit balance for %s: %s\n", - registrar.getClientIdentifier(), totalAmount); + registrar.getClientId(), totalAmount); // Create the actual credit and initial credit balance. RegistrarCredit credit = new RegistrarCredit.Builder() diff --git a/java/google/registry/tools/CreateContactCommand.java b/java/google/registry/tools/CreateContactCommand.java index c9fa8619f..6dc756f26 100644 --- a/java/google/registry/tools/CreateContactCommand.java +++ b/java/google/registry/tools/CreateContactCommand.java @@ -35,7 +35,7 @@ final class CreateContactCommand extends MutatingEppToolCommand implements Gtech names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( names = {"-i", "--id"}, @@ -116,7 +116,7 @@ final class CreateContactCommand extends MutatingEppToolCommand implements Gtech "Addresses must contain at most 3 street lines."); setSoyTemplate(ContactCreateSoyInfo.getInstance(), ContactCreateSoyInfo.CONTACTCREATE); - addSoyRecord(clientIdentifier, new SoyMapData( + addSoyRecord(clientId, new SoyMapData( "id", id, "name", name, "org", org, diff --git a/java/google/registry/tools/CreateDomainCommand.java b/java/google/registry/tools/CreateDomainCommand.java index b1defb5a8..80e477b4c 100644 --- a/java/google/registry/tools/CreateDomainCommand.java +++ b/java/google/registry/tools/CreateDomainCommand.java @@ -33,7 +33,7 @@ final class CreateDomainCommand extends MutatingEppToolCommand implements GtechC names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( names = "--domain", @@ -88,7 +88,7 @@ final class CreateDomainCommand extends MutatingEppToolCommand implements GtechC checkArgument(ns == null || ns.size() <= 13, "There can be at most 13 nameservers."); setSoyTemplate(DomainCreateSoyInfo.getInstance(), DomainCreateSoyInfo.DOMAINCREATE); - addSoyRecord(clientIdentifier, new SoyMapData( + addSoyRecord(clientId, new SoyMapData( "domain", domain, "period", period == null ? null : period.toString(), "ns", ns, diff --git a/java/google/registry/tools/CreateHostCommand.java b/java/google/registry/tools/CreateHostCommand.java index fbb377fa5..6bdd4048e 100644 --- a/java/google/registry/tools/CreateHostCommand.java +++ b/java/google/registry/tools/CreateHostCommand.java @@ -36,7 +36,7 @@ final class CreateHostCommand extends MutatingEppToolCommand implements GtechCom names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as.", required = true) - String clientIdentifier; + String clientId; @Parameter( names = "--host", @@ -67,7 +67,7 @@ final class CreateHostCommand extends MutatingEppToolCommand implements GtechCom } } addSoyRecord( - clientIdentifier, + clientId, new SoyMapData( "hostname", hostName, "ipv4addresses", ipv4Addresses.build(), diff --git a/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java b/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java index f9317889c..a81c16ad1 100644 --- a/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java +++ b/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java @@ -242,7 +242,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand { /** Returns the existing registrar (for update) or null (for creates). */ @Nullable - abstract Registrar getOldRegistrar(String clientIdentifier); + abstract Registrar getOldRegistrar(String clientId); protected void initRegistrarCommand() throws Exception {} @@ -250,10 +250,10 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand { protected final void init() throws Exception { initRegistrarCommand(); DateTime now = DateTime.now(UTC); - for (String clientIdentifier : mainParameters) { - Registrar oldRegistrar = getOldRegistrar(clientIdentifier); + for (String clientId : mainParameters) { + Registrar oldRegistrar = getOldRegistrar(clientId); Registrar.Builder builder = (oldRegistrar == null) - ? new Registrar.Builder().setClientIdentifier(clientIdentifier) + ? new Registrar.Builder().setClientId(clientId) : oldRegistrar.asBuilder(); if (!isNullOrEmpty(password)) { @@ -341,7 +341,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand { checkState(balance.isZero(), "Refusing to change billing method on Registrar '%s' from %s to %s" + " because current balance is non-zero: %s", - clientIdentifier, oldRegistrar.getBillingMethod(), billingMethod, balances); + clientId, oldRegistrar.getBillingMethod(), billingMethod, balances); } } builder.setBillingMethod(billingMethod); diff --git a/java/google/registry/tools/CreateRegistrarCommand.java b/java/google/registry/tools/CreateRegistrarCommand.java index 3d0b5d9b8..99d6fab3e 100644 --- a/java/google/registry/tools/CreateRegistrarCommand.java +++ b/java/google/registry/tools/CreateRegistrarCommand.java @@ -78,30 +78,27 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand @Nullable @Override - Registrar getOldRegistrar(final String clientIdentifier) { - checkArgument(clientIdentifier.length() >= 3, - String.format("Client identifier (%s) is too short", clientIdentifier)); - checkArgument(clientIdentifier.length() <= 16, - String.format("Client identifier (%s) is too long", clientIdentifier)); + Registrar getOldRegistrar(final String clientId) { + checkArgument(clientId.length() >= 3, "Client identifier (%s) is too short", clientId); + checkArgument(clientId.length() <= 16, "Client identifier (%s) is too long", clientId); if (Registrar.Type.REAL.equals(registrarType)) { - checkArgument(clientIdentifier.equals(normalizeClientId(clientIdentifier)), - String.format( - "Client identifier (%s) can only contain lowercase letters, numbers, and hyphens", - clientIdentifier)); + checkArgument( + clientId.equals(normalizeClientId(clientId)), + "Client identifier (%s) can only contain lowercase letters, numbers, and hyphens", + clientId); } - checkState(Registrar.loadByClientId(clientIdentifier) == null, - "Registrar %s already exists", clientIdentifier); + checkState(Registrar.loadByClientId(clientId) == null, "Registrar %s already exists", clientId); List collisions = newArrayList(filter(Registrar.loadAll(), new Predicate() { @Override public boolean apply(Registrar registrar) { - return normalizeClientId(registrar.getClientIdentifier()).equals(clientIdentifier); + return normalizeClientId(registrar.getClientId()).equals(clientId); }})); if (!collisions.isEmpty()) { throw new IllegalArgumentException(String.format( "The registrar client identifier %s normalizes identically to existing registrar %s", - clientIdentifier, - collisions.get(0).getClientIdentifier())); + clientId, + collisions.get(0).getClientId())); } return null; } @@ -118,7 +115,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand try { // We know it is safe to use the only main parameter here because initRegistrarCommand has // already verified that there is only one, and getOldRegistrar has already verified that a - // registrar with this clientIdentifier doesn't already exist. + // registrar with this clientId doesn't already exist. CreateRegistrarGroupsCommand.executeOnServer(connection, getOnlyElement(mainParameters)); } catch (Exception e) { return "\nRegistrar created, but groups creation failed with error:\n" + e; diff --git a/java/google/registry/tools/CreateRegistrarGroupsCommand.java b/java/google/registry/tools/CreateRegistrarGroupsCommand.java index b66336997..67749f562 100644 --- a/java/google/registry/tools/CreateRegistrarGroupsCommand.java +++ b/java/google/registry/tools/CreateRegistrarGroupsCommand.java @@ -72,10 +72,10 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand } /** Calls the server endpoint to create groups for the specified registrar client id. */ - static void executeOnServer(Connection connection, String clientIdentifier) throws IOException { + static void executeOnServer(Connection connection, String clientId) throws IOException { connection.send( CreateGroupsAction.PATH, - ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, clientIdentifier), + ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, clientId), MediaType.PLAIN_TEXT_UTF_8, new byte[0]); } @@ -85,7 +85,7 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand for (Registrar registrar : registrars) { connection.send( CreateGroupsAction.PATH, - ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, registrar.getClientIdentifier()), + ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, registrar.getClientId()), MediaType.PLAIN_TEXT_UTF_8, new byte[0]); } diff --git a/java/google/registry/tools/DeleteDomainCommand.java b/java/google/registry/tools/DeleteDomainCommand.java index 5380d4974..ea8fe5fc7 100644 --- a/java/google/registry/tools/DeleteDomainCommand.java +++ b/java/google/registry/tools/DeleteDomainCommand.java @@ -28,7 +28,7 @@ final class DeleteDomainCommand extends MutatingEppToolCommand implements GtechC names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( names = {"-n", "--domain_name"}, @@ -51,7 +51,7 @@ final class DeleteDomainCommand extends MutatingEppToolCommand implements GtechC @Override protected void initMutatingEppToolCommand() { setSoyTemplate(DeleteDomainSoyInfo.getInstance(), DeleteDomainSoyInfo.DELETEDOMAIN); - addSoyRecord(clientIdentifier, new SoyMapData( + addSoyRecord(clientId, new SoyMapData( "domainName", domainName, "reason", reason, "requestedByRegistrar", requestedByRegistrar)); diff --git a/java/google/registry/tools/DomainApplicationInfoCommand.java b/java/google/registry/tools/DomainApplicationInfoCommand.java index 891dcb804..c20ba8110 100644 --- a/java/google/registry/tools/DomainApplicationInfoCommand.java +++ b/java/google/registry/tools/DomainApplicationInfoCommand.java @@ -32,7 +32,7 @@ final class DomainApplicationInfoCommand extends EppToolCommand implements Gtech names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( names = {"--id"}, @@ -60,7 +60,7 @@ final class DomainApplicationInfoCommand extends EppToolCommand implements Gtech setSoyTemplate( DomainApplicationInfoSoyInfo.getInstance(), DomainApplicationInfoSoyInfo.DOMAINAPPLICATIONINFO); - addSoyRecord(clientIdentifier, new SoyMapData( + addSoyRecord(clientId, new SoyMapData( "domainName", domainName, "id", id, "phase", launchPhase.getPhase(), diff --git a/java/google/registry/tools/DomainCheckClaimsCommand.java b/java/google/registry/tools/DomainCheckClaimsCommand.java index 375804afc..54bc92842 100644 --- a/java/google/registry/tools/DomainCheckClaimsCommand.java +++ b/java/google/registry/tools/DomainCheckClaimsCommand.java @@ -31,7 +31,7 @@ final class DomainCheckClaimsCommand extends EppToolCommand implements GtechComm names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( description = "Domain(s) to check.", @@ -44,7 +44,7 @@ final class DomainCheckClaimsCommand extends EppToolCommand implements GtechComm for (Collection values : domainNameMap.asMap().values()) { setSoyTemplate( DomainCheckClaimsSoyInfo.getInstance(), DomainCheckClaimsSoyInfo.DOMAINCHECKCLAIMS); - addSoyRecord(clientIdentifier, new SoyMapData("domainNames", values)); + addSoyRecord(clientId, new SoyMapData("domainNames", values)); } } } diff --git a/java/google/registry/tools/DomainCheckCommand.java b/java/google/registry/tools/DomainCheckCommand.java index b3d973013..729c76124 100644 --- a/java/google/registry/tools/DomainCheckCommand.java +++ b/java/google/registry/tools/DomainCheckCommand.java @@ -31,7 +31,7 @@ final class DomainCheckCommand extends EppToolCommand implements GtechCommand { names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( description = "List of domains to check.", @@ -43,7 +43,7 @@ final class DomainCheckCommand extends EppToolCommand implements GtechCommand { Multimap domainNameMap = validateAndGroupDomainNamesByTld(mainParameters); for (Collection values : domainNameMap.asMap().values()) { setSoyTemplate(DomainCheckSoyInfo.getInstance(), DomainCheckSoyInfo.DOMAINCHECK); - addSoyRecord(clientIdentifier, new SoyMapData("domainNames", values)); + addSoyRecord(clientId, new SoyMapData("domainNames", values)); } } } diff --git a/java/google/registry/tools/DomainCheckFeeCommand.java b/java/google/registry/tools/DomainCheckFeeCommand.java index ea15a3d82..1cdd03589 100644 --- a/java/google/registry/tools/DomainCheckFeeCommand.java +++ b/java/google/registry/tools/DomainCheckFeeCommand.java @@ -31,7 +31,7 @@ final class DomainCheckFeeCommand extends EppToolCommand implements GtechCommand names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( description = "Domain(s) to check.", @@ -43,7 +43,7 @@ final class DomainCheckFeeCommand extends EppToolCommand implements GtechCommand Multimap domainNameMap = validateAndGroupDomainNamesByTld(mainParameters); for (Collection values : domainNameMap.asMap().values()) { setSoyTemplate(DomainCheckFeeSoyInfo.getInstance(), DomainCheckFeeSoyInfo.DOMAINCHECKFEE); - addSoyRecord(clientIdentifier, new SoyMapData("domainNames", values)); + addSoyRecord(clientId, new SoyMapData("domainNames", values)); } } } diff --git a/java/google/registry/tools/EppToolCommand.java b/java/google/registry/tools/EppToolCommand.java index 517b71a62..ef8de4828 100644 --- a/java/google/registry/tools/EppToolCommand.java +++ b/java/google/registry/tools/EppToolCommand.java @@ -141,11 +141,11 @@ abstract class EppToolCommand extends ConfirmingCommand implements ServerSideCom for (XmlEppParameters command : commands) { Map params = new HashMap<>(); params.put("dryRun", dryRun); - params.put("clientIdentifier", command.clientId); + params.put("clientId", command.clientId); params.put("superuser", superuser); params.put("xml", URLEncoder.encode(command.xml, UTF_8.toString())); - String requestBody = Joiner.on('&').withKeyValueSeparator("=") - .join(filterValues(params, notNull())); + String requestBody = + Joiner.on('&').withKeyValueSeparator("=").join(filterValues(params, notNull())); responses.add(nullToEmpty(connection.send( "/_dr/epptool", ImmutableMap.of(), diff --git a/java/google/registry/tools/ExecuteEppCommand.java b/java/google/registry/tools/ExecuteEppCommand.java index ce5e27202..479d93141 100644 --- a/java/google/registry/tools/ExecuteEppCommand.java +++ b/java/google/registry/tools/ExecuteEppCommand.java @@ -38,7 +38,7 @@ final class ExecuteEppCommand extends MutatingEppToolCommand { names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @NonFinalForTesting private static InputStream stdin = System.in; @@ -47,10 +47,10 @@ final class ExecuteEppCommand extends MutatingEppToolCommand { protected void initMutatingEppToolCommand() throws IOException { if (mainParameters.isEmpty()) { addXmlCommand( - clientIdentifier, CharStreams.toString(new InputStreamReader(stdin, UTF_8))); + clientId, CharStreams.toString(new InputStreamReader(stdin, UTF_8))); } else { for (String command : mainParameters) { - addXmlCommand(clientIdentifier, Files.toString(new File(command), UTF_8)); + addXmlCommand(clientId, Files.toString(new File(command), UTF_8)); } } } diff --git a/java/google/registry/tools/GenerateAuctionDataCommand.java b/java/google/registry/tools/GenerateAuctionDataCommand.java index eca248d18..b00260e66 100644 --- a/java/google/registry/tools/GenerateAuctionDataCommand.java +++ b/java/google/registry/tools/GenerateAuctionDataCommand.java @@ -240,7 +240,7 @@ final class GenerateAuctionDataCommand implements RemoteApiCommand, GtechCommand // Registrar Address 2|Registrar City|Registrar Province|Registrar Postal Code| // Registrar Country|Registrar Email|Registrar Telephone return Joiner.on('|').join(ImmutableList.of( - registrar.getClientIdentifier(), + registrar.getClientId(), contact.isPresent() ? contact.get().getName() : "N/A", nullToEmpty(registrar.getRegistrarName()), Iterables.getFirst(street, ""), diff --git a/java/google/registry/tools/GetRegistrarCommand.java b/java/google/registry/tools/GetRegistrarCommand.java index b968d1a74..22b2ec067 100644 --- a/java/google/registry/tools/GetRegistrarCommand.java +++ b/java/google/registry/tools/GetRegistrarCommand.java @@ -34,8 +34,8 @@ final class GetRegistrarCommand implements RemoteApiCommand, GtechCommand { @Override public void run() { - for (String clientIdentifier : mainParameters) { - Registrar registrar = Registrar.loadByClientId(clientIdentifier); + for (String clientId : mainParameters) { + Registrar registrar = Registrar.loadByClientId(clientId); checkState(registrar != null, "Registrar does not exist"); System.out.println(registrar); diff --git a/java/google/registry/tools/ListCreditsCommand.java b/java/google/registry/tools/ListCreditsCommand.java index b683e9d80..1939c1c36 100644 --- a/java/google/registry/tools/ListCreditsCommand.java +++ b/java/google/registry/tools/ListCreditsCommand.java @@ -43,7 +43,7 @@ final class ListCreditsCommand implements RemoteApiCommand, GtechCommand { for (Registrar registrar : Registrar.loadAll()) { ImmutableList creditStrings = createCreditStrings(registrar); if (!creditStrings.isEmpty()) { - System.out.println(registrar.getClientIdentifier()); + System.out.println(registrar.getClientId()); System.out.print(Joiner.on("").join(creditStrings)); System.out.println(); } diff --git a/java/google/registry/tools/RegistrarContactCommand.java b/java/google/registry/tools/RegistrarContactCommand.java index 7f54123d2..12900dba9 100644 --- a/java/google/registry/tools/RegistrarContactCommand.java +++ b/java/google/registry/tools/RegistrarContactCommand.java @@ -139,9 +139,9 @@ final class RegistrarContactCommand extends MutatingCommand implements GtechComm protected void init() throws Exception { checkArgument(mainParameters.size() == 1, "Must specify exactly one client identifier: %s", ImmutableList.copyOf(mainParameters)); - String clientIdentifier = mainParameters.get(0); - Registrar registrar = checkNotNull( - Registrar.loadByClientId(clientIdentifier), "Registrar %s not found", clientIdentifier); + String clientId = mainParameters.get(0); + Registrar registrar = + checkNotNull(Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); contactTypes = newHashSet( transform( diff --git a/java/google/registry/tools/UpdateRegistrarCommand.java b/java/google/registry/tools/UpdateRegistrarCommand.java index e31b9ccbe..598c883e2 100644 --- a/java/google/registry/tools/UpdateRegistrarCommand.java +++ b/java/google/registry/tools/UpdateRegistrarCommand.java @@ -24,9 +24,10 @@ import google.registry.tools.Command.GtechCommand; @Parameters(separators = " =", commandDescription = "Update registrar account(s)") final class UpdateRegistrarCommand extends CreateOrUpdateRegistrarCommand implements GtechCommand { + @Override - Registrar getOldRegistrar(String clientIdentifier) { + Registrar getOldRegistrar(String clientId) { return checkNotNull( - Registrar.loadByClientId(clientIdentifier), "Registrar %s not found", clientIdentifier); + Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); } } diff --git a/java/google/registry/tools/UpdateServerLocksCommand.java b/java/google/registry/tools/UpdateServerLocksCommand.java index b15120517..ec9df42eb 100644 --- a/java/google/registry/tools/UpdateServerLocksCommand.java +++ b/java/google/registry/tools/UpdateServerLocksCommand.java @@ -40,7 +40,7 @@ final class UpdateServerLocksCommand extends MutatingEppToolCommand implements G names = {"-c", "--client"}, description = "Client identifier of the registrar to execute the command as", required = true) - String clientIdentifier; + String clientId; @Parameter( names = {"-n", "--domain_name"}, @@ -105,7 +105,7 @@ final class UpdateServerLocksCommand extends MutatingEppToolCommand implements G "Add and remove actions are both empty"); setSoyTemplate( UpdateServerLocksSoyInfo.getInstance(), UpdateServerLocksSoyInfo.UPDATESERVERLOCKS); - addSoyRecord(clientIdentifier, new SoyMapData( + addSoyRecord(clientId, new SoyMapData( "domainName", domainName, "locksToApply", valuesToApply, "locksToRemove", valuesToRemove, diff --git a/java/google/registry/tools/ValidateLoginCredentialsCommand.java b/java/google/registry/tools/ValidateLoginCredentialsCommand.java index 4092869ee..98200f99b 100644 --- a/java/google/registry/tools/ValidateLoginCredentialsCommand.java +++ b/java/google/registry/tools/ValidateLoginCredentialsCommand.java @@ -41,7 +41,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo names = {"-c", "--client"}, description = "Client identifier of the registrar to test", required = true) - private String clientIdentifier; + private String clientId; @Parameter( names = {"-p", "--password"}, @@ -76,7 +76,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo clientCertificateHash = getCertificateHash( loadCertificate(new String(Files.readAllBytes(clientCertificatePath), US_ASCII))); } - Registrar registrar = Registrar.loadByClientId(clientIdentifier); + Registrar registrar = Registrar.loadByClientId(clientId); new TlsCredentials(clientCertificateHash, Optional.of(clientIpAddress), null) .validate(registrar, password); checkState(!registrar.getState().equals(Registrar.State.PENDING), "Account pending"); diff --git a/java/google/registry/tools/VerifyOteCommand.java b/java/google/registry/tools/VerifyOteCommand.java index 1b99e50af..a327e7cb7 100644 --- a/java/google/registry/tools/VerifyOteCommand.java +++ b/java/google/registry/tools/VerifyOteCommand.java @@ -108,7 +108,7 @@ final class VerifyOteCommand implements ServerSideCommand, GtechCommand { .transform(new Function() { @Override public String apply(Registrar registrar) { - String name = registrar.getClientIdentifier(); + String name = registrar.getClientId(); // 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/java/google/registry/tools/server/CreateGroupsAction.java b/java/google/registry/tools/server/CreateGroupsAction.java index fdd3f7f79..dd7c6b3d5 100644 --- a/java/google/registry/tools/server/CreateGroupsAction.java +++ b/java/google/registry/tools/server/CreateGroupsAction.java @@ -73,7 +73,7 @@ public class CreateGroupsAction implements Runnable { public Optional apply(Type type) { try { String groupKey = getGroupEmailAddressForContactType( - registrar.getClientIdentifier(), type, publicDomainName); + registrar.getClientId(), type, publicDomainName); String parentGroup = getGroupEmailAddressForContactType("registrar", type, publicDomainName); // Creates the group, then adds it as a member to the global registrar group for diff --git a/java/google/registry/ui/server/registrar/ConsoleUiAction.java b/java/google/registry/ui/server/registrar/ConsoleUiAction.java index e2c31b65c..b942d2502 100644 --- a/java/google/registry/ui/server/registrar/ConsoleUiAction.java +++ b/java/google/registry/ui/server/registrar/ConsoleUiAction.java @@ -91,7 +91,7 @@ public final class ConsoleUiAction implements Runnable { Registrar registrar = Registrar.loadByClientId(sessionUtils.getRegistrarClientId(req)); SoyMapData data = new SoyMapData(); data.put("xsrfToken", XsrfTokenManager.generateToken(EppConsoleAction.XSRF_SCOPE)); - data.put("clientId", registrar.getClientIdentifier()); + data.put("clientId", registrar.getClientId()); data.put("username", userService.getCurrentUser().getNickname()); data.put("isAdmin", userService.isUserAdmin()); data.put("logoutUrl", userService.createLogoutURL(PATH)); diff --git a/java/google/registry/ui/server/registrar/RegistrarPaymentAction.java b/java/google/registry/ui/server/registrar/RegistrarPaymentAction.java index 4825d27d2..6e532c45d 100644 --- a/java/google/registry/ui/server/registrar/RegistrarPaymentAction.java +++ b/java/google/registry/ui/server/registrar/RegistrarPaymentAction.java @@ -181,7 +181,7 @@ public final class RegistrarPaymentAction implements Runnable, JsonAction { .amount(amount.getAmount()) .paymentMethodNonce(paymentMethodNonce) .merchantAccountId(merchantAccountId) - .customerId(registrar.getClientIdentifier()) + .customerId(registrar.getClientId()) .options() .submitForSettlement(true) .done()); diff --git a/java/google/registry/ui/server/registrar/SessionUtils.java b/java/google/registry/ui/server/registrar/SessionUtils.java index 1be6e4ff3..39997f66b 100644 --- a/java/google/registry/ui/server/registrar/SessionUtils.java +++ b/java/google/registry/ui/server/registrar/SessionUtils.java @@ -83,7 +83,7 @@ public class SessionUtils { return false; } verify(hasAccessToRegistrar(registrar.get(), user.getUserId())); - session.setAttribute(CLIENT_ID_ATTRIBUTE, registrar.get().getClientIdentifier()); + session.setAttribute(CLIENT_ID_ATTRIBUTE, registrar.get().getClientId()); } else { if (!hasAccessToRegistrar(clientId, user.getUserId())) { logger.infofmt("Registrar Console access revoked: %s for %s (%s)", diff --git a/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java b/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java index 5d12e7c6d..247c91a03 100644 --- a/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java +++ b/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java @@ -96,7 +96,7 @@ public class SyncRegistrarsSheetTest { public void testWasRegistrarsModifiedInLastInterval() throws Exception { Duration interval = standardHours(1); persistResource(new Registrar.Builder() - .setClientIdentifier("SomeRegistrar") + .setClientId("SomeRegistrar") .setRegistrarName("Some Registrar Inc.") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) @@ -111,7 +111,7 @@ public class SyncRegistrarsSheetTest { @Test public void testRun() throws Exception { persistResource(new Registrar.Builder() - .setClientIdentifier("anotherregistrar") + .setClientId("anotherregistrar") .setRegistrarName("Another Registrar LLC") .setType(Registrar.Type.REAL) .setIanaIdentifier(1L) @@ -141,7 +141,7 @@ public class SyncRegistrarsSheetTest { .build()); Registrar registrar = new Registrar.Builder() - .setClientIdentifier("aaaregistrar") + .setClientId("aaaregistrar") .setRegistrarName("AAA Registrar Inc.") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) @@ -304,7 +304,7 @@ public class SyncRegistrarsSheetTest { @Test public void testRun_missingValues_stillWorks() throws Exception { persistResource(new Registrar.Builder() - .setClientIdentifier("SomeRegistrar") + .setClientId("SomeRegistrar") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) .build()); diff --git a/javatests/google/registry/flows/EppToolActionTest.java b/javatests/google/registry/flows/EppToolActionTest.java index 62331c453..fca122dc9 100644 --- a/javatests/google/registry/flows/EppToolActionTest.java +++ b/javatests/google/registry/flows/EppToolActionTest.java @@ -32,7 +32,7 @@ public class EppToolActionTest { private void doTest(boolean isDryRun, boolean isSuperuser) { EppToolAction action = new EppToolAction(); - action.clientIdentifier = "ClientIdentifier"; + action.clientId = "ClientIdentifier"; action.isDryRun = isDryRun; action.isSuperuser = isSuperuser; action.eppRequestHandler = mock(EppRequestHandler.class); diff --git a/javatests/google/registry/flows/contact/ContactTransferFlowTestCase.java b/javatests/google/registry/flows/contact/ContactTransferFlowTestCase.java index 27e7cc4db..2f32dfa54 100644 --- a/javatests/google/registry/flows/contact/ContactTransferFlowTestCase.java +++ b/javatests/google/registry/flows/contact/ContactTransferFlowTestCase.java @@ -59,7 +59,7 @@ public class ContactTransferFlowTestCase // Registrar ClientZ is used in tests that need another registrar that definitely doesn't own // the resources in question. persistResource( - AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build()); + AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build()); } /** Adds a contact that has a pending transfer on it from TheRegistrar to NewRegistrar. */ diff --git a/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java index 7585f0b33..89b727fa2 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java @@ -284,7 +284,7 @@ public class DomainApplicationInfoFlowTest public void testFailure_unauthorized() throws Exception { thrown.expect(ResourceNotOwnedException.class); persistResource( - AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build()); + AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build()); sessionMetadata.setClientId("ClientZ"); persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); runFlow(); diff --git a/javatests/google/registry/flows/domain/DomainInfoFlowTest.java b/javatests/google/registry/flows/domain/DomainInfoFlowTest.java index 3d8e1a17b..a9dc4419d 100644 --- a/javatests/google/registry/flows/domain/DomainInfoFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainInfoFlowTest.java @@ -70,7 +70,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase // Registrar ClientZ is used in tests that need another registrar that definitely doesn't own // the resources in question. persistResource( - AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build()); + AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build()); } static DomainResource persistWithPendingTransfer(DomainResource domain) { diff --git a/javatests/google/registry/flows/domain/TldSpecificLogicProxyTest.java b/javatests/google/registry/flows/domain/TldSpecificLogicProxyTest.java index bf56cd5bd..fb475f7a0 100644 --- a/javatests/google/registry/flows/domain/TldSpecificLogicProxyTest.java +++ b/javatests/google/registry/flows/domain/TldSpecificLogicProxyTest.java @@ -100,7 +100,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { public void test_eap() throws Exception { TldSpecificLogicProxy.EppCommandOperations createPrice = TldSpecificLogicProxy.getCreatePrice( - Registry.get("eap"), "example.eap", "clientIdentifier", clock.nowUtc(), 1, null); + Registry.get("eap"), "example.eap", "clientId", clock.nowUtc(), 1, null); Range eapValidPeriod = Range.closedOpen(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1)); assertThat(createPrice.getTotalCost()).isEqualTo(basicCreateCost.plus(Money.of(USD, 100))); @@ -129,7 +129,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { public void test_extraLogic_createPrice() throws Exception { TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.getCreatePrice( - Registry.get("test"), "create-54.test", "clientIdentifier", clock.nowUtc(), 3, null); + Registry.get("test"), "create-54.test", "clientId", clock.nowUtc(), 3, null); assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD); assertThat(price.getFees()).hasSize(1); assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(54)); @@ -142,7 +142,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { persistActiveDomain("renew--13.test"); TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.getRenewPrice( - Registry.get("test"), "renew--13.test", "clientIdentifier", clock.nowUtc(), 1, null); + Registry.get("test"), "renew--13.test", "clientId", clock.nowUtc(), 1, null); assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD); assertThat(price.getFees()).isEmpty(); assertThat(price.getCredits()).hasSize(1); @@ -154,7 +154,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { public void test_extraLogic_renewPrice_noDomain() throws Exception { thrown.expect(ResourceToMutateDoesNotExistException.class); TldSpecificLogicProxy.getRenewPrice( - Registry.get("test"), "renew--13.test", "clientIdentifier", clock.nowUtc(), 1, null); + Registry.get("test"), "renew--13.test", "clientId", clock.nowUtc(), 1, null); } void persistPendingDeleteDomain(String domainName, DateTime now) throws Exception { @@ -191,7 +191,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { persistPendingDeleteDomain("renew-13.test", clock.nowUtc()); TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.getRestorePrice( - Registry.get("test"), "renew-13.test", "clientIdentifier", clock.nowUtc(), null); + Registry.get("test"), "renew-13.test", "clientId", clock.nowUtc(), null); assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD); assertThat(price.getFees()).hasSize(2); assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(13)); @@ -204,7 +204,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { public void test_extraLogic_restorePrice_noDomain() throws Exception { thrown.expect(ResourceToMutateDoesNotExistException.class); TldSpecificLogicProxy.getRestorePrice( - Registry.get("test"), "renew-13.test", "clientIdentifier", clock.nowUtc(), null); + Registry.get("test"), "renew-13.test", "clientId", clock.nowUtc(), null); } @Test @@ -212,7 +212,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { persistActiveDomain("renew-26.test"); TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.getTransferPrice( - Registry.get("test"), "renew-26.test", "clientIdentifier", clock.nowUtc(), 2, null); + Registry.get("test"), "renew-26.test", "clientId", clock.nowUtc(), 2, null); assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD); assertThat(price.getFees()).hasSize(1); assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(26)); @@ -225,7 +225,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase { persistActiveDomain("update-13.test"); TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.getUpdatePrice( - Registry.get("test"), "update-13.test", "clientIdentifier", clock.nowUtc(), null); + Registry.get("test"), "update-13.test", "clientId", clock.nowUtc(), null); assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD); assertThat(price.getFees()).hasSize(1); assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(13)); diff --git a/javatests/google/registry/model/domain/TestExtraLogicManager.java b/javatests/google/registry/model/domain/TestExtraLogicManager.java index 674c1ede1..7e5b6732e 100644 --- a/javatests/google/registry/model/domain/TestExtraLogicManager.java +++ b/javatests/google/registry/model/domain/TestExtraLogicManager.java @@ -45,7 +45,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public List getExtensionFlags( - DomainResource domainResource, String clientIdentifier, DateTime asOfDate) { + DomainResource domainResource, String clientId, DateTime asOfDate) { // Take the part before the period, split by dashes, and treat each part after the first as // a flag. List components = @@ -55,7 +55,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { return components.subList(1, components.size()); } - BaseFee domainNameToFeeOrCredit(String domainName) { + BaseFee domainNameToFeeOrCredit(String domainName) { // The second-level domain should be of the form "description-price", where description is the // description string of the fee or credit, and price is the price (credit if negative, fee // otherwise). To make sure this is a valid domain name, don't use any spaces, and limit prices @@ -79,7 +79,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public BaseFee getCreateFeeOrCredit( String domainName, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput) throws EppException { @@ -93,7 +93,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public void performAdditionalDomainCreateLogic( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput, @@ -113,7 +113,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public void performAdditionalDomainDeleteLogic( DomainResource domainResource, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput, HistoryEntry historyEntry) throws EppException { @@ -124,7 +124,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public BaseFee getRenewFeeOrCredit( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput) throws EppException { @@ -138,7 +138,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public void performAdditionalDomainRenewLogic( DomainResource domainResource, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput, @@ -153,7 +153,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public void performAdditionalDomainRestoreLogic( DomainResource domainResource, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput, HistoryEntry historyEntry) throws EppException { @@ -167,7 +167,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public void performAdditionalDomainTransferLogic( DomainResource domainResource, - String clientIdentifier, + String clientId, DateTime asOfDate, int years, EppInput eppInput, @@ -188,7 +188,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public BaseFee getUpdateFeeOrCredit( DomainResource domain, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput) throws EppException { return domainNameToFeeOrCredit(domain.getFullyQualifiedDomainName()); @@ -201,7 +201,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { @Override public void performAdditionalDomainUpdateLogic( DomainResource domainResource, - String clientIdentifier, + String clientId, DateTime asOfDate, EppInput eppInput, HistoryEntry historyEntry) throws EppException { diff --git a/javatests/google/registry/model/ofy/OfyFilterTest.java b/javatests/google/registry/model/ofy/OfyFilterTest.java index a8b2cbc57..d7769890f 100644 --- a/javatests/google/registry/model/ofy/OfyFilterTest.java +++ b/javatests/google/registry/model/ofy/OfyFilterTest.java @@ -16,6 +16,7 @@ package google.registry.model.ofy; import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ofy.ObjectifyService.initOfy; +import static org.junit.Assert.fail; import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig; import com.google.appengine.tools.development.testing.LocalServiceTestHelper; @@ -23,6 +24,8 @@ import com.googlecode.objectify.Key; import com.googlecode.objectify.ObjectifyFactory; import com.googlecode.objectify.ObjectifyFilter; import com.googlecode.objectify.ObjectifyService; +import com.googlecode.objectify.annotation.Entity; +import com.googlecode.objectify.annotation.Id; import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar.Type; import google.registry.testing.ExceptionRule; @@ -73,15 +76,14 @@ public class OfyFilterTest { */ @Test public void testFilterRegistersTypes() throws Exception { - Registrar registrar = new Registrar.Builder() - .setType(Type.TEST) - .setClientIdentifier("registrar") - .build(); + UnregisteredEntity entity = new UnregisteredEntity(5L); try { - Key.create(registrar); + Key.create(entity); + fail("Should not be able to create key for unregistered entity"); } catch (IllegalStateException e) { assertThat(e).hasMessage( - "class google.registry.model.registrar.Registrar has not been registered"); + "class google.registry.model.ofy.OfyFilterTest$UnregisteredEntity " + + "has not been registered"); } } @@ -89,10 +91,18 @@ public class OfyFilterTest { @Test public void testKeyCreateAfterFilter() throws Exception { new OfyFilter().init(null); - Registrar registrar = new Registrar.Builder() - .setType(Type.TEST) - .setClientIdentifier("registrar") - .build(); + Registrar registrar = + new Registrar.Builder().setType(Type.TEST).setClientId("clientId").build(); Key.create(registrar); } + + @Entity + private static class UnregisteredEntity { + + @Id long id; + + UnregisteredEntity(long id) { + this.id = id; + } + } } diff --git a/javatests/google/registry/model/registrar/RegistrarTest.java b/javatests/google/registry/model/registrar/RegistrarTest.java index e1452e5a5..33a16e6d0 100644 --- a/javatests/google/registry/model/registrar/RegistrarTest.java +++ b/javatests/google/registry/model/registrar/RegistrarTest.java @@ -52,7 +52,7 @@ public class RegistrarTest extends EntityTestCase { // Set up a new persisted registrar entity. registrar = cloneAndSetAutoTimestamps( new Registrar.Builder() - .setClientIdentifier("registrar") + .setClientId("registrar") .setRegistrarName("full registrar name") .setType(Type.REAL) .setState(State.PENDING) @@ -119,7 +119,7 @@ public class RegistrarTest extends EntityTestCase { public void testPersistence() throws Exception { assertThat(registrar).isEqualTo(ofy().load().type(Registrar.class) .parent(EntityGroupRoot.getCrossTldKey()) - .id(registrar.clientIdentifier) + .id(registrar.getClientId()) .now()); } @@ -147,23 +147,23 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testSuccess_clientIdentifierBounds() throws Exception { - registrar = registrar.asBuilder().setClientIdentifier("abc").build(); - assertThat(registrar.getClientIdentifier()).isEqualTo("abc"); - registrar = registrar.asBuilder().setClientIdentifier("abcdefghijklmnop").build(); - assertThat(registrar.getClientIdentifier()).isEqualTo("abcdefghijklmnop"); + public void testSuccess_clientId_bounds() throws Exception { + registrar = registrar.asBuilder().setClientId("abc").build(); + assertThat(registrar.getClientId()).isEqualTo("abc"); + registrar = registrar.asBuilder().setClientId("abcdefghijklmnop").build(); + assertThat(registrar.getClientId()).isEqualTo("abcdefghijklmnop"); } @Test - public void testFailure_clientIdentifierTooShort() throws Exception { + public void testFailure_clientId_tooShort() throws Exception { thrown.expect(IllegalArgumentException.class); - new Registrar.Builder().setClientIdentifier("ab"); + new Registrar.Builder().setClientId("ab"); } @Test - public void testFailure_clientIdentifierTooLong() throws Exception { + public void testFailure_clientId_tooLong() throws Exception { thrown.expect(IllegalArgumentException.class); - new Registrar.Builder().setClientIdentifier("abcdefghijklmnopq"); + new Registrar.Builder().setClientId("abcdefghijklmnopq"); } @Test diff --git a/javatests/google/registry/rde/RegistrarToXjcConverterTest.java b/javatests/google/registry/rde/RegistrarToXjcConverterTest.java index 330fd6d07..3e1fc9936 100644 --- a/javatests/google/registry/rde/RegistrarToXjcConverterTest.java +++ b/javatests/google/registry/rde/RegistrarToXjcConverterTest.java @@ -62,7 +62,7 @@ public class RegistrarToXjcConverterTest extends ShardableTestCase { @Before public void init() { registrar = new Registrar.Builder() - .setClientIdentifier("GoblinMarket") + .setClientId("GoblinMarket") .setRegistrarName("Maids heard the goblins cry: Come buy, come buy:") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) diff --git a/javatests/google/registry/testing/AppEngineRule.java b/javatests/google/registry/testing/AppEngineRule.java index ec95cfcf2..f7c3c2cfc 100644 --- a/javatests/google/registry/testing/AppEngineRule.java +++ b/javatests/google/registry/testing/AppEngineRule.java @@ -187,7 +187,7 @@ public final class AppEngineRule extends ExternalResource { /** Public factory for first Registrar to allow comparison against stored value in unit tests. */ public static Registrar makeRegistrar1() { return makeRegistrarCommon() - .setClientIdentifier("NewRegistrar") + .setClientId("NewRegistrar") .setRegistrarName("New Registrar") .setIanaIdentifier(8L) .setPassword("foo-BAR2") @@ -199,7 +199,7 @@ public final class AppEngineRule extends ExternalResource { /** Public factory for second Registrar to allow comparison against stored value in unit tests. */ public static Registrar makeRegistrar2() { return makeRegistrarCommon() - .setClientIdentifier("TheRegistrar") + .setClientId("TheRegistrar") .setRegistrarName("The Registrar") .setIanaIdentifier(1L) .setPassword("password2") diff --git a/javatests/google/registry/testing/DatastoreHelper.java b/javatests/google/registry/testing/DatastoreHelper.java index 382adc655..5d554b2fe 100644 --- a/javatests/google/registry/testing/DatastoreHelper.java +++ b/javatests/google/registry/testing/DatastoreHelper.java @@ -580,7 +580,7 @@ public class DatastoreHelper { public static Registrar persistNewRegistrar(String clientId, long ianaIdentifier) { return persistSimpleResource( new Registrar.Builder() - .setClientIdentifier(clientId) + .setClientId(clientId) .setType(Registrar.Type.REAL) .setIanaIdentifier(ianaIdentifier) .build()); diff --git a/javatests/google/registry/testing/FullFieldsTestEntityHelper.java b/javatests/google/registry/testing/FullFieldsTestEntityHelper.java index 418a4f6d5..6b9446c8e 100644 --- a/javatests/google/registry/testing/FullFieldsTestEntityHelper.java +++ b/javatests/google/registry/testing/FullFieldsTestEntityHelper.java @@ -57,7 +57,7 @@ public final class FullFieldsTestEntityHelper { public static Registrar makeRegistrar( String clientId, String registrarName, Registrar.State state, Long ianaIdentifier) { Registrar registrar = new Registrar.Builder() - .setClientIdentifier(clientId) + .setClientId(clientId) .setRegistrarName(registrarName) .setType(Registrar.Type.REAL) .setIanaIdentifier(ianaIdentifier) @@ -225,7 +225,7 @@ public final class FullFieldsTestEntityHelper { .setLastEppUpdateTime(DateTime.parse("2009-05-29T20:13:00Z")) .setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z")) .setRegistrationExpirationTime(DateTime.parse("2110-10-08T00:44:59Z")) - .setCurrentSponsorClientId(registrar.getClientIdentifier()) + .setCurrentSponsorClientId(registrar.getClientId()) .setStatusValues(ImmutableSet.of( StatusValue.CLIENT_DELETE_PROHIBITED, StatusValue.CLIENT_RENEW_PROHIBITED, diff --git a/javatests/google/registry/tools/AllocateDomainCommandTest.java b/javatests/google/registry/tools/AllocateDomainCommandTest.java index 3b2747dcb..758334869 100644 --- a/javatests/google/registry/tools/AllocateDomainCommandTest.java +++ b/javatests/google/registry/tools/AllocateDomainCommandTest.java @@ -110,7 +110,7 @@ public class AllocateDomainCommandTest extends CommandTestCase extends C /** Helper to get a new {@link EppToolVerifier} instance. */ EppToolVerifier eppVerifier() { - return new EppToolVerifier().withConnection(connection).withClientIdentifier("NewRegistrar"); + return new EppToolVerifier().withConnection(connection).withClientId("NewRegistrar"); } } diff --git a/javatests/google/registry/tools/EppToolVerifier.java b/javatests/google/registry/tools/EppToolVerifier.java index 756d5fb5e..88a59efce 100644 --- a/javatests/google/registry/tools/EppToolVerifier.java +++ b/javatests/google/registry/tools/EppToolVerifier.java @@ -35,7 +35,7 @@ import org.mockito.ArgumentCaptor; public class EppToolVerifier { private final Connection connection; - private final String clientIdentifier; + private final String clientId; private final boolean superuser; private final boolean dryRun; @@ -44,27 +44,27 @@ public class EppToolVerifier { } private EppToolVerifier( - Connection connection, String clientIdentifier, boolean superuser, boolean dryRun) { + Connection connection, String clientId, boolean superuser, boolean dryRun) { this.connection = connection; - this.clientIdentifier = clientIdentifier; + this.clientId = clientId; this.superuser = superuser; this.dryRun = dryRun; } EppToolVerifier withConnection(Connection connection) { - return new EppToolVerifier(connection, clientIdentifier, superuser, dryRun); + return new EppToolVerifier(connection, clientId, superuser, dryRun); } - EppToolVerifier withClientIdentifier(String clientIdentifier) { - return new EppToolVerifier(connection, clientIdentifier, superuser, dryRun); + EppToolVerifier withClientId(String clientId) { + return new EppToolVerifier(connection, clientId, superuser, dryRun); } EppToolVerifier asSuperuser() { - return new EppToolVerifier(connection, clientIdentifier, true, dryRun); + return new EppToolVerifier(connection, clientId, true, dryRun); } EppToolVerifier asDryRun() { - return new EppToolVerifier(connection, clientIdentifier, superuser, true); + return new EppToolVerifier(connection, clientId, superuser, true); } void verifySent(String... xmlToMatch) throws Exception { @@ -88,7 +88,7 @@ public class EppToolVerifier { readResourceUtf8(getClass(), "testdata/" + xml), URLDecoder.decode(map.get("xml"), UTF_8.toString())); assertThat(map).containsEntry("dryRun", Boolean.toString(dryRun)); - assertThat(map).containsEntry("clientIdentifier", clientIdentifier); + assertThat(map).containsEntry("clientId", clientId); assertThat(map).containsEntry("superuser", Boolean.toString(superuser)); } } diff --git a/javatests/google/registry/tools/MutatingCommandTest.java b/javatests/google/registry/tools/MutatingCommandTest.java index e459b5360..ab735a69b 100644 --- a/javatests/google/registry/tools/MutatingCommandTest.java +++ b/javatests/google/registry/tools/MutatingCommandTest.java @@ -60,12 +60,12 @@ public class MutatingCommandTest { public void init() { registrar1 = persistResource(new Registrar.Builder() .setType(Registrar.Type.REAL) - .setClientIdentifier("Registrar1") + .setClientId("Registrar1") .setIanaIdentifier(1L) .build()); registrar2 = persistResource(new Registrar.Builder() .setType(Registrar.Type.REAL) - .setClientIdentifier("Registrar2") + .setClientId("Registrar2") .setIanaIdentifier(2L) .build()); newRegistrar1 = registrar1.asBuilder().setBillingIdentifier(42L).build(); diff --git a/javatests/google/registry/tools/SetupOteCommandTest.java b/javatests/google/registry/tools/SetupOteCommandTest.java index 3448d046b..479c0f426 100644 --- a/javatests/google/registry/tools/SetupOteCommandTest.java +++ b/javatests/google/registry/tools/SetupOteCommandTest.java @@ -279,7 +279,7 @@ public class SetupOteCommandTest extends CommandTestCase { thrown.expect(IllegalStateException.class); Registrar registrar = Registrar.loadByClientId("TheRegistrar").asBuilder() - .setClientIdentifier("blobio-1") + .setClientId("blobio-1") .setRegistrarName("blobio-1") .build(); persistResource(registrar); diff --git a/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java b/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java index f0a928ac0..eb7e47c18 100644 --- a/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java +++ b/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java @@ -43,7 +43,7 @@ public class UniformRapidSuspensionCommandTest public void initResources() { // Since the command's history client ID must be CharlestonRoad, resave TheRegistrar that way. persistResource(Registrar.loadByClientId("TheRegistrar").asBuilder() - .setClientIdentifier("CharlestonRoad") + .setClientId("CharlestonRoad") .build()); ns1 = persistActiveHost("ns1.example.com"); ns2 = persistActiveHost("ns2.example.com"); @@ -72,7 +72,7 @@ public class UniformRapidSuspensionCommandTest "--hosts=urs1.example.com,urs2.example.com", "--dsdata={\"keyTag\":1,\"alg\":1,\"digestType\":1,\"digest\":\"abc\"}"); eppVerifier() - .withClientIdentifier("CharlestonRoad") + .withClientId("CharlestonRoad") .asSuperuser() .verifySent("uniform_rapid_suspension.xml"); assertInStdout("uniform_rapid_suspension --undo"); @@ -89,7 +89,7 @@ public class UniformRapidSuspensionCommandTest persistDomainWithHosts(urs2, ns1); runCommandForced("--domain_name=evil.tld", "--hosts=urs1.example.com,urs2.example.com"); eppVerifier() - .withClientIdentifier("CharlestonRoad") + .withClientId("CharlestonRoad") .asSuperuser() .verifySent("uniform_rapid_suspension_existing_host.xml"); assertInStdout("uniform_rapid_suspension --undo "); @@ -125,7 +125,7 @@ public class UniformRapidSuspensionCommandTest runCommandForced( "--domain_name=evil.tld", "--undo", "--hosts=ns1.example.com,ns2.example.com"); eppVerifier() - .withClientIdentifier("CharlestonRoad") + .withClientId("CharlestonRoad") .asSuperuser() .verifySent("uniform_rapid_suspension_undo.xml"); assertNotInStdout("--undo"); // Undo shouldn't print a new undo command. @@ -140,7 +140,7 @@ public class UniformRapidSuspensionCommandTest "--locks_to_preserve=serverDeleteProhibited", "--hosts=ns1.example.com,ns2.example.com"); eppVerifier() - .withClientIdentifier("CharlestonRoad") + .withClientId("CharlestonRoad") .asSuperuser() .verifySent("uniform_rapid_suspension_undo_preserve.xml"); assertNotInStdout("--undo"); // Undo shouldn't print a new undo command. diff --git a/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java b/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java index cdeab8d8c..361284d20 100644 --- a/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java +++ b/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java @@ -54,7 +54,7 @@ public class UpdateApplicationStatusCommandTest // Since the command's history client ID defaults to CharlestonRoad, resave TheRegistrar as // CharlestonRoad so we don't have to pass in --history_client_id everywhere below. persistResource(Registrar.loadByClientId("TheRegistrar").asBuilder() - .setClientIdentifier("CharlestonRoad") + .setClientId("CharlestonRoad") .build()); createTld("xn--q9jyb4c"); diff --git a/javatests/google/registry/whois/NameserverWhoisResponseTest.java b/javatests/google/registry/whois/NameserverWhoisResponseTest.java index 2fd2b18e5..3db65bf41 100644 --- a/javatests/google/registry/whois/NameserverWhoisResponseTest.java +++ b/javatests/google/registry/whois/NameserverWhoisResponseTest.java @@ -50,7 +50,7 @@ public class NameserverWhoisResponseTest { @Before public void setUp() { persistResource(new Registrar.Builder() - .setClientIdentifier("example") + .setClientId("example") .setRegistrarName("Example Registrar, Inc.") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) diff --git a/javatests/google/registry/whois/RegistrarWhoisResponseTest.java b/javatests/google/registry/whois/RegistrarWhoisResponseTest.java index 554544ecf..7c926c061 100644 --- a/javatests/google/registry/whois/RegistrarWhoisResponseTest.java +++ b/javatests/google/registry/whois/RegistrarWhoisResponseTest.java @@ -44,7 +44,7 @@ public class RegistrarWhoisResponseTest { @Test public void getTextOutputTest() { Registrar registrar = new Registrar.Builder() - .setClientIdentifier("exregistrar") + .setClientId("exregistrar") .setRegistrarName("Example Registrar, Inc.") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) @@ -120,7 +120,7 @@ public class RegistrarWhoisResponseTest { @Test public void testSetOfFields() { Registrar registrar = new Registrar.Builder() - .setClientIdentifier("exregistrar") + .setClientId("exregistrar") .setType(Registrar.Type.REAL) .setIanaIdentifier(8L) .setState(Registrar.State.ACTIVE)