mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 14:54:51 +02:00
Remove nearly all uses of ReferenceUnion
ReferenceUnion is a hack to work around the mismatch between how we store references (by roid) and how they are represented in EPP (by foreign key). If it ever needed to exist (not entirely clear...) it should have remained tightly scoped within the domain commands and resources. Instead it has leaked everywhere in the project, causing lots of boilerplate. This CL hides all of that behind standard Refs, and should be followed by work to remove ReferenceUnion completely. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=122424416
This commit is contained in:
parent
56c8bb0f2a
commit
9a2afc7a9b
59 changed files with 448 additions and 454 deletions
|
@ -17,12 +17,12 @@ package google.registry.flows;
|
||||||
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
|
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
import com.googlecode.objectify.Work;
|
import com.googlecode.objectify.Work;
|
||||||
|
|
||||||
import google.registry.flows.EppException.AssociationProhibitsOperationException;
|
import google.registry.flows.EppException.AssociationProhibitsOperationException;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.EppResource.Builder;
|
import google.registry.model.EppResource.Builder;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppinput.ResourceCommand.SingleResourceCommand;
|
import google.registry.model.eppinput.ResourceCommand.SingleResourceCommand;
|
||||||
import google.registry.model.eppoutput.Result.Code;
|
import google.registry.model.eppoutput.Result.Code;
|
||||||
|
@ -51,7 +51,7 @@ public abstract class ResourceAsyncDeleteFlow
|
||||||
// that would be hard to reason about, and there's no real gain in doing so.
|
// that would be hard to reason about, and there's no real gain in doing so.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isLinkedForFailfast(ReferenceUnion.create(fki.getReference()));
|
return isLinkedForFailfast(fki.getReference());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (isLinked) {
|
if (isLinked) {
|
||||||
|
@ -60,7 +60,7 @@ public abstract class ResourceAsyncDeleteFlow
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Subclasses must override this to check if the supplied reference has incoming links. */
|
/** Subclasses must override this to check if the supplied reference has incoming links. */
|
||||||
protected abstract boolean isLinkedForFailfast(ReferenceUnion<R> ref);
|
protected abstract boolean isLinkedForFailfast(Ref<R> ref);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final R createOrMutateResource() {
|
protected final R createOrMutateResource() {
|
||||||
|
|
|
@ -16,9 +16,10 @@ package google.registry.flows.async;
|
||||||
|
|
||||||
import static google.registry.flows.ResourceFlowUtils.handlePendingTransferOnDelete;
|
import static google.registry.flows.ResourceFlowUtils.handlePendingTransferOnDelete;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.Type;
|
import google.registry.model.reporting.HistoryEntry.Type;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
|
@ -48,7 +49,7 @@ public class DeleteContactResourceAction extends DeleteEppResourceAction<Contact
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isLinked(
|
protected boolean isLinked(
|
||||||
DomainBase domain, ReferenceUnion<ContactResource> targetResourceRef) {
|
DomainBase domain, Ref<ContactResource> targetResourceRef) {
|
||||||
return domain.getReferencedContacts().contains(targetResourceRef);
|
return domain.getReferencedContacts().contains(targetResourceRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ import google.registry.mapreduce.inputs.NullInput;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.annotations.ExternalMessagingName;
|
import google.registry.model.annotations.ExternalMessagingName;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -147,7 +146,7 @@ public abstract class DeleteEppResourceAction<T extends EppResource> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determine whether the target resource is a linked resource on the domain. */
|
/** Determine whether the target resource is a linked resource on the domain. */
|
||||||
protected abstract boolean isLinked(DomainBase domain, ReferenceUnion<T> targetResourceRef);
|
protected abstract boolean isLinked(DomainBase domain, Ref<T> targetResourceRef);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void map(DomainBase domain) {
|
public void map(DomainBase domain) {
|
||||||
|
@ -159,12 +158,12 @@ public abstract class DeleteEppResourceAction<T extends EppResource> implements
|
||||||
emit(targetEppResourceKey, false);
|
emit(targetEppResourceKey, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// The ReferenceUnion can't be a field on the Mapper, because when a Ref<?> is serialized
|
// The Ref can't be a field on the Mapper, because when a Ref<?> is serialized (required for
|
||||||
// (required for each MapShardTask), it uses the DeadRef version, which contains the Ref's
|
// each MapShardTask), it uses the DeadRef version, which contains the Ref's value, which
|
||||||
// value, which isn't serializable. Thankfully, this isn't expensive.
|
// isn't serializable. Thankfully, this isn't expensive.
|
||||||
// See: https://github.com/objectify/objectify/blob/master/src/main/java/com/googlecode/objectify/impl/ref/DeadRef.java
|
// See: https://github.com/objectify/objectify/blob/master/src/main/java/com/googlecode/objectify/impl/ref/DeadRef.java
|
||||||
if (isActive(domain, targetResourceUpdateTimestamp)
|
if (isActive(domain, targetResourceUpdateTimestamp)
|
||||||
&& isLinked(domain, ReferenceUnion.create(Ref.create(targetEppResourceKey)))) {
|
&& isLinked(domain, Ref.create(targetEppResourceKey))) {
|
||||||
emit(targetEppResourceKey, true);
|
emit(targetEppResourceKey, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,10 @@ package google.registry.flows.async;
|
||||||
|
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.dns.DnsQueue;
|
import google.registry.dns.DnsQueue;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntry.Type;
|
import google.registry.model.reporting.HistoryEntry.Type;
|
||||||
|
@ -48,8 +49,7 @@ public class DeleteHostResourceAction extends DeleteEppResourceAction<HostResour
|
||||||
private static final long serialVersionUID = 1941092742903217194L;
|
private static final long serialVersionUID = 1941092742903217194L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isLinked(
|
protected boolean isLinked(DomainBase domain, Ref<HostResource> targetResourceRef) {
|
||||||
DomainBase domain, ReferenceUnion<HostResource> targetResourceRef) {
|
|
||||||
return domain.getNameservers().contains(targetResourceRef);
|
return domain.getNameservers().contains(targetResourceRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import google.registry.mapreduce.MapreduceAction;
|
||||||
import google.registry.mapreduce.MapreduceRunner;
|
import google.registry.mapreduce.MapreduceRunner;
|
||||||
import google.registry.mapreduce.inputs.EppResourceInputs;
|
import google.registry.mapreduce.inputs.EppResourceInputs;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.HttpException.BadRequestException;
|
import google.registry.request.HttpException.BadRequestException;
|
||||||
|
@ -98,7 +97,7 @@ public class DnsRefreshForHostRenameAction implements MapreduceAction {
|
||||||
@Override
|
@Override
|
||||||
public final void map(DomainResource domain) {
|
public final void map(DomainResource domain) {
|
||||||
if (isActive(domain, hostUpdateTime)
|
if (isActive(domain, hostUpdateTime)
|
||||||
&& domain.getNameservers().contains(ReferenceUnion.create(Ref.create(targetHostKey)))) {
|
&& domain.getNameservers().contains(Ref.create(targetHostKey))) {
|
||||||
try {
|
try {
|
||||||
dnsQueue.addDomainRefreshTask(domain.getFullyQualifiedDomainName());
|
dnsQueue.addDomainRefreshTask(domain.getFullyQualifiedDomainName());
|
||||||
logger.infofmt("Enqueued refresh for domain %s", domain.getFullyQualifiedDomainName());
|
logger.infofmt("Enqueued refresh for domain %s", domain.getFullyQualifiedDomainName());
|
||||||
|
|
|
@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.config.RegistryEnvironment;
|
import google.registry.config.RegistryEnvironment;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
@ -33,7 +34,6 @@ import google.registry.model.contact.ContactCommand.Delete;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.contact.ContactResource.Builder;
|
import google.registry.model.contact.ContactResource.Builder;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +50,7 @@ public class ContactDeleteFlow extends ResourceAsyncDeleteFlow<ContactResource,
|
||||||
private static final int FAILFAST_CHECK_COUNT = 5;
|
private static final int FAILFAST_CHECK_COUNT = 5;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isLinkedForFailfast(final ReferenceUnion<ContactResource> ref) {
|
protected boolean isLinkedForFailfast(final Ref<ContactResource> ref) {
|
||||||
// Query for the first few linked domains, and if found, actually load them. The query is
|
// Query for the first few linked domains, and if found, actually load them. The query is
|
||||||
// eventually consistent and so might be very stale, but the direct load will not be stale,
|
// eventually consistent and so might be very stale, but the direct load will not be stale,
|
||||||
// just non-transactional. If we find at least one actual reference then we can reliably
|
// just non-transactional. If we find at least one actual reference then we can reliably
|
||||||
|
@ -58,7 +58,7 @@ public class ContactDeleteFlow extends ResourceAsyncDeleteFlow<ContactResource,
|
||||||
return Iterables.any(
|
return Iterables.any(
|
||||||
ofy().load().keys(
|
ofy().load().keys(
|
||||||
queryDomainsUsingResource(
|
queryDomainsUsingResource(
|
||||||
ContactResource.class, ref.getLinked(), now, FAILFAST_CHECK_COUNT)).values(),
|
ContactResource.class, ref, now, FAILFAST_CHECK_COUNT)).values(),
|
||||||
new Predicate<DomainBase>() {
|
new Predicate<DomainBase>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(DomainBase domain) {
|
public boolean apply(DomainBase domain) {
|
||||||
|
|
|
@ -20,7 +20,8 @@ import static google.registry.flows.domain.DomainFlowUtils.validateContactsHaveT
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateDomainName;
|
import static google.registry.flows.domain.DomainFlowUtils.validateDomainName;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables;
|
import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateDsData;
|
import static google.registry.flows.domain.DomainFlowUtils.validateDsData;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateNameservers;
|
import static google.registry.flows.domain.DomainFlowUtils.validateNameserversAllowedOnTld;
|
||||||
|
import static google.registry.flows.domain.DomainFlowUtils.validateNameserversCount;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateNoDuplicateContacts;
|
import static google.registry.flows.domain.DomainFlowUtils.validateNoDuplicateContacts;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld;
|
import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent;
|
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent;
|
||||||
|
@ -36,6 +37,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.model.registry.Registries.findTldForName;
|
import static google.registry.model.registry.Registries.findTldForName;
|
||||||
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
|
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
|
||||||
import static google.registry.pricing.PricingEngineProxy.getDomainCreateCost;
|
import static google.registry.pricing.PricingEngineProxy.getDomainCreateCost;
|
||||||
|
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
|
@ -67,6 +69,8 @@ import google.registry.model.tmch.ClaimsListShard;
|
||||||
|
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,10 +214,13 @@ public abstract class BaseDomainCreateFlow<R extends DomainBase, B extends Build
|
||||||
command.getRegistrant(),
|
command.getRegistrant(),
|
||||||
command.getNameservers());
|
command.getNameservers());
|
||||||
validateContactsHaveTypes(command.getContacts());
|
validateContactsHaveTypes(command.getContacts());
|
||||||
validateRegistrantAllowedOnTld(tld, command.getRegistrant());
|
validateRegistrantAllowedOnTld(tld, command.getRegistrantContactId());
|
||||||
validateNoDuplicateContacts(command.getContacts());
|
validateNoDuplicateContacts(command.getContacts());
|
||||||
validateRequiredContactsPresent(command.getRegistrant(), command.getContacts());
|
validateRequiredContactsPresent(command.getRegistrant(), command.getContacts());
|
||||||
validateNameservers(tld, command.getNameservers());
|
Set<String> fullyQualifiedHostNames =
|
||||||
|
nullToEmpty(command.getNameserverFullyQualifiedHostNames());
|
||||||
|
validateNameserversCount(fullyQualifiedHostNames.size());
|
||||||
|
validateNameserversAllowedOnTld(tld, fullyQualifiedHostNames);
|
||||||
validateLaunchCreateExtension();
|
validateLaunchCreateExtension();
|
||||||
// If a signed mark was provided, then it must match the desired domain label.
|
// If a signed mark was provided, then it must match the desired domain label.
|
||||||
// We do this after validating the launch create extension so that flows which don't allow any
|
// We do this after validating the launch create extension so that flows which don't allow any
|
||||||
|
|
|
@ -20,7 +20,8 @@ import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToT
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.cloneAndLinkReferences;
|
import static google.registry.flows.domain.DomainFlowUtils.cloneAndLinkReferences;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateContactsHaveTypes;
|
import static google.registry.flows.domain.DomainFlowUtils.validateContactsHaveTypes;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateDsData;
|
import static google.registry.flows.domain.DomainFlowUtils.validateDsData;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateNameservers;
|
import static google.registry.flows.domain.DomainFlowUtils.validateNameserversAllowedOnTld;
|
||||||
|
import static google.registry.flows.domain.DomainFlowUtils.validateNameserversCount;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateNoDuplicateContacts;
|
import static google.registry.flows.domain.DomainFlowUtils.validateNoDuplicateContacts;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld;
|
import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld;
|
||||||
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent;
|
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent;
|
||||||
|
@ -112,6 +113,10 @@ public abstract class BaseDomainUpdateFlow<R extends DomainBase, B extends Build
|
||||||
command.getInnerAdd().getNameservers());
|
command.getInnerAdd().getNameservers());
|
||||||
validateContactsHaveTypes(command.getInnerAdd().getContacts());
|
validateContactsHaveTypes(command.getInnerAdd().getContacts());
|
||||||
validateContactsHaveTypes(command.getInnerRemove().getContacts());
|
validateContactsHaveTypes(command.getInnerRemove().getContacts());
|
||||||
|
validateRegistrantAllowedOnTld(
|
||||||
|
existingResource.getTld(), command.getInnerChange().getRegistrantContactId());
|
||||||
|
validateNameserversAllowedOnTld(
|
||||||
|
existingResource.getTld(), command.getInnerAdd().getNameserverFullyQualifiedHostNames());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Subclasses can override this to do more specific verification. */
|
/** Subclasses can override this to do more specific verification. */
|
||||||
|
@ -123,8 +128,7 @@ public abstract class BaseDomainUpdateFlow<R extends DomainBase, B extends Build
|
||||||
validateNoDuplicateContacts(newResource.getContacts());
|
validateNoDuplicateContacts(newResource.getContacts());
|
||||||
validateRequiredContactsPresent(newResource.getRegistrant(), newResource.getContacts());
|
validateRequiredContactsPresent(newResource.getRegistrant(), newResource.getContacts());
|
||||||
validateDsData(newResource.getDsData());
|
validateDsData(newResource.getDsData());
|
||||||
validateRegistrantAllowedOnTld(newResource.getTld(), newResource.getRegistrant());
|
validateNameserversCount(newResource.getNameservers().size());
|
||||||
validateNameservers(newResource.getTld(), newResource.getNameservers());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The secDNS:all element must have value 'true' if present. */
|
/** The secDNS:all element must have value 'true' if present. */
|
||||||
|
|
|
@ -91,7 +91,7 @@ import java.util.List;
|
||||||
* @error {@link DomainFlowUtils.LeadingDashException}
|
* @error {@link DomainFlowUtils.LeadingDashException}
|
||||||
* @error {@link DomainFlowUtils.LinkedResourceDoesNotExistException}
|
* @error {@link DomainFlowUtils.LinkedResourceDoesNotExistException}
|
||||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||||
* @error {@link DomainFlowUtils.NameserverNotAllowedException}
|
* @error {@link DomainFlowUtils.NameserversNotAllowedException}
|
||||||
* @error {@link DomainFlowUtils.NoMarksFoundMatchingDomainException}
|
* @error {@link DomainFlowUtils.NoMarksFoundMatchingDomainException}
|
||||||
* @error {@link DomainFlowUtils.PremiumNameBlockedException}
|
* @error {@link DomainFlowUtils.PremiumNameBlockedException}
|
||||||
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
||||||
|
|
|
@ -50,7 +50,7 @@ import google.registry.model.reporting.HistoryEntry;
|
||||||
* @error {@link DomainFlowUtils.MissingAdminContactException}
|
* @error {@link DomainFlowUtils.MissingAdminContactException}
|
||||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||||
* @error {@link DomainFlowUtils.MissingTechnicalContactException}
|
* @error {@link DomainFlowUtils.MissingTechnicalContactException}
|
||||||
* @error {@link DomainFlowUtils.NameserverNotAllowedException}
|
* @error {@link DomainFlowUtils.NameserversNotAllowedException}
|
||||||
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
||||||
* @error {@link DomainFlowUtils.TooManyDsRecordsException}
|
* @error {@link DomainFlowUtils.TooManyDsRecordsException}
|
||||||
* @error {@link DomainFlowUtils.TooManyNameserversException}
|
* @error {@link DomainFlowUtils.TooManyNameserversException}
|
||||||
|
|
|
@ -81,7 +81,7 @@ import java.util.Set;
|
||||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||||
* @error {@link DomainFlowUtils.MissingRegistrantException}
|
* @error {@link DomainFlowUtils.MissingRegistrantException}
|
||||||
* @error {@link DomainFlowUtils.MissingTechnicalContactException}
|
* @error {@link DomainFlowUtils.MissingTechnicalContactException}
|
||||||
* @error {@link DomainFlowUtils.NameserverNotAllowedException}
|
* @error {@link DomainFlowUtils.NameserversNotAllowedException}
|
||||||
* @error {@link DomainFlowUtils.PremiumNameBlockedException}
|
* @error {@link DomainFlowUtils.PremiumNameBlockedException}
|
||||||
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
||||||
* @error {@link DomainFlowUtils.TldDoesNotExistException}
|
* @error {@link DomainFlowUtils.TldDoesNotExistException}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import static com.google.common.base.Predicates.equalTo;
|
||||||
import static com.google.common.base.Strings.emptyToNull;
|
import static com.google.common.base.Strings.emptyToNull;
|
||||||
import static com.google.common.collect.Iterables.any;
|
import static com.google.common.collect.Iterables.any;
|
||||||
import static com.google.common.collect.Iterables.concat;
|
import static com.google.common.collect.Iterables.concat;
|
||||||
|
import static com.google.common.collect.Sets.difference;
|
||||||
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.model.registry.Registries.findTldForName;
|
import static google.registry.model.registry.Registries.findTldForName;
|
||||||
|
@ -43,6 +44,7 @@ import com.google.common.collect.Sets;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.EppException.AuthorizationErrorException;
|
import google.registry.flows.EppException.AuthorizationErrorException;
|
||||||
|
@ -65,7 +67,6 @@ import google.registry.model.domain.DomainCommand.CreateOrUpdate;
|
||||||
import google.registry.model.domain.DomainCommand.InvalidReferenceException;
|
import google.registry.model.domain.DomainCommand.InvalidReferenceException;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.fee.BaseFeeCommand;
|
import google.registry.model.domain.fee.BaseFeeCommand;
|
||||||
import google.registry.model.domain.fee.BaseFeeRequest;
|
import google.registry.model.domain.fee.BaseFeeRequest;
|
||||||
import google.registry.model.domain.fee.BaseFeeResponse;
|
import google.registry.model.domain.fee.BaseFeeResponse;
|
||||||
|
@ -249,23 +250,23 @@ public class DomainFlowUtils {
|
||||||
/** Verify that no linked resources have disallowed statuses. */
|
/** Verify that no linked resources have disallowed statuses. */
|
||||||
static void verifyNotInPendingDelete(
|
static void verifyNotInPendingDelete(
|
||||||
Set<DesignatedContact> contacts,
|
Set<DesignatedContact> contacts,
|
||||||
ReferenceUnion<ContactResource> registrant,
|
Ref<ContactResource> registrant,
|
||||||
Set<ReferenceUnion<HostResource>> nameservers) throws EppException {
|
Set<Ref<HostResource>> nameservers) throws EppException {
|
||||||
for (DesignatedContact contact : nullToEmpty(contacts)) {
|
for (DesignatedContact contact : nullToEmpty(contacts)) {
|
||||||
verifyNotInPendingDelete(contact.getContactId());
|
verifyNotInPendingDelete(contact.getContactRef());
|
||||||
}
|
}
|
||||||
if (registrant != null) {
|
if (registrant != null) {
|
||||||
verifyNotInPendingDelete(registrant);
|
verifyNotInPendingDelete(registrant);
|
||||||
}
|
}
|
||||||
for (ReferenceUnion<HostResource> host : nullToEmpty(nameservers)) {
|
for (Ref<HostResource> host : nullToEmpty(nameservers)) {
|
||||||
verifyNotInPendingDelete(host);
|
verifyNotInPendingDelete(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void verifyNotInPendingDelete(
|
private static void verifyNotInPendingDelete(
|
||||||
ReferenceUnion<? extends EppResource> resourceRef) throws EppException {
|
Ref<? extends EppResource> resourceRef) throws EppException {
|
||||||
|
|
||||||
EppResource resource = resourceRef.getLinked().get();
|
EppResource resource = resourceRef.get();
|
||||||
if (resource.getStatusValues().contains(StatusValue.PENDING_DELETE)) {
|
if (resource.getStatusValues().contains(StatusValue.PENDING_DELETE)) {
|
||||||
throw new LinkedResourceInPendingDeleteProhibitsOperationException(resource.getForeignKey());
|
throw new LinkedResourceInPendingDeleteProhibitsOperationException(resource.getForeignKey());
|
||||||
}
|
}
|
||||||
|
@ -280,28 +281,12 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a foreign key for a {@link ReferenceUnion} from memory or datastore as needed. */
|
static void validateNameserversCount(int count) throws EppException {
|
||||||
private static String resolveForeignKey(ReferenceUnion<?> ref) {
|
if (count > MAX_NAMESERVERS_PER_DOMAIN) {
|
||||||
return ref.getForeignKey() != null
|
throw new TooManyNameserversException(String.format(
|
||||||
? ref.getForeignKey()
|
"Only %d nameservers are allowed per domain", MAX_NAMESERVERS_PER_DOMAIN));
|
||||||
: ref.getLinked().get().getForeignKey();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void validateNameservers(String tld, Set<ReferenceUnion<HostResource>> nameservers)
|
|
||||||
throws EppException {
|
|
||||||
if (nameservers != null && nameservers.size() > MAX_NAMESERVERS_PER_DOMAIN) {
|
|
||||||
throw new TooManyNameserversException(String.format(
|
|
||||||
"Only %d nameservers are allowed per domain", MAX_NAMESERVERS_PER_DOMAIN));
|
|
||||||
}
|
|
||||||
ImmutableSet<String> whitelist = Registry.get(tld).getAllowedFullyQualifiedHostNames();
|
|
||||||
if (!whitelist.isEmpty()) { // Empty whitelists are ignored.
|
|
||||||
for (ReferenceUnion<HostResource> nameserver : nullToEmpty(nameservers)) {
|
|
||||||
String foreignKey = resolveForeignKey(nameserver);
|
|
||||||
if (!whitelist.contains(foreignKey)) {
|
|
||||||
throw new NameserverNotAllowedException(foreignKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void validateNoDuplicateContacts(Set<DesignatedContact> contacts)
|
static void validateNoDuplicateContacts(Set<DesignatedContact> contacts)
|
||||||
|
@ -315,8 +300,8 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void validateRequiredContactsPresent(
|
static void validateRequiredContactsPresent(
|
||||||
ReferenceUnion<ContactResource> registrant, Set<DesignatedContact> contacts)
|
Ref<ContactResource> registrant, Set<DesignatedContact> contacts)
|
||||||
throws RequiredParameterMissingException {
|
throws RequiredParameterMissingException {
|
||||||
if (registrant == null) {
|
if (registrant == null) {
|
||||||
throw new MissingRegistrantException();
|
throw new MissingRegistrantException();
|
||||||
}
|
}
|
||||||
|
@ -333,12 +318,24 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void validateRegistrantAllowedOnTld(String tld, ReferenceUnion<ContactResource> registrant)
|
static void validateRegistrantAllowedOnTld(String tld, String registrantContactId)
|
||||||
throws RegistrantNotAllowedException {
|
throws RegistrantNotAllowedException {
|
||||||
ImmutableSet<String> whitelist = Registry.get(tld).getAllowedRegistrantContactIds();
|
ImmutableSet<String> whitelist = Registry.get(tld).getAllowedRegistrantContactIds();
|
||||||
// Empty whitelists are ignored.
|
// Empty whitelists are ignored.
|
||||||
if (!whitelist.isEmpty() && !whitelist.contains(resolveForeignKey(registrant))) {
|
if (!whitelist.isEmpty() && !whitelist.contains(registrantContactId)) {
|
||||||
throw new RegistrantNotAllowedException(resolveForeignKey(registrant));
|
throw new RegistrantNotAllowedException(registrantContactId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void validateNameserversAllowedOnTld(String tld, Set<String> fullyQualifiedHostNames)
|
||||||
|
throws EppException {
|
||||||
|
ImmutableSet<String> whitelist = Registry.get(tld).getAllowedFullyQualifiedHostNames();
|
||||||
|
if (whitelist.isEmpty()) { // Empty whitelists are ignored.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<String> disallowedNameservers = difference(nullToEmpty(fullyQualifiedHostNames), whitelist);
|
||||||
|
if (!disallowedNameservers.isEmpty()) {
|
||||||
|
throw new NameserversNotAllowedException(disallowedNameservers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1015,10 +1012,13 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Nameserver is not whitelisted for this TLD. */
|
/** Nameserver are not whitelisted for this TLD. */
|
||||||
public static class NameserverNotAllowedException extends StatusProhibitsOperationException {
|
public static class NameserversNotAllowedException extends StatusProhibitsOperationException {
|
||||||
public NameserverNotAllowedException(String fullyQualifiedHostName) {
|
public NameserversNotAllowedException(Set<String> fullyQualifiedHostNames) {
|
||||||
super(String.format("Nameserver %s is not whitelisted for this TLD", fullyQualifiedHostName));
|
super(String.format(
|
||||||
|
"Nameservers '%s' are not whitelisted for this TLD",
|
||||||
|
Joiner.on(',').join(fullyQualifiedHostNames)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ import java.util.Set;
|
||||||
* @error {@link DomainFlowUtils.MissingAdminContactException}
|
* @error {@link DomainFlowUtils.MissingAdminContactException}
|
||||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||||
* @error {@link DomainFlowUtils.MissingTechnicalContactException}
|
* @error {@link DomainFlowUtils.MissingTechnicalContactException}
|
||||||
* @error {@link DomainFlowUtils.NameserverNotAllowedException}
|
* @error {@link DomainFlowUtils.NameserversNotAllowedException}
|
||||||
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
|
||||||
* @error {@link DomainFlowUtils.TooManyDsRecordsException}
|
* @error {@link DomainFlowUtils.TooManyDsRecordsException}
|
||||||
* @error {@link DomainFlowUtils.TooManyNameserversException}
|
* @error {@link DomainFlowUtils.TooManyNameserversException}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.config.RegistryEnvironment;
|
import google.registry.config.RegistryEnvironment;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
@ -30,7 +31,6 @@ import google.registry.flows.async.AsyncFlowUtils;
|
||||||
import google.registry.flows.async.DeleteEppResourceAction;
|
import google.registry.flows.async.DeleteEppResourceAction;
|
||||||
import google.registry.flows.async.DeleteHostResourceAction;
|
import google.registry.flows.async.DeleteHostResourceAction;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.host.HostCommand.Delete;
|
import google.registry.model.host.HostCommand.Delete;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.host.HostResource.Builder;
|
import google.registry.model.host.HostResource.Builder;
|
||||||
|
@ -50,7 +50,7 @@ public class HostDeleteFlow extends ResourceAsyncDeleteFlow<HostResource, Builde
|
||||||
private static final int FAILFAST_CHECK_COUNT = 5;
|
private static final int FAILFAST_CHECK_COUNT = 5;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isLinkedForFailfast(final ReferenceUnion<HostResource> ref) {
|
protected boolean isLinkedForFailfast(final Ref<HostResource> ref) {
|
||||||
// Query for the first few linked domains, and if found, actually load them. The query is
|
// Query for the first few linked domains, and if found, actually load them. The query is
|
||||||
// eventually consistent and so might be very stale, but the direct load will not be stale,
|
// eventually consistent and so might be very stale, but the direct load will not be stale,
|
||||||
// just non-transactional. If we find at least one actual reference then we can reliably
|
// just non-transactional. If we find at least one actual reference then we can reliably
|
||||||
|
@ -58,7 +58,7 @@ public class HostDeleteFlow extends ResourceAsyncDeleteFlow<HostResource, Builde
|
||||||
return Iterables.any(
|
return Iterables.any(
|
||||||
ofy().load().keys(
|
ofy().load().keys(
|
||||||
queryDomainsUsingResource(
|
queryDomainsUsingResource(
|
||||||
HostResource.class, ref.getLinked(), now, FAILFAST_CHECK_COUNT)).values(),
|
HostResource.class, ref, now, FAILFAST_CHECK_COUNT)).values(),
|
||||||
new Predicate<DomainBase>() {
|
new Predicate<DomainBase>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(DomainBase domain) {
|
public boolean apply(DomainBase domain) {
|
||||||
|
|
|
@ -36,7 +36,6 @@ import google.registry.model.EppResource.Builder;
|
||||||
import google.registry.model.EppResource.ForeignKeyedEppResource;
|
import google.registry.model.EppResource.ForeignKeyedEppResource;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
|
@ -139,12 +138,12 @@ public final class EppResourceUtils {
|
||||||
latestOf(now, resource.getUpdateAutoTimestamp().getTimestamp()));
|
latestOf(now, resource.getUpdateAutoTimestamp().getTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads returns the hosts specified by the given ReferenceUnions. */
|
/** Loads and returns the hosts specified by the given reference. */
|
||||||
public static ImmutableSet<HostResource> loadReferencedNameservers(
|
public static ImmutableSet<HostResource> loadReferencedNameservers(
|
||||||
Set<ReferenceUnion<HostResource>> hostRefs) {
|
Set<Ref<HostResource>> hostRefs) {
|
||||||
ImmutableSet.Builder<HostResource> builder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<HostResource> builder = new ImmutableSet.Builder<>();
|
||||||
for (ReferenceUnion<HostResource> hostRef : hostRefs) {
|
for (Ref<HostResource> hostRef : hostRefs) {
|
||||||
HostResource host = hostRef.getLinked().get();
|
HostResource host = hostRef.get();
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
builder.add(host);
|
builder.add(host);
|
||||||
}
|
}
|
||||||
|
@ -152,12 +151,12 @@ public final class EppResourceUtils {
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads and returns the contacts specified by the given ReferenceUnions. */
|
/** Loads and returns the contacts specified by the given references. */
|
||||||
public static ImmutableSet<ContactResource> loadReferencedContacts(
|
public static ImmutableSet<ContactResource> loadReferencedContacts(
|
||||||
Set<ReferenceUnion<ContactResource>> contactRefs) {
|
Set<Ref<ContactResource>> contactRefs) {
|
||||||
ImmutableSet.Builder<ContactResource> builder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<ContactResource> builder = new ImmutableSet.Builder<>();
|
||||||
for (ReferenceUnion<ContactResource> contactRef : contactRefs) {
|
for (Ref<ContactResource> contactRef : contactRefs) {
|
||||||
builder.add(contactRef.getLinked().get());
|
builder.add(contactRef.get());
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ package google.registry.model.domain;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
import com.googlecode.objectify.annotation.Embed;
|
import com.googlecode.objectify.annotation.Embed;
|
||||||
import com.googlecode.objectify.annotation.Index;
|
import com.googlecode.objectify.annotation.Index;
|
||||||
|
|
||||||
|
@ -50,10 +51,10 @@ public class DesignatedContact extends ImmutableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static DesignatedContact create(Type type, ReferenceUnion<ContactResource> contact) {
|
public static DesignatedContact create(Type type, Ref<ContactResource> contact) {
|
||||||
DesignatedContact instance = new DesignatedContact();
|
DesignatedContact instance = new DesignatedContact();
|
||||||
instance.type = type;
|
instance.type = type;
|
||||||
instance.contactId = contact;
|
instance.contactId = ReferenceUnion.create(contact);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,13 +63,14 @@ public class DesignatedContact extends ImmutableObject {
|
||||||
|
|
||||||
@Index
|
@Index
|
||||||
@XmlValue
|
@XmlValue
|
||||||
|
//TODO(b/28713909): Make this a Ref<ContactResource>.
|
||||||
ReferenceUnion<ContactResource> contactId;
|
ReferenceUnion<ContactResource> contactId;
|
||||||
|
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceUnion<ContactResource> getContactId() {
|
public Ref<ContactResource> getContactRef() {
|
||||||
return contactId;
|
return contactId.getLinked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ package google.registry.model.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
import com.googlecode.objectify.annotation.Embed;
|
import com.googlecode.objectify.annotation.Embed;
|
||||||
|
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
|
@ -38,9 +39,9 @@ public class DomainAuthInfo extends AuthInfo {
|
||||||
checkNotNull(getPw());
|
checkNotNull(getPw());
|
||||||
if (getRepoId() != null) {
|
if (getRepoId() != null) {
|
||||||
// Make sure the repo id matches one of the contacts on the domain.
|
// Make sure the repo id matches one of the contacts on the domain.
|
||||||
ReferenceUnion<ContactResource> foundContact = null;
|
Ref<ContactResource> foundContact = null;
|
||||||
for (ReferenceUnion<ContactResource> contact : domain.getReferencedContacts()) {
|
for (Ref<ContactResource> contact : domain.getReferencedContacts()) {
|
||||||
String contactRepoId = contact.getLinked().getKey().getName();
|
String contactRepoId = contact.getKey().getName();
|
||||||
if (getRepoId().equals(contactRepoId)) {
|
if (getRepoId().equals(contactRepoId)) {
|
||||||
foundContact = contact;
|
foundContact = contact;
|
||||||
break;
|
break;
|
||||||
|
@ -50,7 +51,7 @@ public class DomainAuthInfo extends AuthInfo {
|
||||||
throw new BadAuthInfoException();
|
throw new BadAuthInfoException();
|
||||||
}
|
}
|
||||||
// Check if the password provided matches the password on the referenced contact.
|
// Check if the password provided matches the password on the referenced contact.
|
||||||
if (!foundContact.getLinked().get().getAuthInfo().getPw().getValue().equals(
|
if (!foundContact.get().getAuthInfo().getPw().getValue().equals(
|
||||||
getPw().getValue())) {
|
getPw().getValue())) {
|
||||||
throw new BadAuthInfoException();
|
throw new BadAuthInfoException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import static com.google.common.base.Strings.isNullOrEmpty;
|
||||||
import static com.google.common.collect.Sets.difference;
|
import static com.google.common.collect.Sets.difference;
|
||||||
import static com.google.common.collect.Sets.union;
|
import static com.google.common.collect.Sets.union;
|
||||||
import static google.registry.model.domain.DesignatedContact.Type.REGISTRANT;
|
import static google.registry.model.domain.DesignatedContact.Type.REGISTRANT;
|
||||||
|
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
||||||
import static google.registry.util.CollectionUtils.union;
|
import static google.registry.util.CollectionUtils.union;
|
||||||
|
@ -27,6 +28,7 @@ import static google.registry.util.DomainNameUtils.getTldFromSld;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSortedSet;
|
import com.google.common.collect.ImmutableSortedSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
import com.googlecode.objectify.annotation.Entity;
|
import com.googlecode.objectify.annotation.Entity;
|
||||||
import com.googlecode.objectify.annotation.Ignore;
|
import com.googlecode.objectify.annotation.Ignore;
|
||||||
import com.googlecode.objectify.annotation.IgnoreSave;
|
import com.googlecode.objectify.annotation.IgnoreSave;
|
||||||
|
@ -74,6 +76,7 @@ public abstract class DomainBase extends EppResource {
|
||||||
/** References to hosts that are the nameservers for the domain. */
|
/** References to hosts that are the nameservers for the domain. */
|
||||||
@XmlElementWrapper(name = "ns")
|
@XmlElementWrapper(name = "ns")
|
||||||
@XmlElement(name = "hostObj")
|
@XmlElement(name = "hostObj")
|
||||||
|
//TODO(b/28713909): Make this a Set<Ref<HostResource>>.
|
||||||
Set<ReferenceUnion<HostResource>> nameservers;
|
Set<ReferenceUnion<HostResource>> nameservers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,6 +105,7 @@ public abstract class DomainBase extends EppResource {
|
||||||
* both stored in {@link DomainBase#allContacts} to allow for more efficient queries.
|
* both stored in {@link DomainBase#allContacts} to allow for more efficient queries.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
@Ignore
|
||||||
|
//TODO(b/28713909): Make this a Ref<ContactResource>.
|
||||||
ReferenceUnion<ContactResource> registrant;
|
ReferenceUnion<ContactResource> registrant;
|
||||||
|
|
||||||
/** Authorization info (aka transfer secret) of the domain. */
|
/** Authorization info (aka transfer secret) of the domain. */
|
||||||
|
@ -149,8 +153,12 @@ public abstract class DomainBase extends EppResource {
|
||||||
return idnTableName;
|
return idnTableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableSet<ReferenceUnion<HostResource>> getNameservers() {
|
public ImmutableSet<Ref<HostResource>> getNameservers() {
|
||||||
return nullToEmptyImmutableCopy(nameservers);
|
ImmutableSet.Builder<Ref<HostResource>> builder = new ImmutableSet.Builder<>();
|
||||||
|
for (ReferenceUnion<HostResource> union : nullToEmptyImmutableCopy(nameservers)) {
|
||||||
|
builder.add(union.getLinked());
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads and returns all linked nameservers. */
|
/** Loads and returns all linked nameservers. */
|
||||||
|
@ -158,12 +166,12 @@ public abstract class DomainBase extends EppResource {
|
||||||
return EppResourceUtils.loadReferencedNameservers(getNameservers());
|
return EppResourceUtils.loadReferencedNameservers(getNameservers());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceUnion<ContactResource> getRegistrant() {
|
public Ref<ContactResource> getRegistrant() {
|
||||||
return registrant;
|
return registrant == null ? null : registrant.getLinked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContactResource loadRegistrant() {
|
public ContactResource loadRegistrant() {
|
||||||
return registrant.getLinked().get();
|
return getRegistrant().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableSet<DesignatedContact> getContacts() {
|
public ImmutableSet<DesignatedContact> getContacts() {
|
||||||
|
@ -175,11 +183,11 @@ public abstract class DomainBase extends EppResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns all referenced contacts from this domain or application. */
|
/** Returns all referenced contacts from this domain or application. */
|
||||||
public ImmutableSet<ReferenceUnion<ContactResource>> getReferencedContacts() {
|
public ImmutableSet<Ref<ContactResource>> getReferencedContacts() {
|
||||||
ImmutableSet.Builder<ReferenceUnion<ContactResource>> contactsBuilder =
|
ImmutableSet.Builder<Ref<ContactResource>> contactsBuilder =
|
||||||
new ImmutableSet.Builder<>();
|
new ImmutableSet.Builder<>();
|
||||||
for (DesignatedContact designated : nullToEmptyImmutableCopy(allContacts)) {
|
for (DesignatedContact designated : nullToEmptyImmutableCopy(allContacts)) {
|
||||||
contactsBuilder.add(designated.getContactId());
|
contactsBuilder.add(designated.getContactRef());
|
||||||
}
|
}
|
||||||
return contactsBuilder.build();
|
return contactsBuilder.build();
|
||||||
}
|
}
|
||||||
|
@ -202,7 +210,7 @@ public abstract class DomainBase extends EppResource {
|
||||||
ImmutableSet.Builder<DesignatedContact> contactsBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<DesignatedContact> contactsBuilder = new ImmutableSet.Builder<>();
|
||||||
for (DesignatedContact contact : nullToEmptyImmutableCopy(allContacts)) {
|
for (DesignatedContact contact : nullToEmptyImmutableCopy(allContacts)) {
|
||||||
if (REGISTRANT.equals(contact.getType())){
|
if (REGISTRANT.equals(contact.getType())){
|
||||||
registrant = contact.getContactId();
|
registrant = ReferenceUnion.create(contact.getContactRef());
|
||||||
} else {
|
} else {
|
||||||
contactsBuilder.add(contact);
|
contactsBuilder.add(contact);
|
||||||
}
|
}
|
||||||
|
@ -229,8 +237,11 @@ public abstract class DomainBase extends EppResource {
|
||||||
checkState(
|
checkState(
|
||||||
!isNullOrEmpty(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
|
!isNullOrEmpty(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
|
||||||
instance.tld = getTldFromSld(instance.fullyQualifiedDomainName);
|
instance.tld = getTldFromSld(instance.fullyQualifiedDomainName);
|
||||||
instance.allContacts = instance.registrant == null ? instance.contacts : union(
|
instance.allContacts = instance.registrant == null
|
||||||
instance.getContacts(), DesignatedContact.create(REGISTRANT, instance.registrant));
|
? instance.contacts
|
||||||
|
: union(
|
||||||
|
instance.getContacts(),
|
||||||
|
DesignatedContact.create(REGISTRANT, instance.registrant.getLinked()));
|
||||||
return super.build();
|
return super.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,8 +255,8 @@ public abstract class DomainBase extends EppResource {
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B setRegistrant(ReferenceUnion<ContactResource> registrant) {
|
public B setRegistrant(Ref<ContactResource> registrant) {
|
||||||
getInstance().registrant = registrant;
|
getInstance().registrant = ReferenceUnion.create(registrant);
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,17 +265,21 @@ public abstract class DomainBase extends EppResource {
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B setNameservers(ImmutableSet<ReferenceUnion<HostResource>> nameservers) {
|
public B setNameservers(ImmutableSet<Ref<HostResource>> nameservers) {
|
||||||
getInstance().nameservers = nameservers;
|
ImmutableSet.Builder<ReferenceUnion<HostResource>> builder = new ImmutableSet.Builder<>();
|
||||||
|
for (Ref<HostResource> ref : nullToEmpty(nameservers)) {
|
||||||
|
builder.add(ReferenceUnion.create(ref));
|
||||||
|
}
|
||||||
|
getInstance().nameservers = builder.build();
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B addNameservers(ImmutableSet<ReferenceUnion<HostResource>> nameservers) {
|
public B addNameservers(ImmutableSet<Ref<HostResource>> nameservers) {
|
||||||
return setNameservers(
|
return setNameservers(
|
||||||
ImmutableSet.copyOf(union(getInstance().getNameservers(), nameservers)));
|
ImmutableSet.copyOf(union(getInstance().getNameservers(), nameservers)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public B removeNameservers(ImmutableSet<ReferenceUnion<HostResource>> nameservers) {
|
public B removeNameservers(ImmutableSet<Ref<HostResource>> nameservers) {
|
||||||
return setNameservers(
|
return setNameservers(
|
||||||
ImmutableSet.copyOf(difference(getInstance().getNameservers(), nameservers)));
|
ImmutableSet.copyOf(difference(getInstance().getNameservers(), nameservers)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,25 @@ public class DomainCommand {
|
||||||
public static class DomainCreateOrChange<B extends DomainBase.Builder<?, ?>>
|
public static class DomainCreateOrChange<B extends DomainBase.Builder<?, ?>>
|
||||||
extends ImmutableObject implements ResourceCreateOrChange<B> {
|
extends ImmutableObject implements ResourceCreateOrChange<B> {
|
||||||
|
|
||||||
/** A reference to the registrant who registered this domain. */
|
/** The contactId of the registrant who registered this domain. */
|
||||||
ReferenceUnion<ContactResource> registrant;
|
@XmlElement(name = "registrant")
|
||||||
|
String registrantContactId;
|
||||||
|
|
||||||
|
/** A resolved reference to the registrant who registered this domain. */
|
||||||
|
@XmlTransient
|
||||||
|
Ref<ContactResource> registrant;
|
||||||
|
|
||||||
/** Authorization info (aka transfer secret) of the domain. */
|
/** Authorization info (aka transfer secret) of the domain. */
|
||||||
DomainAuthInfo authInfo;
|
DomainAuthInfo authInfo;
|
||||||
|
|
||||||
|
public String getRegistrantContactId() {
|
||||||
|
return registrantContactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ref<ContactResource> getRegistrant() {
|
||||||
|
return registrant;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyTo(B builder) {
|
public void applyTo(B builder) {
|
||||||
if (registrant != null) {
|
if (registrant != null) {
|
||||||
|
@ -97,7 +110,12 @@ public class DomainCommand {
|
||||||
*/
|
*/
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlType(propOrder = {
|
@XmlType(propOrder = {
|
||||||
"fullyQualifiedDomainName", "period", "nameservers", "registrant", "contacts", "authInfo" })
|
"fullyQualifiedDomainName",
|
||||||
|
"period",
|
||||||
|
"nameserverFullyQualifiedHostNames",
|
||||||
|
"registrantContactId",
|
||||||
|
"foreignKeyedDesignatedContacts",
|
||||||
|
"authInfo"})
|
||||||
public static class Create
|
public static class Create
|
||||||
extends DomainCreateOrChange<DomainBase.Builder<?, ?>>
|
extends DomainCreateOrChange<DomainBase.Builder<?, ?>>
|
||||||
implements CreateOrUpdate<Create> {
|
implements CreateOrUpdate<Create> {
|
||||||
|
@ -106,13 +124,21 @@ public class DomainCommand {
|
||||||
@XmlElement(name = "name")
|
@XmlElement(name = "name")
|
||||||
String fullyQualifiedDomainName;
|
String fullyQualifiedDomainName;
|
||||||
|
|
||||||
/** References to hosts that are the nameservers for the domain. */
|
/** Fully qualified host names of the hosts that are the nameservers for the domain. */
|
||||||
@XmlElementWrapper(name = "ns")
|
@XmlElementWrapper(name = "ns")
|
||||||
@XmlElement(name = "hostObj")
|
@XmlElement(name = "hostObj")
|
||||||
Set<ReferenceUnion<HostResource>> nameservers;
|
Set<String> nameserverFullyQualifiedHostNames;
|
||||||
|
|
||||||
/** Associated contacts for the domain (other than registrant). */
|
/** Resolved references to hosts that are the nameservers for the domain. */
|
||||||
|
@XmlTransient
|
||||||
|
Set<Ref<HostResource>> nameservers;
|
||||||
|
|
||||||
|
/** Foreign keyed associated contacts for the domain (other than registrant). */
|
||||||
@XmlElement(name = "contact")
|
@XmlElement(name = "contact")
|
||||||
|
Set<ForeignKeyedDesignatedContact> foreignKeyedDesignatedContacts;
|
||||||
|
|
||||||
|
/** Resolved references to associated contacts for the domain (other than registrant). */
|
||||||
|
@XmlTransient
|
||||||
Set<DesignatedContact> contacts;
|
Set<DesignatedContact> contacts;
|
||||||
|
|
||||||
/** The period that this domain's state was set to last for (e.g. 1-10 years). */
|
/** The period that this domain's state was set to last for (e.g. 1-10 years). */
|
||||||
|
@ -131,7 +157,11 @@ public class DomainCommand {
|
||||||
return fullyQualifiedDomainName;
|
return fullyQualifiedDomainName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableSet<ReferenceUnion<HostResource>> getNameservers() {
|
public ImmutableSet<String> getNameserverFullyQualifiedHostNames() {
|
||||||
|
return nullSafeImmutableCopy(nameserverFullyQualifiedHostNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImmutableSet<Ref<HostResource>> getNameservers() {
|
||||||
return nullSafeImmutableCopy(nameservers);
|
return nullSafeImmutableCopy(nameservers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,11 +169,7 @@ public class DomainCommand {
|
||||||
return nullSafeImmutableCopy(contacts);
|
return nullSafeImmutableCopy(contacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceUnion<ContactResource> getRegistrant() {
|
@Override
|
||||||
return registrant;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AuthInfo getAuthInfo() {
|
public AuthInfo getAuthInfo() {
|
||||||
return authInfo;
|
return authInfo;
|
||||||
}
|
}
|
||||||
|
@ -166,10 +192,10 @@ public class DomainCommand {
|
||||||
@Override
|
@Override
|
||||||
public Create cloneAndLinkReferences(DateTime now) throws InvalidReferenceException {
|
public Create cloneAndLinkReferences(DateTime now) throws InvalidReferenceException {
|
||||||
Create clone = clone(this);
|
Create clone = clone(this);
|
||||||
clone.nameservers = linkHosts(clone.nameservers, now);
|
clone.nameservers = linkHosts(clone.nameserverFullyQualifiedHostNames, now);
|
||||||
clone.contacts = linkContacts(clone.contacts, now);
|
clone.contacts = linkContacts(clone.foreignKeyedDesignatedContacts, now);
|
||||||
clone.registrant = clone.registrant == null
|
clone.registrant = clone.registrantContactId == null
|
||||||
? null : linkReference(clone.registrant, ContactResource.class, now);
|
? null : loadReference(clone.registrantContactId, ContactResource.class, now);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,18 +343,33 @@ public class DomainCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The inner change type on a domain update command. */
|
/** The inner change type on a domain update command. */
|
||||||
@XmlType(propOrder = {"nameservers", "contacts", "statusValues"})
|
@XmlType(propOrder = {
|
||||||
|
"nameserverFullyQualifiedHostNames",
|
||||||
|
"foreignKeyedDesignatedContacts",
|
||||||
|
"statusValues"})
|
||||||
public static class AddRemove extends ResourceUpdate.AddRemove {
|
public static class AddRemove extends ResourceUpdate.AddRemove {
|
||||||
/** References to hosts that are the nameservers for the domain. */
|
/** Fully qualified host names of the hosts that are the nameservers for the domain. */
|
||||||
@XmlElementWrapper(name = "ns")
|
@XmlElementWrapper(name = "ns")
|
||||||
@XmlElement(name = "hostObj")
|
@XmlElement(name = "hostObj")
|
||||||
Set<ReferenceUnion<HostResource>> nameservers;
|
Set<String> nameserverFullyQualifiedHostNames;
|
||||||
|
|
||||||
/** Associated contacts for the domain. */
|
/** Resolved references to hosts that are the nameservers for the domain. */
|
||||||
|
@XmlTransient
|
||||||
|
Set<Ref<HostResource>> nameservers;
|
||||||
|
|
||||||
|
/** Foreign keyed associated contacts for the domain (other than registrant). */
|
||||||
@XmlElement(name = "contact")
|
@XmlElement(name = "contact")
|
||||||
|
Set<ForeignKeyedDesignatedContact> foreignKeyedDesignatedContacts;
|
||||||
|
|
||||||
|
/** Resolved references to associated contacts for the domain (other than registrant). */
|
||||||
|
@XmlTransient
|
||||||
Set<DesignatedContact> contacts;
|
Set<DesignatedContact> contacts;
|
||||||
|
|
||||||
public ImmutableSet<ReferenceUnion<HostResource>> getNameservers() {
|
public ImmutableSet<String> getNameserverFullyQualifiedHostNames() {
|
||||||
|
return nullSafeImmutableCopy(nameserverFullyQualifiedHostNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImmutableSet<Ref<HostResource>> getNameservers() {
|
||||||
return nullToEmptyImmutableCopy(nameservers);
|
return nullToEmptyImmutableCopy(nameservers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,25 +380,20 @@ public class DomainCommand {
|
||||||
/** Creates a copy of this {@link AddRemove} with hard links to hosts and contacts. */
|
/** Creates a copy of this {@link AddRemove} with hard links to hosts and contacts. */
|
||||||
private AddRemove cloneAndLinkReferences(DateTime now) throws InvalidReferenceException {
|
private AddRemove cloneAndLinkReferences(DateTime now) throws InvalidReferenceException {
|
||||||
AddRemove clone = clone(this);
|
AddRemove clone = clone(this);
|
||||||
clone.nameservers = linkHosts(clone.nameservers, now);
|
clone.nameservers = linkHosts(clone.nameserverFullyQualifiedHostNames, now);
|
||||||
clone.contacts = linkContacts(clone.contacts, now);
|
clone.contacts = linkContacts(clone.foreignKeyedDesignatedContacts, now);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The inner change type on a domain update command. */
|
/** The inner change type on a domain update command. */
|
||||||
@XmlType(propOrder = {"registrant", "authInfo"})
|
@XmlType(propOrder = {"registrantContactId", "authInfo"})
|
||||||
public static class Change extends DomainCreateOrChange<DomainBase.Builder<?, ?>> {
|
public static class Change extends DomainCreateOrChange<DomainBase.Builder<?, ?>> {
|
||||||
|
|
||||||
public ReferenceUnion<ContactResource> getRegistrant() {
|
|
||||||
return registrant;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Creates a copy of this {@link Change} with hard links to hosts and contacts. */
|
/** Creates a copy of this {@link Change} with hard links to hosts and contacts. */
|
||||||
Change cloneAndLinkReferences(DateTime now) throws InvalidReferenceException {
|
Change cloneAndLinkReferences(DateTime now) throws InvalidReferenceException {
|
||||||
Change clone = clone(this);
|
Change clone = clone(this);
|
||||||
clone.registrant = clone.registrant == null
|
clone.registrant = clone.registrantContactId == null
|
||||||
? null : linkReference(clone.registrant, ContactResource.class, now);
|
? null : loadReference(clone.registrantContactId, ContactResource.class, now);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,50 +432,59 @@ public class DomainCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<ReferenceUnion<HostResource>> linkHosts(
|
private static Set<Ref<HostResource>> linkHosts(
|
||||||
Set<ReferenceUnion<HostResource>> hosts,
|
Set<String> fullyQualifiedHostNames, DateTime now) throws InvalidReferenceException {
|
||||||
DateTime now) throws InvalidReferenceException {
|
if (fullyQualifiedHostNames == null) {
|
||||||
if (hosts == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ImmutableSet.Builder<ReferenceUnion<HostResource>> linked = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<Ref<HostResource>> linked = new ImmutableSet.Builder<>();
|
||||||
for (ReferenceUnion<HostResource> host : hosts) {
|
for (String fullyQualifiedHostName : fullyQualifiedHostNames) {
|
||||||
linked.add(linkReference(host, HostResource.class, now));
|
linked.add(loadReference(fullyQualifiedHostName, HostResource.class, now));
|
||||||
}
|
}
|
||||||
return linked.build();
|
return linked.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<DesignatedContact> linkContacts(
|
private static Set<DesignatedContact> linkContacts(
|
||||||
Set<DesignatedContact> contacts, DateTime now) throws InvalidReferenceException {
|
Set<ForeignKeyedDesignatedContact> contacts, DateTime now) throws InvalidReferenceException {
|
||||||
if (contacts == null) {
|
if (contacts == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ImmutableSet.Builder<DesignatedContact> linkedContacts = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<DesignatedContact> linkedContacts = new ImmutableSet.Builder<>();
|
||||||
for (DesignatedContact contact : contacts) {
|
for (ForeignKeyedDesignatedContact contact : contacts) {
|
||||||
linkedContacts.add(DesignatedContact.create(
|
linkedContacts.add(DesignatedContact.create(
|
||||||
contact.getType(),
|
contact.type, loadReference(contact.contactId, ContactResource.class, now)));
|
||||||
linkReference(contact.getContactId(), ContactResource.class, now)));
|
|
||||||
}
|
}
|
||||||
return linkedContacts.build();
|
return linkedContacts.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Turn a foreign-keyed {@link ReferenceUnion} into a linked one. */
|
/** Load a reference to a resource by its foreign key. */
|
||||||
private static <T extends EppResource> ReferenceUnion<T> linkReference(
|
private static <T extends EppResource> Ref<T> loadReference(
|
||||||
final ReferenceUnion<T> reference, final Class<T> clazz, final DateTime now)
|
final String foreignKey, final Class<T> clazz, final DateTime now)
|
||||||
throws InvalidReferenceException {
|
throws InvalidReferenceException {
|
||||||
if (reference.getForeignKey() == null) {
|
|
||||||
return reference;
|
|
||||||
}
|
|
||||||
Ref<T> ref = ofy().doTransactionless(new Work<Ref<T>>() {
|
Ref<T> ref = ofy().doTransactionless(new Work<Ref<T>>() {
|
||||||
@Override
|
@Override
|
||||||
public Ref<T> run() {
|
public Ref<T> run() {
|
||||||
return loadAndGetReference(clazz, reference.getForeignKey(), now);
|
return loadAndGetReference(clazz, foreignKey, now);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (ref == null) {
|
if (ref == null) {
|
||||||
throw new InvalidReferenceException(clazz, reference.getForeignKey());
|
throw new InvalidReferenceException(clazz, foreignKey);
|
||||||
}
|
}
|
||||||
return ReferenceUnion.create(ref);
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EPP-inputable version of XML type for contact identifiers associated with a domain, which can
|
||||||
|
* be converted to a storable (and EPP-outputable) {@link DesignatedContact}.
|
||||||
|
*
|
||||||
|
* @see "http://tools.ietf.org/html/rfc5731#section-2.2"
|
||||||
|
*/
|
||||||
|
static class ForeignKeyedDesignatedContact extends ImmutableObject {
|
||||||
|
@XmlAttribute(required = true)
|
||||||
|
DesignatedContact.Type type;
|
||||||
|
|
||||||
|
@XmlValue
|
||||||
|
String contactId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Exception to throw when a referenced object does not exist. */
|
/** Exception to throw when a referenced object does not exist. */
|
||||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.model.domain;
|
||||||
|
|
||||||
import com.googlecode.objectify.Ref;
|
import com.googlecode.objectify.Ref;
|
||||||
import com.googlecode.objectify.annotation.Embed;
|
import com.googlecode.objectify.annotation.Embed;
|
||||||
import com.googlecode.objectify.annotation.Ignore;
|
|
||||||
import com.googlecode.objectify.annotation.Index;
|
import com.googlecode.objectify.annotation.Index;
|
||||||
|
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
|
@ -24,81 +23,50 @@ import google.registry.model.ImmutableObject;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A "union" type to represent referenced objects as either a foreign key or as a link to another
|
* Legacy shell of a "union" type to represent referenced objects as either a foreign key or as a
|
||||||
* object in the datastore.
|
* link to another object in the datastore. In its current form it merely wraps a {@link Ref}.
|
||||||
* <p>
|
* <p>
|
||||||
* This type always marshals as the "foreign key". When it is explicitly storing a foreign key it
|
* This type always marshals as the "foreign key". We no longer use this type for unmarshalling.
|
||||||
* gets the value from its own string field. When it is linked to another object, it gets the value
|
|
||||||
* from the other object.
|
|
||||||
* <p>
|
|
||||||
* When a {@link ReferenceUnion} comes in from Epp, either in an update or a delete, it fills in the
|
|
||||||
* "foreign key" string field, but as soon as the relevant Flow runs it deletes that field and
|
|
||||||
* replaces it with a linked {@link Ref} to the object named by that string. We can't do this in a
|
|
||||||
* {@code XmlJavaTypeAdapter} because failing a lookup is a business logic error, not a failure to
|
|
||||||
* parse the XML.
|
|
||||||
*
|
*
|
||||||
* @param <T> the type being referenced
|
* @param <T> the type being referenced
|
||||||
*/
|
*/
|
||||||
@Embed
|
@Embed
|
||||||
public class ReferenceUnion<T extends EppResource> extends ImmutableObject implements Serializable {
|
public class ReferenceUnion<T extends EppResource> extends ImmutableObject {
|
||||||
|
|
||||||
@Index
|
@Index
|
||||||
Ref<T> linked;
|
Ref<T> linked;
|
||||||
|
|
||||||
/** This is never persisted, and only ever populated to marshal or unmarshal to or from XML. */
|
|
||||||
@Ignore
|
|
||||||
String foreignKey;
|
|
||||||
|
|
||||||
public Ref<T> getLinked() {
|
public Ref<T> getLinked() {
|
||||||
return linked;
|
return linked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getForeignKey() {
|
/** An adapter that marshals the linked {@link Ref} as its loaded foreign key. */
|
||||||
return foreignKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** An adapter that is aware of the union inside {@link ReferenceUnion}. */
|
|
||||||
public static class Adapter<T extends EppResource>
|
public static class Adapter<T extends EppResource>
|
||||||
extends XmlAdapter<String, ReferenceUnion<T>> {
|
extends XmlAdapter<String, ReferenceUnion<T>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReferenceUnion<T> unmarshal(String foreignKey) throws Exception {
|
public ReferenceUnion<T> unmarshal(String foreignKey) throws Exception {
|
||||||
return ReferenceUnion.<T>create(foreignKey);
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String marshal(ReferenceUnion<T> reference) throws Exception {
|
public String marshal(ReferenceUnion<T> reference) throws Exception {
|
||||||
return reference.getForeignKey() == null
|
return reference.getLinked().get().getForeignKey();
|
||||||
? reference.getLinked().get().getForeignKey()
|
|
||||||
: reference.getForeignKey();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An adapter for references to contacts. */
|
/** An adapter for references to contacts. */
|
||||||
static class ContactReferenceUnionAdapter extends ReferenceUnion.Adapter<ContactResource>{}
|
static class ContactReferenceUnionAdapter extends Adapter<ContactResource>{}
|
||||||
|
|
||||||
/** An adapter for references to hosts. */
|
/** An adapter for references to hosts. */
|
||||||
static class HostReferenceUnionAdapter extends ReferenceUnion.Adapter<HostResource>{}
|
static class HostReferenceUnionAdapter extends Adapter<HostResource>{}
|
||||||
|
|
||||||
public static <T extends EppResource> ReferenceUnion<T> create(String foreignKey) {
|
|
||||||
ReferenceUnion<T> instance = new ReferenceUnion<>();
|
|
||||||
instance.foreignKey = foreignKey;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T extends EppResource> ReferenceUnion<T> create(Ref<T> linked) {
|
public static <T extends EppResource> ReferenceUnion<T> create(Ref<T> linked) {
|
||||||
ReferenceUnion<T> instance = new ReferenceUnion<>();
|
ReferenceUnion<T> instance = new ReferenceUnion<>();
|
||||||
instance.linked = linked;
|
instance.linked = linked;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convenience method. */
|
|
||||||
public static <T extends EppResource> ReferenceUnion<T> create(T resource) {
|
|
||||||
return create(Ref.create(resource));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ import google.registry.model.domain.DomainApplication;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.index.DomainApplicationIndex;
|
import google.registry.model.index.DomainApplicationIndex;
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
|
@ -246,8 +245,8 @@ public class VerifyEntityIntegrityAction implements Runnable {
|
||||||
if (resource instanceof DomainBase) {
|
if (resource instanceof DomainBase) {
|
||||||
DomainBase domainBase = (DomainBase) resource;
|
DomainBase domainBase = (DomainBase) resource;
|
||||||
Key<?> key = Key.create(domainBase);
|
Key<?> key = Key.create(domainBase);
|
||||||
verifyExistence(key, bustUnions(domainBase.getReferencedContacts()));
|
verifyExistence(key, refsToKeys(domainBase.getReferencedContacts()));
|
||||||
verifyExistence(key, bustUnions(domainBase.getNameservers()));
|
verifyExistence(key, refsToKeys(domainBase.getNameservers()));
|
||||||
verifyExistence(key, domainBase.getTransferData().getServerApproveAutorenewEvent());
|
verifyExistence(key, domainBase.getTransferData().getServerApproveAutorenewEvent());
|
||||||
verifyExistence(key, domainBase.getTransferData().getServerApproveAutorenewPollMessage());
|
verifyExistence(key, domainBase.getTransferData().getServerApproveAutorenewPollMessage());
|
||||||
verifyExistence(key, domainBase.getTransferData().getServerApproveBillingEvent());
|
verifyExistence(key, domainBase.getTransferData().getServerApproveBillingEvent());
|
||||||
|
@ -386,14 +385,13 @@ public class VerifyEntityIntegrityAction implements Runnable {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <E extends EppResource> Set<Key<E>> bustUnions(
|
private static <E extends EppResource> ImmutableSet<Key<E>> refsToKeys(Iterable<Ref<E>> refs) {
|
||||||
Iterable<ReferenceUnion<E>> unions) {
|
|
||||||
return FluentIterable
|
return FluentIterable
|
||||||
.from(unions)
|
.from(refs)
|
||||||
.transform(new Function<ReferenceUnion<E>, Key<E>>() {
|
.transform(new Function<Ref<E>, Key<E>>() {
|
||||||
@Override
|
@Override
|
||||||
public Key<E> apply(ReferenceUnion<E> union) {
|
public Key<E> apply(Ref<E> ref) {
|
||||||
return union.getLinked().getKey();
|
return ref.getKey();
|
||||||
}})
|
}})
|
||||||
.toSet();
|
.toSet();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ import google.registry.model.contact.PostalInfo;
|
||||||
import google.registry.model.domain.DesignatedContact;
|
import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DesignatedContact.Type;
|
import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.Address;
|
import google.registry.model.eppcommon.Address;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
@ -398,11 +397,7 @@ public class RdapJsonFormatter {
|
||||||
@Nullable String linkBase,
|
@Nullable String linkBase,
|
||||||
@Nullable String whoisServer) {
|
@Nullable String whoisServer) {
|
||||||
// Kick off the database loads of the nameservers that we will need.
|
// Kick off the database loads of the nameservers that we will need.
|
||||||
Set<Ref<HostResource>> hostRefs = new LinkedHashSet<>();
|
ImmutableSet<HostResource> loadedHosts = domainResource.loadNameservers();
|
||||||
for (ReferenceUnion<HostResource> hostReference : domainResource.getNameservers()) {
|
|
||||||
hostRefs.add(hostReference.getLinked());
|
|
||||||
}
|
|
||||||
Map<Key<HostResource>, HostResource> loadedHosts = ofy().load().refs(hostRefs);
|
|
||||||
// And the registrant and other contacts.
|
// And the registrant and other contacts.
|
||||||
List<DesignatedContact> allContacts = new ArrayList<>();
|
List<DesignatedContact> allContacts = new ArrayList<>();
|
||||||
if (domainResource.getRegistrant() != null) {
|
if (domainResource.getRegistrant() != null) {
|
||||||
|
@ -411,7 +406,7 @@ public class RdapJsonFormatter {
|
||||||
allContacts.addAll(domainResource.getContacts());
|
allContacts.addAll(domainResource.getContacts());
|
||||||
Set<Ref<ContactResource>> contactRefs = new LinkedHashSet<>();
|
Set<Ref<ContactResource>> contactRefs = new LinkedHashSet<>();
|
||||||
for (DesignatedContact designatedContact : allContacts) {
|
for (DesignatedContact designatedContact : allContacts) {
|
||||||
contactRefs.add(designatedContact.getContactId().getLinked());
|
contactRefs.add(designatedContact.getContactRef());
|
||||||
}
|
}
|
||||||
Map<Key<ContactResource>, ContactResource> loadedContacts = ofy().load().refs(contactRefs);
|
Map<Key<ContactResource>, ContactResource> loadedContacts = ofy().load().refs(contactRefs);
|
||||||
// Now, assemble the results, using the loaded objects as needed.
|
// Now, assemble the results, using the loaded objects as needed.
|
||||||
|
@ -432,8 +427,7 @@ public class RdapJsonFormatter {
|
||||||
}
|
}
|
||||||
// Nameservers
|
// Nameservers
|
||||||
ImmutableList.Builder<Object> nsBuilder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<Object> nsBuilder = new ImmutableList.Builder<>();
|
||||||
for (HostResource hostResource
|
for (HostResource hostResource : HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts)) {
|
||||||
: HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts.values())) {
|
|
||||||
nsBuilder.add(makeRdapJsonForHost(hostResource, false, linkBase, null));
|
nsBuilder.add(makeRdapJsonForHost(hostResource, false, linkBase, null));
|
||||||
}
|
}
|
||||||
ImmutableList<Object> ns = nsBuilder.build();
|
ImmutableList<Object> ns = nsBuilder.build();
|
||||||
|
@ -445,7 +439,7 @@ public class RdapJsonFormatter {
|
||||||
for (DesignatedContact designatedContact
|
for (DesignatedContact designatedContact
|
||||||
: DESIGNATED_CONTACT_ORDERING.immutableSortedCopy(allContacts)) {
|
: DESIGNATED_CONTACT_ORDERING.immutableSortedCopy(allContacts)) {
|
||||||
ContactResource loadedContact =
|
ContactResource loadedContact =
|
||||||
loadedContacts.get(designatedContact.getContactId().getLinked().key());
|
loadedContacts.get(designatedContact.getContactRef().key());
|
||||||
entitiesBuilder.add(makeRdapJsonForContact(
|
entitiesBuilder.add(makeRdapJsonForContact(
|
||||||
loadedContact, false, Optional.of(designatedContact.getType()), linkBase, null));
|
loadedContact, false, Optional.of(designatedContact.getType()), linkBase, null));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,11 @@ package google.registry.rde;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DesignatedContact;
|
import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -163,9 +164,9 @@ final class DomainResourceToXjcConverter {
|
||||||
// o An OPTIONAL <registrant> element that contain the identifier for
|
// o An OPTIONAL <registrant> element that contain the identifier for
|
||||||
// the human or organizational social information object associated
|
// the human or organizational social information object associated
|
||||||
// as the holder of the domain name object.
|
// as the holder of the domain name object.
|
||||||
ReferenceUnion<ContactResource> registrant = model.getRegistrant();
|
Ref<ContactResource> registrant = model.getRegistrant();
|
||||||
if (registrant != null) {
|
if (registrant != null) {
|
||||||
bean.setRegistrant(registrant.getLinked().get().getContactId());
|
bean.setRegistrant(registrant.get().getContactId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// o Zero or more OPTIONAL <contact> elements that contain identifiers
|
// o Zero or more OPTIONAL <contact> elements that contain identifiers
|
||||||
|
@ -282,7 +283,7 @@ final class DomainResourceToXjcConverter {
|
||||||
/** Converts {@link DesignatedContact} to {@link XjcDomainContactType}. */
|
/** Converts {@link DesignatedContact} to {@link XjcDomainContactType}. */
|
||||||
private static XjcDomainContactType convertDesignatedContact(DesignatedContact model) {
|
private static XjcDomainContactType convertDesignatedContact(DesignatedContact model) {
|
||||||
XjcDomainContactType bean = new XjcDomainContactType();
|
XjcDomainContactType bean = new XjcDomainContactType();
|
||||||
ContactResource contact = model.getContactId().getLinked().get();
|
ContactResource contact = model.getContactRef().get();
|
||||||
bean.setType(XjcDomainContactAttrType.fromValue(model.getType().toString().toLowerCase()));
|
bean.setType(XjcDomainContactAttrType.fromValue(model.getType().toString().toLowerCase()));
|
||||||
bean.setValue(contact.getContactId());
|
bean.setValue(contact.getContactId());
|
||||||
return bean;
|
return bean;
|
||||||
|
|
|
@ -140,7 +140,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
|
||||||
for (DesignatedContact contact : application.getContacts()) {
|
for (DesignatedContact contact : application.getContacts()) {
|
||||||
contactsMapBuilder.put(
|
contactsMapBuilder.put(
|
||||||
contact.getType().toString().toLowerCase(),
|
contact.getType().toString().toLowerCase(),
|
||||||
contact.getContactId().getLinked().get().getForeignKey());
|
contact.getContactRef().get().getForeignKey());
|
||||||
}
|
}
|
||||||
LaunchNotice launchNotice = application.getLaunchNotice();
|
LaunchNotice launchNotice = application.getLaunchNotice();
|
||||||
addSoyRecord(application.getCurrentSponsorClientId(), new SoyMapData(
|
addSoyRecord(application.getCurrentSponsorClientId(), new SoyMapData(
|
||||||
|
|
|
@ -27,9 +27,9 @@ import com.google.template.soy.data.SoyMapData;
|
||||||
|
|
||||||
import com.beust.jcommander.Parameter;
|
import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.tools.Command.GtechCommand;
|
import google.registry.tools.Command.GtechCommand;
|
||||||
|
@ -113,8 +113,8 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand impleme
|
||||||
|
|
||||||
private ImmutableSortedSet<String> getExistingNameservers(DomainResource domain) {
|
private ImmutableSortedSet<String> getExistingNameservers(DomainResource domain) {
|
||||||
ImmutableSortedSet.Builder<String> nameservers = ImmutableSortedSet.naturalOrder();
|
ImmutableSortedSet.Builder<String> nameservers = ImmutableSortedSet.naturalOrder();
|
||||||
for (ReferenceUnion<HostResource> nameserverRef : domain.getNameservers()) {
|
for (Ref<HostResource> nameserverRef : domain.getNameservers()) {
|
||||||
nameservers.add(nameserverRef.getLinked().get().getForeignKey());
|
nameservers.add(nameserverRef.get().getForeignKey());
|
||||||
}
|
}
|
||||||
return nameservers.build();
|
return nameservers.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.server;
|
||||||
|
|
||||||
import static com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService;
|
import static com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService;
|
||||||
import static com.google.common.base.Predicates.notNull;
|
import static com.google.common.base.Predicates.notNull;
|
||||||
import static com.google.common.collect.Iterables.transform;
|
|
||||||
import static com.google.common.collect.Iterators.filter;
|
import static com.google.common.collect.Iterators.filter;
|
||||||
import static com.google.common.io.BaseEncoding.base16;
|
import static com.google.common.io.BaseEncoding.base16;
|
||||||
import static google.registry.mapreduce.inputs.EppResourceInputs.createEntityInput;
|
import static google.registry.mapreduce.inputs.EppResourceInputs.createEntityInput;
|
||||||
|
@ -38,15 +37,12 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import com.googlecode.objectify.Ref;
|
|
||||||
|
|
||||||
import google.registry.config.ConfigModule.Config;
|
import google.registry.config.ConfigModule.Config;
|
||||||
import google.registry.gcs.GcsUtils;
|
import google.registry.gcs.GcsUtils;
|
||||||
import google.registry.mapreduce.MapreduceRunner;
|
import google.registry.mapreduce.MapreduceRunner;
|
||||||
import google.registry.mapreduce.inputs.NullInput;
|
import google.registry.mapreduce.inputs.NullInput;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
|
@ -280,14 +276,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
*/
|
*/
|
||||||
private static String domainStanza(DomainResource domain, DateTime exportTime) {
|
private static String domainStanza(DomainResource domain, DateTime exportTime) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (HostResource nameserver : ofy().load().refs(
|
for (HostResource nameserver : ofy().load().refs(domain.getNameservers()).values()) {
|
||||||
transform(
|
|
||||||
domain.getNameservers(),
|
|
||||||
new Function<ReferenceUnion<HostResource>, Ref<HostResource>>() {
|
|
||||||
@Override
|
|
||||||
public Ref<HostResource> apply(ReferenceUnion<HostResource> referenceUnion) {
|
|
||||||
return referenceUnion.getLinked();
|
|
||||||
}})).values()) {
|
|
||||||
result.append(String.format(
|
result.append(String.format(
|
||||||
NS_FORMAT,
|
NS_FORMAT,
|
||||||
domain.getFullyQualifiedDomainName(),
|
domain.getFullyQualifiedDomainName(),
|
||||||
|
|
|
@ -24,6 +24,8 @@ import com.google.common.base.Optional;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.contact.ContactPhoneNumber;
|
import google.registry.model.contact.ContactPhoneNumber;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.contact.PostalInfo;
|
import google.registry.model.contact.PostalInfo;
|
||||||
|
@ -31,7 +33,6 @@ import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DesignatedContact.Type;
|
import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
|
@ -103,14 +104,14 @@ final class DomainWhoisResponse extends WhoisResponseImpl {
|
||||||
|
|
||||||
/** Returns the contact of the given type, or null if it does not exist. */
|
/** Returns the contact of the given type, or null if it does not exist. */
|
||||||
@Nullable
|
@Nullable
|
||||||
private ReferenceUnion<ContactResource> getContactReference(final Type type) {
|
private Ref<ContactResource> getContactReference(final Type type) {
|
||||||
Optional<DesignatedContact> contactOfType = tryFind(domain.getContacts(),
|
Optional<DesignatedContact> contactOfType = tryFind(domain.getContacts(),
|
||||||
new Predicate<DesignatedContact>() {
|
new Predicate<DesignatedContact>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(DesignatedContact d) {
|
public boolean apply(DesignatedContact d) {
|
||||||
return d.getType() == type;
|
return d.getType() == type;
|
||||||
}});
|
}});
|
||||||
return contactOfType.isPresent() ? contactOfType.get().getContactId() : null;
|
return contactOfType.isPresent() ? contactOfType.get().getContactRef() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Output emitter with logic for domains. */
|
/** Output emitter with logic for domains. */
|
||||||
|
@ -126,7 +127,7 @@ final class DomainWhoisResponse extends WhoisResponseImpl {
|
||||||
/** Emit the contact entry of the given type. */
|
/** Emit the contact entry of the given type. */
|
||||||
DomainEmitter emitContact(
|
DomainEmitter emitContact(
|
||||||
String contactType,
|
String contactType,
|
||||||
@Nullable ReferenceUnion<ContactResource> contact,
|
@Nullable Ref<ContactResource> contact,
|
||||||
boolean preferUnicode) {
|
boolean preferUnicode) {
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
return this;
|
return this;
|
||||||
|
@ -134,10 +135,10 @@ final class DomainWhoisResponse extends WhoisResponseImpl {
|
||||||
// If we refer to a contact that doesn't exist, that's a bug. It means referential integrity
|
// If we refer to a contact that doesn't exist, that's a bug. It means referential integrity
|
||||||
// has somehow been broken. We skip the rest of this contact, but log it to hopefully bring it
|
// has somehow been broken. We skip the rest of this contact, but log it to hopefully bring it
|
||||||
// someone's attention.
|
// someone's attention.
|
||||||
ContactResource contactResource = contact.getLinked().get();
|
ContactResource contactResource = contact.get();
|
||||||
if (contactResource == null) {
|
if (contactResource == null) {
|
||||||
logger.severefmt("(BUG) Broken reference found from domain %s to contact %s",
|
logger.severefmt("(BUG) Broken reference found from domain %s to contact %s",
|
||||||
domain.getFullyQualifiedDomainName(), contact.getLinked());
|
domain.getFullyQualifiedDomainName(), contact);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
emitField(contactType, "ID", contactResource.getContactId());
|
emitField(contactType, "ID", contactResource.getContactId());
|
||||||
|
|
|
@ -32,8 +32,9 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
@ -109,8 +110,7 @@ public class DnsUpdateWriterTest {
|
||||||
DomainResource domain =
|
DomainResource domain =
|
||||||
persistActiveDomain("example.tld")
|
persistActiveDomain("example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(
|
.setNameservers(ImmutableSet.of(Ref.create(host1), Ref.create(host2)))
|
||||||
ImmutableSet.of(ReferenceUnion.create(host1), ReferenceUnion.create(host2)))
|
|
||||||
.build();
|
.build();
|
||||||
persistResource(domain);
|
persistResource(domain);
|
||||||
|
|
||||||
|
@ -129,8 +129,7 @@ public class DnsUpdateWriterTest {
|
||||||
DomainResource domain =
|
DomainResource domain =
|
||||||
persistActiveDomain("example.tld")
|
persistActiveDomain("example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(
|
.setNameservers(ImmutableSet.of(Ref.create(persistActiveHost("ns1.example.tld"))))
|
||||||
ImmutableSet.of(ReferenceUnion.create(persistActiveHost("ns1.example.tld"))))
|
|
||||||
.setDsData(
|
.setDsData(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
DelegationSignerData.create(1, 3, 1, base16().decode("0123456789ABCDEF"))))
|
DelegationSignerData.create(1, 3, 1, base16().decode("0123456789ABCDEF"))))
|
||||||
|
@ -154,8 +153,7 @@ public class DnsUpdateWriterTest {
|
||||||
persistActiveDomain("example.tld")
|
persistActiveDomain("example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.addStatusValue(StatusValue.SERVER_HOLD)
|
.addStatusValue(StatusValue.SERVER_HOLD)
|
||||||
.setNameservers(
|
.setNameservers(ImmutableSet.of(Ref.create(persistActiveHost("ns1.example.tld"))))
|
||||||
ImmutableSet.of(ReferenceUnion.create(persistActiveHost("ns1.example.tld"))))
|
|
||||||
.build();
|
.build();
|
||||||
persistResource(domain);
|
persistResource(domain);
|
||||||
|
|
||||||
|
@ -223,8 +221,7 @@ public class DnsUpdateWriterTest {
|
||||||
DomainResource domain =
|
DomainResource domain =
|
||||||
persistActiveDomain("example.tld")
|
persistActiveDomain("example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(
|
.setNameservers(ImmutableSet.of(Ref.create(persistActiveHost("ns1.example.tld"))))
|
||||||
ImmutableSet.of(ReferenceUnion.create(persistActiveHost("ns1.example.tld"))))
|
|
||||||
.build();
|
.build();
|
||||||
persistResource(domain);
|
persistResource(domain);
|
||||||
when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL));
|
when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL));
|
||||||
|
|
|
@ -40,7 +40,6 @@ import google.registry.model.contact.ContactPhoneNumber;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.contact.PostalInfo;
|
import google.registry.model.contact.PostalInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse;
|
||||||
|
@ -79,8 +78,7 @@ public class DeleteContactResourceActionTest
|
||||||
assertAboutContacts().that(contactUsed).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
assertAboutContacts().that(contactUsed).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
||||||
.and().hasDeletionTime(END_OF_TIME);
|
.and().hasDeletionTime(END_OF_TIME);
|
||||||
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
||||||
assertThat(domain.getReferencedContacts())
|
assertThat(domain.getReferencedContacts()).contains(Ref.create(contactUsed));
|
||||||
.contains(ReferenceUnion.<ContactResource>create(Ref.create(contactUsed)));
|
|
||||||
HistoryEntry historyEntry =
|
HistoryEntry historyEntry =
|
||||||
getOnlyHistoryEntryOfType(contactUsed, HistoryEntry.Type.CONTACT_DELETE_FAILURE);
|
getOnlyHistoryEntryOfType(contactUsed, HistoryEntry.Type.CONTACT_DELETE_FAILURE);
|
||||||
assertPollMessageFor(
|
assertPollMessageFor(
|
||||||
|
|
|
@ -29,11 +29,11 @@ import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.mapreduce.MapreduceRunner;
|
import google.registry.mapreduce.MapreduceRunner;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.ofy.Ofy;
|
import google.registry.model.ofy.Ofy;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
|
@ -84,7 +84,7 @@ public abstract class DeleteEppResourceActionTestCase<T extends DeleteEppResourc
|
||||||
hostUsed = persistActiveHost("ns1.example.tld");
|
hostUsed = persistActiveHost("ns1.example.tld");
|
||||||
domain = persistResource(
|
domain = persistResource(
|
||||||
newDomainResource("example.tld", contactUsed).asBuilder()
|
newDomainResource("example.tld", contactUsed).asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(hostUsed)))
|
.setNameservers(ImmutableSet.of(Ref.create(hostUsed)))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import com.googlecode.objectify.Key;
|
||||||
import com.googlecode.objectify.Ref;
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -68,8 +67,7 @@ public class DeleteHostResourceActionTest
|
||||||
assertAboutHosts().that(hostUsed).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
assertAboutHosts().that(hostUsed).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
||||||
.and().hasDeletionTime(END_OF_TIME);
|
.and().hasDeletionTime(END_OF_TIME);
|
||||||
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
||||||
assertThat(domain.getNameservers())
|
assertThat(domain.getNameservers()).contains(Ref.create(hostUsed));
|
||||||
.contains(ReferenceUnion.<HostResource>create(Ref.create(hostUsed)));
|
|
||||||
HistoryEntry historyEntry =
|
HistoryEntry historyEntry =
|
||||||
getOnlyHistoryEntryOfType(hostUsed, HistoryEntry.Type.HOST_DELETE_FAILURE);
|
getOnlyHistoryEntryOfType(hostUsed, HistoryEntry.Type.HOST_DELETE_FAILURE);
|
||||||
assertPollMessageFor(
|
assertPollMessageFor(
|
||||||
|
|
|
@ -30,10 +30,10 @@ import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.dns.DnsQueue;
|
import google.registry.dns.DnsQueue;
|
||||||
import google.registry.mapreduce.MapreduceRunner;
|
import google.registry.mapreduce.MapreduceRunner;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.request.HttpException.BadRequestException;
|
import google.registry.request.HttpException.BadRequestException;
|
||||||
import google.registry.testing.ExceptionRule;
|
import google.registry.testing.ExceptionRule;
|
||||||
|
@ -77,21 +77,21 @@ public class DnsRefreshForHostRenameActionTest
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_dnsUpdateEnqueued() throws Exception {
|
public void testSuccess_dnsUpdateEnqueued() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
HostResource renamedHost = persistActiveHost("ns1.example.tld");
|
Ref<HostResource> renamedHostRef = Ref.create(persistActiveHost("ns1.example.tld"));
|
||||||
HostResource otherHost = persistActiveHost("ns2.example.tld");
|
Ref<HostResource> otherHostRef = Ref.create(persistActiveHost("ns2.example.tld"));
|
||||||
persistResource(newDomainApplication("notadomain.tld").asBuilder()
|
persistResource(newDomainApplication("notadomain.tld").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(renamedHost)))
|
.setNameservers(ImmutableSet.of(renamedHostRef))
|
||||||
.build());
|
.build());
|
||||||
persistResource(newDomainResource("example.tld").asBuilder()
|
persistResource(newDomainResource("example.tld").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(renamedHost)))
|
.setNameservers(ImmutableSet.of(renamedHostRef))
|
||||||
.build());
|
.build());
|
||||||
persistResource(newDomainResource("otherexample.tld").asBuilder()
|
persistResource(newDomainResource("otherexample.tld").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(renamedHost)))
|
.setNameservers(ImmutableSet.of(renamedHostRef))
|
||||||
.build());
|
.build());
|
||||||
persistResource(newDomainResource("untouched.tld").asBuilder()
|
persistResource(newDomainResource("untouched.tld").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(otherHost)))
|
.setNameservers(ImmutableSet.of(otherHostRef))
|
||||||
.build());
|
.build());
|
||||||
runMapreduce(Key.create(renamedHost).getString());
|
runMapreduce(renamedHostRef.getKey().getString());
|
||||||
verify(dnsQueue).addDomainRefreshTask("example.tld");
|
verify(dnsQueue).addDomainRefreshTask("example.tld");
|
||||||
verify(dnsQueue).addDomainRefreshTask("otherexample.tld");
|
verify(dnsQueue).addDomainRefreshTask("otherexample.tld");
|
||||||
verifyNoMoreInteractions(dnsQueue);
|
verifyNoMoreInteractions(dnsQueue);
|
||||||
|
@ -100,12 +100,12 @@ public class DnsRefreshForHostRenameActionTest
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_noDnsTasksForDeletedDomain() throws Exception {
|
public void testSuccess_noDnsTasksForDeletedDomain() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
HostResource renamedHost = persistActiveHost("ns1.example.tld");
|
Ref<HostResource> renamedHostRef = Ref.create(persistActiveHost("ns1.example.tld"));
|
||||||
persistResource(newDomainResource("example.tld").asBuilder()
|
persistResource(newDomainResource("example.tld").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(renamedHost)))
|
.setNameservers(ImmutableSet.of(renamedHostRef))
|
||||||
.setDeletionTime(START_OF_TIME)
|
.setDeletionTime(START_OF_TIME)
|
||||||
.build());
|
.build());
|
||||||
runMapreduce(Key.create(renamedHost).getString());
|
runMapreduce(renamedHostRef.getKey().getString());
|
||||||
verifyZeroInteractions(dnsQueue);
|
verifyZeroInteractions(dnsQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ import google.registry.flows.domain.DomainFlowUtils.LaunchPhaseMismatchException
|
||||||
import google.registry.flows.domain.DomainFlowUtils.LeadingDashException;
|
import google.registry.flows.domain.DomainFlowUtils.LeadingDashException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.LinkedResourceDoesNotExistException;
|
import google.registry.flows.domain.DomainFlowUtils.LinkedResourceDoesNotExistException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NameserverNotAllowedException;
|
import google.registry.flows.domain.DomainFlowUtils.NameserversNotAllowedException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NoMarksFoundMatchingDomainException;
|
import google.registry.flows.domain.DomainFlowUtils.NoMarksFoundMatchingDomainException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.PremiumNameBlockedException;
|
import google.registry.flows.domain.DomainFlowUtils.PremiumNameBlockedException;
|
||||||
|
@ -1191,7 +1191,7 @@ public class DomainApplicationCreateFlowTest
|
||||||
persistResource(Registry.get("tld").asBuilder()
|
persistResource(Registry.get("tld").asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
||||||
.build());
|
.build());
|
||||||
thrown.expect(NameserverNotAllowedException.class, "ns1.example.net");
|
thrown.expect(NameserversNotAllowedException.class, "ns1.example.net");
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ import static google.registry.testing.GenericEppResourceSubject.assertAboutEppRe
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||||
import google.registry.flows.FlowRunner.CommitMode;
|
import google.registry.flows.FlowRunner.CommitMode;
|
||||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||||
|
@ -41,7 +43,6 @@ import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainApplication;
|
import google.registry.model.domain.DomainApplication;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.launch.LaunchPhase;
|
import google.registry.model.domain.launch.LaunchPhase;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
@ -89,10 +90,10 @@ public class DomainApplicationDeleteFlowTest
|
||||||
persistResource(newDomainApplication("example.tld").asBuilder()
|
persistResource(newDomainApplication("example.tld").asBuilder()
|
||||||
.setRepoId("1-TLD")
|
.setRepoId("1-TLD")
|
||||||
.setRegistrant(
|
.setRegistrant(
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))
|
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns1.example.net", clock.nowUtc()))))
|
loadByUniqueId(HostResource.class, "ns1.example.net", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
doSuccessfulTest();
|
doSuccessfulTest();
|
||||||
|
|
|
@ -26,6 +26,8 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||||
import google.registry.flows.ResourceQueryFlow.ResourceToQueryDoesNotExistException;
|
import google.registry.flows.ResourceQueryFlow.ResourceToQueryDoesNotExistException;
|
||||||
|
@ -37,7 +39,6 @@ import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DesignatedContact.Type;
|
import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainApplication;
|
import google.registry.model.domain.DomainApplication;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.launch.ApplicationStatus;
|
import google.registry.model.domain.launch.ApplicationStatus;
|
||||||
import google.registry.model.domain.launch.LaunchCreateExtension;
|
import google.registry.model.domain.launch.LaunchCreateExtension;
|
||||||
import google.registry.model.domain.launch.LaunchPhase;
|
import google.registry.model.domain.launch.LaunchPhase;
|
||||||
|
@ -89,12 +90,12 @@ public class DomainApplicationInfoFlowTest
|
||||||
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
||||||
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
|
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
|
||||||
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
|
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
|
||||||
.setRegistrant(ReferenceUnion.create(registrant))
|
.setRegistrant(Ref.create(registrant))
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(contact)),
|
DesignatedContact.create(Type.ADMIN, Ref.create(contact)),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(contact))))
|
DesignatedContact.create(Type.TECH, Ref.create(contact))))
|
||||||
.setNameservers(hostsState.equals(HostsState.HOSTS_EXIST) ? ImmutableSet.of(
|
.setNameservers(hostsState.equals(HostsState.HOSTS_EXIST) ? ImmutableSet.of(
|
||||||
ReferenceUnion.create(host1), ReferenceUnion.create(host2)) : null)
|
Ref.create(host1), Ref.create(host2)) : null)
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
||||||
.addStatusValue(StatusValue.PENDING_CREATE)
|
.addStatusValue(StatusValue.PENDING_CREATE)
|
||||||
.setApplicationStatus(ApplicationStatus.PENDING_VALIDATION)
|
.setApplicationStatus(ApplicationStatus.PENDING_VALIDATION)
|
||||||
|
@ -244,7 +245,7 @@ public class DomainApplicationInfoFlowTest
|
||||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(
|
.setDsData(ImmutableSet.of(DelegationSignerData.create(
|
||||||
12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC"))))
|
12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC"))))
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(host1), ReferenceUnion.create(host2)))
|
Ref.create(host1), Ref.create(host2)))
|
||||||
.build());
|
.build());
|
||||||
doSuccessfulTest("domain_info_sunrise_response_dsdata.xml", HostsState.NO_HOSTS_EXIST);
|
doSuccessfulTest("domain_info_sunrise_response_dsdata.xml", HostsState.NO_HOSTS_EXIST);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||||
import google.registry.flows.FlowRunner.CommitMode;
|
import google.registry.flows.FlowRunner.CommitMode;
|
||||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||||
|
@ -50,7 +52,7 @@ import google.registry.flows.domain.DomainFlowUtils.LinkedResourceDoesNotExistEx
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingAdminContactException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingAdminContactException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingTechnicalContactException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingTechnicalContactException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NameserverNotAllowedException;
|
import google.registry.flows.domain.DomainFlowUtils.NameserversNotAllowedException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
|
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.TooManyDsRecordsException;
|
import google.registry.flows.domain.DomainFlowUtils.TooManyDsRecordsException;
|
||||||
|
@ -60,7 +62,6 @@ import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DesignatedContact.Type;
|
import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainApplication;
|
import google.registry.model.domain.DomainApplication;
|
||||||
import google.registry.model.domain.DomainApplication.Builder;
|
import google.registry.model.domain.DomainApplication.Builder;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.launch.ApplicationStatus;
|
import google.registry.model.domain.launch.ApplicationStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -108,9 +109,9 @@ public class DomainApplicationUpdateFlowTest
|
||||||
private DomainApplication persistApplication() throws Exception {
|
private DomainApplication persistApplication() throws Exception {
|
||||||
return persistResource(newApplicationBuilder()
|
return persistResource(newApplicationBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(sh8013Contact)),
|
DesignatedContact.create(Type.TECH, Ref.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(unusedContact))))
|
DesignatedContact.create(Type.ADMIN, Ref.create(unusedContact))))
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(
|
.setNameservers(ImmutableSet.of(Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
@ -174,7 +175,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||||
persistResource(
|
persistResource(
|
||||||
newApplicationBuilder().setRegistrant(ReferenceUnion.create(sh8013)).build());
|
newApplicationBuilder().setRegistrant(Ref.create(sh8013)).build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||||
}
|
}
|
||||||
|
@ -184,13 +185,13 @@ public class DomainApplicationUpdateFlowTest
|
||||||
setEppInput("domain_update_sunrise_remove_multiple_contacts.xml");
|
setEppInput("domain_update_sunrise_remove_multiple_contacts.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||||
ReferenceUnion<ContactResource> sh8013ReferenceUnion = ReferenceUnion.create(sh8013);
|
Ref<ContactResource> sh8013Ref = Ref.create(sh8013);
|
||||||
persistResource(newApplicationBuilder()
|
persistResource(newApplicationBuilder()
|
||||||
.setRegistrant(sh8013ReferenceUnion)
|
.setRegistrant(sh8013Ref)
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, sh8013ReferenceUnion),
|
DesignatedContact.create(Type.ADMIN, sh8013Ref),
|
||||||
DesignatedContact.create(Type.BILLING, sh8013ReferenceUnion),
|
DesignatedContact.create(Type.BILLING, sh8013Ref),
|
||||||
DesignatedContact.create(Type.TECH, sh8013ReferenceUnion)))
|
DesignatedContact.create(Type.TECH, sh8013Ref)))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||||
|
@ -373,10 +374,10 @@ public class DomainApplicationUpdateFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modifyApplicationToHave13Nameservers() throws Exception {
|
private void modifyApplicationToHave13Nameservers() throws Exception {
|
||||||
ImmutableSet.Builder<ReferenceUnion<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<Ref<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
||||||
for (int i = 1; i < 15; i++) {
|
for (int i = 1; i < 15; i++) {
|
||||||
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
||||||
nameservers.add(ReferenceUnion.create(loadByUniqueId(
|
nameservers.add(Ref.create(loadByUniqueId(
|
||||||
HostResource.class, String.format("ns%d.example.tld", i), clock.nowUtc())));
|
HostResource.class, String.format("ns%d.example.tld", i), clock.nowUtc())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,7 +497,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
// Add a tech contact to the persisted entity, which should cause the flow to fail when it tries
|
// Add a tech contact to the persisted entity, which should cause the flow to fail when it tries
|
||||||
// to add "mak21" as a second tech contact.
|
// to add "mak21" as a second tech contact.
|
||||||
persistResource(reloadResourceByUniqueId().asBuilder().setContacts(ImmutableSet.of(
|
persistResource(reloadResourceByUniqueId().asBuilder().setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(
|
DesignatedContact.create(Type.TECH, Ref.create(
|
||||||
loadByUniqueId(ContactResource.class, "foo", clock.nowUtc()))))).build());
|
loadByUniqueId(ContactResource.class, "foo", clock.nowUtc()))))).build());
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
@ -581,7 +582,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
setEppInput("domain_update_sunrise_add_remove_same_host.xml");
|
setEppInput("domain_update_sunrise_add_remove_same_host.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(newApplicationBuilder()
|
persistResource(newApplicationBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(
|
.setNameservers(ImmutableSet.of(Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
|
@ -595,7 +596,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
persistResource(newApplicationBuilder()
|
persistResource(newApplicationBuilder()
|
||||||
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
||||||
Type.TECH,
|
Type.TECH,
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))))
|
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
|
@ -608,8 +609,8 @@ public class DomainApplicationUpdateFlowTest
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(newApplicationBuilder()
|
persistResource(newApplicationBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(sh8013Contact)),
|
DesignatedContact.create(Type.ADMIN, Ref.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(sh8013Contact))))
|
DesignatedContact.create(Type.TECH, Ref.create(sh8013Contact))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
@ -621,8 +622,8 @@ public class DomainApplicationUpdateFlowTest
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(newApplicationBuilder()
|
persistResource(newApplicationBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(sh8013Contact)),
|
DesignatedContact.create(Type.ADMIN, Ref.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(sh8013Contact))))
|
DesignatedContact.create(Type.TECH, Ref.create(sh8013Contact))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
@ -649,7 +650,7 @@ public class DomainApplicationUpdateFlowTest
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
thrown.expect(NameserverNotAllowedException.class);
|
thrown.expect(NameserversNotAllowedException.class);
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ import google.registry.flows.domain.DomainFlowUtils.MissingAdminContactException
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingRegistrantException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingRegistrantException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingTechnicalContactException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingTechnicalContactException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NameserverNotAllowedException;
|
import google.registry.flows.domain.DomainFlowUtils.NameserversNotAllowedException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.PremiumNameBlockedException;
|
import google.registry.flows.domain.DomainFlowUtils.PremiumNameBlockedException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
|
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
|
||||||
|
@ -1251,7 +1251,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
persistResource(Registry.get("tld").asBuilder()
|
persistResource(Registry.get("tld").asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
||||||
.build());
|
.build());
|
||||||
thrown.expect(NameserverNotAllowedException.class, "ns1.example.net");
|
thrown.expect(NameserversNotAllowedException.class, "ns1.example.net");
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ import google.registry.model.billing.BillingEvent.Reason;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
|
@ -118,7 +117,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
ContactResource contact = persistActiveContact("sh8013");
|
ContactResource contact = persistActiveContact("sh8013");
|
||||||
domain = newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
domain = newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setCreationTimeForTest(TIME_BEFORE_FLOW)
|
.setCreationTimeForTest(TIME_BEFORE_FLOW)
|
||||||
.setRegistrant(ReferenceUnion.create(contact))
|
.setRegistrant(Ref.create(contact))
|
||||||
.setRegistrationExpirationTime(expirationTime)
|
.setRegistrationExpirationTime(expirationTime)
|
||||||
.build();
|
.build();
|
||||||
earlierHistoryEntry = persistResource(
|
earlierHistoryEntry = persistResource(
|
||||||
|
@ -466,14 +465,12 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
persistResource(loadByUniqueId(
|
persistResource(loadByUniqueId(
|
||||||
DomainResource.class, getUniqueIdFromCommand(), clock.nowUtc())
|
DomainResource.class, getUniqueIdFromCommand(), clock.nowUtc())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(host)))
|
.setNameservers(ImmutableSet.of(Ref.create(host)))
|
||||||
.build());
|
.build());
|
||||||
// Persist another domain that's already been deleted and references this contact and host.
|
// Persist another domain that's already been deleted and references this contact and host.
|
||||||
persistResource(newDomainResource("example1.tld").asBuilder()
|
persistResource(newDomainResource("example1.tld").asBuilder()
|
||||||
.setRegistrant(
|
.setRegistrant(Ref.create(loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))
|
||||||
ReferenceUnion.create(loadByUniqueId(
|
.setNameservers(ImmutableSet.of(Ref.create(host)))
|
||||||
ContactResource.class, "sh8013", clock.nowUtc())))
|
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(host)))
|
|
||||||
.setDeletionTime(START_OF_TIME)
|
.setDeletionTime(START_OF_TIME)
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
|
|
@ -44,7 +44,6 @@ import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
|
@ -91,12 +90,11 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
||||||
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
|
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
|
||||||
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
|
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
|
||||||
.setRegistrationExpirationTime(DateTime.parse("2005-04-03T22:00:00.0Z"))
|
.setRegistrationExpirationTime(DateTime.parse("2005-04-03T22:00:00.0Z"))
|
||||||
.setRegistrant(ReferenceUnion.create(registrant))
|
.setRegistrant(Ref.create(registrant))
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(contact)),
|
DesignatedContact.create(Type.ADMIN, Ref.create(contact)),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(contact))))
|
DesignatedContact.create(Type.TECH, Ref.create(contact))))
|
||||||
.setNameservers(inactive ? null
|
.setNameservers(inactive ? null : ImmutableSet.of(Ref.create(host1), Ref.create(host2)))
|
||||||
: ImmutableSet.of(ReferenceUnion.create(host1), ReferenceUnion.create(host2)))
|
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
||||||
.build());
|
.build());
|
||||||
// Set the superordinate domain of ns1.example.com to example.com. In reality, this would have
|
// Set the superordinate domain of ns1.example.com to example.com. In reality, this would have
|
||||||
|
@ -243,8 +241,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
||||||
persistResource(domain.asBuilder()
|
persistResource(domain.asBuilder()
|
||||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(
|
.setDsData(ImmutableSet.of(DelegationSignerData.create(
|
||||||
12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC"))))
|
12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC"))))
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(Ref.create(host1), Ref.create(host3)))
|
||||||
ReferenceUnion.create(host1), ReferenceUnion.create(host3)))
|
|
||||||
.build());
|
.build());
|
||||||
doSuccessfulTest("domain_info_response_dsdata.xml", false);
|
doSuccessfulTest("domain_info_response_dsdata.xml", false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -123,18 +122,14 @@ public class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||||
.setCreationClientId("TheRegistrar")
|
.setCreationClientId("TheRegistrar")
|
||||||
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
||||||
.setRegistrationExpirationTime(REGISTRATION_EXPIRATION_TIME)
|
.setRegistrationExpirationTime(REGISTRATION_EXPIRATION_TIME)
|
||||||
.setRegistrant(
|
.setRegistrant(Ref.create(loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc())))
|
||||||
ReferenceUnion.create(loadByUniqueId(
|
|
||||||
ContactResource.class, "jd1234", clock.nowUtc())))
|
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(
|
DesignatedContact.create(
|
||||||
Type.ADMIN,
|
Type.ADMIN,
|
||||||
ReferenceUnion.create(
|
Ref.create(loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc()))),
|
||||||
loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc()))),
|
|
||||||
DesignatedContact.create(
|
DesignatedContact.create(
|
||||||
Type.TECH,
|
Type.TECH,
|
||||||
ReferenceUnion.create(
|
Ref.create(loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc())))))
|
||||||
loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc())))))
|
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("fooBAR")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("fooBAR")))
|
||||||
.addGracePeriod(GracePeriod.create(
|
.addGracePeriod(GracePeriod.create(
|
||||||
GracePeriodStatus.ADD, clock.nowUtc().plusDays(10), "foo", null))
|
GracePeriodStatus.ADD, clock.nowUtc().plusDays(10), "foo", null))
|
||||||
|
|
|
@ -62,7 +62,7 @@ import google.registry.flows.domain.DomainFlowUtils.LinkedResourceInPendingDelet
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingAdminContactException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingAdminContactException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingContactTypeException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.MissingTechnicalContactException;
|
import google.registry.flows.domain.DomainFlowUtils.MissingTechnicalContactException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NameserverNotAllowedException;
|
import google.registry.flows.domain.DomainFlowUtils.NameserversNotAllowedException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
|
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.TooManyDsRecordsException;
|
import google.registry.flows.domain.DomainFlowUtils.TooManyDsRecordsException;
|
||||||
|
@ -74,7 +74,6 @@ import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DesignatedContact.Type;
|
import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -123,9 +122,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
DomainResource domain = persistResource(
|
DomainResource domain = persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(sh8013Contact)),
|
DesignatedContact.create(Type.TECH, Ref.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(unusedContact))))
|
DesignatedContact.create(Type.ADMIN, Ref.create(unusedContact))))
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(host)))
|
.setNameservers(ImmutableSet.of(Ref.create(host)))
|
||||||
.build());
|
.build());
|
||||||
historyEntryDomainCreate = persistResource(
|
historyEntryDomainCreate = persistResource(
|
||||||
new HistoryEntry.Builder()
|
new HistoryEntry.Builder()
|
||||||
|
@ -180,7 +179,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
HistoryEntry historyEntryDomainUpdate =
|
HistoryEntry historyEntryDomainUpdate =
|
||||||
getOnlyHistoryEntryOfType(resource, HistoryEntry.Type.DOMAIN_UPDATE);
|
getOnlyHistoryEntryOfType(resource, HistoryEntry.Type.DOMAIN_UPDATE);
|
||||||
assertThat(resource.getNameservers()).containsExactly(
|
assertThat(resource.getNameservers()).containsExactly(
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||||
BillingEvent.OneTime regularAddBillingEvent = new BillingEvent.OneTime.Builder()
|
BillingEvent.OneTime regularAddBillingEvent = new BillingEvent.OneTime.Builder()
|
||||||
.setReason(Reason.CREATE)
|
.setReason(Reason.CREATE)
|
||||||
|
@ -278,7 +277,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// serverHold on it.
|
// serverHold on it.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByUniqueId().asBuilder()
|
reloadResourceByUniqueId().asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(
|
.setNameservers(ImmutableSet.of(Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
.addGracePeriod(GracePeriod.forBillingEvent(
|
||||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||||
|
@ -302,7 +301,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// serverHold on it.
|
// serverHold on it.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByUniqueId().asBuilder()
|
reloadResourceByUniqueId().asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(
|
.setNameservers(ImmutableSet.of(Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
.addGracePeriod(GracePeriod.forBillingEvent(
|
||||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||||
|
@ -345,10 +344,10 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modifyDomainToHave13Nameservers() throws Exception {
|
private void modifyDomainToHave13Nameservers() throws Exception {
|
||||||
ImmutableSet.Builder<ReferenceUnion<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<Ref<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
||||||
for (int i = 1; i < 15; i++) {
|
for (int i = 1; i < 15; i++) {
|
||||||
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
||||||
nameservers.add(ReferenceUnion.create(loadByUniqueId(
|
nameservers.add(Ref.create(loadByUniqueId(
|
||||||
HostResource.class, String.format("ns%d.example.foo", i), clock.nowUtc())));
|
HostResource.class, String.format("ns%d.example.foo", i), clock.nowUtc())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,11 +373,11 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistDomain();
|
persistDomain();
|
||||||
setEppInput("domain_update_max_everything.xml");
|
setEppInput("domain_update_max_everything.xml");
|
||||||
// Create 26 hosts and 8 contacts. Start the domain with half of them.
|
// Create 26 hosts and 8 contacts. Start the domain with half of them.
|
||||||
ImmutableSet.Builder<ReferenceUnion<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<Ref<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
||||||
for (int i = 0; i < 26; i++) {
|
for (int i = 0; i < 26; i++) {
|
||||||
HostResource host = persistActiveHost(String.format("max_test_%d.example.tld", i));
|
HostResource host = persistActiveHost(String.format("max_test_%d.example.tld", i));
|
||||||
if (i < 13) {
|
if (i < 13) {
|
||||||
nameservers.add(ReferenceUnion.create(host));
|
nameservers.add(Ref.create(host));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImmutableSet.Builder<DesignatedContact> contacts = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<DesignatedContact> contacts = new ImmutableSet.Builder<>();
|
||||||
|
@ -388,7 +387,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
contacts.add(
|
contacts.add(
|
||||||
DesignatedContact.create(
|
DesignatedContact.create(
|
||||||
DesignatedContact.Type.values()[i],
|
DesignatedContact.Type.values()[i],
|
||||||
ReferenceUnion.create(contact)));
|
Ref.create(contact)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -407,7 +406,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
assertThat(domain.getNameservers()).hasSize(13);
|
assertThat(domain.getNameservers()).hasSize(13);
|
||||||
// getContacts does not return contacts of type REGISTRANT, so check these separately.
|
// getContacts does not return contacts of type REGISTRANT, so check these separately.
|
||||||
assertThat(domain.getContacts()).hasSize(3);
|
assertThat(domain.getContacts()).hasSize(3);
|
||||||
assertThat(domain.getRegistrant().getLinked().get().getContactId()).isEqualTo("max_test_7");
|
assertThat(domain.getRegistrant().get().getContactId()).isEqualTo("max_test_7");
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
assertDnsTasksEnqueued("example.tld");
|
assertDnsTasksEnqueued("example.tld");
|
||||||
}
|
}
|
||||||
|
@ -459,14 +458,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
domain = persistResource(domain.asBuilder()
|
domain = persistResource(domain.asBuilder()
|
||||||
.addSubordinateHost("ns1.example.tld")
|
.addSubordinateHost("ns1.example.tld")
|
||||||
.addSubordinateHost("ns2.example.tld")
|
.addSubordinateHost("ns2.example.tld")
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(
|
.setNameservers(ImmutableSet.of(Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||||
domain = reloadResourceByUniqueId();
|
domain = reloadResourceByUniqueId();
|
||||||
assertThat(domain.getNameservers()).containsExactly(ReferenceUnion.create(addedHost));
|
assertThat(domain.getNameservers()).containsExactly(Ref.create(addedHost));
|
||||||
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld", "ns2.example.tld");
|
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld", "ns2.example.tld");
|
||||||
existingHost = loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc());
|
existingHost = loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc());
|
||||||
addedHost = loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
addedHost = loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
||||||
|
@ -481,7 +480,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setRegistrant(ReferenceUnion.create(sh8013))
|
.setRegistrant(Ref.create(sh8013))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||||
|
@ -492,14 +491,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_remove_multiple_contacts.xml");
|
setEppInput("domain_update_remove_multiple_contacts.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||||
ReferenceUnion<ContactResource> sh8013ReferenceUnion = ReferenceUnion.create(sh8013);
|
Ref<ContactResource> sh8013Ref = Ref.create(sh8013);
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setRegistrant(sh8013ReferenceUnion)
|
.setRegistrant(sh8013Ref)
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, sh8013ReferenceUnion),
|
DesignatedContact.create(Type.ADMIN, sh8013Ref),
|
||||||
DesignatedContact.create(Type.BILLING, sh8013ReferenceUnion),
|
DesignatedContact.create(Type.BILLING, sh8013Ref),
|
||||||
DesignatedContact.create(Type.TECH, sh8013ReferenceUnion)))
|
DesignatedContact.create(Type.TECH, sh8013Ref)))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||||
|
@ -891,7 +890,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByUniqueId().asBuilder()
|
reloadResourceByUniqueId().asBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(
|
DesignatedContact.create(Type.TECH, Ref.create(
|
||||||
loadByUniqueId(ContactResource.class, "foo", clock.nowUtc())))))
|
loadByUniqueId(ContactResource.class, "foo", clock.nowUtc())))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
|
@ -988,7 +987,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(
|
.setNameservers(ImmutableSet.of(Ref.create(
|
||||||
loadByUniqueId(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
|
loadByUniqueId(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
|
@ -1003,7 +1002,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
||||||
Type.TECH,
|
Type.TECH,
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))))
|
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
|
@ -1017,8 +1016,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(sh8013Contact)),
|
DesignatedContact.create(Type.ADMIN, Ref.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(sh8013Contact))))
|
DesignatedContact.create(Type.TECH, Ref.create(sh8013Contact))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
@ -1031,8 +1030,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(sh8013Contact)),
|
DesignatedContact.create(Type.ADMIN, Ref.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(sh8013Contact))))
|
DesignatedContact.create(Type.TECH, Ref.create(sh8013Contact))))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1093,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
thrown.expect(NameserverNotAllowedException.class);
|
thrown.expect(NameserversNotAllowedException.class);
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.flows.FlowRunner.CommitMode;
|
import google.registry.flows.FlowRunner.CommitMode;
|
||||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||||
|
@ -41,7 +42,6 @@ import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistExce
|
||||||
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
||||||
import google.registry.flows.async.DeleteEppResourceAction;
|
import google.registry.flows.async.DeleteEppResourceAction;
|
||||||
import google.registry.flows.async.DeleteHostResourceAction;
|
import google.registry.flows.async.DeleteHostResourceAction;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -179,7 +179,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(newDomainResource("example.tld").asBuilder()
|
persistResource(newDomainResource("example.tld").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(persistActiveHost(getUniqueIdFromCommand()))))
|
Ref.create(persistActiveHost(getUniqueIdFromCommand()))))
|
||||||
.build());
|
.build());
|
||||||
thrown.expect(ResourceToDeleteIsReferencedException.class);
|
thrown.expect(ResourceToDeleteIsReferencedException.class);
|
||||||
runFlow();
|
runFlow();
|
||||||
|
@ -190,7 +190,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(newDomainApplication("example.tld").asBuilder()
|
persistResource(newDomainApplication("example.tld").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(persistActiveHost(getUniqueIdFromCommand()))))
|
Ref.create(persistActiveHost(getUniqueIdFromCommand()))))
|
||||||
.build());
|
.build());
|
||||||
thrown.expect(ResourceToDeleteIsReferencedException.class);
|
thrown.expect(ResourceToDeleteIsReferencedException.class);
|
||||||
runFlow();
|
runFlow();
|
||||||
|
|
|
@ -29,7 +29,6 @@ import com.googlecode.objectify.Ref;
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
import google.registry.flows.ResourceQueryFlow.ResourceToQueryDoesNotExistException;
|
import google.registry.flows.ResourceQueryFlow.ResourceToQueryDoesNotExistException;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource("example.foobar").asBuilder()
|
newDomainResource("example.foobar").asBuilder()
|
||||||
.addNameservers(
|
.addNameservers(
|
||||||
ImmutableSet.of(ReferenceUnion.<HostResource>create(persistHostResource(true))))
|
ImmutableSet.of(Ref.<HostResource>create(persistHostResource(true))))
|
||||||
.build());
|
.build());
|
||||||
assertTransactionalFlow(false);
|
assertTransactionalFlow(false);
|
||||||
// Check that the persisted host info was returned.
|
// Check that the persisted host info was returned.
|
||||||
|
|
|
@ -58,7 +58,6 @@ import google.registry.flows.host.HostUpdateFlow.HostAlreadyExistsException;
|
||||||
import google.registry.flows.host.HostUpdateFlow.RenameHostToExternalRemoveIpException;
|
import google.registry.flows.host.HostUpdateFlow.RenameHostToExternalRemoveIpException;
|
||||||
import google.registry.flows.host.HostUpdateFlow.RenameHostToSubordinateRequiresIpException;
|
import google.registry.flows.host.HostUpdateFlow.RenameHostToSubordinateRequiresIpException;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
|
@ -162,7 +161,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource("test.xn--q9jyb4c").asBuilder()
|
newDomainResource("test.xn--q9jyb4c").asBuilder()
|
||||||
.setDeletionTime(END_OF_TIME)
|
.setDeletionTime(END_OF_TIME)
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(host)))
|
.setNameservers(ImmutableSet.of(Ref.create(host)))
|
||||||
.build());
|
.build());
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
HostResource renamedHost = doSuccessfulTest();
|
||||||
assertThat(renamedHost.getSuperordinateDomain()).isNull();
|
assertThat(renamedHost.getSuperordinateDomain()).isNull();
|
||||||
|
|
|
@ -19,6 +19,7 @@ import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
||||||
|
import static google.registry.testing.DatastoreHelper.newHostResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
|
@ -29,6 +30,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.EntityTestCase;
|
import google.registry.model.EntityTestCase;
|
||||||
import google.registry.model.billing.BillingEvent;
|
import google.registry.model.billing.BillingEvent;
|
||||||
|
@ -78,12 +80,12 @@ public class DomainApplicationTest extends EntityTestCase {
|
||||||
StatusValue.SERVER_UPDATE_PROHIBITED,
|
StatusValue.SERVER_UPDATE_PROHIBITED,
|
||||||
StatusValue.SERVER_RENEW_PROHIBITED,
|
StatusValue.SERVER_RENEW_PROHIBITED,
|
||||||
StatusValue.SERVER_HOLD))
|
StatusValue.SERVER_HOLD))
|
||||||
.setRegistrant(ReferenceUnion.create(persistActiveContact("contact_id1")))
|
.setRegistrant(Ref.create(persistActiveContact("contact_id1")))
|
||||||
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
||||||
DesignatedContact.Type.ADMIN,
|
DesignatedContact.Type.ADMIN,
|
||||||
ReferenceUnion.create(persistActiveContact("contact_id2")))))
|
Ref.create(persistActiveContact("contact_id2")))))
|
||||||
.setNameservers(
|
.setNameservers(
|
||||||
ImmutableSet.of(ReferenceUnion.create(persistActiveHost("ns1.example.com"))))
|
ImmutableSet.of(Ref.create(persistActiveHost("ns1.example.com"))))
|
||||||
.setCurrentSponsorClientId("a third registrar")
|
.setCurrentSponsorClientId("a third registrar")
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("password")))
|
||||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
||||||
|
@ -149,12 +151,12 @@ public class DomainApplicationTest extends EntityTestCase {
|
||||||
public void testEmptySetsAndArraysBecomeNull() {
|
public void testEmptySetsAndArraysBecomeNull() {
|
||||||
assertThat(emptyBuilder().setNameservers(null).build().nameservers).isNull();
|
assertThat(emptyBuilder().setNameservers(null).build().nameservers).isNull();
|
||||||
assertThat(emptyBuilder()
|
assertThat(emptyBuilder()
|
||||||
.setNameservers(ImmutableSet.<ReferenceUnion<HostResource>>of())
|
.setNameservers(ImmutableSet.<Ref<HostResource>>of())
|
||||||
.build()
|
.build()
|
||||||
.nameservers)
|
.nameservers)
|
||||||
.isNull();
|
.isNull();
|
||||||
assertThat(emptyBuilder()
|
assertThat(emptyBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.<HostResource>create("foo")))
|
.setNameservers(ImmutableSet.of(Ref.create(newHostResource("foo.example.tld"))))
|
||||||
.build()
|
.build()
|
||||||
.nameservers)
|
.nameservers)
|
||||||
.isNotNull();
|
.isNotNull();
|
||||||
|
|
|
@ -20,6 +20,7 @@ import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||||
|
import static google.registry.testing.DatastoreHelper.newHostResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
|
@ -103,11 +104,11 @@ public class DomainResourceTest extends EntityTestCase {
|
||||||
StatusValue.SERVER_UPDATE_PROHIBITED,
|
StatusValue.SERVER_UPDATE_PROHIBITED,
|
||||||
StatusValue.SERVER_RENEW_PROHIBITED,
|
StatusValue.SERVER_RENEW_PROHIBITED,
|
||||||
StatusValue.SERVER_HOLD))
|
StatusValue.SERVER_HOLD))
|
||||||
.setRegistrant(ReferenceUnion.create(contactResource1))
|
.setRegistrant(Ref.create(contactResource1))
|
||||||
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
||||||
DesignatedContact.Type.ADMIN,
|
DesignatedContact.Type.ADMIN,
|
||||||
ReferenceUnion.create(contactResource2))))
|
Ref.create(contactResource2))))
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.create(hostResource)))
|
.setNameservers(ImmutableSet.of(Ref.create(hostResource)))
|
||||||
.setSubordinateHosts(ImmutableSet.of("ns1.example.com"))
|
.setSubordinateHosts(ImmutableSet.of("ns1.example.com"))
|
||||||
.setCurrentSponsorClientId("a third registrar")
|
.setCurrentSponsorClientId("a third registrar")
|
||||||
.setRegistrationExpirationTime(clock.nowUtc().plusYears(1))
|
.setRegistrationExpirationTime(clock.nowUtc().plusYears(1))
|
||||||
|
@ -190,10 +191,10 @@ public class DomainResourceTest extends EntityTestCase {
|
||||||
assertThat(newDomainResource("example.com").asBuilder()
|
assertThat(newDomainResource("example.com").asBuilder()
|
||||||
.setNameservers(null).build().nameservers).isNull();
|
.setNameservers(null).build().nameservers).isNull();
|
||||||
assertThat(newDomainResource("example.com").asBuilder()
|
assertThat(newDomainResource("example.com").asBuilder()
|
||||||
.setNameservers(ImmutableSet.<ReferenceUnion<HostResource>>of()).build().nameservers)
|
.setNameservers(ImmutableSet.<Ref<HostResource>>of()).build().nameservers)
|
||||||
.isNull();
|
.isNull();
|
||||||
assertThat(newDomainResource("example.com").asBuilder()
|
assertThat(newDomainResource("example.com").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(ReferenceUnion.<HostResource>create("foo")))
|
.setNameservers(ImmutableSet.of(Ref.create(newHostResource("foo.example.tld"))))
|
||||||
.build().nameservers)
|
.build().nameservers)
|
||||||
.isNotNull();
|
.isNotNull();
|
||||||
// This behavior should also hold true for ImmutableObjects nested in collections.
|
// This behavior should also hold true for ImmutableObjects nested in collections.
|
||||||
|
@ -222,8 +223,8 @@ public class DomainResourceTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImplicitStatusValues() {
|
public void testImplicitStatusValues() {
|
||||||
ImmutableSet<ReferenceUnion<HostResource>> nameservers =
|
ImmutableSet<Ref<HostResource>> nameservers =
|
||||||
ImmutableSet.of(ReferenceUnion.<HostResource>create("foo"));
|
ImmutableSet.of(Ref.create(newHostResource("foo.example.tld")));
|
||||||
StatusValue[] statuses = {StatusValue.OK};
|
StatusValue[] statuses = {StatusValue.OK};
|
||||||
// OK is implicit if there's no other statuses but there are nameservers.
|
// OK is implicit if there's no other statuses but there are nameservers.
|
||||||
assertAboutDomains()
|
assertAboutDomains()
|
||||||
|
|
|
@ -49,7 +49,6 @@ import google.registry.config.RegistryEnvironment;
|
||||||
import google.registry.mapreduce.MapreduceRunner;
|
import google.registry.mapreduce.MapreduceRunner;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
|
@ -192,9 +191,9 @@ public class VerifyEntityIntegrityActionTest
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(
|
.setNameservers(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
ReferenceUnion.create(Ref.create(missingHost1)),
|
Ref.create(missingHost1),
|
||||||
ReferenceUnion.create(Ref.create(missingHost2)),
|
Ref.create(missingHost2),
|
||||||
ReferenceUnion.create(Ref.create(missingHost3))))
|
Ref.create(missingHost3)))
|
||||||
.build());
|
.build());
|
||||||
String source = Key.create(domain).toString();
|
String source = Key.create(domain).toString();
|
||||||
runMapreduce();
|
runMapreduce();
|
||||||
|
|
|
@ -25,6 +25,7 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
import static org.joda.money.CurrencyUnit.USD;
|
import static org.joda.money.CurrencyUnit.USD;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSortedMap;
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
|
|
||||||
import google.registry.model.registry.Registry;
|
import google.registry.model.registry.Registry;
|
||||||
import google.registry.model.registry.label.PremiumList;
|
import google.registry.model.registry.label.PremiumList;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
|
|
|
@ -46,7 +46,6 @@ import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
|
@ -264,10 +263,10 @@ public class DomainResourceToXjcConverterTest {
|
||||||
domain = domain.asBuilder()
|
domain = domain.asBuilder()
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("secret")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("secret")))
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(DesignatedContact.Type.ADMIN, ReferenceUnion.create(
|
DesignatedContact.create(DesignatedContact.Type.ADMIN, Ref.create(
|
||||||
makeContactResource(clock, "10-Q9JYB4C", "5372808-IRL",
|
makeContactResource(clock, "10-Q9JYB4C", "5372808-IRL",
|
||||||
"be that word our sign in parting", "BOFH@cat.みんな"))),
|
"be that word our sign in parting", "BOFH@cat.みんな"))),
|
||||||
DesignatedContact.create(DesignatedContact.Type.TECH, ReferenceUnion.create(
|
DesignatedContact.create(DesignatedContact.Type.TECH, Ref.create(
|
||||||
makeContactResource(clock, "11-Q9JYB4C", "5372808-TRL",
|
makeContactResource(clock, "11-Q9JYB4C", "5372808-TRL",
|
||||||
"bird or fiend!? i shrieked upstarting", "bog@cat.みんな")))))
|
"bird or fiend!? i shrieked upstarting", "bog@cat.みんな")))))
|
||||||
.setCreationClientId("LawyerCat")
|
.setCreationClientId("LawyerCat")
|
||||||
|
@ -280,11 +279,11 @@ public class DomainResourceToXjcConverterTest {
|
||||||
.setLastEppUpdateClientId("IntoTheTempest")
|
.setLastEppUpdateClientId("IntoTheTempest")
|
||||||
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
makeHostResource(clock, "3-Q9JYB4C", "bird.or.devil.みんな", "1.2.3.4")),
|
makeHostResource(clock, "3-Q9JYB4C", "bird.or.devil.みんな", "1.2.3.4")),
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
makeHostResource(clock, "4-Q9JYB4C", "ns2.cat.みんな", "bad:f00d:cafe::15:beef"))))
|
makeHostResource(clock, "4-Q9JYB4C", "ns2.cat.みんな", "bad:f00d:cafe::15:beef"))))
|
||||||
.setRegistrant(ReferenceUnion.create(makeContactResource(
|
.setRegistrant(Ref.create(makeContactResource(
|
||||||
clock, "12-Q9JYB4C", "5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
|
clock, "12-Q9JYB4C", "5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
|
||||||
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
|
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
|
||||||
.setGracePeriods(ImmutableSet.of(
|
.setGracePeriods(ImmutableSet.of(
|
||||||
|
|
|
@ -41,7 +41,6 @@ import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
|
@ -85,10 +84,10 @@ final class RdeFixtures {
|
||||||
domain = domain.asBuilder()
|
domain = domain.asBuilder()
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("secret")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("secret")))
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(DesignatedContact.Type.ADMIN, ReferenceUnion.create(
|
DesignatedContact.create(DesignatedContact.Type.ADMIN, Ref.create(
|
||||||
makeContactResource(clock, "5372808-IRL",
|
makeContactResource(clock, "5372808-IRL",
|
||||||
"be that word our sign in parting", "BOFH@cat.みんな"))),
|
"be that word our sign in parting", "BOFH@cat.みんな"))),
|
||||||
DesignatedContact.create(DesignatedContact.Type.TECH, ReferenceUnion.create(
|
DesignatedContact.create(DesignatedContact.Type.TECH, Ref.create(
|
||||||
makeContactResource(clock, "5372808-TRL",
|
makeContactResource(clock, "5372808-TRL",
|
||||||
"bird or fiend!? i shrieked upstarting", "bog@cat.みんな")))))
|
"bird or fiend!? i shrieked upstarting", "bog@cat.みんな")))))
|
||||||
.setCreationClientId("TheRegistrar")
|
.setCreationClientId("TheRegistrar")
|
||||||
|
@ -102,12 +101,12 @@ final class RdeFixtures {
|
||||||
.setLastEppUpdateTime(clock.nowUtc())
|
.setLastEppUpdateTime(clock.nowUtc())
|
||||||
.setIdnTableName("extended_latin")
|
.setIdnTableName("extended_latin")
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
makeHostResource(clock, "bird.or.devil.みんな", "1.2.3.4")),
|
makeHostResource(clock, "bird.or.devil.みんな", "1.2.3.4")),
|
||||||
ReferenceUnion.create(
|
Ref.create(
|
||||||
makeHostResource(
|
makeHostResource(
|
||||||
clock, "ns2.cat.みんな", "bad:f00d:cafe::15:beef"))))
|
clock, "ns2.cat.みんな", "bad:f00d:cafe::15:beef"))))
|
||||||
.setRegistrant(ReferenceUnion.create(
|
.setRegistrant(Ref.create(
|
||||||
makeContactResource(clock,
|
makeContactResource(clock,
|
||||||
"5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
|
"5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
|
||||||
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
|
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
|
||||||
|
|
|
@ -38,6 +38,7 @@ java_library(
|
||||||
"//java/com/google/common/collect",
|
"//java/com/google/common/collect",
|
||||||
"//third_party/java/appengine:appengine-api",
|
"//third_party/java/appengine:appengine-api",
|
||||||
"//third_party/java/joda_time",
|
"//third_party/java/joda_time",
|
||||||
|
"//third_party/java/objectify:objectify-v4_1",
|
||||||
"//java/google/registry/model",
|
"//java/google/registry/model",
|
||||||
"//javatests/google/registry/testing",
|
"//javatests/google/registry/testing",
|
||||||
],
|
],
|
||||||
|
|
|
@ -26,11 +26,12 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.contact.ContactAddress;
|
import google.registry.model.contact.ContactAddress;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.contact.PostalInfo;
|
import google.registry.model.contact.PostalInfo;
|
||||||
import google.registry.model.domain.DesignatedContact;
|
import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.ofy.Ofy;
|
import google.registry.model.ofy.Ofy;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
|
@ -114,28 +115,26 @@ public enum Fixture {
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource("love.xn--q9jyb4c", justine).asBuilder()
|
newDomainResource("love.xn--q9jyb4c", justine).asBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(ADMIN, ReferenceUnion.create(robert)),
|
DesignatedContact.create(ADMIN, Ref.create(robert)),
|
||||||
DesignatedContact.create(BILLING, ReferenceUnion.create(google)),
|
DesignatedContact.create(BILLING, Ref.create(google)),
|
||||||
DesignatedContact.create(TECH, ReferenceUnion.create(justine))))
|
DesignatedContact.create(TECH, Ref.create(justine))))
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(
|
Ref.create(persistActiveHost("ns1.love.xn--q9jyb4c")),
|
||||||
persistActiveHost("ns1.love.xn--q9jyb4c")),
|
Ref.create(persistActiveHost("ns2.love.xn--q9jyb4c"))))
|
||||||
ReferenceUnion.create(
|
|
||||||
persistActiveHost("ns2.love.xn--q9jyb4c"))))
|
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource("moogle.example", justine).asBuilder()
|
newDomainResource("moogle.example", justine).asBuilder()
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(ADMIN, ReferenceUnion.create(robert)),
|
DesignatedContact.create(ADMIN, Ref.create(robert)),
|
||||||
DesignatedContact.create(BILLING, ReferenceUnion.create(google)),
|
DesignatedContact.create(BILLING, Ref.create(google)),
|
||||||
DesignatedContact.create(TECH, ReferenceUnion.create(justine))))
|
DesignatedContact.create(TECH, Ref.create(justine))))
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(persistActiveHost("ns1.linode.com")),
|
Ref.create(persistActiveHost("ns1.linode.com")),
|
||||||
ReferenceUnion.create(persistActiveHost("ns2.linode.com")),
|
Ref.create(persistActiveHost("ns2.linode.com")),
|
||||||
ReferenceUnion.create(persistActiveHost("ns3.linode.com")),
|
Ref.create(persistActiveHost("ns3.linode.com")),
|
||||||
ReferenceUnion.create(persistActiveHost("ns4.linode.com")),
|
Ref.create(persistActiveHost("ns4.linode.com")),
|
||||||
ReferenceUnion.create(persistActiveHost("ns5.linode.com"))))
|
Ref.create(persistActiveHost("ns5.linode.com"))))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
persistResource(
|
persistResource(
|
||||||
|
|
|
@ -68,7 +68,6 @@ import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.DomainApplication;
|
import google.registry.model.domain.DomainApplication;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.launch.LaunchPhase;
|
import google.registry.model.domain.launch.LaunchPhase;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -132,6 +131,7 @@ public class DatastoreHelper {
|
||||||
|
|
||||||
public static DomainResource newDomainResource(
|
public static DomainResource newDomainResource(
|
||||||
String domainName, String repoId, ContactResource contact) {
|
String domainName, String repoId, ContactResource contact) {
|
||||||
|
Ref<ContactResource> contactRef = Ref.create(contact);
|
||||||
return new DomainResource.Builder()
|
return new DomainResource.Builder()
|
||||||
.setRepoId(repoId)
|
.setRepoId(repoId)
|
||||||
.setFullyQualifiedDomainName(domainName)
|
.setFullyQualifiedDomainName(domainName)
|
||||||
|
@ -139,10 +139,10 @@ public class DatastoreHelper {
|
||||||
.setCurrentSponsorClientId("TheRegistrar")
|
.setCurrentSponsorClientId("TheRegistrar")
|
||||||
.setCreationTimeForTest(START_OF_TIME)
|
.setCreationTimeForTest(START_OF_TIME)
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
||||||
.setRegistrant(ReferenceUnion.create(contact))
|
.setRegistrant(contactRef)
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(contact)),
|
DesignatedContact.create(Type.ADMIN, contactRef),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(contact))))
|
DesignatedContact.create(Type.TECH, contactRef)))
|
||||||
.setRegistrationExpirationTime(END_OF_TIME)
|
.setRegistrationExpirationTime(END_OF_TIME)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -172,15 +172,16 @@ public class DatastoreHelper {
|
||||||
|
|
||||||
public static DomainApplication newDomainApplication(
|
public static DomainApplication newDomainApplication(
|
||||||
String domainName, String repoId, ContactResource contact, LaunchPhase phase) {
|
String domainName, String repoId, ContactResource contact, LaunchPhase phase) {
|
||||||
|
Ref<ContactResource> contactRef = Ref.create(contact);
|
||||||
return new DomainApplication.Builder()
|
return new DomainApplication.Builder()
|
||||||
.setRepoId(repoId)
|
.setRepoId(repoId)
|
||||||
.setFullyQualifiedDomainName(domainName)
|
.setFullyQualifiedDomainName(domainName)
|
||||||
.setCurrentSponsorClientId("TheRegistrar")
|
.setCurrentSponsorClientId("TheRegistrar")
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
||||||
.setRegistrant(ReferenceUnion.create(contact))
|
.setRegistrant(contactRef)
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, ReferenceUnion.create(contact)),
|
DesignatedContact.create(Type.ADMIN, contactRef),
|
||||||
DesignatedContact.create(Type.TECH, ReferenceUnion.create(contact))))
|
DesignatedContact.create(Type.TECH, contactRef)))
|
||||||
.setPhase(phase)
|
.setPhase(phase)
|
||||||
.setApplicationStatus(VALIDATED)
|
.setApplicationStatus(VALIDATED)
|
||||||
.addStatusValue(StatusValue.PENDING_CREATE)
|
.addStatusValue(StatusValue.PENDING_CREATE)
|
||||||
|
|
|
@ -24,6 +24,8 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.ContactAddress;
|
import google.registry.model.contact.ContactAddress;
|
||||||
import google.registry.model.contact.ContactPhoneNumber;
|
import google.registry.model.contact.ContactPhoneNumber;
|
||||||
|
@ -32,7 +34,6 @@ import google.registry.model.contact.PostalInfo;
|
||||||
import google.registry.model.domain.DesignatedContact;
|
import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
|
@ -232,27 +233,27 @@ public final class FullFieldsTestEntityHelper {
|
||||||
StatusValue.SERVER_UPDATE_PROHIBITED))
|
StatusValue.SERVER_UPDATE_PROHIBITED))
|
||||||
.setDsData(ImmutableSet.of(new DelegationSignerData()));
|
.setDsData(ImmutableSet.of(new DelegationSignerData()));
|
||||||
if (registrant != null) {
|
if (registrant != null) {
|
||||||
builder.setRegistrant(ReferenceUnion.create(registrant));
|
builder.setRegistrant(Ref.create(registrant));
|
||||||
}
|
}
|
||||||
if ((admin != null) || (tech != null)) {
|
if ((admin != null) || (tech != null)) {
|
||||||
ImmutableSet.Builder<DesignatedContact> contactsBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<DesignatedContact> contactsBuilder = new ImmutableSet.Builder<>();
|
||||||
if (admin != null) {
|
if (admin != null) {
|
||||||
contactsBuilder.add(DesignatedContact.create(
|
contactsBuilder.add(DesignatedContact.create(
|
||||||
DesignatedContact.Type.ADMIN, ReferenceUnion.create(admin)));
|
DesignatedContact.Type.ADMIN, Ref.create(admin)));
|
||||||
}
|
}
|
||||||
if (tech != null) {
|
if (tech != null) {
|
||||||
contactsBuilder.add(DesignatedContact.create(
|
contactsBuilder.add(DesignatedContact.create(
|
||||||
DesignatedContact.Type.TECH, ReferenceUnion.create(tech)));
|
DesignatedContact.Type.TECH, Ref.create(tech)));
|
||||||
}
|
}
|
||||||
builder.setContacts(contactsBuilder.build());
|
builder.setContacts(contactsBuilder.build());
|
||||||
}
|
}
|
||||||
if ((ns1 != null) || (ns2 != null)) {
|
if ((ns1 != null) || (ns2 != null)) {
|
||||||
ImmutableSet.Builder<ReferenceUnion<HostResource>> nsBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<Ref<HostResource>> nsBuilder = new ImmutableSet.Builder<>();
|
||||||
if (ns1 != null) {
|
if (ns1 != null) {
|
||||||
nsBuilder.add(ReferenceUnion.create(ns1));
|
nsBuilder.add(Ref.create(ns1));
|
||||||
}
|
}
|
||||||
if (ns2 != null) {
|
if (ns2 != null) {
|
||||||
nsBuilder.add(ReferenceUnion.create(ns2));
|
nsBuilder.add(Ref.create(ns2));
|
||||||
}
|
}
|
||||||
builder.setNameservers(nsBuilder.build());
|
builder.setNameservers(nsBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,12 +42,12 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import com.beust.jcommander.ParameterException;
|
import com.beust.jcommander.ParameterException;
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.flows.EppXmlTransformer;
|
import google.registry.flows.EppXmlTransformer;
|
||||||
import google.registry.flows.domain.DomainAllocateFlow;
|
import google.registry.flows.domain.DomainAllocateFlow;
|
||||||
import google.registry.model.domain.DesignatedContact;
|
import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DomainApplication;
|
import google.registry.model.domain.DomainApplication;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.launch.LaunchNotice;
|
import google.registry.model.domain.launch.LaunchNotice;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
|
@ -93,20 +93,20 @@ public class AllocateDomainCommandTest extends CommandTestCase<AllocateDomainCom
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRepoId(repoId)
|
.setRepoId(repoId)
|
||||||
.setCreationTimeForTest(START_OF_TIME)
|
.setCreationTimeForTest(START_OF_TIME)
|
||||||
.setRegistrant(ReferenceUnion.create(persistActiveContact("registrant")))
|
.setRegistrant(Ref.create(persistActiveContact("registrant")))
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(
|
DesignatedContact.create(
|
||||||
ADMIN,
|
ADMIN,
|
||||||
ReferenceUnion.create(persistActiveContact("adminContact"))),
|
Ref.create(persistActiveContact("adminContact"))),
|
||||||
DesignatedContact.create(
|
DesignatedContact.create(
|
||||||
BILLING,
|
BILLING,
|
||||||
ReferenceUnion.create(persistActiveContact("billingContact"))),
|
Ref.create(persistActiveContact("billingContact"))),
|
||||||
DesignatedContact.create(
|
DesignatedContact.create(
|
||||||
TECH,
|
TECH,
|
||||||
ReferenceUnion.create(persistActiveContact("techContact")))))
|
Ref.create(persistActiveContact("techContact")))))
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(
|
||||||
ReferenceUnion.create(persistActiveHost("ns1.example.com")),
|
Ref.create(persistActiveHost("ns1.example.com")),
|
||||||
ReferenceUnion.create(persistActiveHost("ns2.example.com"))))
|
Ref.create(persistActiveHost("ns2.example.com"))))
|
||||||
.setApplicationStatus(VALIDATED)
|
.setApplicationStatus(VALIDATED)
|
||||||
.setDsData(ImmutableSet.of(
|
.setDsData(ImmutableSet.of(
|
||||||
DelegationSignerData.create(
|
DelegationSignerData.create(
|
||||||
|
|
|
@ -34,7 +34,6 @@ import com.beust.jcommander.ParameterException;
|
||||||
import com.googlecode.objectify.Ref;
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
@ -135,17 +134,13 @@ public class GenerateDnsReportCommandTest extends CommandTestCase<GenerateDnsRep
|
||||||
nameserver3 = persistActiveHost("ns1.google.com");
|
nameserver3 = persistActiveHost("ns1.google.com");
|
||||||
nameserver4 = persistActiveHost("ns2.google.com");
|
nameserver4 = persistActiveHost("ns2.google.com");
|
||||||
domain1 = persistResource(newDomainResource("example.xn--q9jyb4c").asBuilder()
|
domain1 = persistResource(newDomainResource("example.xn--q9jyb4c").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(Ref.create(nameserver1), Ref.create(nameserver2)))
|
||||||
ReferenceUnion.create(Ref.create(nameserver1)),
|
|
||||||
ReferenceUnion.create(Ref.create(nameserver2))))
|
|
||||||
.setDsData(ImmutableSet.of(
|
.setDsData(ImmutableSet.of(
|
||||||
DelegationSignerData.create(12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC")),
|
DelegationSignerData.create(12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC")),
|
||||||
DelegationSignerData.create(56789, 2, 4, base16().decode("69FD46E6C4A45C55D4AC"))))
|
DelegationSignerData.create(56789, 2, 4, base16().decode("69FD46E6C4A45C55D4AC"))))
|
||||||
.build());
|
.build());
|
||||||
persistResource(newDomainResource("foobar.xn--q9jyb4c").asBuilder()
|
persistResource(newDomainResource("foobar.xn--q9jyb4c").asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(
|
.setNameservers(ImmutableSet.of(Ref.create(nameserver3), Ref.create(nameserver4)))
|
||||||
ReferenceUnion.create(Ref.create(nameserver3)),
|
|
||||||
ReferenceUnion.create(Ref.create(nameserver4))))
|
|
||||||
.build());
|
.build());
|
||||||
// Persist a domain in a different tld that should be ignored.
|
// Persist a domain in a different tld that should be ignored.
|
||||||
persistActiveDomain("should-be-ignored.example");
|
persistActiveDomain("should-be-ignored.example");
|
||||||
|
|
|
@ -24,7 +24,6 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.beust.jcommander.ParameterException;
|
import com.beust.jcommander.ParameterException;
|
||||||
import com.googlecode.objectify.Ref;
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
|
@ -45,9 +44,9 @@ public class UniformRapidSuspensionCommandTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void persistDomainWithHosts(HostResource... hosts) {
|
private void persistDomainWithHosts(HostResource... hosts) {
|
||||||
ImmutableSet.Builder<ReferenceUnion<HostResource>> hostRefs = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<Ref<HostResource>> hostRefs = new ImmutableSet.Builder<>();
|
||||||
for (HostResource host : hosts) {
|
for (HostResource host : hosts) {
|
||||||
hostRefs.add(ReferenceUnion.create(Ref.create(host)));
|
hostRefs.add(Ref.create(host));
|
||||||
}
|
}
|
||||||
persistResource(newDomainResource("evil.tld").asBuilder()
|
persistResource(newDomainResource("evil.tld").asBuilder()
|
||||||
.setNameservers(hostRefs.build())
|
.setNameservers(hostRefs.build())
|
||||||
|
|
|
@ -37,8 +37,9 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
|
|
||||||
import google.registry.mapreduce.MapreduceRunner;
|
import google.registry.mapreduce.MapreduceRunner;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
|
@ -73,10 +74,8 @@ public class GenerateZoneFilesActionTest extends MapreduceTestCase<GenerateZoneF
|
||||||
HostResource host2 =
|
HostResource host2 =
|
||||||
persistResource(newHostResource("ns.bar.tld").asBuilder().addInetAddresses(ips).build());
|
persistResource(newHostResource("ns.bar.tld").asBuilder().addInetAddresses(ips).build());
|
||||||
|
|
||||||
ImmutableSet<ReferenceUnion<HostResource>> nameservers =
|
ImmutableSet<Ref<HostResource>> nameservers =
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(Ref.create(host1), Ref.create(host2));
|
||||||
ReferenceUnion.<HostResource>create(host1),
|
|
||||||
ReferenceUnion.<HostResource>create(host2));
|
|
||||||
persistResource(newDomainResource("ns-and-ds.tld").asBuilder()
|
persistResource(newDomainResource("ns-and-ds.tld").asBuilder()
|
||||||
.addNameservers(nameservers)
|
.addNameservers(nameservers)
|
||||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
||||||
|
|
|
@ -32,7 +32,6 @@ import google.registry.model.contact.PostalInfo;
|
||||||
import google.registry.model.domain.DesignatedContact;
|
import google.registry.model.domain.DesignatedContact;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.ReferenceUnion;
|
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -227,17 +226,11 @@ public class DomainWhoisResponseTest {
|
||||||
StatusValue.CLIENT_RENEW_PROHIBITED,
|
StatusValue.CLIENT_RENEW_PROHIBITED,
|
||||||
StatusValue.CLIENT_TRANSFER_PROHIBITED,
|
StatusValue.CLIENT_TRANSFER_PROHIBITED,
|
||||||
StatusValue.SERVER_UPDATE_PROHIBITED))
|
StatusValue.SERVER_UPDATE_PROHIBITED))
|
||||||
.setRegistrant(ReferenceUnion.create(registrantResourceRef))
|
.setRegistrant(registrantResourceRef)
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(ImmutableSet.of(
|
||||||
DesignatedContact.create(
|
DesignatedContact.create(DesignatedContact.Type.ADMIN, adminResourceRef),
|
||||||
DesignatedContact.Type.ADMIN,
|
DesignatedContact.create(DesignatedContact.Type.TECH, techResourceRef)))
|
||||||
ReferenceUnion.create(adminResourceRef)),
|
.setNameservers(ImmutableSet.of(hostResource1Ref, hostResource2Ref))
|
||||||
DesignatedContact.create(
|
|
||||||
DesignatedContact.Type.TECH,
|
|
||||||
ReferenceUnion.create(techResourceRef))))
|
|
||||||
.setNameservers(ImmutableSet.of(
|
|
||||||
ReferenceUnion.create(hostResource1Ref),
|
|
||||||
ReferenceUnion.create(hostResource2Ref)))
|
|
||||||
.setDsData(ImmutableSet.of(new DelegationSignerData()))
|
.setDsData(ImmutableSet.of(new DelegationSignerData()))
|
||||||
.setGracePeriods(ImmutableSet.of(
|
.setGracePeriods(ImmutableSet.of(
|
||||||
GracePeriod.create(GracePeriodStatus.ADD, END_OF_TIME, "", null),
|
GracePeriod.create(GracePeriodStatus.ADD, END_OF_TIME, "", null),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue