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
This commit is contained in:
mcilwain 2016-09-22 08:31:00 -07:00 committed by Ben McIlwain
parent 0564bcdbc9
commit 4813ed392b
62 changed files with 208 additions and 200 deletions

View file

@ -41,7 +41,7 @@ public class BraintreeRegistrarSyncer {
/**
* Syncs {@code registrar} with Braintree customer entry, creating it if one doesn't exist.
*
* <p>The customer ID will be the same as {@link Registrar#getClientIdentifier()}.
* <p>The customer ID will be the same as {@link Registrar#getClientId()}.
*
* <p>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<RegistrarContact> contact = getBillingContact(registrar);
if (contact.isPresent()) {

View file

@ -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<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey);
Set<String> desiredMembers = FluentIterable.from(registrarContacts)
.filter(new Predicate<RegistrarContact>() {
@ -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);
}
}

View file

@ -74,7 +74,7 @@ class SyncRegistrarsSheet {
new Ordering<Registrar>() {
@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()));

View file

@ -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");
}
}
}

View file

@ -103,7 +103,7 @@ public class TlsCredentials implements TransportCredentials {
ImmutableList<CidrAddressBlock> 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();

View file

@ -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());

View file

@ -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<String> 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;

View file

@ -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);
}

View file

@ -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)))),

View file

@ -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;
}

View file

@ -49,7 +49,7 @@ final class RegistrarToXjcConverter {
// the registrar object. This <id> has a superordinate relationship
// to a subordinate <clID>, <crRr> or <upRr> of domain, contact and
// host objects.
bean.setId(model.getClientIdentifier());
bean.setId(model.getClientId());
// o An <name> element that contains the name of the registrar.
bean.setName(model.getRegistrarName());

View file

@ -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,

View file

@ -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()

View file

@ -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,

View file

@ -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,

View file

@ -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(),

View file

@ -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);

View file

@ -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(
checkArgument(
clientId.equals(normalizeClientId(clientId)),
"Client identifier (%s) can only contain lowercase letters, numbers, and hyphens",
clientIdentifier));
clientId);
}
checkState(Registrar.loadByClientId(clientIdentifier) == null,
"Registrar %s already exists", clientIdentifier);
checkState(Registrar.loadByClientId(clientId) == null, "Registrar %s already exists", clientId);
List<Registrar> collisions =
newArrayList(filter(Registrar.loadAll(), new Predicate<Registrar>() {
@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;

View file

@ -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]);
}

View file

@ -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));

View file

@ -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(),

View file

@ -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<String> values : domainNameMap.asMap().values()) {
setSoyTemplate(
DomainCheckClaimsSoyInfo.getInstance(), DomainCheckClaimsSoyInfo.DOMAINCHECKCLAIMS);
addSoyRecord(clientIdentifier, new SoyMapData("domainNames", values));
addSoyRecord(clientId, new SoyMapData("domainNames", values));
}
}
}

View file

@ -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<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters);
for (Collection<String> values : domainNameMap.asMap().values()) {
setSoyTemplate(DomainCheckSoyInfo.getInstance(), DomainCheckSoyInfo.DOMAINCHECK);
addSoyRecord(clientIdentifier, new SoyMapData("domainNames", values));
addSoyRecord(clientId, new SoyMapData("domainNames", values));
}
}
}

View file

@ -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<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters);
for (Collection<String> values : domainNameMap.asMap().values()) {
setSoyTemplate(DomainCheckFeeSoyInfo.getInstance(), DomainCheckFeeSoyInfo.DOMAINCHECKFEE);
addSoyRecord(clientIdentifier, new SoyMapData("domainNames", values));
addSoyRecord(clientId, new SoyMapData("domainNames", values));
}
}
}

View file

@ -141,11 +141,11 @@ abstract class EppToolCommand extends ConfirmingCommand implements ServerSideCom
for (XmlEppParameters command : commands) {
Map<String, Object> 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.<String, String>of(),

View file

@ -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));
}
}
}

View file

@ -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, ""),

View file

@ -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);

View file

@ -43,7 +43,7 @@ final class ListCreditsCommand implements RemoteApiCommand, GtechCommand {
for (Registrar registrar : Registrar.loadAll()) {
ImmutableList<String> 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();
}

View file

@ -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(

View file

@ -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);
}
}

View file

@ -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,

View file

@ -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");

View file

@ -108,7 +108,7 @@ final class VerifyOteCommand implements ServerSideCommand, GtechCommand {
.transform(new Function<Registrar, String>() {
@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.

View file

@ -73,7 +73,7 @@ public class CreateGroupsAction implements Runnable {
public Optional<Exception> 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

View file

@ -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));

View file

@ -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());

View file

@ -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)",

View file

@ -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());

View file

@ -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);

View file

@ -59,7 +59,7 @@ public class ContactTransferFlowTestCase<F extends Flow, R extends EppResource>
// 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. */

View file

@ -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();

View file

@ -70,7 +70,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
clock.setTo(DateTime.parse("2005-03-03T22:00:00.000Z"));
createTlds("tld", "flags");
persistResource(
AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build());
AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
// For flags extension tests.
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
}

View file

@ -92,7 +92,7 @@ public class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
// 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) {

View file

@ -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<DateTime> 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));

View file

@ -45,7 +45,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override
public List<String> 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<String> components =
@ -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 {

View file

@ -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;
}
}
}

View file

@ -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

View file

@ -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)

View file

@ -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")

View file

@ -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());

View file

@ -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,

View file

@ -110,7 +110,7 @@ public class AllocateDomainCommandTest extends CommandTestCase<AllocateDomainCom
private EppToolVerifier eppVerifier() {
return new EppToolVerifier()
.withConnection(connection)
.withClientIdentifier("TheRegistrar")
.withClientId("TheRegistrar")
.asSuperuser();
}

View file

@ -1147,7 +1147,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
public void testFailure_alreadyExists() throws Exception {
thrown.expect(IllegalStateException.class, "Registrar existing already exists");
persistResource(new Registrar.Builder()
.setClientIdentifier("existing")
.setClientId("existing")
.setIanaIdentifier(1L)
.setType(Registrar.Type.REAL)
.build());

View file

@ -39,6 +39,6 @@ public abstract class EppToolCommandTestCase<C extends EppToolCommand> 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");
}
}

View file

@ -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));
}
}

View file

@ -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();

View file

@ -279,7 +279,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
thrown.expect(IllegalStateException.class);
Registrar registrar = Registrar.loadByClientId("TheRegistrar").asBuilder()
.setClientIdentifier("blobio-1")
.setClientId("blobio-1")
.setRegistrarName("blobio-1")
.build();
persistResource(registrar);

View file

@ -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.

View file

@ -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");

View file

@ -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)

View file

@ -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)