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. * 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 * <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. * 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 IllegalArgumentException if {@code registrar} is not using BRAINTREE billing
* @throws VerifyException if the Braintree API returned a failure response * @throws VerifyException if the Braintree API returned a failure response
*/ */
public void sync(Registrar registrar) throws VerifyException { public void sync(Registrar registrar) {
String id = registrar.getClientIdentifier(); String id = registrar.getClientId();
checkArgument(registrar.getBillingMethod() == Registrar.BillingMethod.BRAINTREE, checkArgument(registrar.getBillingMethod() == Registrar.BillingMethod.BRAINTREE,
"Registrar (%s) billing method (%s) is not BRAINTREE", id, registrar.getBillingMethod()); "Registrar (%s) billing method (%s) is not BRAINTREE", id, registrar.getBillingMethod());
CustomerRequest request = createRequest(registrar); CustomerRequest request = createRequest(registrar);
@ -67,8 +67,8 @@ public class BraintreeRegistrarSyncer {
private CustomerRequest createRequest(Registrar registrar) { private CustomerRequest createRequest(Registrar registrar) {
CustomerRequest result = CustomerRequest result =
new CustomerRequest() new CustomerRequest()
.id(registrar.getClientIdentifier()) .id(registrar.getClientId())
.customerId(registrar.getClientIdentifier()) .customerId(registrar.getClientId())
.company(registrar.getRegistrarName()); .company(registrar.getRegistrarName());
Optional<RegistrarContact> contact = getBillingContact(registrar); Optional<RegistrarContact> contact = getBillingContact(registrar);
if (contact.isPresent()) { if (contact.isPresent()) {

View file

@ -194,7 +194,7 @@ public final class SyncGroupMembersAction implements Runnable {
long totalRemoved = 0; long totalRemoved = 0;
for (final RegistrarContact.Type type : RegistrarContact.Type.values()) { for (final RegistrarContact.Type type : RegistrarContact.Type.values()) {
groupKey = getGroupEmailAddressForContactType( groupKey = getGroupEmailAddressForContactType(
registrar.getClientIdentifier(), type, publicDomainName); registrar.getClientId(), type, publicDomainName);
Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey); Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey);
Set<String> desiredMembers = FluentIterable.from(registrarContacts) Set<String> desiredMembers = FluentIterable.from(registrarContacts)
.filter(new Predicate<RegistrarContact>() { .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", logger.infofmt("Successfully synced contacts for registrar %s: added %d and removed %d",
registrar.getClientIdentifier(), registrar.getClientId(),
totalAdded, totalAdded,
totalRemoved); totalRemoved);
} catch (IOException e) { } 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 // job will run within an hour anyway and effectively resume where it left off if this was a
// transient error. // transient error.
String msg = String.format("Couldn't sync contacts for registrar %s to group %s", 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); throw new RuntimeException(msg, e);
} }
} }

View file

@ -74,7 +74,7 @@ class SyncRegistrarsSheet {
new Ordering<Registrar>() { new Ordering<Registrar>() {
@Override @Override
public int compare(Registrar left, Registrar right) { public int compare(Registrar left, Registrar right) {
return left.getClientIdentifier().compareTo(right.getClientIdentifier()); return left.getClientId().compareTo(right.getClientId());
} }
}.immutableSortedCopy(Registrar.loadAll())) }.immutableSortedCopy(Registrar.loadAll()))
.filter( .filter(
@ -114,7 +114,7 @@ class SyncRegistrarsSheet {
// and you'll need to remove deleted columns probably like a week after // and you'll need to remove deleted columns probably like a week after
// deployment. // deployment.
// //
builder.put("clientIdentifier", convert(registrar.getClientIdentifier())); builder.put("clientIdentifier", convert(registrar.getClientId()));
builder.put("registrarName", convert(registrar.getRegistrarName())); builder.put("registrarName", convert(registrar.getRegistrarName()));
builder.put("state", convert(registrar.getState())); builder.put("state", convert(registrar.getState()));
builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier())); builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier()));

View file

@ -35,7 +35,7 @@ import javax.servlet.http.HttpServletRequest;
method = Method.POST) method = Method.POST)
public class EppToolAction implements Runnable { public class EppToolAction implements Runnable {
@Inject @Parameter("clientIdentifier") String clientIdentifier; @Inject @Parameter("clientId") String clientId;
@Inject @Parameter("superuser") boolean isSuperuser; @Inject @Parameter("superuser") boolean isSuperuser;
@Inject @Parameter("dryRun") boolean isDryRun; @Inject @Parameter("dryRun") boolean isDryRun;
@Inject @Parameter("xml") String xml; @Inject @Parameter("xml") String xml;
@ -46,7 +46,7 @@ public class EppToolAction implements Runnable {
public void run() { public void run() {
eppRequestHandler.executeEpp( eppRequestHandler.executeEpp(
new StatelessRequestSessionMetadata( new StatelessRequestSessionMetadata(
clientIdentifier, clientId,
ProtocolDefinition.getVisibleServiceExtensionUris()), ProtocolDefinition.getVisibleServiceExtensionUris()),
new PasswordOnlyTransportCredentials(), new PasswordOnlyTransportCredentials(),
EppRequestSource.TOOL, EppRequestSource.TOOL,
@ -75,9 +75,9 @@ public class EppToolAction implements Runnable {
} }
@Provides @Provides
@Parameter("clientIdentifier") @Parameter("clientId")
static String provideClientIdentifier(HttpServletRequest req) { static String provideClientId(HttpServletRequest req) {
return extractRequiredParameter(req, "clientIdentifier"); return extractRequiredParameter(req, "clientId");
} }
} }
} }

View file

@ -103,7 +103,7 @@ public class TlsCredentials implements TransportCredentials {
ImmutableList<CidrAddressBlock> ipWhitelist = registrar.getIpAddressWhitelist(); ImmutableList<CidrAddressBlock> ipWhitelist = registrar.getIpAddressWhitelist();
if (ipWhitelist.isEmpty()) { if (ipWhitelist.isEmpty()) {
logger.infofmt("Skipping IP whitelist check because %s doesn't have an IP whitelist", logger.infofmt("Skipping IP whitelist check because %s doesn't have an IP whitelist",
registrar.getClientIdentifier()); registrar.getClientId());
return; return;
} }
for (CidrAddressBlock cidrAddressBlock : ipWhitelist) { for (CidrAddressBlock cidrAddressBlock : ipWhitelist) {
@ -113,7 +113,7 @@ public class TlsCredentials implements TransportCredentials {
} }
} }
logger.infofmt("%s not in %s's CIDR whitelist: %s", logger.infofmt("%s not in %s's CIDR whitelist: %s",
clientInetAddr, registrar.getClientIdentifier(), ipWhitelist); clientInetAddr, registrar.getClientId(), ipWhitelist);
throw new BadRegistrarIpAddressException(); throw new BadRegistrarIpAddressException();
} }
@ -129,7 +129,7 @@ public class TlsCredentials implements TransportCredentials {
&& isNullOrEmpty(registrar.getFailoverClientCertificateHash())) { && isNullOrEmpty(registrar.getFailoverClientCertificateHash())) {
logger.infofmt( logger.infofmt(
"Skipping SSL certificate check because %s doesn't have any certificate hashes on file", "Skipping SSL certificate check because %s doesn't have any certificate hashes on file",
registrar.getClientIdentifier()); registrar.getClientId());
return; return;
} }
if (isNullOrEmpty(clientCertificateHash)) { if (isNullOrEmpty(clientCertificateHash)) {
@ -145,7 +145,7 @@ public class TlsCredentials implements TransportCredentials {
&& !clientCertificateHash.equals(registrar.getFailoverClientCertificateHash())) { && !clientCertificateHash.equals(registrar.getFailoverClientCertificateHash())) {
logger.warningfmt("bad certificate hash (%s) for %s, wanted either %s or %s", logger.warningfmt("bad certificate hash (%s) for %s, wanted either %s or %s",
clientCertificateHash, clientCertificateHash,
registrar.getClientIdentifier(), registrar.getClientId(),
registrar.getClientCertificateHash(), registrar.getClientCertificateHash(),
registrar.getFailoverClientCertificateHash()); registrar.getFailoverClientCertificateHash());
throw new BadRegistrarCertificateException(); throw new BadRegistrarCertificateException();

View file

@ -402,11 +402,11 @@ public class DomainFlowUtils {
* this registrar. * this registrar.
*/ */
static void verifyPremiumNameIsNotBlocked( static void verifyPremiumNameIsNotBlocked(
String domainName, DateTime priceTime, String clientIdentifier) throws EppException { String domainName, DateTime priceTime, String clientId) throws EppException {
if (getPricesForDomainName(domainName, priceTime).isPremium()) { if (getPricesForDomainName(domainName, priceTime).isPremium()) {
// NB: The load of the Registar object is transactionless, which means that it should hit // NB: The load of the Registar object is transactionless, which means that it should hit
// memcache most of the time. // memcache most of the time.
if (Registrar.loadByClientId(clientIdentifier).getBlockPremiumNames()) { if (Registrar.loadByClientId(clientId).getBlockPremiumNames()) {
throw new PremiumNameBlockedException(); throw new PremiumNameBlockedException();
} }
} }
@ -577,7 +577,7 @@ public class DomainFlowUtils {
FeeQueryCommandExtensionItem feeRequest, FeeQueryCommandExtensionItem feeRequest,
FeeQueryResponseExtensionItem.Builder builder, FeeQueryResponseExtensionItem.Builder builder,
InternetDomainName domain, InternetDomainName domain,
String clientIdentifier, String clientId,
@Nullable CurrencyUnit topLevelCurrency, @Nullable CurrencyUnit topLevelCurrency,
DateTime now, DateTime now,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
@ -611,13 +611,13 @@ public class DomainFlowUtils {
} else { } else {
builder.setAvailIfSupported(true); builder.setAvailIfSupported(true);
builder.setFees(TldSpecificLogicProxy.getCreatePrice( builder.setFees(TldSpecificLogicProxy.getCreatePrice(
registry, domainNameString, clientIdentifier, now, years, eppInput).getFees()); registry, domainNameString, clientId, now, years, eppInput).getFees());
} }
break; break;
case RENEW: case RENEW:
builder.setAvailIfSupported(true); builder.setAvailIfSupported(true);
builder.setFees(TldSpecificLogicProxy.getRenewPrice( builder.setFees(TldSpecificLogicProxy.getRenewPrice(
registry, domainNameString, clientIdentifier, now, years, eppInput).getFees()); registry, domainNameString, clientId, now, years, eppInput).getFees());
break; break;
case RESTORE: case RESTORE:
if (years != 1) { if (years != 1) {
@ -625,17 +625,17 @@ public class DomainFlowUtils {
} }
builder.setAvailIfSupported(true); builder.setAvailIfSupported(true);
builder.setFees(TldSpecificLogicProxy.getRestorePrice( builder.setFees(TldSpecificLogicProxy.getRestorePrice(
registry, domainNameString, clientIdentifier, now, eppInput).getFees()); registry, domainNameString, clientId, now, eppInput).getFees());
break; break;
case TRANSFER: case TRANSFER:
builder.setAvailIfSupported(true); builder.setAvailIfSupported(true);
builder.setFees(TldSpecificLogicProxy.getTransferPrice( builder.setFees(TldSpecificLogicProxy.getTransferPrice(
registry, domainNameString, clientIdentifier, now, years, eppInput).getFees()); registry, domainNameString, clientId, now, years, eppInput).getFees());
break; break;
case UPDATE: case UPDATE:
builder.setAvailIfSupported(true); builder.setAvailIfSupported(true);
builder.setFees(TldSpecificLogicProxy.getUpdatePrice( builder.setFees(TldSpecificLogicProxy.getUpdatePrice(
registry, domainNameString, clientIdentifier, now, eppInput).getFees()); registry, domainNameString, clientId, now, eppInput).getFees());
break; break;
default: default:
throw new UnknownFeeCommandException(feeRequest.getUnparsedCommandName()); 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. */ /** Gets the flags to be used in the EPP flags extension. This is used for EPP info commands. */
public List<String> getExtensionFlags( 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. */ /** Computes the expected creation fee, for use in fee challenges and the like. */
public BaseFee getCreateFeeOrCredit( public BaseFee getCreateFeeOrCredit(
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput) throws EppException; EppInput eppInput) throws EppException;
@ -46,7 +46,7 @@ public interface RegistryExtraFlowLogic {
*/ */
public void performAdditionalDomainCreateLogic( public void performAdditionalDomainCreateLogic(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput, EppInput eppInput,
@ -58,7 +58,7 @@ public interface RegistryExtraFlowLogic {
*/ */
public void performAdditionalDomainDeleteLogic( public void performAdditionalDomainDeleteLogic(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput, EppInput eppInput,
HistoryEntry historyEntry) throws EppException; HistoryEntry historyEntry) throws EppException;
@ -66,7 +66,7 @@ public interface RegistryExtraFlowLogic {
/** Computes the expected renewal fee, for use in fee challenges and the like. */ /** Computes the expected renewal fee, for use in fee challenges and the like. */
public BaseFee getRenewFeeOrCredit( public BaseFee getRenewFeeOrCredit(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput) throws EppException; EppInput eppInput) throws EppException;
@ -77,7 +77,7 @@ public interface RegistryExtraFlowLogic {
*/ */
public void performAdditionalDomainRenewLogic( public void performAdditionalDomainRenewLogic(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput, EppInput eppInput,
@ -89,7 +89,7 @@ public interface RegistryExtraFlowLogic {
*/ */
public void performAdditionalDomainRestoreLogic( public void performAdditionalDomainRestoreLogic(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput, EppInput eppInput,
HistoryEntry historyEntry) throws EppException; HistoryEntry historyEntry) throws EppException;
@ -100,7 +100,7 @@ public interface RegistryExtraFlowLogic {
*/ */
public void performAdditionalDomainTransferLogic( public void performAdditionalDomainTransferLogic(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput, EppInput eppInput,
@ -109,7 +109,7 @@ public interface RegistryExtraFlowLogic {
/** Computes the expected update fee, for use in fee challenges and the like. */ /** Computes the expected update fee, for use in fee challenges and the like. */
public BaseFee getUpdateFeeOrCredit( public BaseFee getUpdateFeeOrCredit(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput) throws EppException; EppInput eppInput) throws EppException;
@ -119,7 +119,7 @@ public interface RegistryExtraFlowLogic {
*/ */
public void performAdditionalDomainUpdateLogic( public void performAdditionalDomainUpdateLogic(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput, EppInput eppInput,
HistoryEntry historyEntry) throws EppException; HistoryEntry historyEntry) throws EppException;

View file

@ -138,7 +138,7 @@ public final class TldSpecificLogicProxy {
public static EppCommandOperations getCreatePrice( public static EppCommandOperations getCreatePrice(
Registry registry, Registry registry,
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime date, DateTime date,
int years, int years,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
@ -150,7 +150,7 @@ public final class TldSpecificLogicProxy {
RegistryExtraFlowLogicProxy.newInstanceForTld(registry.getTldStr()); RegistryExtraFlowLogicProxy.newInstanceForTld(registry.getTldStr());
if (extraFlowLogic.isPresent()) { if (extraFlowLogic.isPresent()) {
createFeeOrCredit = extraFlowLogic.get() createFeeOrCredit = extraFlowLogic.get()
.getCreateFeeOrCredit(domainName, clientIdentifier, date, years, eppInput); .getCreateFeeOrCredit(domainName, clientId, date, years, eppInput);
} else { } else {
DomainPrices prices = getPricesForDomainName(domainName, date); DomainPrices prices = getPricesForDomainName(domainName, date);
createFeeOrCredit = createFeeOrCredit =
@ -173,7 +173,7 @@ public final class TldSpecificLogicProxy {
static BaseFee getRenewFeeOrCredit( static BaseFee getRenewFeeOrCredit(
Registry registry, Registry registry,
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime date, DateTime date,
int years, int years,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
@ -186,7 +186,7 @@ public final class TldSpecificLogicProxy {
throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName); throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName);
} }
return return
extraFlowLogic.get().getRenewFeeOrCredit(domain, clientIdentifier, date, years, eppInput); extraFlowLogic.get().getRenewFeeOrCredit(domain, clientId, date, years, eppInput);
} else { } else {
DomainPrices prices = getPricesForDomainName(domainName, date); DomainPrices prices = getPricesForDomainName(domainName, date);
return Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), FeeType.RENEW); return Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), FeeType.RENEW);
@ -197,25 +197,25 @@ public final class TldSpecificLogicProxy {
public static EppCommandOperations getRenewPrice( public static EppCommandOperations getRenewPrice(
Registry registry, Registry registry,
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime date, DateTime date,
int years, int years,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
return new EppCommandOperations( return new EppCommandOperations(
registry.getCurrency(), registry.getCurrency(),
getRenewFeeOrCredit(registry, domainName, clientIdentifier, date, years, eppInput)); getRenewFeeOrCredit(registry, domainName, clientId, date, years, eppInput));
} }
/** Returns a new restore price for the pricer. */ /** Returns a new restore price for the pricer. */
public static EppCommandOperations getRestorePrice( public static EppCommandOperations getRestorePrice(
Registry registry, Registry registry,
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime date, DateTime date,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
return new EppCommandOperations( return new EppCommandOperations(
registry.getCurrency(), registry.getCurrency(),
getRenewFeeOrCredit(registry, domainName, clientIdentifier, date, 1, eppInput), getRenewFeeOrCredit(registry, domainName, clientId, date, 1, eppInput),
Fee.create(registry.getStandardRestoreCost().getAmount(), FeeType.RESTORE)); Fee.create(registry.getStandardRestoreCost().getAmount(), FeeType.RESTORE));
} }
@ -223,20 +223,20 @@ public final class TldSpecificLogicProxy {
public static EppCommandOperations getTransferPrice( public static EppCommandOperations getTransferPrice(
Registry registry, Registry registry,
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime transferDate, DateTime transferDate,
int years, int years,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
// Currently, all transfer prices = renew prices, so just pass through. // Currently, all transfer prices = renew prices, so just pass through.
return getRenewPrice( return getRenewPrice(
registry, domainName, clientIdentifier, transferDate, years, eppInput); registry, domainName, clientId, transferDate, years, eppInput);
} }
/** Returns a new update price for the pricer. */ /** Returns a new update price for the pricer. */
public static EppCommandOperations getUpdatePrice( public static EppCommandOperations getUpdatePrice(
Registry registry, Registry registry,
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime date, DateTime date,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
CurrencyUnit currency = registry.getCurrency(); CurrencyUnit currency = registry.getCurrency();
@ -252,7 +252,7 @@ public final class TldSpecificLogicProxy {
throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName); throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName);
} }
feeOrCredit = feeOrCredit =
extraFlowLogic.get().getUpdateFeeOrCredit(domain, clientIdentifier, date, eppInput); extraFlowLogic.get().getUpdateFeeOrCredit(domain, clientId, date, eppInput);
} else { } else {
feeOrCredit = Fee.create(Money.zero(registry.getCurrency()).getAmount(), FeeType.UPDATE); feeOrCredit = Fee.create(Money.zero(registry.getCurrency()).getAmount(), FeeType.UPDATE);
} }

View file

@ -284,7 +284,7 @@ public class LoadTestAction implements Runnable {
.payload( .payload(
Joiner.on('&').withKeyValueSeparator("=").join( Joiner.on('&').withKeyValueSeparator("=").join(
ImmutableMap.of( ImmutableMap.of(
"clientIdentifier", clientId, "clientId", clientId,
"superuser", false, "superuser", false,
"dryRun", false, "dryRun", false,
"xml", urlEncode(xmls.get(i)))), "xml", urlEncode(xmls.get(i)))),

View file

@ -353,7 +353,7 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return salt; return salt;
}}; }};
public String getClientIdentifier() { public String getClientId() {
return clientIdentifier; return clientIdentifier;
} }
@ -570,12 +570,12 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
super(instance); 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. // 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.) // (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."); "Client identifier must be 3-16 characters long.");
getInstance().clientIdentifier = clientIdentifier; getInstance().clientIdentifier = clientId;
return this; return this;
} }

View file

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

View file

@ -41,7 +41,7 @@ final class CreateAnchorTenantCommand extends MutatingEppToolCommand implements
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
names = {"-n", "--domain_name"}, names = {"-n", "--domain_name"},
@ -89,7 +89,7 @@ final class CreateAnchorTenantCommand extends MutatingEppToolCommand implements
setSoyTemplate(CreateAnchorTenantSoyInfo.getInstance(), setSoyTemplate(CreateAnchorTenantSoyInfo.getInstance(),
CreateAnchorTenantSoyInfo.CREATEANCHORTENANT); CreateAnchorTenantSoyInfo.CREATEANCHORTENANT);
addSoyRecord(clientIdentifier, new SoyMapData( addSoyRecord(clientId, new SoyMapData(
"domainName", domainName, "domainName", domainName,
"contactId", contact, "contactId", contact,
"reason", reason, "reason", reason,

View file

@ -190,7 +190,7 @@ final class CreateAuctionCreditsCommand extends MutatingCommand {
Money totalAmount = Money totalAmount =
BigMoney.total(currency, creditMap.get(registrar)).toMoney(RoundingMode.UP); BigMoney.total(currency, creditMap.get(registrar)).toMoney(RoundingMode.UP);
System.out.printf("Total auction credit balance for %s: %s\n", 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. // Create the actual credit and initial credit balance.
RegistrarCredit credit = new RegistrarCredit.Builder() RegistrarCredit credit = new RegistrarCredit.Builder()

View file

@ -35,7 +35,7 @@ final class CreateContactCommand extends MutatingEppToolCommand implements Gtech
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
names = {"-i", "--id"}, names = {"-i", "--id"},
@ -116,7 +116,7 @@ final class CreateContactCommand extends MutatingEppToolCommand implements Gtech
"Addresses must contain at most 3 street lines."); "Addresses must contain at most 3 street lines.");
setSoyTemplate(ContactCreateSoyInfo.getInstance(), ContactCreateSoyInfo.CONTACTCREATE); setSoyTemplate(ContactCreateSoyInfo.getInstance(), ContactCreateSoyInfo.CONTACTCREATE);
addSoyRecord(clientIdentifier, new SoyMapData( addSoyRecord(clientId, new SoyMapData(
"id", id, "id", id,
"name", name, "name", name,
"org", org, "org", org,

View file

@ -33,7 +33,7 @@ final class CreateDomainCommand extends MutatingEppToolCommand implements GtechC
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
names = "--domain", 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."); checkArgument(ns == null || ns.size() <= 13, "There can be at most 13 nameservers.");
setSoyTemplate(DomainCreateSoyInfo.getInstance(), DomainCreateSoyInfo.DOMAINCREATE); setSoyTemplate(DomainCreateSoyInfo.getInstance(), DomainCreateSoyInfo.DOMAINCREATE);
addSoyRecord(clientIdentifier, new SoyMapData( addSoyRecord(clientId, new SoyMapData(
"domain", domain, "domain", domain,
"period", period == null ? null : period.toString(), "period", period == null ? null : period.toString(),
"ns", ns, "ns", ns,

View file

@ -36,7 +36,7 @@ final class CreateHostCommand extends MutatingEppToolCommand implements GtechCom
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as.", description = "Client identifier of the registrar to execute the command as.",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
names = "--host", names = "--host",
@ -67,7 +67,7 @@ final class CreateHostCommand extends MutatingEppToolCommand implements GtechCom
} }
} }
addSoyRecord( addSoyRecord(
clientIdentifier, clientId,
new SoyMapData( new SoyMapData(
"hostname", hostName, "hostname", hostName,
"ipv4addresses", ipv4Addresses.build(), "ipv4addresses", ipv4Addresses.build(),

View file

@ -242,7 +242,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
/** Returns the existing registrar (for update) or null (for creates). */ /** Returns the existing registrar (for update) or null (for creates). */
@Nullable @Nullable
abstract Registrar getOldRegistrar(String clientIdentifier); abstract Registrar getOldRegistrar(String clientId);
protected void initRegistrarCommand() throws Exception {} protected void initRegistrarCommand() throws Exception {}
@ -250,10 +250,10 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
protected final void init() throws Exception { protected final void init() throws Exception {
initRegistrarCommand(); initRegistrarCommand();
DateTime now = DateTime.now(UTC); DateTime now = DateTime.now(UTC);
for (String clientIdentifier : mainParameters) { for (String clientId : mainParameters) {
Registrar oldRegistrar = getOldRegistrar(clientIdentifier); Registrar oldRegistrar = getOldRegistrar(clientId);
Registrar.Builder builder = (oldRegistrar == null) Registrar.Builder builder = (oldRegistrar == null)
? new Registrar.Builder().setClientIdentifier(clientIdentifier) ? new Registrar.Builder().setClientId(clientId)
: oldRegistrar.asBuilder(); : oldRegistrar.asBuilder();
if (!isNullOrEmpty(password)) { if (!isNullOrEmpty(password)) {
@ -341,7 +341,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
checkState(balance.isZero(), checkState(balance.isZero(),
"Refusing to change billing method on Registrar '%s' from %s to %s" "Refusing to change billing method on Registrar '%s' from %s to %s"
+ " because current balance is non-zero: %s", + " because current balance is non-zero: %s",
clientIdentifier, oldRegistrar.getBillingMethod(), billingMethod, balances); clientId, oldRegistrar.getBillingMethod(), billingMethod, balances);
} }
} }
builder.setBillingMethod(billingMethod); builder.setBillingMethod(billingMethod);

View file

@ -78,30 +78,27 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
@Nullable @Nullable
@Override @Override
Registrar getOldRegistrar(final String clientIdentifier) { Registrar getOldRegistrar(final String clientId) {
checkArgument(clientIdentifier.length() >= 3, checkArgument(clientId.length() >= 3, "Client identifier (%s) is too short", clientId);
String.format("Client identifier (%s) is too short", clientIdentifier)); checkArgument(clientId.length() <= 16, "Client identifier (%s) is too long", clientId);
checkArgument(clientIdentifier.length() <= 16,
String.format("Client identifier (%s) is too long", clientIdentifier));
if (Registrar.Type.REAL.equals(registrarType)) { if (Registrar.Type.REAL.equals(registrarType)) {
checkArgument(clientIdentifier.equals(normalizeClientId(clientIdentifier)), checkArgument(
String.format( clientId.equals(normalizeClientId(clientId)),
"Client identifier (%s) can only contain lowercase letters, numbers, and hyphens", "Client identifier (%s) can only contain lowercase letters, numbers, and hyphens",
clientIdentifier)); clientId);
} }
checkState(Registrar.loadByClientId(clientIdentifier) == null, checkState(Registrar.loadByClientId(clientId) == null, "Registrar %s already exists", clientId);
"Registrar %s already exists", clientIdentifier);
List<Registrar> collisions = List<Registrar> collisions =
newArrayList(filter(Registrar.loadAll(), new Predicate<Registrar>() { newArrayList(filter(Registrar.loadAll(), new Predicate<Registrar>() {
@Override @Override
public boolean apply(Registrar registrar) { public boolean apply(Registrar registrar) {
return normalizeClientId(registrar.getClientIdentifier()).equals(clientIdentifier); return normalizeClientId(registrar.getClientId()).equals(clientId);
}})); }}));
if (!collisions.isEmpty()) { if (!collisions.isEmpty()) {
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"The registrar client identifier %s normalizes identically to existing registrar %s", "The registrar client identifier %s normalizes identically to existing registrar %s",
clientIdentifier, clientId,
collisions.get(0).getClientIdentifier())); collisions.get(0).getClientId()));
} }
return null; return null;
} }
@ -118,7 +115,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
try { try {
// We know it is safe to use the only main parameter here because initRegistrarCommand has // 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 // 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)); CreateRegistrarGroupsCommand.executeOnServer(connection, getOnlyElement(mainParameters));
} catch (Exception e) { } catch (Exception e) {
return "\nRegistrar created, but groups creation failed with error:\n" + 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. */ /** 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( connection.send(
CreateGroupsAction.PATH, CreateGroupsAction.PATH,
ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, clientIdentifier), ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, clientId),
MediaType.PLAIN_TEXT_UTF_8, MediaType.PLAIN_TEXT_UTF_8,
new byte[0]); new byte[0]);
} }
@ -85,7 +85,7 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand
for (Registrar registrar : registrars) { for (Registrar registrar : registrars) {
connection.send( connection.send(
CreateGroupsAction.PATH, CreateGroupsAction.PATH,
ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, registrar.getClientIdentifier()), ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, registrar.getClientId()),
MediaType.PLAIN_TEXT_UTF_8, MediaType.PLAIN_TEXT_UTF_8,
new byte[0]); new byte[0]);
} }

View file

@ -28,7 +28,7 @@ final class DeleteDomainCommand extends MutatingEppToolCommand implements GtechC
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
names = {"-n", "--domain_name"}, names = {"-n", "--domain_name"},
@ -51,7 +51,7 @@ final class DeleteDomainCommand extends MutatingEppToolCommand implements GtechC
@Override @Override
protected void initMutatingEppToolCommand() { protected void initMutatingEppToolCommand() {
setSoyTemplate(DeleteDomainSoyInfo.getInstance(), DeleteDomainSoyInfo.DELETEDOMAIN); setSoyTemplate(DeleteDomainSoyInfo.getInstance(), DeleteDomainSoyInfo.DELETEDOMAIN);
addSoyRecord(clientIdentifier, new SoyMapData( addSoyRecord(clientId, new SoyMapData(
"domainName", domainName, "domainName", domainName,
"reason", reason, "reason", reason,
"requestedByRegistrar", requestedByRegistrar)); "requestedByRegistrar", requestedByRegistrar));

View file

@ -32,7 +32,7 @@ final class DomainApplicationInfoCommand extends EppToolCommand implements Gtech
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
names = {"--id"}, names = {"--id"},
@ -60,7 +60,7 @@ final class DomainApplicationInfoCommand extends EppToolCommand implements Gtech
setSoyTemplate( setSoyTemplate(
DomainApplicationInfoSoyInfo.getInstance(), DomainApplicationInfoSoyInfo.getInstance(),
DomainApplicationInfoSoyInfo.DOMAINAPPLICATIONINFO); DomainApplicationInfoSoyInfo.DOMAINAPPLICATIONINFO);
addSoyRecord(clientIdentifier, new SoyMapData( addSoyRecord(clientId, new SoyMapData(
"domainName", domainName, "domainName", domainName,
"id", id, "id", id,
"phase", launchPhase.getPhase(), "phase", launchPhase.getPhase(),

View file

@ -31,7 +31,7 @@ final class DomainCheckClaimsCommand extends EppToolCommand implements GtechComm
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
description = "Domain(s) to check.", description = "Domain(s) to check.",
@ -44,7 +44,7 @@ final class DomainCheckClaimsCommand extends EppToolCommand implements GtechComm
for (Collection<String> values : domainNameMap.asMap().values()) { for (Collection<String> values : domainNameMap.asMap().values()) {
setSoyTemplate( setSoyTemplate(
DomainCheckClaimsSoyInfo.getInstance(), DomainCheckClaimsSoyInfo.DOMAINCHECKCLAIMS); 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"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
description = "List of domains to check.", description = "List of domains to check.",
@ -43,7 +43,7 @@ final class DomainCheckCommand extends EppToolCommand implements GtechCommand {
Multimap<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters); Multimap<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters);
for (Collection<String> values : domainNameMap.asMap().values()) { for (Collection<String> values : domainNameMap.asMap().values()) {
setSoyTemplate(DomainCheckSoyInfo.getInstance(), DomainCheckSoyInfo.DOMAINCHECK); 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"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
description = "Domain(s) to check.", description = "Domain(s) to check.",
@ -43,7 +43,7 @@ final class DomainCheckFeeCommand extends EppToolCommand implements GtechCommand
Multimap<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters); Multimap<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters);
for (Collection<String> values : domainNameMap.asMap().values()) { for (Collection<String> values : domainNameMap.asMap().values()) {
setSoyTemplate(DomainCheckFeeSoyInfo.getInstance(), DomainCheckFeeSoyInfo.DOMAINCHECKFEE); 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) { for (XmlEppParameters command : commands) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("dryRun", dryRun); params.put("dryRun", dryRun);
params.put("clientIdentifier", command.clientId); params.put("clientId", command.clientId);
params.put("superuser", superuser); params.put("superuser", superuser);
params.put("xml", URLEncoder.encode(command.xml, UTF_8.toString())); params.put("xml", URLEncoder.encode(command.xml, UTF_8.toString()));
String requestBody = Joiner.on('&').withKeyValueSeparator("=") String requestBody =
.join(filterValues(params, notNull())); Joiner.on('&').withKeyValueSeparator("=").join(filterValues(params, notNull()));
responses.add(nullToEmpty(connection.send( responses.add(nullToEmpty(connection.send(
"/_dr/epptool", "/_dr/epptool",
ImmutableMap.<String, String>of(), ImmutableMap.<String, String>of(),

View file

@ -38,7 +38,7 @@ final class ExecuteEppCommand extends MutatingEppToolCommand {
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@NonFinalForTesting @NonFinalForTesting
private static InputStream stdin = System.in; private static InputStream stdin = System.in;
@ -47,10 +47,10 @@ final class ExecuteEppCommand extends MutatingEppToolCommand {
protected void initMutatingEppToolCommand() throws IOException { protected void initMutatingEppToolCommand() throws IOException {
if (mainParameters.isEmpty()) { if (mainParameters.isEmpty()) {
addXmlCommand( addXmlCommand(
clientIdentifier, CharStreams.toString(new InputStreamReader(stdin, UTF_8))); clientId, CharStreams.toString(new InputStreamReader(stdin, UTF_8)));
} else { } else {
for (String command : mainParameters) { 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 Address 2|Registrar City|Registrar Province|Registrar Postal Code|
// Registrar Country|Registrar Email|Registrar Telephone // Registrar Country|Registrar Email|Registrar Telephone
return Joiner.on('|').join(ImmutableList.of( return Joiner.on('|').join(ImmutableList.of(
registrar.getClientIdentifier(), registrar.getClientId(),
contact.isPresent() ? contact.get().getName() : "N/A", contact.isPresent() ? contact.get().getName() : "N/A",
nullToEmpty(registrar.getRegistrarName()), nullToEmpty(registrar.getRegistrarName()),
Iterables.getFirst(street, ""), Iterables.getFirst(street, ""),

View file

@ -34,8 +34,8 @@ final class GetRegistrarCommand implements RemoteApiCommand, GtechCommand {
@Override @Override
public void run() { public void run() {
for (String clientIdentifier : mainParameters) { for (String clientId : mainParameters) {
Registrar registrar = Registrar.loadByClientId(clientIdentifier); Registrar registrar = Registrar.loadByClientId(clientId);
checkState(registrar != null, "Registrar does not exist"); checkState(registrar != null, "Registrar does not exist");
System.out.println(registrar); System.out.println(registrar);

View file

@ -43,7 +43,7 @@ final class ListCreditsCommand implements RemoteApiCommand, GtechCommand {
for (Registrar registrar : Registrar.loadAll()) { for (Registrar registrar : Registrar.loadAll()) {
ImmutableList<String> creditStrings = createCreditStrings(registrar); ImmutableList<String> creditStrings = createCreditStrings(registrar);
if (!creditStrings.isEmpty()) { if (!creditStrings.isEmpty()) {
System.out.println(registrar.getClientIdentifier()); System.out.println(registrar.getClientId());
System.out.print(Joiner.on("").join(creditStrings)); System.out.print(Joiner.on("").join(creditStrings));
System.out.println(); System.out.println();
} }

View file

@ -139,9 +139,9 @@ final class RegistrarContactCommand extends MutatingCommand implements GtechComm
protected void init() throws Exception { protected void init() throws Exception {
checkArgument(mainParameters.size() == 1, checkArgument(mainParameters.size() == 1,
"Must specify exactly one client identifier: %s", ImmutableList.copyOf(mainParameters)); "Must specify exactly one client identifier: %s", ImmutableList.copyOf(mainParameters));
String clientIdentifier = mainParameters.get(0); String clientId = mainParameters.get(0);
Registrar registrar = checkNotNull( Registrar registrar =
Registrar.loadByClientId(clientIdentifier), "Registrar %s not found", clientIdentifier); checkNotNull(Registrar.loadByClientId(clientId), "Registrar %s not found", clientId);
contactTypes = contactTypes =
newHashSet( newHashSet(
transform( transform(

View file

@ -24,9 +24,10 @@ import google.registry.tools.Command.GtechCommand;
@Parameters(separators = " =", commandDescription = "Update registrar account(s)") @Parameters(separators = " =", commandDescription = "Update registrar account(s)")
final class UpdateRegistrarCommand extends CreateOrUpdateRegistrarCommand final class UpdateRegistrarCommand extends CreateOrUpdateRegistrarCommand
implements GtechCommand { implements GtechCommand {
@Override @Override
Registrar getOldRegistrar(String clientIdentifier) { Registrar getOldRegistrar(String clientId) {
return checkNotNull( 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"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to execute the command as", description = "Client identifier of the registrar to execute the command as",
required = true) required = true)
String clientIdentifier; String clientId;
@Parameter( @Parameter(
names = {"-n", "--domain_name"}, names = {"-n", "--domain_name"},
@ -105,7 +105,7 @@ final class UpdateServerLocksCommand extends MutatingEppToolCommand implements G
"Add and remove actions are both empty"); "Add and remove actions are both empty");
setSoyTemplate( setSoyTemplate(
UpdateServerLocksSoyInfo.getInstance(), UpdateServerLocksSoyInfo.UPDATESERVERLOCKS); UpdateServerLocksSoyInfo.getInstance(), UpdateServerLocksSoyInfo.UPDATESERVERLOCKS);
addSoyRecord(clientIdentifier, new SoyMapData( addSoyRecord(clientId, new SoyMapData(
"domainName", domainName, "domainName", domainName,
"locksToApply", valuesToApply, "locksToApply", valuesToApply,
"locksToRemove", valuesToRemove, "locksToRemove", valuesToRemove,

View file

@ -41,7 +41,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo
names = {"-c", "--client"}, names = {"-c", "--client"},
description = "Client identifier of the registrar to test", description = "Client identifier of the registrar to test",
required = true) required = true)
private String clientIdentifier; private String clientId;
@Parameter( @Parameter(
names = {"-p", "--password"}, names = {"-p", "--password"},
@ -76,7 +76,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo
clientCertificateHash = getCertificateHash( clientCertificateHash = getCertificateHash(
loadCertificate(new String(Files.readAllBytes(clientCertificatePath), US_ASCII))); 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) new TlsCredentials(clientCertificateHash, Optional.of(clientIpAddress), null)
.validate(registrar, password); .validate(registrar, password);
checkState(!registrar.getState().equals(Registrar.State.PENDING), "Account pending"); 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>() { .transform(new Function<Registrar, String>() {
@Override @Override
public String apply(Registrar registrar) { 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. // Look for names of the form "regname-1", "regname-2", etc. and strip the -# suffix.
String replacedName = name.replaceFirst("^(.*)-[1234]$", "$1"); String replacedName = name.replaceFirst("^(.*)-[1234]$", "$1");
// Check if any replacement happened, and thus whether the name matches the format. // 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) { public Optional<Exception> apply(Type type) {
try { try {
String groupKey = getGroupEmailAddressForContactType( String groupKey = getGroupEmailAddressForContactType(
registrar.getClientIdentifier(), type, publicDomainName); registrar.getClientId(), type, publicDomainName);
String parentGroup = String parentGroup =
getGroupEmailAddressForContactType("registrar", type, publicDomainName); getGroupEmailAddressForContactType("registrar", type, publicDomainName);
// Creates the group, then adds it as a member to the global registrar group for // 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)); Registrar registrar = Registrar.loadByClientId(sessionUtils.getRegistrarClientId(req));
SoyMapData data = new SoyMapData(); SoyMapData data = new SoyMapData();
data.put("xsrfToken", XsrfTokenManager.generateToken(EppConsoleAction.XSRF_SCOPE)); 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("username", userService.getCurrentUser().getNickname());
data.put("isAdmin", userService.isUserAdmin()); data.put("isAdmin", userService.isUserAdmin());
data.put("logoutUrl", userService.createLogoutURL(PATH)); data.put("logoutUrl", userService.createLogoutURL(PATH));

View file

@ -181,7 +181,7 @@ public final class RegistrarPaymentAction implements Runnable, JsonAction {
.amount(amount.getAmount()) .amount(amount.getAmount())
.paymentMethodNonce(paymentMethodNonce) .paymentMethodNonce(paymentMethodNonce)
.merchantAccountId(merchantAccountId) .merchantAccountId(merchantAccountId)
.customerId(registrar.getClientIdentifier()) .customerId(registrar.getClientId())
.options() .options()
.submitForSettlement(true) .submitForSettlement(true)
.done()); .done());

View file

@ -83,7 +83,7 @@ public class SessionUtils {
return false; return false;
} }
verify(hasAccessToRegistrar(registrar.get(), user.getUserId())); verify(hasAccessToRegistrar(registrar.get(), user.getUserId()));
session.setAttribute(CLIENT_ID_ATTRIBUTE, registrar.get().getClientIdentifier()); session.setAttribute(CLIENT_ID_ATTRIBUTE, registrar.get().getClientId());
} else { } else {
if (!hasAccessToRegistrar(clientId, user.getUserId())) { if (!hasAccessToRegistrar(clientId, user.getUserId())) {
logger.infofmt("Registrar Console access revoked: %s for %s (%s)", logger.infofmt("Registrar Console access revoked: %s for %s (%s)",

View file

@ -96,7 +96,7 @@ public class SyncRegistrarsSheetTest {
public void testWasRegistrarsModifiedInLastInterval() throws Exception { public void testWasRegistrarsModifiedInLastInterval() throws Exception {
Duration interval = standardHours(1); Duration interval = standardHours(1);
persistResource(new Registrar.Builder() persistResource(new Registrar.Builder()
.setClientIdentifier("SomeRegistrar") .setClientId("SomeRegistrar")
.setRegistrarName("Some Registrar Inc.") .setRegistrarName("Some Registrar Inc.")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(8L) .setIanaIdentifier(8L)
@ -111,7 +111,7 @@ public class SyncRegistrarsSheetTest {
@Test @Test
public void testRun() throws Exception { public void testRun() throws Exception {
persistResource(new Registrar.Builder() persistResource(new Registrar.Builder()
.setClientIdentifier("anotherregistrar") .setClientId("anotherregistrar")
.setRegistrarName("Another Registrar LLC") .setRegistrarName("Another Registrar LLC")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(1L) .setIanaIdentifier(1L)
@ -141,7 +141,7 @@ public class SyncRegistrarsSheetTest {
.build()); .build());
Registrar registrar = new Registrar.Builder() Registrar registrar = new Registrar.Builder()
.setClientIdentifier("aaaregistrar") .setClientId("aaaregistrar")
.setRegistrarName("AAA Registrar Inc.") .setRegistrarName("AAA Registrar Inc.")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(8L) .setIanaIdentifier(8L)
@ -304,7 +304,7 @@ public class SyncRegistrarsSheetTest {
@Test @Test
public void testRun_missingValues_stillWorks() throws Exception { public void testRun_missingValues_stillWorks() throws Exception {
persistResource(new Registrar.Builder() persistResource(new Registrar.Builder()
.setClientIdentifier("SomeRegistrar") .setClientId("SomeRegistrar")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(8L) .setIanaIdentifier(8L)
.build()); .build());

View file

@ -32,7 +32,7 @@ public class EppToolActionTest {
private void doTest(boolean isDryRun, boolean isSuperuser) { private void doTest(boolean isDryRun, boolean isSuperuser) {
EppToolAction action = new EppToolAction(); EppToolAction action = new EppToolAction();
action.clientIdentifier = "ClientIdentifier"; action.clientId = "ClientIdentifier";
action.isDryRun = isDryRun; action.isDryRun = isDryRun;
action.isSuperuser = isSuperuser; action.isSuperuser = isSuperuser;
action.eppRequestHandler = mock(EppRequestHandler.class); 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 // Registrar ClientZ is used in tests that need another registrar that definitely doesn't own
// the resources in question. // the resources in question.
persistResource( 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. */ /** 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 { public void testFailure_unauthorized() throws Exception {
thrown.expect(ResourceNotOwnedException.class); thrown.expect(ResourceNotOwnedException.class);
persistResource( persistResource(
AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build()); AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
sessionMetadata.setClientId("ClientZ"); sessionMetadata.setClientId("ClientZ");
persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST);
runFlow(); runFlow();

View file

@ -70,7 +70,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
clock.setTo(DateTime.parse("2005-03-03T22:00:00.000Z")); clock.setTo(DateTime.parse("2005-03-03T22:00:00.000Z"));
createTlds("tld", "flags"); createTlds("tld", "flags");
persistResource( persistResource(
AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build()); AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
// For flags extension tests. // For flags extension tests.
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class); 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 // Registrar ClientZ is used in tests that need another registrar that definitely doesn't own
// the resources in question. // the resources in question.
persistResource( persistResource(
AppEngineRule.makeRegistrar1().asBuilder().setClientIdentifier("ClientZ").build()); AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
} }
static DomainResource persistWithPendingTransfer(DomainResource domain) { static DomainResource persistWithPendingTransfer(DomainResource domain) {

View file

@ -100,7 +100,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
public void test_eap() throws Exception { public void test_eap() throws Exception {
TldSpecificLogicProxy.EppCommandOperations createPrice = TldSpecificLogicProxy.EppCommandOperations createPrice =
TldSpecificLogicProxy.getCreatePrice( 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<DateTime> eapValidPeriod =
Range.closedOpen(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1)); Range.closedOpen(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1));
assertThat(createPrice.getTotalCost()).isEqualTo(basicCreateCost.plus(Money.of(USD, 100))); 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 { public void test_extraLogic_createPrice() throws Exception {
TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.EppCommandOperations price =
TldSpecificLogicProxy.getCreatePrice( 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.getCurrency()).isEqualTo(CurrencyUnit.USD);
assertThat(price.getFees()).hasSize(1); assertThat(price.getFees()).hasSize(1);
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(54)); assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(54));
@ -142,7 +142,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
persistActiveDomain("renew--13.test"); persistActiveDomain("renew--13.test");
TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.EppCommandOperations price =
TldSpecificLogicProxy.getRenewPrice( 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.getCurrency()).isEqualTo(CurrencyUnit.USD);
assertThat(price.getFees()).isEmpty(); assertThat(price.getFees()).isEmpty();
assertThat(price.getCredits()).hasSize(1); assertThat(price.getCredits()).hasSize(1);
@ -154,7 +154,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
public void test_extraLogic_renewPrice_noDomain() throws Exception { public void test_extraLogic_renewPrice_noDomain() throws Exception {
thrown.expect(ResourceToMutateDoesNotExistException.class); thrown.expect(ResourceToMutateDoesNotExistException.class);
TldSpecificLogicProxy.getRenewPrice( 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 { void persistPendingDeleteDomain(String domainName, DateTime now) throws Exception {
@ -191,7 +191,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
persistPendingDeleteDomain("renew-13.test", clock.nowUtc()); persistPendingDeleteDomain("renew-13.test", clock.nowUtc());
TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.EppCommandOperations price =
TldSpecificLogicProxy.getRestorePrice( 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.getCurrency()).isEqualTo(CurrencyUnit.USD);
assertThat(price.getFees()).hasSize(2); assertThat(price.getFees()).hasSize(2);
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(13)); 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 { public void test_extraLogic_restorePrice_noDomain() throws Exception {
thrown.expect(ResourceToMutateDoesNotExistException.class); thrown.expect(ResourceToMutateDoesNotExistException.class);
TldSpecificLogicProxy.getRestorePrice( TldSpecificLogicProxy.getRestorePrice(
Registry.get("test"), "renew-13.test", "clientIdentifier", clock.nowUtc(), null); Registry.get("test"), "renew-13.test", "clientId", clock.nowUtc(), null);
} }
@Test @Test
@ -212,7 +212,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
persistActiveDomain("renew-26.test"); persistActiveDomain("renew-26.test");
TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.EppCommandOperations price =
TldSpecificLogicProxy.getTransferPrice( 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.getCurrency()).isEqualTo(CurrencyUnit.USD);
assertThat(price.getFees()).hasSize(1); assertThat(price.getFees()).hasSize(1);
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(26)); assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(26));
@ -225,7 +225,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
persistActiveDomain("update-13.test"); persistActiveDomain("update-13.test");
TldSpecificLogicProxy.EppCommandOperations price = TldSpecificLogicProxy.EppCommandOperations price =
TldSpecificLogicProxy.getUpdatePrice( 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.getCurrency()).isEqualTo(CurrencyUnit.USD);
assertThat(price.getFees()).hasSize(1); assertThat(price.getFees()).hasSize(1);
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(13)); assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(13));

View file

@ -45,7 +45,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public List<String> getExtensionFlags( 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 // Take the part before the period, split by dashes, and treat each part after the first as
// a flag. // a flag.
List<String> components = List<String> components =
@ -79,7 +79,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public BaseFee getCreateFeeOrCredit( public BaseFee getCreateFeeOrCredit(
String domainName, String domainName,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
@ -93,7 +93,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public void performAdditionalDomainCreateLogic( public void performAdditionalDomainCreateLogic(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput, EppInput eppInput,
@ -113,7 +113,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public void performAdditionalDomainDeleteLogic( public void performAdditionalDomainDeleteLogic(
DomainResource domainResource, DomainResource domainResource,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput, EppInput eppInput,
HistoryEntry historyEntry) throws EppException { HistoryEntry historyEntry) throws EppException {
@ -124,7 +124,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public BaseFee getRenewFeeOrCredit( public BaseFee getRenewFeeOrCredit(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
@ -138,7 +138,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public void performAdditionalDomainRenewLogic( public void performAdditionalDomainRenewLogic(
DomainResource domainResource, DomainResource domainResource,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput, EppInput eppInput,
@ -153,7 +153,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public void performAdditionalDomainRestoreLogic( public void performAdditionalDomainRestoreLogic(
DomainResource domainResource, DomainResource domainResource,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput, EppInput eppInput,
HistoryEntry historyEntry) throws EppException { HistoryEntry historyEntry) throws EppException {
@ -167,7 +167,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public void performAdditionalDomainTransferLogic( public void performAdditionalDomainTransferLogic(
DomainResource domainResource, DomainResource domainResource,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
int years, int years,
EppInput eppInput, EppInput eppInput,
@ -188,7 +188,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public BaseFee getUpdateFeeOrCredit( public BaseFee getUpdateFeeOrCredit(
DomainResource domain, DomainResource domain,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput) throws EppException { EppInput eppInput) throws EppException {
return domainNameToFeeOrCredit(domain.getFullyQualifiedDomainName()); return domainNameToFeeOrCredit(domain.getFullyQualifiedDomainName());
@ -201,7 +201,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
@Override @Override
public void performAdditionalDomainUpdateLogic( public void performAdditionalDomainUpdateLogic(
DomainResource domainResource, DomainResource domainResource,
String clientIdentifier, String clientId,
DateTime asOfDate, DateTime asOfDate,
EppInput eppInput, EppInput eppInput,
HistoryEntry historyEntry) throws EppException { 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 com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.initOfy; 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.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper; 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.ObjectifyFactory;
import com.googlecode.objectify.ObjectifyFilter; import com.googlecode.objectify.ObjectifyFilter;
import com.googlecode.objectify.ObjectifyService; 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;
import google.registry.model.registrar.Registrar.Type; import google.registry.model.registrar.Registrar.Type;
import google.registry.testing.ExceptionRule; import google.registry.testing.ExceptionRule;
@ -73,15 +76,14 @@ public class OfyFilterTest {
*/ */
@Test @Test
public void testFilterRegistersTypes() throws Exception { public void testFilterRegistersTypes() throws Exception {
Registrar registrar = new Registrar.Builder() UnregisteredEntity entity = new UnregisteredEntity(5L);
.setType(Type.TEST)
.setClientIdentifier("registrar")
.build();
try { try {
Key.create(registrar); Key.create(entity);
fail("Should not be able to create key for unregistered entity");
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
assertThat(e).hasMessage( 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 @Test
public void testKeyCreateAfterFilter() throws Exception { public void testKeyCreateAfterFilter() throws Exception {
new OfyFilter().init(null); new OfyFilter().init(null);
Registrar registrar = new Registrar.Builder() Registrar registrar =
.setType(Type.TEST) new Registrar.Builder().setType(Type.TEST).setClientId("clientId").build();
.setClientIdentifier("registrar")
.build();
Key.create(registrar); 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. // Set up a new persisted registrar entity.
registrar = cloneAndSetAutoTimestamps( registrar = cloneAndSetAutoTimestamps(
new Registrar.Builder() new Registrar.Builder()
.setClientIdentifier("registrar") .setClientId("registrar")
.setRegistrarName("full registrar name") .setRegistrarName("full registrar name")
.setType(Type.REAL) .setType(Type.REAL)
.setState(State.PENDING) .setState(State.PENDING)
@ -119,7 +119,7 @@ public class RegistrarTest extends EntityTestCase {
public void testPersistence() throws Exception { public void testPersistence() throws Exception {
assertThat(registrar).isEqualTo(ofy().load().type(Registrar.class) assertThat(registrar).isEqualTo(ofy().load().type(Registrar.class)
.parent(EntityGroupRoot.getCrossTldKey()) .parent(EntityGroupRoot.getCrossTldKey())
.id(registrar.clientIdentifier) .id(registrar.getClientId())
.now()); .now());
} }
@ -147,23 +147,23 @@ public class RegistrarTest extends EntityTestCase {
} }
@Test @Test
public void testSuccess_clientIdentifierBounds() throws Exception { public void testSuccess_clientId_bounds() throws Exception {
registrar = registrar.asBuilder().setClientIdentifier("abc").build(); registrar = registrar.asBuilder().setClientId("abc").build();
assertThat(registrar.getClientIdentifier()).isEqualTo("abc"); assertThat(registrar.getClientId()).isEqualTo("abc");
registrar = registrar.asBuilder().setClientIdentifier("abcdefghijklmnop").build(); registrar = registrar.asBuilder().setClientId("abcdefghijklmnop").build();
assertThat(registrar.getClientIdentifier()).isEqualTo("abcdefghijklmnop"); assertThat(registrar.getClientId()).isEqualTo("abcdefghijklmnop");
} }
@Test @Test
public void testFailure_clientIdentifierTooShort() throws Exception { public void testFailure_clientId_tooShort() throws Exception {
thrown.expect(IllegalArgumentException.class); thrown.expect(IllegalArgumentException.class);
new Registrar.Builder().setClientIdentifier("ab"); new Registrar.Builder().setClientId("ab");
} }
@Test @Test
public void testFailure_clientIdentifierTooLong() throws Exception { public void testFailure_clientId_tooLong() throws Exception {
thrown.expect(IllegalArgumentException.class); thrown.expect(IllegalArgumentException.class);
new Registrar.Builder().setClientIdentifier("abcdefghijklmnopq"); new Registrar.Builder().setClientId("abcdefghijklmnopq");
} }
@Test @Test

View file

@ -62,7 +62,7 @@ public class RegistrarToXjcConverterTest extends ShardableTestCase {
@Before @Before
public void init() { public void init() {
registrar = new Registrar.Builder() registrar = new Registrar.Builder()
.setClientIdentifier("GoblinMarket") .setClientId("GoblinMarket")
.setRegistrarName("Maids heard the goblins cry: Come buy, come buy:") .setRegistrarName("Maids heard the goblins cry: Come buy, come buy:")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(8L) .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 factory for first Registrar to allow comparison against stored value in unit tests. */
public static Registrar makeRegistrar1() { public static Registrar makeRegistrar1() {
return makeRegistrarCommon() return makeRegistrarCommon()
.setClientIdentifier("NewRegistrar") .setClientId("NewRegistrar")
.setRegistrarName("New Registrar") .setRegistrarName("New Registrar")
.setIanaIdentifier(8L) .setIanaIdentifier(8L)
.setPassword("foo-BAR2") .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 factory for second Registrar to allow comparison against stored value in unit tests. */
public static Registrar makeRegistrar2() { public static Registrar makeRegistrar2() {
return makeRegistrarCommon() return makeRegistrarCommon()
.setClientIdentifier("TheRegistrar") .setClientId("TheRegistrar")
.setRegistrarName("The Registrar") .setRegistrarName("The Registrar")
.setIanaIdentifier(1L) .setIanaIdentifier(1L)
.setPassword("password2") .setPassword("password2")

View file

@ -580,7 +580,7 @@ public class DatastoreHelper {
public static Registrar persistNewRegistrar(String clientId, long ianaIdentifier) { public static Registrar persistNewRegistrar(String clientId, long ianaIdentifier) {
return persistSimpleResource( return persistSimpleResource(
new Registrar.Builder() new Registrar.Builder()
.setClientIdentifier(clientId) .setClientId(clientId)
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(ianaIdentifier) .setIanaIdentifier(ianaIdentifier)
.build()); .build());

View file

@ -57,7 +57,7 @@ public final class FullFieldsTestEntityHelper {
public static Registrar makeRegistrar( public static Registrar makeRegistrar(
String clientId, String registrarName, Registrar.State state, Long ianaIdentifier) { String clientId, String registrarName, Registrar.State state, Long ianaIdentifier) {
Registrar registrar = new Registrar.Builder() Registrar registrar = new Registrar.Builder()
.setClientIdentifier(clientId) .setClientId(clientId)
.setRegistrarName(registrarName) .setRegistrarName(registrarName)
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(ianaIdentifier) .setIanaIdentifier(ianaIdentifier)
@ -225,7 +225,7 @@ public final class FullFieldsTestEntityHelper {
.setLastEppUpdateTime(DateTime.parse("2009-05-29T20:13:00Z")) .setLastEppUpdateTime(DateTime.parse("2009-05-29T20:13:00Z"))
.setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z")) .setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z"))
.setRegistrationExpirationTime(DateTime.parse("2110-10-08T00:44:59Z")) .setRegistrationExpirationTime(DateTime.parse("2110-10-08T00:44:59Z"))
.setCurrentSponsorClientId(registrar.getClientIdentifier()) .setCurrentSponsorClientId(registrar.getClientId())
.setStatusValues(ImmutableSet.of( .setStatusValues(ImmutableSet.of(
StatusValue.CLIENT_DELETE_PROHIBITED, StatusValue.CLIENT_DELETE_PROHIBITED,
StatusValue.CLIENT_RENEW_PROHIBITED, StatusValue.CLIENT_RENEW_PROHIBITED,

View file

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

View file

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

View file

@ -39,6 +39,6 @@ public abstract class EppToolCommandTestCase<C extends EppToolCommand> extends C
/** Helper to get a new {@link EppToolVerifier} instance. */ /** Helper to get a new {@link EppToolVerifier} instance. */
EppToolVerifier eppVerifier() { 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 { public class EppToolVerifier {
private final Connection connection; private final Connection connection;
private final String clientIdentifier; private final String clientId;
private final boolean superuser; private final boolean superuser;
private final boolean dryRun; private final boolean dryRun;
@ -44,27 +44,27 @@ public class EppToolVerifier {
} }
private EppToolVerifier( private EppToolVerifier(
Connection connection, String clientIdentifier, boolean superuser, boolean dryRun) { Connection connection, String clientId, boolean superuser, boolean dryRun) {
this.connection = connection; this.connection = connection;
this.clientIdentifier = clientIdentifier; this.clientId = clientId;
this.superuser = superuser; this.superuser = superuser;
this.dryRun = dryRun; this.dryRun = dryRun;
} }
EppToolVerifier withConnection(Connection connection) { EppToolVerifier withConnection(Connection connection) {
return new EppToolVerifier(connection, clientIdentifier, superuser, dryRun); return new EppToolVerifier(connection, clientId, superuser, dryRun);
} }
EppToolVerifier withClientIdentifier(String clientIdentifier) { EppToolVerifier withClientId(String clientId) {
return new EppToolVerifier(connection, clientIdentifier, superuser, dryRun); return new EppToolVerifier(connection, clientId, superuser, dryRun);
} }
EppToolVerifier asSuperuser() { EppToolVerifier asSuperuser() {
return new EppToolVerifier(connection, clientIdentifier, true, dryRun); return new EppToolVerifier(connection, clientId, true, dryRun);
} }
EppToolVerifier asDryRun() { EppToolVerifier asDryRun() {
return new EppToolVerifier(connection, clientIdentifier, superuser, true); return new EppToolVerifier(connection, clientId, superuser, true);
} }
void verifySent(String... xmlToMatch) throws Exception { void verifySent(String... xmlToMatch) throws Exception {
@ -88,7 +88,7 @@ public class EppToolVerifier {
readResourceUtf8(getClass(), "testdata/" + xml), readResourceUtf8(getClass(), "testdata/" + xml),
URLDecoder.decode(map.get("xml"), UTF_8.toString())); URLDecoder.decode(map.get("xml"), UTF_8.toString()));
assertThat(map).containsEntry("dryRun", Boolean.toString(dryRun)); assertThat(map).containsEntry("dryRun", Boolean.toString(dryRun));
assertThat(map).containsEntry("clientIdentifier", clientIdentifier); assertThat(map).containsEntry("clientId", clientId);
assertThat(map).containsEntry("superuser", Boolean.toString(superuser)); assertThat(map).containsEntry("superuser", Boolean.toString(superuser));
} }
} }

View file

@ -60,12 +60,12 @@ public class MutatingCommandTest {
public void init() { public void init() {
registrar1 = persistResource(new Registrar.Builder() registrar1 = persistResource(new Registrar.Builder()
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setClientIdentifier("Registrar1") .setClientId("Registrar1")
.setIanaIdentifier(1L) .setIanaIdentifier(1L)
.build()); .build());
registrar2 = persistResource(new Registrar.Builder() registrar2 = persistResource(new Registrar.Builder()
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setClientIdentifier("Registrar2") .setClientId("Registrar2")
.setIanaIdentifier(2L) .setIanaIdentifier(2L)
.build()); .build());
newRegistrar1 = registrar1.asBuilder().setBillingIdentifier(42L).build(); newRegistrar1 = registrar1.asBuilder().setBillingIdentifier(42L).build();

View file

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

View file

@ -43,7 +43,7 @@ public class UniformRapidSuspensionCommandTest
public void initResources() { public void initResources() {
// Since the command's history client ID must be CharlestonRoad, resave TheRegistrar that way. // Since the command's history client ID must be CharlestonRoad, resave TheRegistrar that way.
persistResource(Registrar.loadByClientId("TheRegistrar").asBuilder() persistResource(Registrar.loadByClientId("TheRegistrar").asBuilder()
.setClientIdentifier("CharlestonRoad") .setClientId("CharlestonRoad")
.build()); .build());
ns1 = persistActiveHost("ns1.example.com"); ns1 = persistActiveHost("ns1.example.com");
ns2 = persistActiveHost("ns2.example.com"); ns2 = persistActiveHost("ns2.example.com");
@ -72,7 +72,7 @@ public class UniformRapidSuspensionCommandTest
"--hosts=urs1.example.com,urs2.example.com", "--hosts=urs1.example.com,urs2.example.com",
"--dsdata={\"keyTag\":1,\"alg\":1,\"digestType\":1,\"digest\":\"abc\"}"); "--dsdata={\"keyTag\":1,\"alg\":1,\"digestType\":1,\"digest\":\"abc\"}");
eppVerifier() eppVerifier()
.withClientIdentifier("CharlestonRoad") .withClientId("CharlestonRoad")
.asSuperuser() .asSuperuser()
.verifySent("uniform_rapid_suspension.xml"); .verifySent("uniform_rapid_suspension.xml");
assertInStdout("uniform_rapid_suspension --undo"); assertInStdout("uniform_rapid_suspension --undo");
@ -89,7 +89,7 @@ public class UniformRapidSuspensionCommandTest
persistDomainWithHosts(urs2, ns1); persistDomainWithHosts(urs2, ns1);
runCommandForced("--domain_name=evil.tld", "--hosts=urs1.example.com,urs2.example.com"); runCommandForced("--domain_name=evil.tld", "--hosts=urs1.example.com,urs2.example.com");
eppVerifier() eppVerifier()
.withClientIdentifier("CharlestonRoad") .withClientId("CharlestonRoad")
.asSuperuser() .asSuperuser()
.verifySent("uniform_rapid_suspension_existing_host.xml"); .verifySent("uniform_rapid_suspension_existing_host.xml");
assertInStdout("uniform_rapid_suspension --undo "); assertInStdout("uniform_rapid_suspension --undo ");
@ -125,7 +125,7 @@ public class UniformRapidSuspensionCommandTest
runCommandForced( runCommandForced(
"--domain_name=evil.tld", "--undo", "--hosts=ns1.example.com,ns2.example.com"); "--domain_name=evil.tld", "--undo", "--hosts=ns1.example.com,ns2.example.com");
eppVerifier() eppVerifier()
.withClientIdentifier("CharlestonRoad") .withClientId("CharlestonRoad")
.asSuperuser() .asSuperuser()
.verifySent("uniform_rapid_suspension_undo.xml"); .verifySent("uniform_rapid_suspension_undo.xml");
assertNotInStdout("--undo"); // Undo shouldn't print a new undo command. assertNotInStdout("--undo"); // Undo shouldn't print a new undo command.
@ -140,7 +140,7 @@ public class UniformRapidSuspensionCommandTest
"--locks_to_preserve=serverDeleteProhibited", "--locks_to_preserve=serverDeleteProhibited",
"--hosts=ns1.example.com,ns2.example.com"); "--hosts=ns1.example.com,ns2.example.com");
eppVerifier() eppVerifier()
.withClientIdentifier("CharlestonRoad") .withClientId("CharlestonRoad")
.asSuperuser() .asSuperuser()
.verifySent("uniform_rapid_suspension_undo_preserve.xml"); .verifySent("uniform_rapid_suspension_undo_preserve.xml");
assertNotInStdout("--undo"); // Undo shouldn't print a new undo command. 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 // 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. // CharlestonRoad so we don't have to pass in --history_client_id everywhere below.
persistResource(Registrar.loadByClientId("TheRegistrar").asBuilder() persistResource(Registrar.loadByClientId("TheRegistrar").asBuilder()
.setClientIdentifier("CharlestonRoad") .setClientId("CharlestonRoad")
.build()); .build());
createTld("xn--q9jyb4c"); createTld("xn--q9jyb4c");

View file

@ -50,7 +50,7 @@ public class NameserverWhoisResponseTest {
@Before @Before
public void setUp() { public void setUp() {
persistResource(new Registrar.Builder() persistResource(new Registrar.Builder()
.setClientIdentifier("example") .setClientId("example")
.setRegistrarName("Example Registrar, Inc.") .setRegistrarName("Example Registrar, Inc.")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(8L) .setIanaIdentifier(8L)

View file

@ -44,7 +44,7 @@ public class RegistrarWhoisResponseTest {
@Test @Test
public void getTextOutputTest() { public void getTextOutputTest() {
Registrar registrar = new Registrar.Builder() Registrar registrar = new Registrar.Builder()
.setClientIdentifier("exregistrar") .setClientId("exregistrar")
.setRegistrarName("Example Registrar, Inc.") .setRegistrarName("Example Registrar, Inc.")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(8L) .setIanaIdentifier(8L)
@ -120,7 +120,7 @@ public class RegistrarWhoisResponseTest {
@Test @Test
public void testSetOfFields() { public void testSetOfFields() {
Registrar registrar = new Registrar.Builder() Registrar registrar = new Registrar.Builder()
.setClientIdentifier("exregistrar") .setClientId("exregistrar")
.setType(Registrar.Type.REAL) .setType(Registrar.Type.REAL)
.setIanaIdentifier(8L) .setIanaIdentifier(8L)
.setState(Registrar.State.ACTIVE) .setState(Registrar.State.ACTIVE)