mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Use the correct text VKey for HostResource's superordinateDomain (#608)
* Store the superordinateDomain reference as a VKey rather than Key This is a reference to a Domain object, so we should store it as a VKey in reference to the Domain table. This should not affect any business logic, but rather will allow us to set up the SQL tables for HostResource et al. properly.
This commit is contained in:
parent
1081f7572d
commit
38c481d63e
35 changed files with 276 additions and 249 deletions
|
@ -347,7 +347,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
||||||
String resourceClientId = resource.getPersistedCurrentSponsorClientId();
|
String resourceClientId = resource.getPersistedCurrentSponsorClientId();
|
||||||
if (resource instanceof HostResource && ((HostResource) resource).isSubordinate()) {
|
if (resource instanceof HostResource && ((HostResource) resource).isSubordinate()) {
|
||||||
resourceClientId =
|
resourceClientId =
|
||||||
ofy().load().key(((HostResource) resource).getSuperordinateDomain()).now()
|
tm().load(((HostResource) resource).getSuperordinateDomain())
|
||||||
.cloneProjectedAtTime(now)
|
.cloneProjectedAtTime(now)
|
||||||
.getCurrentSponsorClientId();
|
.getCurrentSponsorClientId();
|
||||||
}
|
}
|
||||||
|
@ -466,10 +466,11 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
||||||
HostResource host = (HostResource) existingResource;
|
HostResource host = (HostResource) existingResource;
|
||||||
if (host.isSubordinate()) {
|
if (host.isSubordinate()) {
|
||||||
dnsQueue.addHostRefreshTask(host.getFullyQualifiedHostName());
|
dnsQueue.addHostRefreshTask(host.getFullyQualifiedHostName());
|
||||||
ofy().save().entity(
|
tm().saveNewOrUpdate(
|
||||||
ofy().load().key(host.getSuperordinateDomain()).now().asBuilder()
|
tm().load(host.getSuperordinateDomain())
|
||||||
.removeSubordinateHost(host.getFullyQualifiedHostName())
|
.asBuilder()
|
||||||
.build());
|
.removeSubordinateHost(host.getFullyQualifiedHostName())
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
|
|
@ -128,7 +128,7 @@ public final class HostCreateFlow implements TransactionalFlow {
|
||||||
.setFullyQualifiedHostName(targetId)
|
.setFullyQualifiedHostName(targetId)
|
||||||
.setInetAddresses(command.getInetAddresses())
|
.setInetAddresses(command.getInetAddresses())
|
||||||
.setRepoId(createRepoId(ObjectifyService.allocateId(), roidSuffix))
|
.setRepoId(createRepoId(ObjectifyService.allocateId(), roidSuffix))
|
||||||
.setSuperordinateDomain(superordinateDomain.map(Key::create).orElse(null))
|
.setSuperordinateDomain(superordinateDomain.map(DomainBase::createVKey).orElse(null))
|
||||||
.build();
|
.build();
|
||||||
historyBuilder
|
historyBuilder
|
||||||
.setType(HistoryEntry.Type.HOST_CREATE)
|
.setType(HistoryEntry.Type.HOST_CREATE)
|
||||||
|
|
|
@ -96,8 +96,7 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
||||||
// the client id, needs to be read off of it.
|
// the client id, needs to be read off of it.
|
||||||
EppResource owningResource =
|
EppResource owningResource =
|
||||||
existingHost.isSubordinate()
|
existingHost.isSubordinate()
|
||||||
? ofy().load().key(existingHost.getSuperordinateDomain()).now()
|
? tm().load(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now)
|
||||||
.cloneProjectedAtTime(now)
|
|
||||||
: existingHost;
|
: existingHost;
|
||||||
verifyResourceOwnership(clientId, owningResource);
|
verifyResourceOwnership(clientId, owningResource);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||||
import static google.registry.model.EppResourceUtils.isLinked;
|
import static google.registry.model.EppResourceUtils.isLinked;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
@ -77,7 +77,7 @@ public final class HostInfoFlow implements Flow {
|
||||||
// there is no superordinate domain, the host's own values for these fields will be correct.
|
// there is no superordinate domain, the host's own values for these fields will be correct.
|
||||||
if (host.isSubordinate()) {
|
if (host.isSubordinate()) {
|
||||||
DomainBase superordinateDomain =
|
DomainBase superordinateDomain =
|
||||||
ofy().load().key(host.getSuperordinateDomain()).now().cloneProjectedAtTime(now);
|
tm().load(host.getSuperordinateDomain()).cloneProjectedAtTime(now);
|
||||||
hostInfoDataBuilder
|
hostInfoDataBuilder
|
||||||
.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId())
|
.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId())
|
||||||
.setLastTransferTime(host.computeLastTransferTime(superordinateDomain));
|
.setLastTransferTime(host.computeLastTransferTime(superordinateDomain));
|
||||||
|
|
|
@ -60,6 +60,7 @@ import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
|
import google.registry.persistence.VKey;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -136,9 +137,10 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
boolean isHostRename = suppliedNewHostName != null;
|
boolean isHostRename = suppliedNewHostName != null;
|
||||||
String oldHostName = targetId;
|
String oldHostName = targetId;
|
||||||
String newHostName = firstNonNull(suppliedNewHostName, oldHostName);
|
String newHostName = firstNonNull(suppliedNewHostName, oldHostName);
|
||||||
DomainBase oldSuperordinateDomain = existingHost.isSubordinate()
|
DomainBase oldSuperordinateDomain =
|
||||||
? ofy().load().key(existingHost.getSuperordinateDomain()).now().cloneProjectedAtTime(now)
|
existingHost.isSubordinate()
|
||||||
: null;
|
? tm().load(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now)
|
||||||
|
: null;
|
||||||
// Note that lookupSuperordinateDomain calls cloneProjectedAtTime on the domain for us.
|
// Note that lookupSuperordinateDomain calls cloneProjectedAtTime on the domain for us.
|
||||||
Optional<DomainBase> newSuperordinateDomain =
|
Optional<DomainBase> newSuperordinateDomain =
|
||||||
lookupSuperordinateDomain(validateHostName(newHostName), now);
|
lookupSuperordinateDomain(validateHostName(newHostName), now);
|
||||||
|
@ -153,8 +155,8 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
AddRemove remove = command.getInnerRemove();
|
AddRemove remove = command.getInnerRemove();
|
||||||
checkSameValuesNotAddedAndRemoved(add.getStatusValues(), remove.getStatusValues());
|
checkSameValuesNotAddedAndRemoved(add.getStatusValues(), remove.getStatusValues());
|
||||||
checkSameValuesNotAddedAndRemoved(add.getInetAddresses(), remove.getInetAddresses());
|
checkSameValuesNotAddedAndRemoved(add.getInetAddresses(), remove.getInetAddresses());
|
||||||
Key<DomainBase> newSuperordinateDomainKey =
|
VKey<DomainBase> newSuperordinateDomainKey =
|
||||||
newSuperordinateDomain.map(Key::create).orElse(null);
|
newSuperordinateDomain.map(DomainBase::createVKey).orElse(null);
|
||||||
// If the superordinateDomain field is changing, set the lastSuperordinateChange to now.
|
// If the superordinateDomain field is changing, set the lastSuperordinateChange to now.
|
||||||
DateTime lastSuperordinateChange =
|
DateTime lastSuperordinateChange =
|
||||||
Objects.equals(newSuperordinateDomainKey, existingHost.getSuperordinateDomain())
|
Objects.equals(newSuperordinateDomainKey, existingHost.getSuperordinateDomain())
|
||||||
|
@ -280,28 +282,28 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
if (existingHost.isSubordinate()
|
if (existingHost.isSubordinate()
|
||||||
&& newHost.isSubordinate()
|
&& newHost.isSubordinate()
|
||||||
&& Objects.equals(
|
&& Objects.equals(
|
||||||
existingHost.getSuperordinateDomain(),
|
existingHost.getSuperordinateDomain(), newHost.getSuperordinateDomain())) {
|
||||||
newHost.getSuperordinateDomain())) {
|
tm().saveNewOrUpdate(
|
||||||
ofy().save().entity(
|
tm().load(existingHost.getSuperordinateDomain())
|
||||||
ofy().load().key(existingHost.getSuperordinateDomain()).now().asBuilder()
|
.asBuilder()
|
||||||
.removeSubordinateHost(existingHost.getFullyQualifiedHostName())
|
.removeSubordinateHost(existingHost.getFullyQualifiedHostName())
|
||||||
.addSubordinateHost(newHost.getFullyQualifiedHostName())
|
.addSubordinateHost(newHost.getFullyQualifiedHostName())
|
||||||
.build());
|
.build());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (existingHost.isSubordinate()) {
|
if (existingHost.isSubordinate()) {
|
||||||
ofy().save().entity(
|
tm().saveNewOrUpdate(
|
||||||
ofy().load().key(existingHost.getSuperordinateDomain()).now()
|
tm().load(existingHost.getSuperordinateDomain())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.removeSubordinateHost(existingHost.getFullyQualifiedHostName())
|
.removeSubordinateHost(existingHost.getFullyQualifiedHostName())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
if (newHost.isSubordinate()) {
|
if (newHost.isSubordinate()) {
|
||||||
ofy().save().entity(
|
tm().saveNewOrUpdate(
|
||||||
ofy().load().key(newHost.getSuperordinateDomain()).now()
|
tm().load(newHost.getSuperordinateDomain())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.addSubordinateHost(newHost.getFullyQualifiedHostName())
|
.addSubordinateHost(newHost.getFullyQualifiedHostName())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ import google.registry.model.registry.Registry;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
import google.registry.model.transfer.TransferStatus;
|
import google.registry.model.transfer.TransferStatus;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
|
import google.registry.persistence.WithStringVKey;
|
||||||
import google.registry.schema.replay.DatastoreAndSqlEntity;
|
import google.registry.schema.replay.DatastoreAndSqlEntity;
|
||||||
import google.registry.util.CollectionUtils;
|
import google.registry.util.CollectionUtils;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -106,6 +107,7 @@ import org.joda.time.Interval;
|
||||||
@javax.persistence.Index(columnList = "fullyQualifiedDomainName"),
|
@javax.persistence.Index(columnList = "fullyQualifiedDomainName"),
|
||||||
@javax.persistence.Index(columnList = "tld")
|
@javax.persistence.Index(columnList = "tld")
|
||||||
})
|
})
|
||||||
|
@WithStringVKey
|
||||||
@ExternalMessagingName("domain")
|
@ExternalMessagingName("domain")
|
||||||
public class DomainBase extends EppResource
|
public class DomainBase extends EppResource
|
||||||
implements DatastoreAndSqlEntity, ForeignKeyedEppResource, ResourceWithTransferData {
|
implements DatastoreAndSqlEntity, ForeignKeyedEppResource, ResourceWithTransferData {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class HostResource extends EppResource
|
||||||
@Index
|
@Index
|
||||||
@IgnoreSave(IfNull.class)
|
@IgnoreSave(IfNull.class)
|
||||||
@DoNotHydrate
|
@DoNotHydrate
|
||||||
Key<DomainBase> superordinateDomain;
|
VKey<DomainBase> superordinateDomain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time that this resource was last transferred.
|
* The time that this resource was last transferred.
|
||||||
|
@ -98,7 +98,7 @@ public class HostResource extends EppResource
|
||||||
return fullyQualifiedHostName;
|
return fullyQualifiedHostName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key<DomainBase> getSuperordinateDomain() {
|
public VKey<DomainBase> getSuperordinateDomain() {
|
||||||
return superordinateDomain;
|
return superordinateDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,18 +145,18 @@ public class HostResource extends EppResource
|
||||||
*
|
*
|
||||||
* <p>If the host is not subordinate the domain can be null and we just return last transfer time.
|
* <p>If the host is not subordinate the domain can be null and we just return last transfer time.
|
||||||
*
|
*
|
||||||
* @param superordinateDomain the loaded superordinate domain, which must match the key in
|
* @param superordinateDomain the loaded superordinate domain, which must match the key in the
|
||||||
* the {@link #superordinateDomain} field. Passing it as a parameter allows the caller to
|
* {@link #superordinateDomain} field. Passing it as a parameter allows the caller to control
|
||||||
* control the degree of consistency used to load it.
|
* the degree of consistency used to load it.
|
||||||
*/
|
*/
|
||||||
public DateTime computeLastTransferTime(@Nullable DomainBase superordinateDomain) {
|
public DateTime computeLastTransferTime(@Nullable DomainBase superordinateDomain) {
|
||||||
if (!isSubordinate()) {
|
if (!isSubordinate()) {
|
||||||
checkArgument(superordinateDomain == null);
|
checkArgument(superordinateDomain == null);
|
||||||
return getLastTransferTime();
|
return getLastTransferTime();
|
||||||
}
|
}
|
||||||
checkArgument(
|
checkArgument(
|
||||||
superordinateDomain != null
|
superordinateDomain != null
|
||||||
&& Key.create(superordinateDomain).equals(getSuperordinateDomain()));
|
&& superordinateDomain.createVKey().equals(getSuperordinateDomain()));
|
||||||
DateTime lastSuperordinateChange =
|
DateTime lastSuperordinateChange =
|
||||||
Optional.ofNullable(getLastSuperordinateChange()).orElse(getCreationTime());
|
Optional.ofNullable(getLastSuperordinateChange()).orElse(getCreationTime());
|
||||||
DateTime lastTransferOfCurrentSuperordinate =
|
DateTime lastTransferOfCurrentSuperordinate =
|
||||||
|
@ -207,7 +207,7 @@ public class HostResource extends EppResource
|
||||||
difference(getInstance().getInetAddresses(), inetAddresses)));
|
difference(getInstance().getInetAddresses(), inetAddresses)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setSuperordinateDomain(Key<DomainBase> superordinateDomain) {
|
public Builder setSuperordinateDomain(VKey<DomainBase> superordinateDomain) {
|
||||||
getInstance().superordinateDomain = superordinateDomain;
|
getInstance().superordinateDomain = superordinateDomain;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,10 +433,7 @@ public class RdapJsonFormatter {
|
||||||
statuses.add(StatusValue.LINKED);
|
statuses.add(StatusValue.LINKED);
|
||||||
}
|
}
|
||||||
if (hostResource.isSubordinate()
|
if (hostResource.isSubordinate()
|
||||||
&& ofy()
|
&& tm().load(hostResource.getSuperordinateDomain())
|
||||||
.load()
|
|
||||||
.key(hostResource.getSuperordinateDomain())
|
|
||||||
.now()
|
|
||||||
.cloneProjectedAtTime(getRequestTime())
|
.cloneProjectedAtTime(getRequestTime())
|
||||||
.getStatusValues()
|
.getStatusValues()
|
||||||
.contains(StatusValue.PENDING_TRANSFER)) {
|
.contains(StatusValue.PENDING_TRANSFER)) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.rde;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
@ -35,9 +34,8 @@ import org.joda.time.DateTime;
|
||||||
final class HostResourceToXjcConverter {
|
final class HostResourceToXjcConverter {
|
||||||
|
|
||||||
/** Converts a subordinate {@link HostResource} to {@link XjcRdeHostElement}. */
|
/** Converts a subordinate {@link HostResource} to {@link XjcRdeHostElement}. */
|
||||||
static XjcRdeHostElement convertSubordinate(
|
static XjcRdeHostElement convertSubordinate(HostResource host, DomainBase superordinateDomain) {
|
||||||
HostResource host, DomainBase superordinateDomain) {
|
checkArgument(superordinateDomain.createVKey().equals(host.getSuperordinateDomain()));
|
||||||
checkArgument(Key.create(superordinateDomain).equals(host.getSuperordinateDomain()));
|
|
||||||
return new XjcRdeHostElement(convertSubordinateHost(host, superordinateDomain));
|
return new XjcRdeHostElement(convertSubordinateHost(host, superordinateDomain));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import static com.google.common.base.Strings.nullToEmpty;
|
||||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||||
import static google.registry.model.EppResourceUtils.loadAtPointInTime;
|
import static google.registry.model.EppResourceUtils.loadAtPointInTime;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
|
||||||
import com.google.appengine.tools.mapreduce.Mapper;
|
import com.google.appengine.tools.mapreduce.Mapper;
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
|
@ -186,13 +187,16 @@ public final class RdeStagingMapper extends Mapper<EppResource, PendingDeposit,
|
||||||
return result;
|
return result;
|
||||||
} else if (resource instanceof HostResource) {
|
} else if (resource instanceof HostResource) {
|
||||||
HostResource host = (HostResource) resource;
|
HostResource host = (HostResource) resource;
|
||||||
result = Optional.of(host.isSubordinate()
|
result =
|
||||||
? marshaller.marshalSubordinateHost(
|
Optional.of(
|
||||||
host,
|
host.isSubordinate()
|
||||||
// Note that loadAtPointInTime() does cloneProjectedAtTime(watermark) for us.
|
? marshaller.marshalSubordinateHost(
|
||||||
loadAtPointInTime(
|
host,
|
||||||
ofy().load().key(host.getSuperordinateDomain()).now(), watermark).now())
|
// Note that loadAtPointInTime() does cloneProjectedAtTime(watermark) for
|
||||||
: marshaller.marshalExternalHost(host));
|
// us.
|
||||||
|
loadAtPointInTime(tm().load(host.getSuperordinateDomain()), watermark)
|
||||||
|
.now())
|
||||||
|
: marshaller.marshalExternalHost(host));
|
||||||
cache.put(WatermarkModePair.create(watermark, RdeMode.FULL), result);
|
cache.put(WatermarkModePair.create(watermark, RdeMode.FULL), result);
|
||||||
cache.put(WatermarkModePair.create(watermark, RdeMode.THIN), result);
|
cache.put(WatermarkModePair.create(watermark, RdeMode.THIN), result);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.whois;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
|
@ -49,7 +49,7 @@ final class NameserverWhoisResponse extends WhoisResponseImpl {
|
||||||
HostResource host = hosts.get(i);
|
HostResource host = hosts.get(i);
|
||||||
String clientId =
|
String clientId =
|
||||||
host.isSubordinate()
|
host.isSubordinate()
|
||||||
? ofy().load().key(host.getSuperordinateDomain()).now()
|
? tm().load(host.getSuperordinateDomain())
|
||||||
.cloneProjectedAtTime(getTimestamp())
|
.cloneProjectedAtTime(getTimestamp())
|
||||||
.getCurrentSponsorClientId()
|
.getCurrentSponsorClientId()
|
||||||
: host.getPersistedCurrentSponsorClientId();
|
: host.getPersistedCurrentSponsorClientId();
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
|
|
||||||
<!-- Generated converters for VKey -->
|
<!-- Generated converters for VKey -->
|
||||||
<class>google.registry.model.billing.VKeyConverter_BillingEvent</class>
|
<class>google.registry.model.billing.VKeyConverter_BillingEvent</class>
|
||||||
|
<class>google.registry.model.domain.VKeyConverter_DomainBase</class>
|
||||||
<class>google.registry.model.domain.token.VKeyConverter_AllocationToken</class>
|
<class>google.registry.model.domain.token.VKeyConverter_AllocationToken</class>
|
||||||
<class>google.registry.model.host.VKeyConverter_HostResource</class>
|
<class>google.registry.model.host.VKeyConverter_HostResource</class>
|
||||||
<class>google.registry.model.contact.VKeyConverter_ContactResource</class>
|
<class>google.registry.model.contact.VKeyConverter_ContactResource</class>
|
||||||
|
|
|
@ -725,7 +725,7 @@ public class DeleteContactsAndHostsActionTest
|
||||||
persistResource(
|
persistResource(
|
||||||
persistHostPendingDelete("ns2.example.tld")
|
persistHostPendingDelete("ns2.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
enqueuer.enqueueAsyncDelete(
|
enqueuer.enqueueAsyncDelete(
|
||||||
host,
|
host,
|
||||||
|
|
|
@ -24,7 +24,6 @@ import static google.registry.testing.EppMetricSubject.assertThat;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
|
@ -221,7 +220,7 @@ public class EppLifecycleHostTest extends EppTestCase {
|
||||||
loadByForeignKey(DomainBase.class, "example.bar.foo.tld", timeAfterCreates).get();
|
loadByForeignKey(DomainBase.class, "example.bar.foo.tld", timeAfterCreates).get();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(exampleBarFooTldHost)
|
.that(exampleBarFooTldHost)
|
||||||
.hasSuperordinateDomain(Key.create(exampleBarFooTldDomain));
|
.hasSuperordinateDomain(exampleBarFooTldDomain.createVKey());
|
||||||
assertThat(exampleBarFooTldDomain.getSubordinateHosts())
|
assertThat(exampleBarFooTldDomain.getSubordinateHosts())
|
||||||
.containsExactly("ns1.example.bar.foo.tld");
|
.containsExactly("ns1.example.bar.foo.tld");
|
||||||
|
|
||||||
|
@ -231,14 +230,14 @@ public class EppLifecycleHostTest extends EppTestCase {
|
||||||
loadByForeignKey(DomainBase.class, "example.foo.tld", timeAfterCreates).get();
|
loadByForeignKey(DomainBase.class, "example.foo.tld", timeAfterCreates).get();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(exampleFooTldHost)
|
.that(exampleFooTldHost)
|
||||||
.hasSuperordinateDomain(Key.create(exampleFooTldDomain));
|
.hasSuperordinateDomain(exampleFooTldDomain.createVKey());
|
||||||
assertThat(exampleFooTldDomain.getSubordinateHosts()).containsExactly("ns1.example.foo.tld");
|
assertThat(exampleFooTldDomain.getSubordinateHosts()).containsExactly("ns1.example.foo.tld");
|
||||||
|
|
||||||
HostResource exampleTldHost =
|
HostResource exampleTldHost =
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.tld", timeAfterCreates).get();
|
loadByForeignKey(HostResource.class, "ns1.example.tld", timeAfterCreates).get();
|
||||||
DomainBase exampleTldDomain =
|
DomainBase exampleTldDomain =
|
||||||
loadByForeignKey(DomainBase.class, "example.tld", timeAfterCreates).get();
|
loadByForeignKey(DomainBase.class, "example.tld", timeAfterCreates).get();
|
||||||
assertAboutHosts().that(exampleTldHost).hasSuperordinateDomain(Key.create(exampleTldDomain));
|
assertAboutHosts().that(exampleTldHost).hasSuperordinateDomain(exampleTldDomain.createVKey());
|
||||||
assertThat(exampleTldDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
assertThat(exampleTldDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
||||||
|
|
||||||
assertThatLogoutSucceeds();
|
assertThatLogoutSucceeds();
|
||||||
|
|
|
@ -719,7 +719,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1." + getUniqueIdFromCommand())
|
newHostResource("ns1." + getUniqueIdFromCommand())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(reloadResourceByForeignKey()))
|
.setSuperordinateDomain(reloadResourceByForeignKey().createVKey())
|
||||||
.setDeletionTime(clock.nowUtc().minusDays(1))
|
.setDeletionTime(clock.nowUtc().minusDays(1))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -767,7 +767,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1." + getUniqueIdFromCommand())
|
newHostResource("ns1." + getUniqueIdFromCommand())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(reloadResourceByForeignKey()))
|
.setSuperordinateDomain(reloadResourceByForeignKey().createVKey())
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
domain.asBuilder().addSubordinateHost(subordinateHost.getFullyQualifiedHostName()).build());
|
domain.asBuilder().addSubordinateHost(subordinateHost.getFullyQualifiedHostName()).build());
|
||||||
|
|
|
@ -123,14 +123,14 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
||||||
.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
|
||||||
// happened in the flow that created it, but here we just overwrite it in Datastore.
|
// happened in the flow that created it, but here we just overwrite it in Datastore.
|
||||||
host1 = persistResource(host1.asBuilder().setSuperordinateDomain(Key.create(domain)).build());
|
host1 = persistResource(host1.asBuilder().setSuperordinateDomain(domain.createVKey()).build());
|
||||||
// Create a subordinate host that is not delegated to by anyone.
|
// Create a subordinate host that is not delegated to by anyone.
|
||||||
host3 =
|
host3 =
|
||||||
persistResource(
|
persistResource(
|
||||||
new HostResource.Builder()
|
new HostResource.Builder()
|
||||||
.setFullyQualifiedHostName("ns2.example.tld")
|
.setFullyQualifiedHostName("ns2.example.tld")
|
||||||
.setRepoId("3FF-TLD")
|
.setRepoId("3FF-TLD")
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
// Add the subordinate host keys to the existing domain.
|
// Add the subordinate host keys to the existing domain.
|
||||||
domain =
|
domain =
|
||||||
|
|
|
@ -29,7 +29,6 @@ import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
|
|
||||||
import com.google.common.base.Ascii;
|
import com.google.common.base.Ascii;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.flows.Flow;
|
import google.registry.flows.Flow;
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
|
@ -116,7 +115,7 @@ public class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||||
.setPersistedCurrentSponsorClientId("TheRegistrar")
|
.setPersistedCurrentSponsorClientId("TheRegistrar")
|
||||||
.setCreationClientId("TheRegistrar")
|
.setCreationClientId("TheRegistrar")
|
||||||
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
domain =
|
domain =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
|
|
@ -389,8 +389,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
HostResource existingHost =
|
HostResource existingHost =
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()).get();
|
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()).get();
|
||||||
addedHost = loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc()).get();
|
addedHost = loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc()).get();
|
||||||
assertThat(existingHost.getSuperordinateDomain()).isEqualTo(Key.create(domain));
|
assertThat(existingHost.getSuperordinateDomain()).isEqualTo(domain.createVKey());
|
||||||
assertThat(addedHost.getSuperordinateDomain()).isEqualTo(Key.create(domain));
|
assertThat(addedHost.getSuperordinateDomain()).isEqualTo(domain.createVKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -34,7 +34,6 @@ import static org.junit.Assert.assertThrows;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
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.Key;
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowUtils.IpAddressVersionMismatchException;
|
import google.registry.flows.FlowUtils.IpAddressVersionMismatchException;
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
|
@ -119,7 +118,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
||||||
HostResource host = reloadResourceByForeignKey();
|
HostResource host = reloadResourceByForeignKey();
|
||||||
DomainBase superordinateDomain =
|
DomainBase superordinateDomain =
|
||||||
loadByForeignKey(DomainBase.class, "example.tld", clock.nowUtc()).get();
|
loadByForeignKey(DomainBase.class, "example.tld", clock.nowUtc()).get();
|
||||||
assertAboutHosts().that(host).hasSuperordinateDomain(Key.create(superordinateDomain));
|
assertAboutHosts().that(host).hasSuperordinateDomain(superordinateDomain.createVKey());
|
||||||
assertThat(superordinateDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
assertThat(superordinateDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
||||||
assertDnsTasksEnqueued("ns1.example.tld");
|
assertDnsTasksEnqueued("ns1.example.tld");
|
||||||
}
|
}
|
||||||
|
@ -148,7 +147,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
||||||
HostResource host = reloadResourceByForeignKey();
|
HostResource host = reloadResourceByForeignKey();
|
||||||
DomainBase superordinateDomain =
|
DomainBase superordinateDomain =
|
||||||
loadByForeignKey(DomainBase.class, "example.tld", clock.nowUtc()).get();
|
loadByForeignKey(DomainBase.class, "example.tld", clock.nowUtc()).get();
|
||||||
assertAboutHosts().that(host).hasSuperordinateDomain(Key.create(superordinateDomain));
|
assertAboutHosts().that(host).hasSuperordinateDomain(superordinateDomain.createVKey());
|
||||||
assertThat(superordinateDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
assertThat(superordinateDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
||||||
assertDnsTasksEnqueued("ns1.example.tld");
|
assertDnsTasksEnqueued("ns1.example.tld");
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import static org.junit.Assert.assertThrows;
|
||||||
|
|
||||||
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.Key;
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||||
|
@ -186,7 +185,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
||||||
|
@ -206,7 +205,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
|
@ -239,7 +238,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
runFlowAssertResponse(loadFile("host_delete_response.xml"));
|
||||||
|
@ -272,7 +271,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
|
|
|
@ -25,7 +25,6 @@ import static org.junit.Assert.assertThrows;
|
||||||
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.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||||
|
@ -118,7 +117,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
||||||
persistHostResource()
|
persistHostResource()
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRepoId("CEEF-FOOBAR")
|
.setRepoId("CEEF-FOOBAR")
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setLastSuperordinateChange(lastSuperordinateChange)
|
.setLastSuperordinateChange(lastSuperordinateChange)
|
||||||
.build());
|
.build());
|
||||||
assertTransactionalFlow(false);
|
assertTransactionalFlow(false);
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
.that(reloadResourceByForeignKey())
|
.that(reloadResourceByForeignKey())
|
||||||
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange())
|
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange())
|
||||||
.and()
|
.and()
|
||||||
.hasSuperordinateDomain(Key.create(domain))
|
.hasSuperordinateDomain(domain.createVKey())
|
||||||
.and()
|
.and()
|
||||||
.hasPersistedCurrentSponsorClientId("TheRegistrar")
|
.hasPersistedCurrentSponsorClientId("TheRegistrar")
|
||||||
.and()
|
.and()
|
||||||
|
@ -246,7 +246,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
.that(reloadResourceByForeignKey())
|
.that(reloadResourceByForeignKey())
|
||||||
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange())
|
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange())
|
||||||
.and()
|
.and()
|
||||||
.hasSuperordinateDomain(Key.create(domain))
|
.hasSuperordinateDomain(domain.createVKey())
|
||||||
.and()
|
.and()
|
||||||
.hasPersistedCurrentSponsorClientId("NewRegistrar")
|
.hasPersistedCurrentSponsorClientId("NewRegistrar")
|
||||||
.and()
|
.and()
|
||||||
|
@ -279,7 +279,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
HostResource renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasSuperordinateDomain(Key.create(domain))
|
.hasSuperordinateDomain(domain.createVKey())
|
||||||
.and()
|
.and()
|
||||||
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange())
|
.hasLastSuperordinateChange(oldHost.getLastSuperordinateChange())
|
||||||
.and()
|
.and()
|
||||||
|
@ -313,7 +313,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasSuperordinateDomain(Key.create(example))
|
.hasSuperordinateDomain(example.createVKey())
|
||||||
.and()
|
.and()
|
||||||
.hasLastSuperordinateChange(now)
|
.hasLastSuperordinateChange(now)
|
||||||
.and()
|
.and()
|
||||||
|
@ -350,7 +350,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasSuperordinateDomain(Key.create(tldDomain))
|
.hasSuperordinateDomain(tldDomain.createVKey())
|
||||||
.and()
|
.and()
|
||||||
.hasLastSuperordinateChange(now)
|
.hasLastSuperordinateChange(now)
|
||||||
.and()
|
.and()
|
||||||
|
@ -432,7 +432,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasSuperordinateDomain(Key.create(domain))
|
.hasSuperordinateDomain(domain.createVKey())
|
||||||
.and()
|
.and()
|
||||||
.hasLastSuperordinateChange(now)
|
.hasLastSuperordinateChange(now)
|
||||||
.and()
|
.and()
|
||||||
|
@ -514,7 +514,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(foo))
|
.setSuperordinateDomain(foo.createVKey())
|
||||||
.setLastTransferTime(null)
|
.setLastTransferTime(null)
|
||||||
.build());
|
.build());
|
||||||
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
||||||
|
@ -551,7 +551,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setLastTransferTime(clock.nowUtc().minusDays(20))
|
.setLastTransferTime(clock.nowUtc().minusDays(20))
|
||||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
||||||
.build());
|
.build());
|
||||||
|
@ -586,7 +586,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(foo))
|
.setSuperordinateDomain(foo.createVKey())
|
||||||
.setLastTransferTime(lastTransferTime)
|
.setLastTransferTime(lastTransferTime)
|
||||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
||||||
.build());
|
.build());
|
||||||
|
@ -617,7 +617,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(foo))
|
.setSuperordinateDomain(foo.createVKey())
|
||||||
.setLastTransferTime(lastTransferTime)
|
.setLastTransferTime(lastTransferTime)
|
||||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(10))
|
.setLastSuperordinateChange(clock.nowUtc().minusDays(10))
|
||||||
.build());
|
.build());
|
||||||
|
@ -649,7 +649,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(foo))
|
.setSuperordinateDomain(foo.createVKey())
|
||||||
.setLastTransferTime(null)
|
.setLastTransferTime(null)
|
||||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
||||||
.build());
|
.build());
|
||||||
|
@ -675,7 +675,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build());
|
.build());
|
||||||
DateTime lastTransferTime = clock.nowUtc().minusDays(2);
|
DateTime lastTransferTime = clock.nowUtc().minusDays(2);
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -712,7 +712,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setLastTransferTime(lastTransferTime)
|
.setLastTransferTime(lastTransferTime)
|
||||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
||||||
.build());
|
.build());
|
||||||
|
@ -747,7 +747,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setLastTransferTime(clock.nowUtc().minusDays(12))
|
.setLastTransferTime(clock.nowUtc().minusDays(12))
|
||||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
.setLastSuperordinateChange(clock.nowUtc().minusDays(4))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1017,7 +1017,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
|
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
||||||
.build());
|
.build());
|
||||||
EppException thrown =
|
EppException thrown =
|
||||||
assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
|
assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
|
||||||
|
@ -1031,7 +1031,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
|
||||||
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
|
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
||||||
.build());
|
.build());
|
||||||
ResourceStatusProhibitsOperationException thrown =
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
|
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
|
||||||
|
@ -1045,7 +1045,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
newHostResource(oldHostName())
|
newHostResource(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||||
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
|
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
||||||
.build());
|
.build());
|
||||||
ResourceStatusProhibitsOperationException thrown =
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
|
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
|
||||||
|
@ -1105,7 +1105,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -1127,7 +1127,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -1163,7 +1163,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
newHostResource("ns1.example.tld")
|
newHostResource("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -1228,7 +1228,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.foo")
|
newHostResource("ns1.example.foo")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(superordinate))
|
.setSuperordinateDomain(superordinate.createVKey())
|
||||||
.setPersistedCurrentSponsorClientId("NewRegistrar")
|
.setPersistedCurrentSponsorClientId("NewRegistrar")
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class DomainBaseTest extends EntityTestCase {
|
||||||
persistResource(
|
persistResource(
|
||||||
new HostResource.Builder()
|
new HostResource.Builder()
|
||||||
.setFullyQualifiedHostName("ns1.example.com")
|
.setFullyQualifiedHostName("ns1.example.com")
|
||||||
.setSuperordinateDomain(domainKey)
|
.setSuperordinateDomain(VKey.createOfy(DomainBase.class, domainKey))
|
||||||
.setRepoId("1-COM")
|
.setRepoId("1-COM")
|
||||||
.build())
|
.build())
|
||||||
.createVKey();
|
.createVKey();
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class HostResourceTest extends EntityTestCase {
|
||||||
.setLastTransferTime(fakeClock.nowUtc())
|
.setLastTransferTime(fakeClock.nowUtc())
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build()));
|
.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public class HostResourceTest extends EntityTestCase {
|
||||||
.setLastEppUpdateClientId("another registrar")
|
.setLastEppUpdateClientId("another registrar")
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.build()));
|
.build()));
|
||||||
assertThat(host.computeLastTransferTime(domain)).isNull();
|
assertThat(host.computeLastTransferTime(domain)).isNull();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ import com.google.common.collect.Range;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
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.Period;
|
import google.registry.model.domain.Period;
|
||||||
|
@ -81,14 +80,18 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
private HostResource hostNs2CatLol;
|
private HostResource hostNs2CatLol;
|
||||||
private HashMap<String, HostResource> hostNameToHostMap = new HashMap<>();
|
private HashMap<String, HostResource> hostNameToHostMap = new HashMap<>();
|
||||||
|
|
||||||
enum RequestType { NONE, NAME, NS_LDH_NAME, NS_IP }
|
enum RequestType {
|
||||||
|
NONE,
|
||||||
|
NAME,
|
||||||
|
NS_LDH_NAME,
|
||||||
|
NS_IP
|
||||||
|
}
|
||||||
|
|
||||||
private JsonObject generateActualJson(RequestType requestType, String paramValue) {
|
private JsonObject generateActualJson(RequestType requestType, String paramValue) {
|
||||||
return generateActualJson(requestType, paramValue, null);
|
return generateActualJson(requestType, paramValue, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JsonObject generateActualJson(
|
private JsonObject generateActualJson(RequestType requestType, String paramValue, String cursor) {
|
||||||
RequestType requestType, String paramValue, String cursor) {
|
|
||||||
action.requestPath = actionPath;
|
action.requestPath = actionPath;
|
||||||
action.requestMethod = POST;
|
action.requestMethod = POST;
|
||||||
String requestTypeParam = null;
|
String requestTypeParam = null;
|
||||||
|
@ -179,9 +182,9 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
.setCreationClientId("foo")
|
.setCreationClientId("foo")
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
hostNs1CatLol.asBuilder().setSuperordinateDomain(Key.create(domainCatLol)).build());
|
hostNs1CatLol.asBuilder().setSuperordinateDomain(domainCatLol.createVKey()).build());
|
||||||
persistResource(
|
persistResource(
|
||||||
hostNs2CatLol.asBuilder().setSuperordinateDomain(Key.create(domainCatLol)).build());
|
hostNs2CatLol.asBuilder().setSuperordinateDomain(domainCatLol.createVKey()).build());
|
||||||
|
|
||||||
domainCatLol2 =
|
domainCatLol2 =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -220,8 +223,9 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
.build());
|
.build());
|
||||||
// cat.example
|
// cat.example
|
||||||
createTld("example");
|
createTld("example");
|
||||||
registrar = persistResource(
|
registrar =
|
||||||
makeRegistrar("goodregistrar", "St. John Chrysostom", Registrar.State.ACTIVE));
|
persistResource(
|
||||||
|
makeRegistrar("goodregistrar", "St. John Chrysostom", Registrar.State.ACTIVE));
|
||||||
persistSimpleResources(makeRegistrarContacts(registrar));
|
persistSimpleResources(makeRegistrarContacts(registrar));
|
||||||
domainCatExample =
|
domainCatExample =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -297,8 +301,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
.build());
|
.build());
|
||||||
// cat.1.test
|
// cat.1.test
|
||||||
createTld("1.test");
|
createTld("1.test");
|
||||||
registrar =
|
registrar = persistResource(makeRegistrar("multiregistrar", "1.test", Registrar.State.ACTIVE));
|
||||||
persistResource(makeRegistrar("multiregistrar", "1.test", Registrar.State.ACTIVE));
|
|
||||||
persistSimpleResources(makeRegistrarContacts(registrar));
|
persistSimpleResources(makeRegistrarContacts(registrar));
|
||||||
domainMultipart =
|
domainMultipart =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -395,10 +398,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
|
|
||||||
private void deleteCatLol() {
|
private void deleteCatLol() {
|
||||||
persistResource(
|
persistResource(
|
||||||
domainCatLol
|
domainCatLol.asBuilder().setDeletionTime(clock.nowUtc().minusMonths(6)).build());
|
||||||
.asBuilder()
|
|
||||||
.setDeletionTime(clock.nowUtc().minusMonths(6))
|
|
||||||
.build());
|
|
||||||
persistResource(
|
persistResource(
|
||||||
makeHistoryEntry(
|
makeHistoryEntry(
|
||||||
domainCatLol,
|
domainCatLol,
|
||||||
|
@ -416,8 +416,11 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
for (int i = numHosts; i >= 1; i--) {
|
for (int i = numHosts; i >= 1; i--) {
|
||||||
String hostName = String.format("ns%d.%s", i, mainDomainName);
|
String hostName = String.format("ns%d.%s", i, mainDomainName);
|
||||||
subordinateHostnamesBuilder.add(hostName);
|
subordinateHostnamesBuilder.add(hostName);
|
||||||
HostResource host = makeAndPersistHostResource(
|
HostResource host =
|
||||||
hostName, String.format("5.5.%d.%d", 5 + i / 250, i % 250), clock.nowUtc().minusYears(1));
|
makeAndPersistHostResource(
|
||||||
|
hostName,
|
||||||
|
String.format("5.5.%d.%d", 5 + i / 250, i % 250),
|
||||||
|
clock.nowUtc().minusYears(1));
|
||||||
hostKeysBuilder.add(host.createVKey());
|
hostKeysBuilder.add(host.createVKey());
|
||||||
}
|
}
|
||||||
ImmutableSet<VKey<HostResource>> hostKeys = hostKeysBuilder.build();
|
ImmutableSet<VKey<HostResource>> hostKeys = hostKeysBuilder.build();
|
||||||
|
@ -533,8 +536,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
assertThat(response.getStatus()).isEqualTo(200);
|
assertThat(response.getStatus()).isEqualTo(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runNotFoundTest(
|
private void runNotFoundTest(RequestType requestType, String queryString, String errorMessage) {
|
||||||
RequestType requestType, String queryString, String errorMessage) {
|
|
||||||
rememberWildcardType(queryString);
|
rememberWildcardType(queryString);
|
||||||
assertThat(generateActualJson(requestType, queryString))
|
assertThat(generateActualJson(requestType, queryString))
|
||||||
.isEqualTo(generateExpectedJsonError(errorMessage, 404));
|
.isEqualTo(generateExpectedJsonError(errorMessage, 404));
|
||||||
|
@ -654,9 +656,9 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidRequest_rejected() {
|
public void testInvalidRequest_rejected() {
|
||||||
assertThat(generateActualJson(RequestType.NONE, null))
|
assertThat(generateActualJson(RequestType.NONE, null))
|
||||||
.isEqualTo(generateExpectedJsonError(
|
.isEqualTo(
|
||||||
"You must specify either name=XXXX, nsLdhName=YYYY or nsIp=ZZZZ",
|
generateExpectedJsonError(
|
||||||
400));
|
"You must specify either name=XXXX, nsLdhName=YYYY or nsIp=ZZZZ", 400));
|
||||||
assertThat(response.getStatus()).isEqualTo(400);
|
assertThat(response.getStatus()).isEqualTo(400);
|
||||||
verifyErrorMetrics(SearchType.NONE, Optional.empty(), 400);
|
verifyErrorMetrics(SearchType.NONE, Optional.empty(), 400);
|
||||||
}
|
}
|
||||||
|
@ -1233,7 +1235,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
login("evilregistrar");
|
login("evilregistrar");
|
||||||
runSuccessfulTestWithCatLol(RequestType.NS_LDH_NAME, "ns2.cat.l*", "rdap_domain.json");
|
runSuccessfulTestWithCatLol(RequestType.NS_LDH_NAME, "ns2.cat.l*", "rdap_domain.json");
|
||||||
verifyMetrics(SearchType.BY_NAMESERVER_NAME, 1, 1);
|
verifyMetrics(SearchType.BY_NAMESERVER_NAME, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNameserverMatchWithWildcard_found_sameRegistrarRequested() {
|
public void testNameserverMatchWithWildcard_found_sameRegistrarRequested() {
|
||||||
|
@ -1458,24 +1460,21 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDom
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNameserverMatchDeletedNameserver_notFound() {
|
public void testNameserverMatchDeletedNameserver_notFound() {
|
||||||
persistResource(
|
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
|
||||||
runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.lol", "No matching nameservers found");
|
runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.lol", "No matching nameservers found");
|
||||||
verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404);
|
verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNameserverMatchDeletedNameserverWithWildcard_notFound() {
|
public void testNameserverMatchDeletedNameserverWithWildcard_notFound() {
|
||||||
persistResource(
|
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
|
||||||
runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.l*", "No matching nameservers found");
|
runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.l*", "No matching nameservers found");
|
||||||
verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404);
|
verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNameserverMatchDeletedNameserverWithWildcardAndSuffix_notFound() {
|
public void testNameserverMatchDeletedNameserverWithWildcardAndSuffix_notFound() {
|
||||||
persistResource(
|
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
|
||||||
runNotFoundTest(RequestType.NS_LDH_NAME, "ns1*.cat.lol", "No matching nameservers found");
|
runNotFoundTest(RequestType.NS_LDH_NAME, "ns1*.cat.lol", "No matching nameservers found");
|
||||||
verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404);
|
verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
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.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -159,8 +158,7 @@ public class RdapJsonFormatterTest {
|
||||||
"ns1.dog.みんな", null, null, clock.nowUtc().minusYears(6), "unicoderegistrar")
|
"ns1.dog.みんな", null, null, clock.nowUtc().minusYears(6), "unicoderegistrar")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(
|
.setSuperordinateDomain(
|
||||||
Key.create(
|
persistResource(
|
||||||
persistResource(
|
|
||||||
makeDomainBase(
|
makeDomainBase(
|
||||||
"dog.みんな",
|
"dog.みんな",
|
||||||
contactResourceRegistrant,
|
contactResourceRegistrant,
|
||||||
|
@ -182,7 +180,8 @@ public class RdapJsonFormatterTest {
|
||||||
.setTransferredRegistrationExpirationTime(
|
.setTransferredRegistrationExpirationTime(
|
||||||
DateTime.parse("2111-10-08T00:44:59Z"))
|
DateTime.parse("2111-10-08T00:44:59Z"))
|
||||||
.build())
|
.build())
|
||||||
.build())))
|
.build())
|
||||||
|
.createVKey())
|
||||||
.build());
|
.build());
|
||||||
domainBaseFull =
|
domainBaseFull =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
|
|
@ -36,7 +36,6 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
|
@ -111,10 +110,11 @@ public class RdapNameserverSearchActionTest
|
||||||
persistResource(
|
persistResource(
|
||||||
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
|
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
|
||||||
persistSimpleResources(makeRegistrarContacts(registrar));
|
persistSimpleResources(makeRegistrarContacts(registrar));
|
||||||
hostNs1CatLol = makeAndPersistHostResource(
|
hostNs1CatLol =
|
||||||
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
|
makeAndPersistHostResource("ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
|
||||||
hostNs2CatLol = makeAndPersistHostResource(
|
hostNs2CatLol =
|
||||||
"ns2.cat.lol", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
|
makeAndPersistHostResource(
|
||||||
|
"ns2.cat.lol", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
|
||||||
makeAndPersistHostResource(
|
makeAndPersistHostResource(
|
||||||
"ns1.cat2.lol", "1.2.3.3", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
|
"ns1.cat2.lol", "1.2.3.3", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
|
||||||
makeAndPersistHostResource("ns1.cat.external", null, null, clock.nowUtc().minusYears(1));
|
makeAndPersistHostResource("ns1.cat.external", null, null, clock.nowUtc().minusYears(1));
|
||||||
|
@ -132,25 +132,28 @@ public class RdapNameserverSearchActionTest
|
||||||
makeAndPersistHostResource("ns1.cat.1.test", "1.2.3.6", clock.nowUtc().minusYears(1));
|
makeAndPersistHostResource("ns1.cat.1.test", "1.2.3.6", clock.nowUtc().minusYears(1));
|
||||||
|
|
||||||
// create a domain so that we can use it as a test nameserver search string suffix
|
// create a domain so that we can use it as a test nameserver search string suffix
|
||||||
domainCatLol = persistResource(
|
domainCatLol =
|
||||||
makeDomainBase(
|
persistResource(
|
||||||
"cat.lol",
|
makeDomainBase(
|
||||||
persistResource(
|
"cat.lol",
|
||||||
makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol", registrar)),
|
persistResource(
|
||||||
persistResource(
|
makeContactResource(
|
||||||
makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol", registrar)),
|
"5372808-ERL", "Goblin Market", "lol@cat.lol", registrar)),
|
||||||
persistResource(
|
persistResource(
|
||||||
makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol", registrar)),
|
makeContactResource(
|
||||||
hostNs1CatLol,
|
"5372808-IRL", "Santa Claus", "BOFH@cat.lol", registrar)),
|
||||||
hostNs2CatLol,
|
persistResource(
|
||||||
registrar)
|
makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol", registrar)),
|
||||||
.asBuilder()
|
hostNs1CatLol,
|
||||||
.setSubordinateHosts(ImmutableSet.of("ns1.cat.lol", "ns2.cat.lol"))
|
hostNs2CatLol,
|
||||||
.build());
|
registrar)
|
||||||
|
.asBuilder()
|
||||||
|
.setSubordinateHosts(ImmutableSet.of("ns1.cat.lol", "ns2.cat.lol"))
|
||||||
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
hostNs1CatLol.asBuilder().setSuperordinateDomain(Key.create(domainCatLol)).build());
|
hostNs1CatLol.asBuilder().setSuperordinateDomain(domainCatLol.createVKey()).build());
|
||||||
persistResource(
|
persistResource(
|
||||||
hostNs2CatLol.asBuilder().setSuperordinateDomain(Key.create(domainCatLol)).build());
|
hostNs2CatLol.asBuilder().setSuperordinateDomain(domainCatLol.createVKey()).build());
|
||||||
|
|
||||||
action.ipParam = Optional.empty();
|
action.ipParam = Optional.empty();
|
||||||
action.nameParam = Optional.empty();
|
action.nameParam = Optional.empty();
|
||||||
|
@ -187,10 +190,9 @@ public class RdapNameserverSearchActionTest
|
||||||
hostsBuilder.add(makeHostResource(hostName, "5.5.5.1", "5.5.5.2"));
|
hostsBuilder.add(makeHostResource(hostName, "5.5.5.1", "5.5.5.2"));
|
||||||
}
|
}
|
||||||
persistResources(hostsBuilder.build());
|
persistResources(hostsBuilder.build());
|
||||||
domainCatLol = persistResource(
|
domainCatLol =
|
||||||
domainCatLol.asBuilder()
|
persistResource(
|
||||||
.setSubordinateHosts(subordinateHostsBuilder.build())
|
domainCatLol.asBuilder().setSubordinateHosts(subordinateHostsBuilder.build()).build());
|
||||||
.build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDeletedHost() {
|
private void createDeletedHost() {
|
||||||
|
@ -245,10 +247,7 @@ public class RdapNameserverSearchActionTest
|
||||||
public void testInvalidRequest_rejected() {
|
public void testInvalidRequest_rejected() {
|
||||||
action.run();
|
action.run();
|
||||||
assertThat(parseJsonObject(response.getPayload()))
|
assertThat(parseJsonObject(response.getPayload()))
|
||||||
.isEqualTo(
|
.isEqualTo(generateExpectedJsonError("You must specify either name=XXXX or ip=YYYY", 400));
|
||||||
generateExpectedJsonError(
|
|
||||||
"You must specify either name=XXXX or ip=YYYY",
|
|
||||||
400));
|
|
||||||
assertThat(response.getStatus()).isEqualTo(400);
|
assertThat(response.getStatus()).isEqualTo(400);
|
||||||
verifyErrorMetrics(Optional.empty(), 400);
|
verifyErrorMetrics(Optional.empty(), 400);
|
||||||
}
|
}
|
||||||
|
@ -294,8 +293,7 @@ public class RdapNameserverSearchActionTest
|
||||||
public void testNoCharactersToMatch_rejected() {
|
public void testNoCharactersToMatch_rejected() {
|
||||||
assertThat(generateActualJsonWithName("*"))
|
assertThat(generateActualJsonWithName("*"))
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
generateExpectedJsonError(
|
generateExpectedJsonError("Initial search string must be at least 2 characters", 422));
|
||||||
"Initial search string must be at least 2 characters", 422));
|
|
||||||
assertThat(response.getStatus()).isEqualTo(422);
|
assertThat(response.getStatus()).isEqualTo(422);
|
||||||
verifyErrorMetrics(Optional.empty(), 422);
|
verifyErrorMetrics(Optional.empty(), 422);
|
||||||
}
|
}
|
||||||
|
@ -304,8 +302,7 @@ public class RdapNameserverSearchActionTest
|
||||||
public void testFewerThanTwoCharactersToMatch_rejected() {
|
public void testFewerThanTwoCharactersToMatch_rejected() {
|
||||||
assertThat(generateActualJsonWithName("a*"))
|
assertThat(generateActualJsonWithName("a*"))
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
generateExpectedJsonError(
|
generateExpectedJsonError("Initial search string must be at least 2 characters", 422));
|
||||||
"Initial search string must be at least 2 characters", 422));
|
|
||||||
assertThat(response.getStatus()).isEqualTo(422);
|
assertThat(response.getStatus()).isEqualTo(422);
|
||||||
verifyErrorMetrics(Optional.empty(), 422);
|
verifyErrorMetrics(Optional.empty(), 422);
|
||||||
}
|
}
|
||||||
|
@ -349,7 +346,8 @@ public class RdapNameserverSearchActionTest
|
||||||
@Test
|
@Test
|
||||||
public void testNameMatch_ns2_cat_lol_found() {
|
public void testNameMatch_ns2_cat_lol_found() {
|
||||||
assertThat(generateActualJsonWithName("ns2.cat.lol"))
|
assertThat(generateActualJsonWithName("ns2.cat.lol"))
|
||||||
.isEqualTo(generateExpectedJsonForNameserver(
|
.isEqualTo(
|
||||||
|
generateExpectedJsonForNameserver(
|
||||||
"ns2.cat.lol",
|
"ns2.cat.lol",
|
||||||
null,
|
null,
|
||||||
"4-ROID",
|
"4-ROID",
|
||||||
|
@ -505,7 +503,7 @@ public class RdapNameserverSearchActionTest
|
||||||
public void testNameMatch_nontruncatedResultSet() {
|
public void testNameMatch_nontruncatedResultSet() {
|
||||||
createManyHosts(4);
|
createManyHosts(4);
|
||||||
assertThat(generateActualJsonWithName("nsx*.cat.lol"))
|
assertThat(generateActualJsonWithName("nsx*.cat.lol"))
|
||||||
.isEqualTo(loadJsonFile("rdap_nontruncated_hosts.json"));
|
.isEqualTo(loadJsonFile("rdap_nontruncated_hosts.json"));
|
||||||
assertThat(response.getStatus()).isEqualTo(200);
|
assertThat(response.getStatus()).isEqualTo(200);
|
||||||
verifyMetrics(4);
|
verifyMetrics(4);
|
||||||
}
|
}
|
||||||
|
@ -535,8 +533,7 @@ public class RdapNameserverSearchActionTest
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNameMatchDeletedHost_foundTheOtherHost() {
|
public void testNameMatchDeletedHost_foundTheOtherHost() {
|
||||||
persistResource(
|
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
|
||||||
assertThat(generateActualJsonWithName("ns*.cat.lol"))
|
assertThat(generateActualJsonWithName("ns*.cat.lol"))
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
generateExpectedJsonForNameserver(
|
generateExpectedJsonForNameserver(
|
||||||
|
@ -648,8 +645,7 @@ public class RdapNameserverSearchActionTest
|
||||||
* @param expectedNames an immutable list of the host names we expect to retrieve
|
* @param expectedNames an immutable list of the host names we expect to retrieve
|
||||||
*/
|
*/
|
||||||
private void checkCursorNavigation(
|
private void checkCursorNavigation(
|
||||||
boolean byName, String paramValue, ImmutableList<String> expectedNames)
|
boolean byName, String paramValue, ImmutableList<String> expectedNames) throws Exception {
|
||||||
throws Exception {
|
|
||||||
String cursor = null;
|
String cursor = null;
|
||||||
int expectedNameOffset = 0;
|
int expectedNameOffset = 0;
|
||||||
int expectedPageCount =
|
int expectedPageCount =
|
||||||
|
@ -792,9 +788,9 @@ public class RdapNameserverSearchActionTest
|
||||||
public void testAddressMatch_truncatedResultSet() {
|
public void testAddressMatch_truncatedResultSet() {
|
||||||
createManyHosts(5);
|
createManyHosts(5);
|
||||||
assertThat(generateActualJsonWithIp("5.5.5.1"))
|
assertThat(generateActualJsonWithIp("5.5.5.1"))
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
loadJsonFile(
|
loadJsonFile(
|
||||||
"rdap_truncated_hosts.json", "QUERY", "ip=5.5.5.1&cursor=MTctUk9JRA%3D%3D"));
|
"rdap_truncated_hosts.json", "QUERY", "ip=5.5.5.1&cursor=MTctUk9JRA%3D%3D"));
|
||||||
assertThat(response.getStatus()).isEqualTo(200);
|
assertThat(response.getStatus()).isEqualTo(200);
|
||||||
verifyMetrics(5, IncompletenessWarningType.TRUNCATED);
|
verifyMetrics(5, IncompletenessWarningType.TRUNCATED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import static org.junit.Assert.assertThrows;
|
||||||
|
|
||||||
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.Key;
|
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
@ -43,8 +42,8 @@ import org.junit.runners.JUnit4;
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link HostResourceToXjcConverter}.
|
* Unit tests for {@link HostResourceToXjcConverter}.
|
||||||
*
|
*
|
||||||
* <p>This tests the mapping between {@link HostResource} and {@link XjcRdeHost} as well as
|
* <p>This tests the mapping between {@link HostResource} and {@link XjcRdeHost} as well as some
|
||||||
* some exceptional conditions.
|
* exceptional conditions.
|
||||||
*/
|
*/
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class HostResourceToXjcConverterTest {
|
public class HostResourceToXjcConverterTest {
|
||||||
|
@ -59,26 +58,29 @@ public class HostResourceToXjcConverterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConvertSubordinateHost() {
|
public void testConvertSubordinateHost() {
|
||||||
DomainBase domain = newDomainBase("love.foobar").asBuilder()
|
DomainBase domain =
|
||||||
.setPersistedCurrentSponsorClientId("LeisureDog")
|
newDomainBase("love.foobar")
|
||||||
.setLastTransferTime(DateTime.parse("2010-01-01T00:00:00Z"))
|
.asBuilder()
|
||||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
.setPersistedCurrentSponsorClientId("LeisureDog")
|
||||||
.build();
|
.setLastTransferTime(DateTime.parse("2010-01-01T00:00:00Z"))
|
||||||
XjcRdeHost bean = HostResourceToXjcConverter.convertSubordinateHost(
|
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||||
new HostResource.Builder()
|
.build();
|
||||||
.setCreationClientId("LawyerCat")
|
XjcRdeHost bean =
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
HostResourceToXjcConverter.convertSubordinateHost(
|
||||||
.setPersistedCurrentSponsorClientId("BusinessCat")
|
new HostResource.Builder()
|
||||||
.setFullyQualifiedHostName("ns1.love.foobar")
|
.setCreationClientId("LawyerCat")
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
.setPersistedCurrentSponsorClientId("BusinessCat")
|
||||||
.setLastEppUpdateClientId("CeilingCat")
|
.setFullyQualifiedHostName("ns1.love.foobar")
|
||||||
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.setRepoId("2-roid")
|
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
.setLastEppUpdateClientId("CeilingCat")
|
||||||
.setSuperordinateDomain(Key.create(domain))
|
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
||||||
.build(),
|
.setRepoId("2-roid")
|
||||||
domain);
|
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||||
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
.build(),
|
||||||
|
domain);
|
||||||
|
|
||||||
assertThat(bean.getAddrs()).hasSize(1);
|
assertThat(bean.getAddrs()).hasSize(1);
|
||||||
assertThat(bean.getAddrs().get(0).getIp().value()).isEqualTo("v4");
|
assertThat(bean.getAddrs().get(0).getIp().value()).isEqualTo("v4");
|
||||||
|
@ -119,19 +121,20 @@ public class HostResourceToXjcConverterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConvertExternalHost() {
|
public void testConvertExternalHost() {
|
||||||
XjcRdeHost bean = HostResourceToXjcConverter.convertExternalHost(
|
XjcRdeHost bean =
|
||||||
new HostResource.Builder()
|
HostResourceToXjcConverter.convertExternalHost(
|
||||||
.setCreationClientId("LawyerCat")
|
new HostResource.Builder()
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationClientId("LawyerCat")
|
||||||
.setPersistedCurrentSponsorClientId("BusinessCat")
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setFullyQualifiedHostName("ns1.love.lol")
|
.setPersistedCurrentSponsorClientId("BusinessCat")
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setFullyQualifiedHostName("ns1.love.lol")
|
||||||
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.setLastEppUpdateClientId("CeilingCat")
|
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
||||||
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
.setLastEppUpdateClientId("CeilingCat")
|
||||||
.setRepoId("2-roid")
|
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
.setRepoId("2-roid")
|
||||||
.build());
|
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||||
|
.build());
|
||||||
|
|
||||||
assertThat(bean.getAddrs()).hasSize(1);
|
assertThat(bean.getAddrs()).hasSize(1);
|
||||||
assertThat(bean.getAddrs().get(0).getIp().value()).isEqualTo("v4");
|
assertThat(bean.getAddrs().get(0).getIp().value()).isEqualTo("v4");
|
||||||
|
@ -167,19 +170,20 @@ public class HostResourceToXjcConverterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConvertExternalHost_ipv6() {
|
public void testConvertExternalHost_ipv6() {
|
||||||
XjcRdeHost bean = HostResourceToXjcConverter.convertExternalHost(
|
XjcRdeHost bean =
|
||||||
new HostResource.Builder()
|
HostResourceToXjcConverter.convertExternalHost(
|
||||||
.setCreationClientId("LawyerCat")
|
new HostResource.Builder()
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationClientId("LawyerCat")
|
||||||
.setPersistedCurrentSponsorClientId("BusinessCat")
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setFullyQualifiedHostName("ns1.love.lol")
|
.setPersistedCurrentSponsorClientId("BusinessCat")
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("cafe::abba")))
|
.setFullyQualifiedHostName("ns1.love.lol")
|
||||||
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("cafe::abba")))
|
||||||
.setLastEppUpdateClientId("CeilingCat")
|
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
||||||
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
.setLastEppUpdateClientId("CeilingCat")
|
||||||
.setRepoId("2-LOL")
|
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
.setRepoId("2-LOL")
|
||||||
.build());
|
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||||
|
.build());
|
||||||
assertThat(bean.getAddrs()).hasSize(1);
|
assertThat(bean.getAddrs()).hasSize(1);
|
||||||
assertThat(bean.getAddrs().get(0).getIp().value()).isEqualTo("v6");
|
assertThat(bean.getAddrs().get(0).getIp().value()).isEqualTo("v6");
|
||||||
assertThat(bean.getAddrs().get(0).getValue()).isEqualTo("cafe::abba");
|
assertThat(bean.getAddrs().get(0).getValue()).isEqualTo("cafe::abba");
|
||||||
|
@ -208,19 +212,20 @@ public class HostResourceToXjcConverterTest {
|
||||||
@Test
|
@Test
|
||||||
public void testMarshal() throws Exception {
|
public void testMarshal() throws Exception {
|
||||||
// Bean! Bean! Bean!
|
// Bean! Bean! Bean!
|
||||||
XjcRdeHostElement bean = HostResourceToXjcConverter.convertExternal(
|
XjcRdeHostElement bean =
|
||||||
new HostResource.Builder()
|
HostResourceToXjcConverter.convertExternal(
|
||||||
.setCreationClientId("LawyerCat")
|
new HostResource.Builder()
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationClientId("LawyerCat")
|
||||||
.setPersistedCurrentSponsorClientId("BusinessCat")
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setFullyQualifiedHostName("ns1.love.lol")
|
.setPersistedCurrentSponsorClientId("BusinessCat")
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("cafe::abba")))
|
.setFullyQualifiedHostName("ns1.love.lol")
|
||||||
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("cafe::abba")))
|
||||||
.setLastEppUpdateClientId("CeilingCat")
|
.setLastTransferTime(DateTime.parse("1910-01-01T00:00:00Z"))
|
||||||
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
.setLastEppUpdateClientId("CeilingCat")
|
||||||
.setRepoId("2-LOL")
|
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
.setRepoId("2-LOL")
|
||||||
.build());
|
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||||
|
.build());
|
||||||
marshalStrict(bean, new ByteArrayOutputStream(), UTF_8);
|
marshalStrict(bean, new ByteArrayOutputStream(), UTF_8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ abstract class AbstractEppResourceSubject<
|
||||||
return andChainer();
|
return andChainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <E> And<S> hasValue(E expected, E actual, String name) {
|
protected <E> And<S> hasValue(@Nullable E expected, @Nullable E actual, String name) {
|
||||||
check(name).that(actual).isEqualTo(expected);
|
check(name).that(actual).isEqualTo(expected);
|
||||||
return andChainer();
|
return andChainer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ public class DatastoreHelper {
|
||||||
return persistResource(
|
return persistResource(
|
||||||
newHostResource(hostName)
|
newHostResource(hostName)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(Key.create(superordinateDomain))
|
.setSuperordinateDomain(superordinateDomain.createVKey())
|
||||||
.setInetAddresses(
|
.setInetAddresses(
|
||||||
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
ImmutableSet.of(InetAddresses.forString("1080:0:0:0:8:800:200C:417A")))
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -19,10 +19,11 @@ import static com.google.common.truth.Truth.assertAbout;
|
||||||
|
|
||||||
import com.google.common.truth.FailureMetadata;
|
import com.google.common.truth.FailureMetadata;
|
||||||
import com.google.common.truth.SimpleSubjectBuilder;
|
import com.google.common.truth.SimpleSubjectBuilder;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.testing.TruthChainer.And;
|
import google.registry.testing.TruthChainer.And;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
/** Truth subject for asserting things about {@link HostResource} instances. */
|
/** Truth subject for asserting things about {@link HostResource} instances. */
|
||||||
|
@ -55,7 +56,8 @@ public final class HostResourceSubject
|
||||||
"has lastSuperordinateChange");
|
"has lastSuperordinateChange");
|
||||||
}
|
}
|
||||||
|
|
||||||
public And<HostResourceSubject> hasSuperordinateDomain(Key<DomainBase> superordinateDomain) {
|
public And<HostResourceSubject> hasSuperordinateDomain(
|
||||||
|
@Nullable VKey<DomainBase> superordinateDomain) {
|
||||||
return hasValue(
|
return hasValue(
|
||||||
superordinateDomain, actual.getSuperordinateDomain(), "has superordinateDomain");
|
superordinateDomain, actual.getSuperordinateDomain(), "has superordinateDomain");
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,9 +288,9 @@ class google.registry.model.eppcommon.Trid {
|
||||||
class google.registry.model.host.HostResource {
|
class google.registry.model.host.HostResource {
|
||||||
@Id java.lang.String repoId;
|
@Id java.lang.String repoId;
|
||||||
com.google.common.collect.ImmutableSortedMap<org.joda.time.DateTime, com.googlecode.objectify.Key<google.registry.model.ofy.CommitLogManifest>> revisions;
|
com.google.common.collect.ImmutableSortedMap<org.joda.time.DateTime, com.googlecode.objectify.Key<google.registry.model.ofy.CommitLogManifest>> revisions;
|
||||||
com.googlecode.objectify.Key<google.registry.model.domain.DomainBase> superordinateDomain;
|
|
||||||
google.registry.model.CreateAutoTimestamp creationTime;
|
google.registry.model.CreateAutoTimestamp creationTime;
|
||||||
google.registry.model.UpdateAutoTimestamp updateTimestamp;
|
google.registry.model.UpdateAutoTimestamp updateTimestamp;
|
||||||
|
google.registry.persistence.VKey<google.registry.model.domain.DomainBase> superordinateDomain;
|
||||||
java.lang.String creationClientId;
|
java.lang.String creationClientId;
|
||||||
java.lang.String currentSponsorClientId;
|
java.lang.String currentSponsorClientId;
|
||||||
java.lang.String fullyQualifiedHostName;
|
java.lang.String fullyQualifiedHostName;
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
-- Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
||||||
|
--
|
||||||
|
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
-- you may not use this file except in compliance with the License.
|
||||||
|
-- You may obtain a copy of the License at
|
||||||
|
--
|
||||||
|
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
--
|
||||||
|
-- Unless required by applicable law or agreed to in writing, software
|
||||||
|
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
-- See the License for the specific language governing permissions and
|
||||||
|
-- limitations under the License.
|
||||||
|
|
||||||
|
ALTER TABLE "HostResource" ALTER COLUMN superordinate_domain TYPE text;
|
||||||
|
|
||||||
|
ALTER TABLE IF EXISTS "HostResource"
|
||||||
|
ADD CONSTRAINT fk_host_resource_superordinate_domain
|
||||||
|
FOREIGN KEY (superordinate_domain) REFERENCES "Domain"(repo_id);
|
|
@ -195,7 +195,7 @@
|
||||||
fully_qualified_host_name text,
|
fully_qualified_host_name text,
|
||||||
last_superordinate_change timestamptz,
|
last_superordinate_change timestamptz,
|
||||||
last_transfer_time timestamptz,
|
last_transfer_time timestamptz,
|
||||||
superordinate_domain bytea,
|
superordinate_domain text,
|
||||||
primary key (repo_id)
|
primary key (repo_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ CREATE TABLE public."HostResource" (
|
||||||
fully_qualified_host_name text,
|
fully_qualified_host_name text,
|
||||||
last_superordinate_change timestamp with time zone,
|
last_superordinate_change timestamp with time zone,
|
||||||
last_transfer_time timestamp with time zone,
|
last_transfer_time timestamp with time zone,
|
||||||
superordinate_domain bytea
|
superordinate_domain text
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1167,6 +1167,14 @@ ALTER TABLE ONLY public."DomainHost"
|
||||||
ADD CONSTRAINT fk_domainhost_host_valid FOREIGN KEY (ns_hosts) REFERENCES public."HostResource"(repo_id);
|
ADD CONSTRAINT fk_domainhost_host_valid FOREIGN KEY (ns_hosts) REFERENCES public."HostResource"(repo_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: HostResource fk_host_resource_superordinate_domain; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public."HostResource"
|
||||||
|
ADD CONSTRAINT fk_host_resource_superordinate_domain FOREIGN KEY (superordinate_domain) REFERENCES public."Domain"(repo_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: PollMessage fk_poll_message_contact_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
|
-- Name: PollMessage fk_poll_message_contact_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
|
Loading…
Add table
Reference in a new issue