mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
parent
4399067ddd
commit
a12a716806
119 changed files with 985 additions and 1032 deletions
|
@ -29,7 +29,7 @@ import com.google.common.flogger.FluentLogger;
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.request.Action.Service;
|
import google.registry.request.Action.Service;
|
||||||
import google.registry.util.CloudTasksUtils;
|
import google.registry.util.CloudTasksUtils;
|
||||||
|
@ -140,8 +140,8 @@ public final class AsyncTaskEnqueuer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Enqueues a task to asynchronously refresh DNS for a renamed host. */
|
/** Enqueues a task to asynchronously refresh DNS for a renamed host. */
|
||||||
public void enqueueAsyncDnsRefresh(HostResource host, DateTime now) {
|
public void enqueueAsyncDnsRefresh(Host host, DateTime now) {
|
||||||
VKey<HostResource> hostKey = host.createVKey();
|
VKey<Host> hostKey = host.createVKey();
|
||||||
logger.atInfo().log("Enqueuing async DNS refresh for renamed host %s.", hostKey);
|
logger.atInfo().log("Enqueuing async DNS refresh for renamed host %s.", hostKey);
|
||||||
addTaskToQueueWithRetry(
|
addTaskToQueueWithRetry(
|
||||||
asyncDnsRefreshPullQueue,
|
asyncDnsRefreshPullQueue,
|
||||||
|
|
|
@ -31,7 +31,7 @@ import google.registry.model.EppResource;
|
||||||
import google.registry.model.EppResourceUtils;
|
import google.registry.model.EppResourceUtils;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.reporting.HistoryEntryDao;
|
import google.registry.model.reporting.HistoryEntryDao;
|
||||||
|
@ -43,8 +43,8 @@ import google.registry.util.Clock;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hard deletes load-test ContactResources, HostResources, their subordinate history entries, and
|
* Hard deletes load-test ContactResources, Hosts, their subordinate history entries, and the
|
||||||
* the associated ForeignKey and EppResourceIndex entities.
|
* associated ForeignKey and EppResourceIndex entities.
|
||||||
*
|
*
|
||||||
* <p>This only deletes contacts and hosts, NOT domains. To delete domains, use {@link
|
* <p>This only deletes contacts and hosts, NOT domains. To delete domains, use {@link
|
||||||
* DeleteProberDataAction} and pass it the TLD(s) that the load test domains were created on. Note
|
* DeleteProberDataAction} and pass it the TLD(s) that the load test domains were created on. Note
|
||||||
|
@ -93,7 +93,7 @@ public class DeleteLoadTestDataAction implements Runnable {
|
||||||
() -> {
|
() -> {
|
||||||
LOAD_TEST_REGISTRARS.forEach(this::deletePollMessages);
|
LOAD_TEST_REGISTRARS.forEach(this::deletePollMessages);
|
||||||
tm().loadAllOfStream(ContactResource.class).forEach(this::deleteContact);
|
tm().loadAllOfStream(ContactResource.class).forEach(this::deleteContact);
|
||||||
tm().loadAllOfStream(HostResource.class).forEach(this::deleteHost);
|
tm().loadAllOfStream(Host.class).forEach(this::deleteHost);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +123,11 @@ public class DeleteLoadTestDataAction implements Runnable {
|
||||||
deleteResource(contact);
|
deleteResource(contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteHost(HostResource host) {
|
private void deleteHost(Host host) {
|
||||||
if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorRegistrarId())) {
|
if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorRegistrarId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VKey<HostResource> hostVKey = host.createVKey();
|
VKey<Host> hostVKey = host.createVKey();
|
||||||
// We can remove hosts from linked domains, so we should do so then delete the hosts
|
// We can remove hosts from linked domains, so we should do so then delete the hosts
|
||||||
ImmutableSet<VKey<Domain>> linkedDomains =
|
ImmutableSet<VKey<Domain>> linkedDomains =
|
||||||
EppResourceUtils.getLinkedDomainKeys(hostVKey, clock.nowUtc(), null);
|
EppResourceUtils.getLinkedDomainKeys(hostVKey, clock.nowUtc(), null);
|
||||||
|
@ -135,7 +135,7 @@ public class DeleteLoadTestDataAction implements Runnable {
|
||||||
.values()
|
.values()
|
||||||
.forEach(
|
.forEach(
|
||||||
domain -> {
|
domain -> {
|
||||||
ImmutableSet<VKey<HostResource>> remainingHosts =
|
ImmutableSet<VKey<Host>> remainingHosts =
|
||||||
domain.getNsHosts().stream()
|
domain.getNsHosts().stream()
|
||||||
.filter(vkey -> !vkey.equals(hostVKey))
|
.filter(vkey -> !vkey.equals(hostVKey))
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
|
|
|
@ -49,8 +49,8 @@ import google.registry.model.contact.ContactHistory;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.Registrar.Type;
|
import google.registry.model.registrar.Registrar.Type;
|
||||||
|
@ -148,7 +148,7 @@ import org.joda.time.DateTime;
|
||||||
* then loaded from the remaining referenced contact histories, and marshalled into (pending
|
* then loaded from the remaining referenced contact histories, and marshalled into (pending
|
||||||
* deposit: deposit fragment) pairs.
|
* deposit: deposit fragment) pairs.
|
||||||
*
|
*
|
||||||
* <h3>{@link HostResource}</h3>
|
* <h3>{@link Host}</h3>
|
||||||
*
|
*
|
||||||
* Similar to {@link ContactResource}, we join the most recent host history with referenced hosts to
|
* Similar to {@link ContactResource}, we join the most recent host history with referenced hosts to
|
||||||
* find most recent referenced hosts. For external hosts we do the same treatment as we did on
|
* find most recent referenced hosts. For external hosts we do the same treatment as we did on
|
||||||
|
@ -467,10 +467,9 @@ public class RdePipeline implements Serializable {
|
||||||
Counter activeDomainCounter = Metrics.counter("RDE", "ActiveDomainBase");
|
Counter activeDomainCounter = Metrics.counter("RDE", "ActiveDomainBase");
|
||||||
Counter domainFragmentCounter = Metrics.counter("RDE", "DomainFragment");
|
Counter domainFragmentCounter = Metrics.counter("RDE", "DomainFragment");
|
||||||
Counter referencedContactCounter = Metrics.counter("RDE", "ReferencedContactResource");
|
Counter referencedContactCounter = Metrics.counter("RDE", "ReferencedContactResource");
|
||||||
Counter referencedHostCounter = Metrics.counter("RDE", "ReferencedHostResource");
|
Counter referencedHostCounter = Metrics.counter("RDE", "ReferencedHost");
|
||||||
return domainHistories.apply(
|
return domainHistories.apply(
|
||||||
"Map DomainHistory to DepositFragment "
|
"Map DomainHistory to DepositFragment " + "and emit referenced ContactResource and Host",
|
||||||
+ "and emit referenced ContactResource and HostResource",
|
|
||||||
ParDo.of(
|
ParDo.of(
|
||||||
new DoFn<KV<String, Long>, KV<PendingDeposit, DepositFragment>>() {
|
new DoFn<KV<String, Long>, KV<PendingDeposit, DepositFragment>>() {
|
||||||
@ProcessElement
|
@ProcessElement
|
||||||
|
@ -565,10 +564,10 @@ public class RdePipeline implements Serializable {
|
||||||
private PCollectionTuple processHostHistories(
|
private PCollectionTuple processHostHistories(
|
||||||
PCollection<KV<String, PendingDeposit>> referencedHosts,
|
PCollection<KV<String, PendingDeposit>> referencedHosts,
|
||||||
PCollection<KV<String, Long>> hostHistories) {
|
PCollection<KV<String, Long>> hostHistories) {
|
||||||
Counter subordinateHostCounter = Metrics.counter("RDE", "SubordinateHostResource");
|
Counter subordinateHostCounter = Metrics.counter("RDE", "SubordinateHost");
|
||||||
Counter externalHostCounter = Metrics.counter("RDE", "ExternalHostResource");
|
Counter externalHostCounter = Metrics.counter("RDE", "ExternalHost");
|
||||||
Counter externalHostFragmentCounter = Metrics.counter("RDE", "ExternalHostFragment");
|
Counter externalHostFragmentCounter = Metrics.counter("RDE", "ExternalHostFragment");
|
||||||
return removeUnreferencedResource(referencedHosts, hostHistories, HostResource.class)
|
return removeUnreferencedResource(referencedHosts, hostHistories, Host.class)
|
||||||
.apply(
|
.apply(
|
||||||
"Map external DomainResource to DepositFragment and process subordinate domains",
|
"Map external DomainResource to DepositFragment and process subordinate domains",
|
||||||
ParDo.of(
|
ParDo.of(
|
||||||
|
@ -576,8 +575,8 @@ public class RdePipeline implements Serializable {
|
||||||
@ProcessElement
|
@ProcessElement
|
||||||
public void processElement(
|
public void processElement(
|
||||||
@Element KV<String, CoGbkResult> kv, MultiOutputReceiver receiver) {
|
@Element KV<String, CoGbkResult> kv, MultiOutputReceiver receiver) {
|
||||||
HostResource host =
|
Host host =
|
||||||
(HostResource)
|
(Host)
|
||||||
loadResourceByHistoryEntryId(
|
loadResourceByHistoryEntryId(
|
||||||
HostHistory.class,
|
HostHistory.class,
|
||||||
kv.getKey(),
|
kv.getKey(),
|
||||||
|
@ -631,11 +630,9 @@ public class RdePipeline implements Serializable {
|
||||||
Counter referencedSubordinateHostCounter = Metrics.counter("RDE", "ReferencedSubordinateHost");
|
Counter referencedSubordinateHostCounter = Metrics.counter("RDE", "ReferencedSubordinateHost");
|
||||||
return KeyedPCollectionTuple.of(HOST_TO_PENDING_DEPOSIT, superordinateDomains)
|
return KeyedPCollectionTuple.of(HOST_TO_PENDING_DEPOSIT, superordinateDomains)
|
||||||
.and(REVISION_ID, domainHistories)
|
.and(REVISION_ID, domainHistories)
|
||||||
|
.apply("Join Host:PendingDeposits with DomainHistory on Domain", CoGroupByKey.create())
|
||||||
.apply(
|
.apply(
|
||||||
"Join HostResource:PendingDeposits with DomainHistory on DomainResource",
|
" Remove unreferenced Domain",
|
||||||
CoGroupByKey.create())
|
|
||||||
.apply(
|
|
||||||
" Remove unreferenced DomainResource",
|
|
||||||
Filter.by(
|
Filter.by(
|
||||||
kv -> {
|
kv -> {
|
||||||
boolean toInclude =
|
boolean toInclude =
|
||||||
|
@ -647,7 +644,7 @@ public class RdePipeline implements Serializable {
|
||||||
return toInclude;
|
return toInclude;
|
||||||
}))
|
}))
|
||||||
.apply(
|
.apply(
|
||||||
"Map subordinate HostResource to DepositFragment",
|
"Map subordinate Host to DepositFragment",
|
||||||
FlatMapElements.into(
|
FlatMapElements.into(
|
||||||
kvs(
|
kvs(
|
||||||
TypeDescriptor.of(PendingDeposit.class),
|
TypeDescriptor.of(PendingDeposit.class),
|
||||||
|
@ -664,8 +661,8 @@ public class RdePipeline implements Serializable {
|
||||||
new ImmutableSet.Builder<>();
|
new ImmutableSet.Builder<>();
|
||||||
for (KV<String, CoGbkResult> hostToPendingDeposits :
|
for (KV<String, CoGbkResult> hostToPendingDeposits :
|
||||||
kv.getValue().getAll(HOST_TO_PENDING_DEPOSIT)) {
|
kv.getValue().getAll(HOST_TO_PENDING_DEPOSIT)) {
|
||||||
HostResource host =
|
Host host =
|
||||||
(HostResource)
|
(Host)
|
||||||
loadResourceByHistoryEntryId(
|
loadResourceByHistoryEntryId(
|
||||||
HostHistory.class,
|
HostHistory.class,
|
||||||
hostToPendingDeposits.getKey(),
|
hostToPendingDeposits.getKey(),
|
||||||
|
|
|
@ -25,7 +25,7 @@ import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||||
import google.registry.util.DateTimeUtils;
|
import google.registry.util.DateTimeUtils;
|
||||||
|
@ -52,7 +52,7 @@ import org.joda.time.DateTime;
|
||||||
public class ResaveAllEppResourcesPipeline implements Serializable {
|
public class ResaveAllEppResourcesPipeline implements Serializable {
|
||||||
|
|
||||||
private static final ImmutableSet<Class<? extends EppResource>> EPP_RESOURCE_CLASSES =
|
private static final ImmutableSet<Class<? extends EppResource>> EPP_RESOURCE_CLASSES =
|
||||||
ImmutableSet.of(ContactResource.class, Domain.class, HostResource.class);
|
ImmutableSet.of(ContactResource.class, Domain.class, Host.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* There exist three possible situations where we know we'll want to project domains to the
|
* There exist three possible situations where we know we'll want to project domains to the
|
||||||
|
|
|
@ -21,7 +21,7 @@ import google.registry.model.EppResource;
|
||||||
import google.registry.model.EppResource.ForeignKeyedEppResource;
|
import google.registry.model.EppResource.ForeignKeyedEppResource;
|
||||||
import google.registry.model.annotations.ExternalMessagingName;
|
import google.registry.model.annotations.ExternalMessagingName;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.HttpException.BadRequestException;
|
import google.registry.request.HttpException.BadRequestException;
|
||||||
import google.registry.request.HttpException.NotFoundException;
|
import google.registry.request.HttpException.NotFoundException;
|
||||||
|
@ -66,7 +66,7 @@ public final class RefreshDnsAction implements Runnable {
|
||||||
dnsQueue.addDomainRefreshTask(domainOrHostName);
|
dnsQueue.addDomainRefreshTask(domainOrHostName);
|
||||||
break;
|
break;
|
||||||
case HOST:
|
case HOST:
|
||||||
verifyHostIsSubordinate(loadAndVerifyExistence(HostResource.class, domainOrHostName));
|
verifyHostIsSubordinate(loadAndVerifyExistence(Host.class, domainOrHostName));
|
||||||
dnsQueue.addHostRefreshTask(domainOrHostName);
|
dnsQueue.addHostRefreshTask(domainOrHostName);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -86,7 +86,7 @@ public final class RefreshDnsAction implements Runnable {
|
||||||
domainOrHostName)));
|
domainOrHostName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void verifyHostIsSubordinate(HostResource host) {
|
private static void verifyHostIsSubordinate(Host host) {
|
||||||
if (!host.isSubordinate()) {
|
if (!host.isSubordinate()) {
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
String.format("%s isn't a subordinate hostname", host.getHostName()));
|
String.format("%s isn't a subordinate hostname", host.getHostName()));
|
||||||
|
|
|
@ -38,7 +38,7 @@ import google.registry.dns.writer.DnsWriter;
|
||||||
import google.registry.dns.writer.DnsWriterZone;
|
import google.registry.dns.writer.DnsWriterZone;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import google.registry.util.Concurrent;
|
import google.registry.util.Concurrent;
|
||||||
|
@ -190,7 +190,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
||||||
// Load the target host. Note that it can be absent if this host was just deleted.
|
// Load the target host. Note that it can be absent if this host was just deleted.
|
||||||
// desiredRecords is populated with an empty set to indicate that all existing records
|
// desiredRecords is populated with an empty set to indicate that all existing records
|
||||||
// should be deleted.
|
// should be deleted.
|
||||||
Optional<HostResource> host = loadByForeignKey(HostResource.class, hostName, clock.nowUtc());
|
Optional<Host> host = loadByForeignKey(Host.class, hostName, clock.nowUtc());
|
||||||
|
|
||||||
// Return early if the host is deleted.
|
// Return early if the host is deleted.
|
||||||
if (!host.isPresent()) {
|
if (!host.isPresent()) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ import google.registry.dns.writer.BaseDnsWriter;
|
||||||
import google.registry.dns.writer.DnsWriterZone;
|
import google.registry.dns.writer.DnsWriterZone;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -215,7 +215,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
|
||||||
private void addInBailiwickNameServerSet(Domain domain, Update update) {
|
private void addInBailiwickNameServerSet(Domain domain, Update update) {
|
||||||
for (String hostName :
|
for (String hostName :
|
||||||
intersection(domain.loadNameserverHostNames(), domain.getSubordinateHosts())) {
|
intersection(domain.loadNameserverHostNames(), domain.getSubordinateHosts())) {
|
||||||
Optional<HostResource> host = loadByForeignKey(HostResource.class, hostName, clock.nowUtc());
|
Optional<Host> host = loadByForeignKey(Host.class, hostName, clock.nowUtc());
|
||||||
checkState(host.isPresent(), "Host %s cannot be loaded", hostName);
|
checkState(host.isPresent(), "Host %s cannot be loaded", hostName);
|
||||||
update.add(makeAddressSet(host.get()));
|
update.add(makeAddressSet(host.get()));
|
||||||
update.add(makeV6AddressSet(host.get()));
|
update.add(makeV6AddressSet(host.get()));
|
||||||
|
@ -236,7 +236,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
|
||||||
return nameServerSet;
|
return nameServerSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RRset makeAddressSet(HostResource host) {
|
private RRset makeAddressSet(Host host) {
|
||||||
RRset addressSet = new RRset();
|
RRset addressSet = new RRset();
|
||||||
for (InetAddress address : host.getInetAddresses()) {
|
for (InetAddress address : host.getInetAddresses()) {
|
||||||
if (address instanceof Inet4Address) {
|
if (address instanceof Inet4Address) {
|
||||||
|
@ -252,7 +252,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
|
||||||
return addressSet;
|
return addressSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RRset makeV6AddressSet(HostResource host) {
|
private RRset makeV6AddressSet(Host host) {
|
||||||
RRset addressSet = new RRset();
|
RRset addressSet = new RRset();
|
||||||
for (InetAddress address : host.getInetAddresses()) {
|
for (InetAddress address : host.getInetAddresses()) {
|
||||||
if (address instanceof Inet6Address) {
|
if (address instanceof Inet6Address) {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<property name="creationTime" direction="desc"/>
|
<property name="creationTime" direction="desc"/>
|
||||||
</datastore-index>
|
</datastore-index>
|
||||||
<!-- For finding host resources by registrar. -->
|
<!-- For finding host resources by registrar. -->
|
||||||
<datastore-index kind="HostResource" ancestor="false" source="manual">
|
<datastore-index kind="Host" ancestor="false" source="manual">
|
||||||
<property name="currentSponsorClientId" direction="asc"/>
|
<property name="currentSponsorClientId" direction="asc"/>
|
||||||
<property name="deletionTime" direction="asc"/>
|
<property name="deletionTime" direction="asc"/>
|
||||||
<property name="fullyQualifiedHostName" direction="asc"/>
|
<property name="fullyQualifiedHostName" direction="asc"/>
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<property name="deletionTime" direction="asc"/>
|
<property name="deletionTime" direction="asc"/>
|
||||||
</datastore-index>
|
</datastore-index>
|
||||||
<!-- For WHOIS IP address lookup -->
|
<!-- For WHOIS IP address lookup -->
|
||||||
<datastore-index kind="HostResource" ancestor="false" source="manual">
|
<datastore-index kind="Host" ancestor="false" source="manual">
|
||||||
<property name="inetAddresses" direction="asc"/>
|
<property name="inetAddresses" direction="asc"/>
|
||||||
<property name="deletionTime" direction="asc"/>
|
<property name="deletionTime" direction="asc"/>
|
||||||
</datastore-index>
|
</datastore-index>
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
<property name="tld" direction="asc"/>
|
<property name="tld" direction="asc"/>
|
||||||
<property name="fullyQualifiedDomainName" direction="asc"/>
|
<property name="fullyQualifiedDomainName" direction="asc"/>
|
||||||
</datastore-index>
|
</datastore-index>
|
||||||
<datastore-index kind="HostResource" ancestor="false" source="manual">
|
<datastore-index kind="Host" ancestor="false" source="manual">
|
||||||
<property name="deletionTime" direction="asc"/>
|
<property name="deletionTime" direction="asc"/>
|
||||||
<property name="fullyQualifiedHostName" direction="asc"/>
|
<property name="fullyQualifiedHostName" direction="asc"/>
|
||||||
</datastore-index>
|
</datastore-index>
|
||||||
|
|
|
@ -114,7 +114,7 @@ import google.registry.model.domain.secdns.SecDnsUpdateExtension.Remove;
|
||||||
import google.registry.model.domain.token.AllocationToken;
|
import google.registry.model.domain.token.AllocationToken;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.Registrar.State;
|
import google.registry.model.registrar.Registrar.State;
|
||||||
|
@ -375,7 +375,7 @@ public class DomainFlowUtils {
|
||||||
static void verifyNotInPendingDelete(
|
static void verifyNotInPendingDelete(
|
||||||
Set<DesignatedContact> contacts,
|
Set<DesignatedContact> contacts,
|
||||||
VKey<ContactResource> registrant,
|
VKey<ContactResource> registrant,
|
||||||
Set<VKey<HostResource>> nameservers)
|
Set<VKey<Host>> nameservers)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
ImmutableList.Builder<VKey<? extends EppResource>> keysToLoad = new ImmutableList.Builder<>();
|
ImmutableList.Builder<VKey<? extends EppResource>> keysToLoad = new ImmutableList.Builder<>();
|
||||||
contacts.stream().map(DesignatedContact::getContactKey).forEach(keysToLoad::add);
|
contacts.stream().map(DesignatedContact::getContactKey).forEach(keysToLoad::add);
|
||||||
|
|
|
@ -30,8 +30,8 @@ import google.registry.model.eppinput.ResourceCommand;
|
||||||
import google.registry.model.eppoutput.CheckData.HostCheck;
|
import google.registry.model.eppoutput.CheckData.HostCheck;
|
||||||
import google.registry.model.eppoutput.CheckData.HostCheckData;
|
import google.registry.model.eppoutput.CheckData.HostCheckData;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostCommand.Check;
|
import google.registry.model.host.HostCommand.Check;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -61,8 +61,7 @@ public final class HostCheckFlow implements Flow {
|
||||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||||
ImmutableList<String> hostnames = ((Check) resourceCommand).getTargetIds();
|
ImmutableList<String> hostnames = ((Check) resourceCommand).getTargetIds();
|
||||||
verifyTargetIdCount(hostnames, maxChecks);
|
verifyTargetIdCount(hostnames, maxChecks);
|
||||||
ImmutableSet<String> existingIds =
|
ImmutableSet<String> existingIds = checkResourcesExist(Host.class, hostnames, clock.nowUtc());
|
||||||
checkResourcesExist(HostResource.class, hostnames, clock.nowUtc());
|
|
||||||
ImmutableList.Builder<HostCheck> checks = new ImmutableList.Builder<>();
|
ImmutableList.Builder<HostCheck> checks = new ImmutableList.Builder<>();
|
||||||
for (String hostname : hostnames) {
|
for (String hostname : hostnames) {
|
||||||
boolean unused = !existingIds.contains(hostname);
|
boolean unused = !existingIds.contains(hostname);
|
||||||
|
|
|
@ -46,9 +46,9 @@ import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
import google.registry.model.eppinput.ResourceCommand;
|
||||||
import google.registry.model.eppoutput.CreateData.HostCreateData;
|
import google.registry.model.eppoutput.CreateData.HostCreateData;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostCommand.Create;
|
import google.registry.model.host.HostCommand.Create;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
|
@ -105,7 +105,7 @@ public final class HostCreateFlow implements TransactionalFlow {
|
||||||
extensionManager.validate();
|
extensionManager.validate();
|
||||||
Create command = (Create) resourceCommand;
|
Create command = (Create) resourceCommand;
|
||||||
DateTime now = tm().getTransactionTime();
|
DateTime now = tm().getTransactionTime();
|
||||||
verifyResourceDoesNotExist(HostResource.class, targetId, now, registrarId);
|
verifyResourceDoesNotExist(Host.class, targetId, now, registrarId);
|
||||||
// The superordinate domain of the host object if creating an in-bailiwick host, or null if
|
// The superordinate domain of the host object if creating an in-bailiwick host, or null if
|
||||||
// creating an external host. This is looked up before we actually create the Host object so
|
// creating an external host. This is looked up before we actually create the Host object so
|
||||||
// we can detect error conditions earlier.
|
// we can detect error conditions earlier.
|
||||||
|
@ -121,8 +121,8 @@ public final class HostCreateFlow implements TransactionalFlow {
|
||||||
? new SubordinateHostMustHaveIpException()
|
? new SubordinateHostMustHaveIpException()
|
||||||
: new UnexpectedExternalHostIpException();
|
: new UnexpectedExternalHostIpException();
|
||||||
}
|
}
|
||||||
HostResource newHost =
|
Host newHost =
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationRegistrarId(registrarId)
|
.setCreationRegistrarId(registrarId)
|
||||||
.setPersistedCurrentSponsorRegistrarId(registrarId)
|
.setPersistedCurrentSponsorRegistrarId(registrarId)
|
||||||
.setHostName(targetId)
|
.setHostName(targetId)
|
||||||
|
|
|
@ -38,8 +38,8 @@ import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.reporting.HistoryEntry.Type;
|
import google.registry.model.reporting.HistoryEntry.Type;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -92,8 +92,8 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
||||||
extensionManager.validate();
|
extensionManager.validate();
|
||||||
DateTime now = tm().getTransactionTime();
|
DateTime now = tm().getTransactionTime();
|
||||||
validateHostName(targetId);
|
validateHostName(targetId);
|
||||||
checkLinkedDomains(targetId, now, HostResource.class);
|
checkLinkedDomains(targetId, now, Host.class);
|
||||||
HostResource existingHost = loadAndVerifyExistence(HostResource.class, targetId, now);
|
Host existingHost = loadAndVerifyExistence(Host.class, targetId, now);
|
||||||
verifyNoDisallowedStatuses(existingHost, DISALLOWED_STATUSES);
|
verifyNoDisallowedStatuses(existingHost, DISALLOWED_STATUSES);
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
// Hosts transfer with their superordinate domains, so for hosts with a superordinate domain,
|
// Hosts transfer with their superordinate domains, so for hosts with a superordinate domain,
|
||||||
|
@ -104,8 +104,7 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
||||||
: existingHost;
|
: existingHost;
|
||||||
verifyResourceOwnership(registrarId, owningResource);
|
verifyResourceOwnership(registrarId, owningResource);
|
||||||
}
|
}
|
||||||
HostResource newHost =
|
Host newHost = existingHost.asBuilder().setStatusValues(null).setDeletionTime(now).build();
|
||||||
existingHost.asBuilder().setStatusValues(null).setDeletionTime(now).build();
|
|
||||||
if (existingHost.isSubordinate()) {
|
if (existingHost.isSubordinate()) {
|
||||||
dnsQueue.addHostRefreshTask(existingHost.getHostName());
|
dnsQueue.addHostRefreshTask(existingHost.getHostName());
|
||||||
tm().update(
|
tm().update(
|
||||||
|
|
|
@ -30,8 +30,8 @@ import google.registry.flows.annotations.ReportingSpec;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostInfoData;
|
import google.registry.model.host.HostInfoData;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -65,7 +65,7 @@ public final class HostInfoFlow implements Flow {
|
||||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||||
validateHostName(targetId);
|
validateHostName(targetId);
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
|
Host host = loadAndVerifyExistence(Host.class, targetId, now);
|
||||||
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
||||||
statusValues.addAll(host.getStatusValues());
|
statusValues.addAll(host.getStatusValues());
|
||||||
if (isLinked(host.createVKey(), now)) {
|
if (isLinked(host.createVKey(), now)) {
|
||||||
|
|
|
@ -52,11 +52,11 @@ import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
import google.registry.model.eppinput.ResourceCommand;
|
||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostCommand.Update;
|
import google.registry.model.host.HostCommand.Update;
|
||||||
import google.registry.model.host.HostCommand.Update.AddRemove;
|
import google.registry.model.host.HostCommand.Update.AddRemove;
|
||||||
import google.registry.model.host.HostCommand.Update.Change;
|
import google.registry.model.host.HostCommand.Update.Change;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
|
@ -133,7 +133,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
String suppliedNewHostName = change.getFullyQualifiedHostName();
|
String suppliedNewHostName = change.getFullyQualifiedHostName();
|
||||||
DateTime now = tm().getTransactionTime();
|
DateTime now = tm().getTransactionTime();
|
||||||
validateHostName(targetId);
|
validateHostName(targetId);
|
||||||
HostResource existingHost = loadAndVerifyExistence(HostResource.class, targetId, now);
|
Host existingHost = loadAndVerifyExistence(Host.class, targetId, now);
|
||||||
boolean isHostRename = suppliedNewHostName != null;
|
boolean isHostRename = suppliedNewHostName != null;
|
||||||
String oldHostName = targetId;
|
String oldHostName = targetId;
|
||||||
String newHostName = firstNonNull(suppliedNewHostName, oldHostName);
|
String newHostName = firstNonNull(suppliedNewHostName, oldHostName);
|
||||||
|
@ -148,7 +148,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
EppResource owningResource = firstNonNull(oldSuperordinateDomain, existingHost);
|
EppResource owningResource = firstNonNull(oldSuperordinateDomain, existingHost);
|
||||||
verifyUpdateAllowed(
|
verifyUpdateAllowed(
|
||||||
command, existingHost, newSuperordinateDomain.orElse(null), owningResource, isHostRename);
|
command, existingHost, newSuperordinateDomain.orElse(null), owningResource, isHostRename);
|
||||||
if (isHostRename && loadAndGetKey(HostResource.class, newHostName, now) != null) {
|
if (isHostRename && loadAndGetKey(Host.class, newHostName, now) != null) {
|
||||||
throw new HostAlreadyExistsException(newHostName);
|
throw new HostAlreadyExistsException(newHostName);
|
||||||
}
|
}
|
||||||
AddRemove add = command.getInnerAdd();
|
AddRemove add = command.getInnerAdd();
|
||||||
|
@ -175,7 +175,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
newSuperordinateDomain.isPresent()
|
newSuperordinateDomain.isPresent()
|
||||||
? newSuperordinateDomain.get().getCurrentSponsorRegistrarId()
|
? newSuperordinateDomain.get().getCurrentSponsorRegistrarId()
|
||||||
: owningResource.getPersistedCurrentSponsorRegistrarId();
|
: owningResource.getPersistedCurrentSponsorRegistrarId();
|
||||||
HostResource newHost =
|
Host newHost =
|
||||||
existingHost
|
existingHost
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setHostName(newHostName)
|
.setHostName(newHostName)
|
||||||
|
@ -210,7 +210,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
|
|
||||||
private void verifyUpdateAllowed(
|
private void verifyUpdateAllowed(
|
||||||
Update command,
|
Update command,
|
||||||
HostResource existingHost,
|
Host existingHost,
|
||||||
Domain newSuperordinateDomain,
|
Domain newSuperordinateDomain,
|
||||||
EppResource owningResource,
|
EppResource owningResource,
|
||||||
boolean isHostRename)
|
boolean isHostRename)
|
||||||
|
@ -237,8 +237,8 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
verifyNoDisallowedStatuses(existingHost, DISALLOWED_STATUSES);
|
verifyNoDisallowedStatuses(existingHost, DISALLOWED_STATUSES);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyHasIpsIffIsExternal(
|
private void verifyHasIpsIffIsExternal(Update command, Host existingHost, Host newHost)
|
||||||
Update command, HostResource existingHost, HostResource newHost) throws EppException {
|
throws EppException {
|
||||||
boolean wasSubordinate = existingHost.isSubordinate();
|
boolean wasSubordinate = existingHost.isSubordinate();
|
||||||
boolean willBeSubordinate = newHost.isSubordinate();
|
boolean willBeSubordinate = newHost.isSubordinate();
|
||||||
boolean willBeExternal = !willBeSubordinate;
|
boolean willBeExternal = !willBeSubordinate;
|
||||||
|
@ -258,7 +258,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enqueueTasks(HostResource existingHost, HostResource newHost) {
|
private void enqueueTasks(Host existingHost, Host newHost) {
|
||||||
// Only update DNS for subordinate hosts. External hosts have no glue to write, so they
|
// Only update DNS for subordinate hosts. External hosts have no glue to write, so they
|
||||||
// are only written as NS records from the referencing domain.
|
// are only written as NS records from the referencing domain.
|
||||||
if (existingHost.isSubordinate()) {
|
if (existingHost.isSubordinate()) {
|
||||||
|
@ -277,7 +277,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateSuperordinateDomains(HostResource existingHost, HostResource newHost) {
|
private static void updateSuperordinateDomains(Host existingHost, Host newHost) {
|
||||||
if (existingHost.isSubordinate()
|
if (existingHost.isSubordinate()
|
||||||
&& newHost.isSubordinate()
|
&& newHost.isSubordinate()
|
||||||
&& Objects.equals(
|
&& Objects.equals(
|
||||||
|
|
|
@ -41,7 +41,7 @@ public abstract class BackupGroupRoot extends ImmutableObject implements UnsafeS
|
||||||
* that this is updated on every save, rather than only in response to an {@code <update>} command
|
* that this is updated on every save, rather than only in response to an {@code <update>} command
|
||||||
*/
|
*/
|
||||||
@XmlTransient
|
@XmlTransient
|
||||||
// Prevents subclasses from unexpectedly accessing as property (e.g., HostResource), which would
|
// Prevents subclasses from unexpectedly accessing as property (e.g., Host), which would
|
||||||
// require an unnecessary non-private setter method.
|
// require an unnecessary non-private setter method.
|
||||||
@Access(AccessType.FIELD)
|
@Access(AccessType.FIELD)
|
||||||
@AttributeOverride(name = "lastUpdateTime", column = @Column(name = "updateTimestamp"))
|
@AttributeOverride(name = "lastUpdateTime", column = @Column(name = "updateTimestamp"))
|
||||||
|
|
|
@ -23,8 +23,8 @@ import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.token.AllocationToken;
|
import google.registry.model.domain.token.AllocationToken;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
import google.registry.model.index.EppResourceIndexBucket;
|
import google.registry.model.index.EppResourceIndexBucket;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
|
@ -55,8 +55,8 @@ public final class EntityClasses {
|
||||||
ForeignKeyIndex.ForeignKeyHostIndex.class,
|
ForeignKeyIndex.ForeignKeyHostIndex.class,
|
||||||
GaeUserIdConverter.class,
|
GaeUserIdConverter.class,
|
||||||
HistoryEntry.class,
|
HistoryEntry.class,
|
||||||
|
Host.class,
|
||||||
HostHistory.class,
|
HostHistory.class,
|
||||||
HostResource.class,
|
|
||||||
Lock.class,
|
Lock.class,
|
||||||
PollMessage.class,
|
PollMessage.class,
|
||||||
PollMessage.Autorenew.class,
|
PollMessage.Autorenew.class,
|
||||||
|
|
|
@ -35,7 +35,7 @@ import google.registry.model.EppResource.ResourceWithTransferData;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
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.HistoryEntryDao;
|
import google.registry.model.reporting.HistoryEntryDao;
|
||||||
|
@ -345,8 +345,8 @@ public final class EppResourceUtils {
|
||||||
public static ImmutableSet<VKey<Domain>> getLinkedDomainKeys(
|
public static ImmutableSet<VKey<Domain>> getLinkedDomainKeys(
|
||||||
VKey<? extends EppResource> key, DateTime now, @Nullable Integer limit) {
|
VKey<? extends EppResource> key, DateTime now, @Nullable Integer limit) {
|
||||||
checkArgument(
|
checkArgument(
|
||||||
key.getKind().equals(ContactResource.class) || key.getKind().equals(HostResource.class),
|
key.getKind().equals(ContactResource.class) || key.getKind().equals(Host.class),
|
||||||
"key must be either VKey<ContactResource> or VKey<HostResource>, but it is %s",
|
"key must be either VKey<ContactResource> or VKey<Host>, but it is %s",
|
||||||
key);
|
key);
|
||||||
boolean isContactKey = key.getKind().equals(ContactResource.class);
|
boolean isContactKey = key.getKind().equals(ContactResource.class);
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import google.registry.model.domain.GracePeriod;
|
||||||
import google.registry.model.domain.GracePeriod.GracePeriodHistory;
|
import google.registry.model.domain.GracePeriod.GracePeriodHistory;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.domain.secdns.DomainDsDataHistory;
|
import google.registry.model.domain.secdns.DomainDsDataHistory;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.persistence.transaction.JpaTransactionManager;
|
import google.registry.persistence.transaction.JpaTransactionManager;
|
||||||
|
@ -68,7 +68,7 @@ public class BulkQueryEntities {
|
||||||
DomainLite domainLite,
|
DomainLite domainLite,
|
||||||
ImmutableSet<GracePeriod> gracePeriods,
|
ImmutableSet<GracePeriod> gracePeriods,
|
||||||
ImmutableSet<DelegationSignerData> delegationSignerData,
|
ImmutableSet<DelegationSignerData> delegationSignerData,
|
||||||
ImmutableSet<VKey<HostResource>> nsHosts) {
|
ImmutableSet<VKey<Host>> nsHosts) {
|
||||||
Domain.Builder builder = new Domain.Builder();
|
Domain.Builder builder = new Domain.Builder();
|
||||||
builder.copyFrom(domainLite);
|
builder.copyFrom(domainLite);
|
||||||
builder.setGracePeriods(gracePeriods);
|
builder.setGracePeriods(gracePeriods);
|
||||||
|
@ -82,7 +82,7 @@ public class BulkQueryEntities {
|
||||||
public static DomainHistory assembleDomainHistory(
|
public static DomainHistory assembleDomainHistory(
|
||||||
DomainHistoryLite domainHistoryLite,
|
DomainHistoryLite domainHistoryLite,
|
||||||
ImmutableSet<DomainDsDataHistory> dsDataHistories,
|
ImmutableSet<DomainDsDataHistory> dsDataHistories,
|
||||||
ImmutableSet<VKey<HostResource>> domainHistoryHosts,
|
ImmutableSet<VKey<Host>> domainHistoryHosts,
|
||||||
ImmutableSet<GracePeriodHistory> gracePeriodHistories,
|
ImmutableSet<GracePeriodHistory> gracePeriodHistories,
|
||||||
ImmutableSet<DomainTransactionRecord> transactionRecords) {
|
ImmutableSet<DomainTransactionRecord> transactionRecords) {
|
||||||
DomainHistory.Builder builder = new DomainHistory.Builder();
|
DomainHistory.Builder builder = new DomainHistory.Builder();
|
||||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.model.bulkquery;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
|
@ -44,8 +44,8 @@ public class DomainHistoryHost implements Serializable {
|
||||||
return new DomainHistoryId(domainHistoryDomainRepoId, domainHistoryHistoryRevisionId);
|
return new DomainHistoryId(domainHistoryDomainRepoId, domainHistoryHistoryRevisionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VKey<HostResource> getHostVKey() {
|
public VKey<Host> getHostVKey() {
|
||||||
return VKey.create(HostResource.class, hostRepoId);
|
return VKey.create(Host.class, hostRepoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
package google.registry.model.bulkquery;
|
package google.registry.model.bulkquery;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
|
@ -40,8 +40,8 @@ public class DomainHost implements Serializable {
|
||||||
return domainRepoId;
|
return domainRepoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VKey<HostResource> getHostVKey() {
|
public VKey<Host> getHostVKey() {
|
||||||
return VKey.create(HostResource.class, hostRepoId);
|
return VKey.create(Host.class, hostRepoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,7 +20,7 @@ import google.registry.model.EppResource.ForeignKeyedEppResource;
|
||||||
import google.registry.model.annotations.ExternalMessagingName;
|
import google.registry.model.annotations.ExternalMessagingName;
|
||||||
import google.registry.model.annotations.ReportedOn;
|
import google.registry.model.annotations.ReportedOn;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.persistence.WithStringVKey;
|
import google.registry.persistence.WithStringVKey;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -89,7 +89,7 @@ public class Domain extends DomainBase implements ForeignKeyedEppResource {
|
||||||
})
|
})
|
||||||
@Access(AccessType.PROPERTY)
|
@Access(AccessType.PROPERTY)
|
||||||
@Column(name = "host_repo_id")
|
@Column(name = "host_repo_id")
|
||||||
public Set<VKey<HostResource>> getNsHosts() {
|
public Set<VKey<Host>> getNsHosts() {
|
||||||
return super.nsHosts;
|
return super.nsHosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ import google.registry.model.domain.launch.LaunchNotice;
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
|
@ -128,7 +128,7 @@ public class DomainBase extends EppResource
|
||||||
@Index String tld;
|
@Index String tld;
|
||||||
|
|
||||||
/** References to hosts that are the nameservers for the domain. */
|
/** References to hosts that are the nameservers for the domain. */
|
||||||
@EmptySetToNull @Index @Transient Set<VKey<HostResource>> nsHosts;
|
@EmptySetToNull @Index @Transient Set<VKey<Host>> nsHosts;
|
||||||
|
|
||||||
/** Contacts. */
|
/** Contacts. */
|
||||||
VKey<ContactResource> adminContact;
|
VKey<ContactResource> adminContact;
|
||||||
|
@ -372,13 +372,13 @@ public class DomainBase extends EppResource
|
||||||
return idnTableName;
|
return idnTableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableSet<VKey<HostResource>> getNameservers() {
|
public ImmutableSet<VKey<Host>> getNameservers() {
|
||||||
return nullToEmptyImmutableCopy(nsHosts);
|
return nullToEmptyImmutableCopy(nsHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hibernate needs this in order to populate nsHosts but no one else should ever use it
|
// Hibernate needs this in order to populate nsHosts but no one else should ever use it
|
||||||
@SuppressWarnings("UnusedMethod")
|
@SuppressWarnings("UnusedMethod")
|
||||||
private void setNsHosts(Set<VKey<HostResource>> nsHosts) {
|
private void setNsHosts(Set<VKey<Host>> nsHosts) {
|
||||||
this.nsHosts = forceEmptyToNull(nsHosts);
|
this.nsHosts = forceEmptyToNull(nsHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ public class DomainBase extends EppResource
|
||||||
return tm().transact(
|
return tm().transact(
|
||||||
() ->
|
() ->
|
||||||
tm().loadByKeys(getNameservers()).values().stream()
|
tm().loadByKeys(getNameservers()).values().stream()
|
||||||
.map(HostResource::getHostName)
|
.map(Host::getHostName)
|
||||||
.collect(toImmutableSortedSet(Ordering.natural())));
|
.collect(toImmutableSortedSet(Ordering.natural())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,32 +787,32 @@ public class DomainBase extends EppResource
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B setNameservers(VKey<HostResource> nameserver) {
|
public B setNameservers(VKey<Host> nameserver) {
|
||||||
getInstance().nsHosts = ImmutableSet.of(nameserver);
|
getInstance().nsHosts = ImmutableSet.of(nameserver);
|
||||||
getInstance().resetUpdateTimestamp();
|
getInstance().resetUpdateTimestamp();
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B setNameservers(ImmutableSet<VKey<HostResource>> nameservers) {
|
public B setNameservers(ImmutableSet<VKey<Host>> nameservers) {
|
||||||
getInstance().nsHosts = forceEmptyToNull(nameservers);
|
getInstance().nsHosts = forceEmptyToNull(nameservers);
|
||||||
getInstance().resetUpdateTimestamp();
|
getInstance().resetUpdateTimestamp();
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B addNameserver(VKey<HostResource> nameserver) {
|
public B addNameserver(VKey<Host> nameserver) {
|
||||||
return addNameservers(ImmutableSet.of(nameserver));
|
return addNameservers(ImmutableSet.of(nameserver));
|
||||||
}
|
}
|
||||||
|
|
||||||
public B addNameservers(ImmutableSet<VKey<HostResource>> nameservers) {
|
public B addNameservers(ImmutableSet<VKey<Host>> nameservers) {
|
||||||
return setNameservers(
|
return setNameservers(
|
||||||
ImmutableSet.copyOf(Sets.union(getInstance().getNameservers(), nameservers)));
|
ImmutableSet.copyOf(Sets.union(getInstance().getNameservers(), nameservers)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public B removeNameserver(VKey<HostResource> nameserver) {
|
public B removeNameserver(VKey<Host> nameserver) {
|
||||||
return removeNameservers(ImmutableSet.of(nameserver));
|
return removeNameservers(ImmutableSet.of(nameserver));
|
||||||
}
|
}
|
||||||
|
|
||||||
public B removeNameservers(ImmutableSet<VKey<HostResource>> nameservers) {
|
public B removeNameservers(ImmutableSet<VKey<Host>> nameservers) {
|
||||||
return setNameservers(
|
return setNameservers(
|
||||||
ImmutableSet.copyOf(difference(getInstance().getNameservers(), nameservers)));
|
ImmutableSet.copyOf(difference(getInstance().getNameservers(), nameservers)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import google.registry.model.eppinput.ResourceCommand.ResourceCheck;
|
||||||
import google.registry.model.eppinput.ResourceCommand.ResourceCreateOrChange;
|
import google.registry.model.eppinput.ResourceCommand.ResourceCreateOrChange;
|
||||||
import google.registry.model.eppinput.ResourceCommand.ResourceUpdate;
|
import google.registry.model.eppinput.ResourceCommand.ResourceUpdate;
|
||||||
import google.registry.model.eppinput.ResourceCommand.SingleResourceCommand;
|
import google.registry.model.eppinput.ResourceCommand.SingleResourceCommand;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -126,7 +126,7 @@ public class DomainCommand {
|
||||||
Set<String> nameserverFullyQualifiedHostNames;
|
Set<String> nameserverFullyQualifiedHostNames;
|
||||||
|
|
||||||
/** Resolved keys to hosts that are the nameservers for the domain. */
|
/** Resolved keys to hosts that are the nameservers for the domain. */
|
||||||
@XmlTransient Set<VKey<HostResource>> nameservers;
|
@XmlTransient Set<VKey<Host>> nameservers;
|
||||||
|
|
||||||
/** Foreign keyed associated contacts for the domain (other than registrant). */
|
/** Foreign keyed associated contacts for the domain (other than registrant). */
|
||||||
@XmlElement(name = "contact")
|
@XmlElement(name = "contact")
|
||||||
|
@ -156,7 +156,7 @@ public class DomainCommand {
|
||||||
return nullToEmptyImmutableCopy(nameserverFullyQualifiedHostNames);
|
return nullToEmptyImmutableCopy(nameserverFullyQualifiedHostNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableSet<VKey<HostResource>> getNameservers() {
|
public ImmutableSet<VKey<Host>> getNameservers() {
|
||||||
return nullToEmptyImmutableCopy(nameservers);
|
return nullToEmptyImmutableCopy(nameservers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ public class DomainCommand {
|
||||||
Set<String> nameserverFullyQualifiedHostNames;
|
Set<String> nameserverFullyQualifiedHostNames;
|
||||||
|
|
||||||
/** Resolved keys to hosts that are the nameservers for the domain. */
|
/** Resolved keys to hosts that are the nameservers for the domain. */
|
||||||
@XmlTransient Set<VKey<HostResource>> nameservers;
|
@XmlTransient Set<VKey<Host>> nameservers;
|
||||||
|
|
||||||
/** Foreign keyed associated contacts for the domain (other than registrant). */
|
/** Foreign keyed associated contacts for the domain (other than registrant). */
|
||||||
@XmlElement(name = "contact")
|
@XmlElement(name = "contact")
|
||||||
|
@ -363,7 +363,7 @@ public class DomainCommand {
|
||||||
return nullSafeImmutableCopy(nameserverFullyQualifiedHostNames);
|
return nullSafeImmutableCopy(nameserverFullyQualifiedHostNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableSet<VKey<HostResource>> getNameservers() {
|
public ImmutableSet<VKey<Host>> getNameservers() {
|
||||||
return nullToEmptyImmutableCopy(nameservers);
|
return nullToEmptyImmutableCopy(nameservers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,13 +413,13 @@ public class DomainCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<VKey<HostResource>> linkHosts(
|
private static Set<VKey<Host>> linkHosts(Set<String> fullyQualifiedHostNames, DateTime now)
|
||||||
Set<String> fullyQualifiedHostNames, DateTime now) throws InvalidReferencesException {
|
throws InvalidReferencesException {
|
||||||
if (fullyQualifiedHostNames == null) {
|
if (fullyQualifiedHostNames == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ImmutableSet.copyOf(
|
return ImmutableSet.copyOf(
|
||||||
loadByForeignKeysCached(fullyQualifiedHostNames, HostResource.class, now).values());
|
loadByForeignKeysCached(fullyQualifiedHostNames, Host.class, now).values());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<DesignatedContact> linkContacts(
|
private static Set<DesignatedContact> linkContacts(
|
||||||
|
|
|
@ -26,7 +26,7 @@ import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
||||||
import google.registry.model.domain.GracePeriod.GracePeriodHistory;
|
import google.registry.model.domain.GracePeriod.GracePeriodHistory;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.domain.secdns.DomainDsDataHistory;
|
import google.registry.model.domain.secdns.DomainDsDataHistory;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
|
@ -113,7 +113,7 @@ public class DomainHistory extends HistoryEntry {
|
||||||
})
|
})
|
||||||
@ImmutableObject.EmptySetToNull
|
@ImmutableObject.EmptySetToNull
|
||||||
@Column(name = "host_repo_id")
|
@Column(name = "host_repo_id")
|
||||||
Set<VKey<HostResource>> nsHosts;
|
Set<VKey<Host>> nsHosts;
|
||||||
|
|
||||||
@DoNotCompare
|
@DoNotCompare
|
||||||
@OneToMany(
|
@OneToMany(
|
||||||
|
@ -221,8 +221,8 @@ public class DomainHistory extends HistoryEntry {
|
||||||
return new DomainHistoryId(getDomainRepoId(), getId());
|
return new DomainHistoryId(getDomainRepoId(), getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns keys to the {@link HostResource} that are the nameservers for the domain. */
|
/** Returns keys to the {@link Host} that are the nameservers for the domain. */
|
||||||
public Set<VKey<HostResource>> getNsHosts() {
|
public Set<VKey<Host>> getNsHosts() {
|
||||||
return nsHosts;
|
return nsHosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ public class DomainHistory extends HistoryEntry {
|
||||||
|
|
||||||
public DomainHistory buildAndAssemble(
|
public DomainHistory buildAndAssemble(
|
||||||
ImmutableSet<DomainDsDataHistory> dsDataHistories,
|
ImmutableSet<DomainDsDataHistory> dsDataHistories,
|
||||||
ImmutableSet<VKey<HostResource>> domainHistoryHosts,
|
ImmutableSet<VKey<Host>> domainHistoryHosts,
|
||||||
ImmutableSet<GracePeriodHistory> gracePeriodHistories,
|
ImmutableSet<GracePeriodHistory> gracePeriodHistories,
|
||||||
ImmutableSet<DomainTransactionRecord> transactionRecords) {
|
ImmutableSet<DomainTransactionRecord> transactionRecords) {
|
||||||
DomainHistory instance = super.build();
|
DomainHistory instance = super.build();
|
||||||
|
|
|
@ -24,8 +24,8 @@ import google.registry.model.contact.ContactBase;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostBase;
|
import google.registry.model.host.HostBase;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.translators.EnumToAttributeAdapter.EppEnum;
|
import google.registry.model.translators.EnumToAttributeAdapter.EppEnum;
|
||||||
import google.registry.model.translators.StatusValueAdapter;
|
import google.registry.model.translators.StatusValueAdapter;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
@ -135,7 +135,7 @@ public enum StatusValue implements EppEnum {
|
||||||
DomainBase.class,
|
DomainBase.class,
|
||||||
Domain.class,
|
Domain.class,
|
||||||
HostBase.class,
|
HostBase.class,
|
||||||
HostResource.class),
|
Host.class),
|
||||||
NONE,
|
NONE,
|
||||||
DOMAINS(DomainBase.class, Domain.class);
|
DOMAINS(DomainBase.class, Domain.class);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import javax.persistence.AccessType;
|
||||||
/**
|
/**
|
||||||
* A persistable Host resource including mutable and non-mutable fields.
|
* A persistable Host resource including mutable and non-mutable fields.
|
||||||
*
|
*
|
||||||
* <p>The {@link javax.persistence.Id} of the HostResource is the repoId.
|
* <p>The {@link javax.persistence.Id} of the Host is the repoId.
|
||||||
*/
|
*/
|
||||||
@ReportedOn
|
@ReportedOn
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -54,7 +54,7 @@ import javax.persistence.AccessType;
|
||||||
@ExternalMessagingName("host")
|
@ExternalMessagingName("host")
|
||||||
@WithStringVKey
|
@WithStringVKey
|
||||||
@Access(AccessType.FIELD) // otherwise it'll use the default if the repoId (property)
|
@Access(AccessType.FIELD) // otherwise it'll use the default if the repoId (property)
|
||||||
public class HostResource extends HostBase implements ForeignKeyedEppResource {
|
public class Host extends HostBase implements ForeignKeyedEppResource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@javax.persistence.Id
|
@javax.persistence.Id
|
||||||
|
@ -64,8 +64,8 @@ public class HostResource extends HostBase implements ForeignKeyedEppResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VKey<HostResource> createVKey() {
|
public VKey<Host> createVKey() {
|
||||||
return VKey.create(HostResource.class, getRepoId(), Key.create(this));
|
return VKey.create(Host.class, getRepoId(), Key.create(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,11 +73,11 @@ public class HostResource extends HostBase implements ForeignKeyedEppResource {
|
||||||
return new Builder(clone(this));
|
return new Builder(clone(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A builder for constructing {@link HostResource}, since it is immutable. */
|
/** A builder for constructing {@link Host}, since it is immutable. */
|
||||||
public static class Builder extends HostBase.Builder<HostResource, Builder> {
|
public static class Builder extends HostBase.Builder<Host, Builder> {
|
||||||
public Builder() {}
|
public Builder() {}
|
||||||
|
|
||||||
private Builder(HostResource instance) {
|
private Builder(Host instance) {
|
||||||
super(instance);
|
super(instance);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,8 +126,7 @@ public class HostBase extends EppResource {
|
||||||
@Override
|
@Override
|
||||||
public VKey<? extends HostBase> createVKey() {
|
public VKey<? extends HostBase> createVKey() {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"HostBase is not an actual persisted entity you can create a key to;"
|
"HostBase is not an actual persisted entity you can create a key to; use Host instead");
|
||||||
+ " use HostResource instead");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -29,26 +29,26 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
/** A collection of {@link HostResource} commands. */
|
/** A collection of {@link Host} commands. */
|
||||||
public class HostCommand {
|
public class HostCommand {
|
||||||
|
|
||||||
/** The fields on "chgType" from <a href="http://tools.ietf.org/html/rfc5732">RFC5732</a>. */
|
/** The fields on "chgType" from <a href="http://tools.ietf.org/html/rfc5732">RFC5732</a>. */
|
||||||
@XmlTransient
|
@XmlTransient
|
||||||
abstract static class HostCreateOrChange extends AbstractSingleResourceCommand
|
abstract static class HostCreateOrChange extends AbstractSingleResourceCommand
|
||||||
implements ResourceCreateOrChange<HostResource.Builder> {
|
implements ResourceCreateOrChange<Host.Builder> {
|
||||||
public String getFullyQualifiedHostName() {
|
public String getFullyQualifiedHostName() {
|
||||||
return getTargetId();
|
return getTargetId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A create command for a {@link HostResource}, mapping "createType" from <a
|
* A create command for a {@link Host}, mapping "createType" from <a
|
||||||
* href="http://tools.ietf.org/html/rfc5732">RFC5732</a>.
|
* href="http://tools.ietf.org/html/rfc5732">RFC5732</a>.
|
||||||
*/
|
*/
|
||||||
@XmlType(propOrder = {"targetId", "inetAddresses"})
|
@XmlType(propOrder = {"targetId", "inetAddresses"})
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public static class Create extends HostCreateOrChange
|
public static class Create extends HostCreateOrChange
|
||||||
implements ResourceCreateOrChange<HostResource.Builder> {
|
implements ResourceCreateOrChange<Host.Builder> {
|
||||||
/** IP Addresses for this host. Can be null if this is an external host. */
|
/** IP Addresses for this host. Can be null if this is an external host. */
|
||||||
@XmlElement(name = "addr")
|
@XmlElement(name = "addr")
|
||||||
Set<InetAddress> inetAddresses;
|
Set<InetAddress> inetAddresses;
|
||||||
|
@ -58,23 +58,22 @@ public class HostCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A delete command for a {@link HostResource}. */
|
/** A delete command for a {@link Host}. */
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public static class Delete extends AbstractSingleResourceCommand {}
|
public static class Delete extends AbstractSingleResourceCommand {}
|
||||||
|
|
||||||
/** An info request for a {@link HostResource}. */
|
/** An info request for a {@link Host}. */
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public static class Info extends AbstractSingleResourceCommand {}
|
public static class Info extends AbstractSingleResourceCommand {}
|
||||||
|
|
||||||
/** A check request for {@link HostResource}. */
|
/** A check request for {@link Host}. */
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public static class Check extends ResourceCheck {}
|
public static class Check extends ResourceCheck {}
|
||||||
|
|
||||||
/** An update to a {@link HostResource}. */
|
/** An update to a {@link Host}. */
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlType(propOrder = {"targetId", "innerAdd", "innerRemove", "innerChange"})
|
@XmlType(propOrder = {"targetId", "innerAdd", "innerRemove", "innerChange"})
|
||||||
public static class Update extends ResourceUpdate
|
public static class Update extends ResourceUpdate<Update.AddRemove, Host.Builder, Update.Change> {
|
||||||
<Update.AddRemove, HostResource.Builder, Update.Change> {
|
|
||||||
|
|
||||||
@XmlElement(name = "chg")
|
@XmlElement(name = "chg")
|
||||||
protected Change innerChange;
|
protected Change innerChange;
|
||||||
|
|
|
@ -59,7 +59,7 @@ import javax.persistence.PostLoad;
|
||||||
@IdClass(HostHistoryId.class)
|
@IdClass(HostHistoryId.class)
|
||||||
public class HostHistory extends HistoryEntry implements UnsafeSerializable {
|
public class HostHistory extends HistoryEntry implements UnsafeSerializable {
|
||||||
|
|
||||||
// Store HostBase instead of HostResource so we don't pick up its @Id
|
// Store HostBase instead of Host so we don't pick up its @Id
|
||||||
// Nullable for the sake of pre-Registry-3.0 history objects
|
// Nullable for the sake of pre-Registry-3.0 history objects
|
||||||
@DoNotCompare @Nullable HostBase hostBase;
|
@DoNotCompare @Nullable HostBase hostBase;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public class HostHistory extends HistoryEntry implements UnsafeSerializable {
|
||||||
/** This method is private because it is only used by Hibernate. */
|
/** This method is private because it is only used by Hibernate. */
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void setHostRepoId(String hostRepoId) {
|
private void setHostRepoId(String hostRepoId) {
|
||||||
parent = Key.create(HostResource.class, hostRepoId);
|
parent = Key.create(Host.class, hostRepoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@ -99,9 +99,9 @@ public class HostHistory extends HistoryEntry implements UnsafeSerializable {
|
||||||
return Optional.ofNullable(hostBase);
|
return Optional.ofNullable(hostBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The key to the {@link google.registry.model.host.HostResource} this is based off of. */
|
/** The key to the {@link Host} this is based off of. */
|
||||||
public VKey<HostResource> getParentVKey() {
|
public VKey<Host> getParentVKey() {
|
||||||
return VKey.create(HostResource.class, getHostRepoId());
|
return VKey.create(Host.class, getHostRepoId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a {@link VKey} instance for this entity. */
|
/** Creates a {@link VKey} instance for this entity. */
|
||||||
|
@ -113,7 +113,7 @@ public class HostHistory extends HistoryEntry implements UnsafeSerializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<? extends EppResource> getResourceAtPointInTime() {
|
public Optional<? extends EppResource> getResourceAtPointInTime() {
|
||||||
return getHostBase().map(hostBase -> new HostResource.Builder().copyFrom(hostBase).build());
|
return getHostBase().map(hostBase -> new Host.Builder().copyFrom(hostBase).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostLoad
|
@PostLoad
|
||||||
|
@ -210,7 +210,7 @@ public class HostHistory extends HistoryEntry implements UnsafeSerializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setHostRepoId(String hostRepoId) {
|
public Builder setHostRepoId(String hostRepoId) {
|
||||||
getInstance().parent = Key.create(HostResource.class, hostRepoId);
|
getInstance().parent = Key.create(Host.class, hostRepoId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ import google.registry.model.annotations.DeleteAfterMigration;
|
||||||
import google.registry.model.annotations.ReportedOn;
|
import google.registry.model.annotations.ReportedOn;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||||
import google.registry.persistence.transaction.JpaTransactionManager;
|
import google.registry.persistence.transaction.JpaTransactionManager;
|
||||||
|
@ -80,10 +80,10 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
|
||||||
@Entity
|
@Entity
|
||||||
public static class ForeignKeyDomainIndex extends ForeignKeyIndex<Domain> {}
|
public static class ForeignKeyDomainIndex extends ForeignKeyIndex<Domain> {}
|
||||||
|
|
||||||
/** The {@link ForeignKeyIndex} type for {@link HostResource} entities. */
|
/** The {@link ForeignKeyIndex} type for {@link Host} entities. */
|
||||||
@ReportedOn
|
@ReportedOn
|
||||||
@Entity
|
@Entity
|
||||||
public static class ForeignKeyHostIndex extends ForeignKeyIndex<HostResource> {}
|
public static class ForeignKeyHostIndex extends ForeignKeyIndex<Host> {}
|
||||||
|
|
||||||
private static final ImmutableBiMap<
|
private static final ImmutableBiMap<
|
||||||
Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>
|
Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>
|
||||||
|
@ -91,14 +91,14 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
|
||||||
ImmutableBiMap.of(
|
ImmutableBiMap.of(
|
||||||
ContactResource.class, ForeignKeyContactIndex.class,
|
ContactResource.class, ForeignKeyContactIndex.class,
|
||||||
Domain.class, ForeignKeyDomainIndex.class,
|
Domain.class, ForeignKeyDomainIndex.class,
|
||||||
HostResource.class, ForeignKeyHostIndex.class);
|
Host.class, ForeignKeyHostIndex.class);
|
||||||
|
|
||||||
private static final ImmutableMap<Class<? extends EppResource>, String>
|
private static final ImmutableMap<Class<? extends EppResource>, String>
|
||||||
RESOURCE_CLASS_TO_FKI_PROPERTY =
|
RESOURCE_CLASS_TO_FKI_PROPERTY =
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
ContactResource.class, "contactId",
|
ContactResource.class, "contactId",
|
||||||
Domain.class, "fullyQualifiedDomainName",
|
Domain.class, "fullyQualifiedDomainName",
|
||||||
HostResource.class, "fullyQualifiedHostName");
|
Host.class, "fullyQualifiedHostName");
|
||||||
|
|
||||||
@Id String foreignKey;
|
@Id String foreignKey;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
|
||||||
* The deletion time of this {@link ForeignKeyIndex}.
|
* The deletion time of this {@link ForeignKeyIndex}.
|
||||||
*
|
*
|
||||||
* <p>This will generally be equal to the deletion time of {@link #topReference}. However, in the
|
* <p>This will generally be equal to the deletion time of {@link #topReference}. However, in the
|
||||||
* case of a {@link HostResource} that was renamed, this field will hold the time of the rename.
|
* case of a {@link Host} that was renamed, this field will hold the time of the rename.
|
||||||
*/
|
*/
|
||||||
@Index DateTime deletionTime;
|
@Index DateTime deletionTime;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
* via Objectify.
|
* via Objectify.
|
||||||
*
|
*
|
||||||
* <p>All first class entities are represented as a resource class - {@link
|
* <p>All first class entities are represented as a resource class - {@link
|
||||||
* google.registry.model.domain.Domain}, {@link google.registry.model.host.HostResource}, {@link
|
* google.registry.model.domain.Domain}, {@link google.registry.model.host.Host}, {@link
|
||||||
* google.registry.model.contact.ContactResource}, and {@link
|
* google.registry.model.contact.ContactResource}, and {@link
|
||||||
* google.registry.model.registrar.Registrar}. Resource objects are written in a single shared
|
* google.registry.model.registrar.Registrar}. Resource objects are written in a single shared
|
||||||
* entity group per TLD. All commands that operate on those entities are grouped in a "Command"
|
* entity group per TLD. All commands that operate on those entities are grouped in a "Command"
|
||||||
|
|
|
@ -40,9 +40,9 @@ import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
||||||
import google.registry.model.domain.DomainRenewData;
|
import google.registry.model.domain.DomainRenewData;
|
||||||
import google.registry.model.eppoutput.EppResponse.ResponseData;
|
import google.registry.model.eppoutput.EppResponse.ResponseData;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostHistory.HostHistoryId;
|
import google.registry.model.host.HostHistory.HostHistoryId;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.ContactPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.ContactPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.HostPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.HostPendingActionNotificationResponse;
|
||||||
|
@ -105,7 +105,7 @@ public abstract class PollMessage extends ImmutableObject
|
||||||
public enum Type {
|
public enum Type {
|
||||||
DOMAIN(1L, Domain.class),
|
DOMAIN(1L, Domain.class),
|
||||||
CONTACT(2L, ContactResource.class),
|
CONTACT(2L, ContactResource.class),
|
||||||
HOST(3L, HostResource.class);
|
HOST(3L, Host.class);
|
||||||
|
|
||||||
private final long id;
|
private final long id;
|
||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
@ -216,7 +216,7 @@ public abstract class PollMessage extends ImmutableObject
|
||||||
/**
|
/**
|
||||||
* Returns the host repo id.
|
* Returns the host repo id.
|
||||||
*
|
*
|
||||||
* <p>This may only be used on a HostResource poll event.
|
* <p>This may only be used on a Host poll event.
|
||||||
*/
|
*/
|
||||||
public String getHostRepoId() {
|
public String getHostRepoId() {
|
||||||
checkArgument(getType() == Type.DOMAIN);
|
checkArgument(getType() == Type.DOMAIN);
|
||||||
|
|
|
@ -44,10 +44,10 @@ import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostBase;
|
import google.registry.model.host.HostBase;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostHistory.HostHistoryId;
|
import google.registry.model.host.HostHistory.HostHistoryId;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -389,7 +389,7 @@ public class HistoryEntry extends ImmutableObject implements Buildable, UnsafeSe
|
||||||
if (parentKind.equals(getKind(Domain.class))) {
|
if (parentKind.equals(getKind(Domain.class))) {
|
||||||
resultEntity =
|
resultEntity =
|
||||||
new DomainHistory.Builder().copyFrom(this).setDomainRepoId(parent.getName()).build();
|
new DomainHistory.Builder().copyFrom(this).setDomainRepoId(parent.getName()).build();
|
||||||
} else if (parentKind.equals(getKind(HostResource.class))) {
|
} else if (parentKind.equals(getKind(Host.class))) {
|
||||||
resultEntity =
|
resultEntity =
|
||||||
new HostHistory.Builder().copyFrom(this).setHostRepoId(parent.getName()).build();
|
new HostHistory.Builder().copyFrom(this).setHostRepoId(parent.getName()).build();
|
||||||
} else if (parentKind.equals(getKind(ContactResource.class))) {
|
} else if (parentKind.equals(getKind(ContactResource.class))) {
|
||||||
|
@ -413,7 +413,7 @@ public class HistoryEntry extends ImmutableObject implements Buildable, UnsafeSe
|
||||||
DomainHistory.class,
|
DomainHistory.class,
|
||||||
new DomainHistoryId(repoId, id),
|
new DomainHistoryId(repoId, id),
|
||||||
Key.create(parent, DomainHistory.class, id));
|
Key.create(parent, DomainHistory.class, id));
|
||||||
} else if (parentKind.equals(getKind(HostResource.class))) {
|
} else if (parentKind.equals(getKind(Host.class))) {
|
||||||
return VKey.create(
|
return VKey.create(
|
||||||
HostHistory.class,
|
HostHistory.class,
|
||||||
new HostHistoryId(repoId, id),
|
new HostHistoryId(repoId, id),
|
||||||
|
|
|
@ -29,8 +29,8 @@ import google.registry.model.contact.ContactHistory;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -55,7 +55,7 @@ public class HistoryEntryDao {
|
||||||
ContactHistory.class,
|
ContactHistory.class,
|
||||||
Domain.class,
|
Domain.class,
|
||||||
DomainHistory.class,
|
DomainHistory.class,
|
||||||
HostResource.class,
|
Host.class,
|
||||||
HostHistory.class);
|
HostHistory.class);
|
||||||
|
|
||||||
public static ImmutableMap<Class<? extends HistoryEntry>, String> REPO_ID_FIELD_NAMES =
|
public static ImmutableMap<Class<? extends HistoryEntry>, String> REPO_ID_FIELD_NAMES =
|
||||||
|
|
|
@ -37,7 +37,7 @@ import com.google.common.net.InetAddresses;
|
||||||
import com.google.common.primitives.Booleans;
|
import com.google.common.primitives.Booleans;
|
||||||
import com.googlecode.objectify.cmd.Query;
|
import com.googlecode.objectify.cmd.Query;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||||
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
||||||
|
@ -301,8 +301,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
*/
|
*/
|
||||||
private DomainSearchResponse searchByNameserverLdhName(
|
private DomainSearchResponse searchByNameserverLdhName(
|
||||||
final RdapSearchPattern partialStringQuery) {
|
final RdapSearchPattern partialStringQuery) {
|
||||||
ImmutableCollection<VKey<HostResource>> hostKeys =
|
ImmutableCollection<VKey<Host>> hostKeys = getNameserverRefsByLdhName(partialStringQuery);
|
||||||
getNameserverRefsByLdhName(partialStringQuery);
|
|
||||||
if (Iterables.isEmpty(hostKeys)) {
|
if (Iterables.isEmpty(hostKeys)) {
|
||||||
metricInformationBuilder.setNumHostsRetrieved(0);
|
metricInformationBuilder.setNumHostsRetrieved(0);
|
||||||
throw new NotFoundException("No matching nameservers found");
|
throw new NotFoundException("No matching nameservers found");
|
||||||
|
@ -311,7 +310,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles a list of {@link HostResource} keys by name.
|
* Assembles a list of {@link Host} keys by name.
|
||||||
*
|
*
|
||||||
* <p>Nameserver query strings with wildcards are allowed to have a suffix after the wildcard,
|
* <p>Nameserver query strings with wildcards are allowed to have a suffix after the wildcard,
|
||||||
* which must be a domain. If the domain is not specified, or is not an existing domain in one of
|
* which must be a domain. If the domain is not specified, or is not an existing domain in one of
|
||||||
|
@ -320,7 +319,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
* initial string is not required (e.g. "*.example.tld" is valid), because we can look up the
|
* initial string is not required (e.g. "*.example.tld" is valid), because we can look up the
|
||||||
* domain and just list all of its subordinate hosts.
|
* domain and just list all of its subordinate hosts.
|
||||||
*/
|
*/
|
||||||
private ImmutableCollection<VKey<HostResource>> getNameserverRefsByLdhName(
|
private ImmutableCollection<VKey<Host>> getNameserverRefsByLdhName(
|
||||||
final RdapSearchPattern partialStringQuery) {
|
final RdapSearchPattern partialStringQuery) {
|
||||||
// Handle queries without a wildcard.
|
// Handle queries without a wildcard.
|
||||||
if (!partialStringQuery.getHasWildcard()) {
|
if (!partialStringQuery.getHasWildcard()) {
|
||||||
|
@ -341,9 +340,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
// limit in order to avoid arbitrarily long-running queries.
|
// limit in order to avoid arbitrarily long-running queries.
|
||||||
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
Query<HostResource> query =
|
Query<Host> query =
|
||||||
queryItems(
|
queryItems(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
"fullyQualifiedHostName",
|
"fullyQualifiedHostName",
|
||||||
partialStringQuery,
|
partialStringQuery,
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
|
@ -359,9 +358,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
return replicaJpaTm()
|
return replicaJpaTm()
|
||||||
.transact(
|
.transact(
|
||||||
() -> {
|
() -> {
|
||||||
CriteriaQueryBuilder<HostResource> builder =
|
CriteriaQueryBuilder<Host> builder =
|
||||||
queryItemsSql(
|
queryItemsSql(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
"fullyQualifiedHostName",
|
"fullyQualifiedHostName",
|
||||||
partialStringQuery,
|
partialStringQuery,
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
|
@ -376,22 +375,22 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
return getMatchingResourcesSql(builder, true, maxNameserversInFirstStage)
|
return getMatchingResourcesSql(builder, true, maxNameserversInFirstStage)
|
||||||
.resources()
|
.resources()
|
||||||
.stream()
|
.stream()
|
||||||
.map(HostResource::createVKey)
|
.map(Host::createVKey)
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Assembles a list of {@link HostResource} keys by name when the pattern has no wildcard. */
|
/** Assembles a list of {@link Host} keys by name when the pattern has no wildcard. */
|
||||||
private ImmutableList<VKey<HostResource>> getNameserverRefsByLdhNameWithoutWildcard(
|
private ImmutableList<VKey<Host>> getNameserverRefsByLdhNameWithoutWildcard(
|
||||||
final RdapSearchPattern partialStringQuery) {
|
final RdapSearchPattern partialStringQuery) {
|
||||||
// If we need to check the sponsoring registrar, we need to load the resource rather than just
|
// If we need to check the sponsoring registrar, we need to load the resource rather than just
|
||||||
// the key.
|
// the key.
|
||||||
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
||||||
if (desiredRegistrar.isPresent()) {
|
if (desiredRegistrar.isPresent()) {
|
||||||
Optional<HostResource> host =
|
Optional<Host> host =
|
||||||
loadByForeignKey(
|
loadByForeignKey(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
partialStringQuery.getInitialString(),
|
partialStringQuery.getInitialString(),
|
||||||
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
||||||
return (!host.isPresent()
|
return (!host.isPresent()
|
||||||
|
@ -399,17 +398,17 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
? ImmutableList.of()
|
? ImmutableList.of()
|
||||||
: ImmutableList.of(host.get().createVKey());
|
: ImmutableList.of(host.get().createVKey());
|
||||||
} else {
|
} else {
|
||||||
VKey<HostResource> hostKey =
|
VKey<Host> hostKey =
|
||||||
loadAndGetKey(
|
loadAndGetKey(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
partialStringQuery.getInitialString(),
|
partialStringQuery.getInitialString(),
|
||||||
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
||||||
return (hostKey == null) ? ImmutableList.of() : ImmutableList.of(hostKey);
|
return (hostKey == null) ? ImmutableList.of() : ImmutableList.of(hostKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Assembles a list of {@link HostResource} keys by name using a superordinate domain suffix. */
|
/** Assembles a list of {@link Host} keys by name using a superordinate domain suffix. */
|
||||||
private ImmutableList<VKey<HostResource>> getNameserverRefsByLdhNameWithSuffix(
|
private ImmutableList<VKey<Host>> getNameserverRefsByLdhNameWithSuffix(
|
||||||
final RdapSearchPattern partialStringQuery) {
|
final RdapSearchPattern partialStringQuery) {
|
||||||
// The suffix must be a domain that we manage. That way, we can look up the domain and search
|
// The suffix must be a domain that we manage. That way, we can look up the domain and search
|
||||||
// through the subordinate hosts. This is more efficient, and lets us permit wildcard searches
|
// through the subordinate hosts. This is more efficient, and lets us permit wildcard searches
|
||||||
|
@ -425,17 +424,15 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
"A suffix in a lookup by nameserver name "
|
"A suffix in a lookup by nameserver name "
|
||||||
+ "must be a domain defined in the system"));
|
+ "must be a domain defined in the system"));
|
||||||
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
||||||
ImmutableList.Builder<VKey<HostResource>> builder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<VKey<Host>> builder = new ImmutableList.Builder<>();
|
||||||
for (String fqhn : ImmutableSortedSet.copyOf(domain.getSubordinateHosts())) {
|
for (String fqhn : ImmutableSortedSet.copyOf(domain.getSubordinateHosts())) {
|
||||||
// We can't just check that the host name starts with the initial query string, because
|
// We can't just check that the host name starts with the initial query string, because
|
||||||
// then the query ns.exam*.example.com would match against nameserver ns.example.com.
|
// then the query ns.exam*.example.com would match against nameserver ns.example.com.
|
||||||
if (partialStringQuery.matches(fqhn)) {
|
if (partialStringQuery.matches(fqhn)) {
|
||||||
if (desiredRegistrar.isPresent()) {
|
if (desiredRegistrar.isPresent()) {
|
||||||
Optional<HostResource> host =
|
Optional<Host> host =
|
||||||
loadByForeignKey(
|
loadByForeignKey(
|
||||||
HostResource.class,
|
Host.class, fqhn, shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
||||||
fqhn,
|
|
||||||
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
|
||||||
if (host.isPresent()
|
if (host.isPresent()
|
||||||
&& desiredRegistrar
|
&& desiredRegistrar
|
||||||
.get()
|
.get()
|
||||||
|
@ -443,11 +440,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
builder.add(host.get().createVKey());
|
builder.add(host.get().createVKey());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
VKey<HostResource> hostKey =
|
VKey<Host> hostKey =
|
||||||
loadAndGetKey(
|
loadAndGetKey(
|
||||||
HostResource.class,
|
Host.class, fqhn, shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
||||||
fqhn,
|
|
||||||
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
|
||||||
if (hostKey != null) {
|
if (hostKey != null) {
|
||||||
builder.add(hostKey);
|
builder.add(hostKey);
|
||||||
} else {
|
} else {
|
||||||
|
@ -477,11 +472,11 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
*/
|
*/
|
||||||
private DomainSearchResponse searchByNameserverIp(final InetAddress inetAddress) {
|
private DomainSearchResponse searchByNameserverIp(final InetAddress inetAddress) {
|
||||||
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
Optional<String> desiredRegistrar = getDesiredRegistrar();
|
||||||
ImmutableSet<VKey<HostResource>> hostKeys;
|
ImmutableSet<VKey<Host>> hostKeys;
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
Query<HostResource> query =
|
Query<Host> query =
|
||||||
queryItems(
|
queryItems(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
"inetAddresses",
|
"inetAddresses",
|
||||||
inetAddress.getHostAddress(),
|
inetAddress.getHostAddress(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
|
@ -524,7 +519,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Stream<String> resultStream = query.getResultStream();
|
Stream<String> resultStream = query.getResultStream();
|
||||||
return resultStream
|
return resultStream
|
||||||
.map(repoId -> VKey.create(HostResource.class, repoId))
|
.map(repoId -> VKey.create(Host.class, repoId))
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -538,7 +533,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
* #searchByNameserverIp} after they assemble the relevant host keys.
|
* #searchByNameserverIp} after they assemble the relevant host keys.
|
||||||
*/
|
*/
|
||||||
private DomainSearchResponse searchByNameserverRefs(
|
private DomainSearchResponse searchByNameserverRefs(
|
||||||
final ImmutableCollection<VKey<HostResource>> hostKeys) {
|
final ImmutableCollection<VKey<Host>> hostKeys) {
|
||||||
// We must break the query up into chunks, because the in operator is limited to 30 subqueries.
|
// We must break the query up into chunks, because the in operator is limited to 30 subqueries.
|
||||||
// Since it is possible for the same domain to show up more than once in our result list (if
|
// Since it is possible for the same domain to show up more than once in our result list (if
|
||||||
// we do a wildcard nameserver search that returns multiple nameservers used by the same
|
// we do a wildcard nameserver search that returns multiple nameservers used by the same
|
||||||
|
@ -548,7 +543,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
ImmutableSortedSet.Builder<Domain> domainSetBuilder =
|
ImmutableSortedSet.Builder<Domain> domainSetBuilder =
|
||||||
ImmutableSortedSet.orderedBy(Comparator.comparing(Domain::getDomainName));
|
ImmutableSortedSet.orderedBy(Comparator.comparing(Domain::getDomainName));
|
||||||
int numHostKeysSearched = 0;
|
int numHostKeysSearched = 0;
|
||||||
for (List<VKey<HostResource>> chunk : Iterables.partition(hostKeys, 30)) {
|
for (List<VKey<Host>> chunk : Iterables.partition(hostKeys, 30)) {
|
||||||
numHostKeysSearched += chunk.size();
|
numHostKeysSearched += chunk.size();
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
Query<Domain> query =
|
Query<Domain> query =
|
||||||
|
@ -574,7 +569,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
||||||
replicaJpaTm()
|
replicaJpaTm()
|
||||||
.transact(
|
.transact(
|
||||||
() -> {
|
() -> {
|
||||||
for (VKey<HostResource> hostKey : hostKeys) {
|
for (VKey<Host> hostKey : hostKeys) {
|
||||||
CriteriaQueryBuilder<Domain> queryBuilder =
|
CriteriaQueryBuilder<Domain> queryBuilder =
|
||||||
CriteriaQueryBuilder.create(replicaJpaTm(), Domain.class)
|
CriteriaQueryBuilder.create(replicaJpaTm(), Domain.class)
|
||||||
.whereFieldContains("nsHosts", hostKey)
|
.whereFieldContains("nsHosts", hostKey)
|
||||||
|
|
|
@ -48,7 +48,7 @@ import google.registry.model.domain.DesignatedContact.Type;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.Address;
|
import google.registry.model.eppcommon.Address;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.RegistrarAddress;
|
import google.registry.model.registrar.RegistrarAddress;
|
||||||
import google.registry.model.registrar.RegistrarPoc;
|
import google.registry.model.registrar.RegistrarPoc;
|
||||||
|
@ -235,8 +235,8 @@ public class RdapJsonFormatter {
|
||||||
ImmutableMap.of("type", ImmutableList.of("fax"));
|
ImmutableMap.of("type", ImmutableList.of("fax"));
|
||||||
|
|
||||||
/** Sets the ordering for hosts; just use the fully qualified host name. */
|
/** Sets the ordering for hosts; just use the fully qualified host name. */
|
||||||
private static final Ordering<HostResource> HOST_RESOURCE_ORDERING =
|
private static final Ordering<Host> HOST_RESOURCE_ORDERING =
|
||||||
Ordering.natural().onResultOf(HostResource::getHostName);
|
Ordering.natural().onResultOf(Host::getHostName);
|
||||||
|
|
||||||
/** Sets the ordering for designated contacts; order them in a fixed order by contact type. */
|
/** Sets the ordering for designated contacts; order them in a fixed order by contact type. */
|
||||||
private static final Ordering<DesignatedContact> DESIGNATED_CONTACT_ORDERING =
|
private static final Ordering<DesignatedContact> DESIGNATED_CONTACT_ORDERING =
|
||||||
|
@ -356,7 +356,7 @@ public class RdapJsonFormatter {
|
||||||
|
|
||||||
// Kick off the database loads of the nameservers that we will need, so it can load
|
// Kick off the database loads of the nameservers that we will need, so it can load
|
||||||
// asynchronously while we load and process the contacts.
|
// asynchronously while we load and process the contacts.
|
||||||
ImmutableSet<HostResource> loadedHosts =
|
ImmutableSet<Host> loadedHosts =
|
||||||
tm().transact(() -> ImmutableSet.copyOf(tm().loadByKeys(domain.getNameservers()).values()));
|
tm().transact(() -> ImmutableSet.copyOf(tm().loadByKeys(domain.getNameservers()).values()));
|
||||||
// Load the registrant and other contacts and add them to the data.
|
// Load the registrant and other contacts and add them to the data.
|
||||||
ImmutableMap<VKey<? extends ContactResource>, ContactResource> loadedContacts =
|
ImmutableMap<VKey<? extends ContactResource>, ContactResource> loadedContacts =
|
||||||
|
@ -393,8 +393,8 @@ public class RdapJsonFormatter {
|
||||||
}
|
}
|
||||||
// Add the nameservers to the data; the load was kicked off above for efficiency.
|
// Add the nameservers to the data; the load was kicked off above for efficiency.
|
||||||
// RDAP Response Profile 2.9: we MUST have the nameservers
|
// RDAP Response Profile 2.9: we MUST have the nameservers
|
||||||
for (HostResource hostResource : HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts)) {
|
for (Host host : HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts)) {
|
||||||
builder.nameserversBuilder().add(createRdapNameserver(hostResource, OutputDataType.INTERNAL));
|
builder.nameserversBuilder().add(createRdapNameserver(host, OutputDataType.INTERNAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
// RDAP Response Profile 2.10 - MUST contain a secureDns member including at least a
|
// RDAP Response Profile 2.10 - MUST contain a secureDns member including at least a
|
||||||
|
@ -410,23 +410,23 @@ public class RdapJsonFormatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a JSON object for a {@link HostResource}.
|
* Creates a JSON object for a {@link Host}.
|
||||||
*
|
*
|
||||||
* @param hostResource the host resource object from which the JSON object should be created
|
* @param host the host resource object from which the JSON object should be created
|
||||||
* @param outputDataType whether to generate full or summary data
|
* @param outputDataType whether to generate full or summary data
|
||||||
*/
|
*/
|
||||||
RdapNameserver createRdapNameserver(HostResource hostResource, OutputDataType outputDataType) {
|
RdapNameserver createRdapNameserver(Host host, OutputDataType outputDataType) {
|
||||||
RdapNameserver.Builder builder = RdapNameserver.builder();
|
RdapNameserver.Builder builder = RdapNameserver.builder();
|
||||||
builder.linksBuilder().add(makeSelfLink("nameserver", hostResource.getHostName()));
|
builder.linksBuilder().add(makeSelfLink("nameserver", host.getHostName()));
|
||||||
if (outputDataType != OutputDataType.FULL) {
|
if (outputDataType != OutputDataType.FULL) {
|
||||||
builder.remarksBuilder().add(RdapIcannStandardInformation.SUMMARY_DATA_REMARK);
|
builder.remarksBuilder().add(RdapIcannStandardInformation.SUMMARY_DATA_REMARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need the ldhName: RDAP Response Profile 2.9.1, 4.1
|
// We need the ldhName: RDAP Response Profile 2.9.1, 4.1
|
||||||
builder.setLdhName(hostResource.getHostName());
|
builder.setLdhName(host.getHostName());
|
||||||
// Handle is optional, but if given it MUST be the ROID.
|
// Handle is optional, but if given it MUST be the ROID.
|
||||||
// We will set it always as it's important as a "self link"
|
// We will set it always as it's important as a "self link"
|
||||||
builder.setHandle(hostResource.getRepoId());
|
builder.setHandle(host.getRepoId());
|
||||||
|
|
||||||
// Status is optional for internal Nameservers - RDAP Response Profile 2.9.2
|
// Status is optional for internal Nameservers - RDAP Response Profile 2.9.2
|
||||||
// It isn't mentioned at all anywhere else. So we can just not put it at all?
|
// It isn't mentioned at all anywhere else. So we can just not put it at all?
|
||||||
|
@ -434,14 +434,14 @@ public class RdapJsonFormatter {
|
||||||
// To be safe, we'll put it on the "FULL" version anyway
|
// To be safe, we'll put it on the "FULL" version anyway
|
||||||
if (outputDataType == OutputDataType.FULL) {
|
if (outputDataType == OutputDataType.FULL) {
|
||||||
ImmutableSet.Builder<StatusValue> statuses = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<StatusValue> statuses = new ImmutableSet.Builder<>();
|
||||||
statuses.addAll(hostResource.getStatusValues());
|
statuses.addAll(host.getStatusValues());
|
||||||
if (isLinked(hostResource.createVKey(), getRequestTime())) {
|
if (isLinked(host.createVKey(), getRequestTime())) {
|
||||||
statuses.add(StatusValue.LINKED);
|
statuses.add(StatusValue.LINKED);
|
||||||
}
|
}
|
||||||
if (hostResource.isSubordinate()
|
if (host.isSubordinate()
|
||||||
&& tm().transact(
|
&& tm().transact(
|
||||||
() ->
|
() ->
|
||||||
tm().loadByKey(hostResource.getSuperordinateDomain())
|
tm().loadByKey(host.getSuperordinateDomain())
|
||||||
.cloneProjectedAtTime(getRequestTime())
|
.cloneProjectedAtTime(getRequestTime())
|
||||||
.getStatusValues()
|
.getStatusValues()
|
||||||
.contains(StatusValue.PENDING_TRANSFER))) {
|
.contains(StatusValue.PENDING_TRANSFER))) {
|
||||||
|
@ -453,14 +453,14 @@ public class RdapJsonFormatter {
|
||||||
makeStatusValueList(
|
makeStatusValueList(
|
||||||
statuses.build(),
|
statuses.build(),
|
||||||
false, // isRedacted
|
false, // isRedacted
|
||||||
hostResource.getDeletionTime().isBefore(getRequestTime())));
|
host.getDeletionTime().isBefore(getRequestTime())));
|
||||||
}
|
}
|
||||||
|
|
||||||
// For query responses - we MUST have all the ip addresses: RDAP Response Profile 4.2.
|
// For query responses - we MUST have all the ip addresses: RDAP Response Profile 4.2.
|
||||||
//
|
//
|
||||||
// However, it is optional for internal responses: RDAP Response Profile 2.9.2
|
// However, it is optional for internal responses: RDAP Response Profile 2.9.2
|
||||||
if (outputDataType != OutputDataType.INTERNAL) {
|
if (outputDataType != OutputDataType.INTERNAL) {
|
||||||
for (InetAddress inetAddress : hostResource.getInetAddresses()) {
|
for (InetAddress inetAddress : host.getInetAddresses()) {
|
||||||
if (inetAddress instanceof Inet4Address) {
|
if (inetAddress instanceof Inet4Address) {
|
||||||
builder.ipv4Builder().add(InetAddresses.toAddrString(inetAddress));
|
builder.ipv4Builder().add(InetAddresses.toAddrString(inetAddress));
|
||||||
} else if (inetAddress instanceof Inet6Address) {
|
} else if (inetAddress instanceof Inet6Address) {
|
||||||
|
@ -472,8 +472,7 @@ public class RdapJsonFormatter {
|
||||||
// RDAP Response Profile 4.3 - Registrar member is optional, so we only set it for FULL
|
// RDAP Response Profile 4.3 - Registrar member is optional, so we only set it for FULL
|
||||||
if (outputDataType == OutputDataType.FULL) {
|
if (outputDataType == OutputDataType.FULL) {
|
||||||
Registrar registrar =
|
Registrar registrar =
|
||||||
Registrar.loadRequiredRegistrarCached(
|
Registrar.loadRequiredRegistrarCached(host.getPersistedCurrentSponsorRegistrarId());
|
||||||
hostResource.getPersistedCurrentSponsorRegistrarId());
|
|
||||||
builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL));
|
builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL));
|
||||||
}
|
}
|
||||||
if (outputDataType != OutputDataType.INTERNAL) {
|
if (outputDataType != OutputDataType.INTERNAL) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.request.Action.Method.HEAD;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
||||||
import google.registry.rdap.RdapMetrics.EndpointType;
|
import google.registry.rdap.RdapMetrics.EndpointType;
|
||||||
import google.registry.rdap.RdapObjectClasses.RdapNameserver;
|
import google.registry.rdap.RdapObjectClasses.RdapNameserver;
|
||||||
|
@ -61,12 +61,12 @@ public class RdapNameserverAction extends RdapActionBase {
|
||||||
}
|
}
|
||||||
// If there are no undeleted nameservers with the given name, the foreign key should point to
|
// If there are no undeleted nameservers with the given name, the foreign key should point to
|
||||||
// the most recently deleted one.
|
// the most recently deleted one.
|
||||||
Optional<HostResource> hostResource =
|
Optional<Host> host =
|
||||||
loadByForeignKey(
|
loadByForeignKey(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
pathSearchString,
|
pathSearchString,
|
||||||
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
||||||
if (!hostResource.isPresent() || !isAuthorized(hostResource.get())) {
|
if (!host.isPresent() || !isAuthorized(host.get())) {
|
||||||
// RFC7480 5.3 - if the server wishes to respond that it doesn't have data satisfying the
|
// RFC7480 5.3 - if the server wishes to respond that it doesn't have data satisfying the
|
||||||
// query, it MUST reply with 404 response code.
|
// query, it MUST reply with 404 response code.
|
||||||
//
|
//
|
||||||
|
@ -74,6 +74,6 @@ public class RdapNameserverAction extends RdapActionBase {
|
||||||
// exists but we don't want to show it to you", because we DON'T wish to say that.
|
// exists but we don't want to show it to you", because we DON'T wish to say that.
|
||||||
throw new NotFoundException(pathSearchString + " not found");
|
throw new NotFoundException(pathSearchString + " not found");
|
||||||
}
|
}
|
||||||
return rdapJsonFormatter.createRdapNameserver(hostResource.get(), OutputDataType.FULL);
|
return rdapJsonFormatter.createRdapNameserver(host.get(), OutputDataType.FULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.net.InetAddresses;
|
||||||
import com.google.common.primitives.Booleans;
|
import com.google.common.primitives.Booleans;
|
||||||
import com.googlecode.objectify.cmd.Query;
|
import com.googlecode.objectify.cmd.Query;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||||
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
||||||
import google.registry.rdap.RdapMetrics.EndpointType;
|
import google.registry.rdap.RdapMetrics.EndpointType;
|
||||||
|
@ -159,16 +159,15 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
NameserverSearchResponse.builder()
|
NameserverSearchResponse.builder()
|
||||||
.setIncompletenessWarningType(IncompletenessWarningType.COMPLETE);
|
.setIncompletenessWarningType(IncompletenessWarningType.COMPLETE);
|
||||||
|
|
||||||
Optional<HostResource> hostResource =
|
Optional<Host> host =
|
||||||
loadByForeignKey(
|
loadByForeignKey(Host.class, partialStringQuery.getInitialString(), getRequestTime());
|
||||||
HostResource.class, partialStringQuery.getInitialString(), getRequestTime());
|
|
||||||
|
|
||||||
metricInformationBuilder.setNumHostsRetrieved(hostResource.isPresent() ? 1 : 0);
|
metricInformationBuilder.setNumHostsRetrieved(host.isPresent() ? 1 : 0);
|
||||||
|
|
||||||
if (shouldBeVisible(hostResource)) {
|
if (shouldBeVisible(host)) {
|
||||||
builder
|
builder
|
||||||
.nameserverSearchResultsBuilder()
|
.nameserverSearchResultsBuilder()
|
||||||
.add(rdapJsonFormatter.createRdapNameserver(hostResource.get(), OutputDataType.FULL));
|
.add(rdapJsonFormatter.createRdapNameserver(host.get(), OutputDataType.FULL));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
@ -187,7 +186,7 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
throw new UnprocessableEntityException(
|
throw new UnprocessableEntityException(
|
||||||
"A suffix after a wildcard in a nameserver lookup must be an in-bailiwick domain");
|
"A suffix after a wildcard in a nameserver lookup must be an in-bailiwick domain");
|
||||||
}
|
}
|
||||||
List<HostResource> hostList = new ArrayList<>();
|
List<Host> hostList = new ArrayList<>();
|
||||||
for (String fqhn : ImmutableSortedSet.copyOf(domain.get().getSubordinateHosts())) {
|
for (String fqhn : ImmutableSortedSet.copyOf(domain.get().getSubordinateHosts())) {
|
||||||
if (cursorString.isPresent() && (fqhn.compareTo(cursorString.get()) <= 0)) {
|
if (cursorString.isPresent() && (fqhn.compareTo(cursorString.get()) <= 0)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -195,10 +194,9 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
// We can't just check that the host name starts with the initial query string, because
|
// We can't just check that the host name starts with the initial query string, because
|
||||||
// then the query ns.exam*.example.com would match against nameserver ns.example.com.
|
// then the query ns.exam*.example.com would match against nameserver ns.example.com.
|
||||||
if (partialStringQuery.matches(fqhn)) {
|
if (partialStringQuery.matches(fqhn)) {
|
||||||
Optional<HostResource> hostResource =
|
Optional<Host> host = loadByForeignKey(Host.class, fqhn, getRequestTime());
|
||||||
loadByForeignKey(HostResource.class, fqhn, getRequestTime());
|
if (shouldBeVisible(host)) {
|
||||||
if (shouldBeVisible(hostResource)) {
|
hostList.add(host.get());
|
||||||
hostList.add(hostResource.get());
|
|
||||||
if (hostList.size() > rdapResultSetMaxSize) {
|
if (hostList.size() > rdapResultSetMaxSize) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -222,9 +220,9 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
// Add 1 so we can detect truncation.
|
// Add 1 so we can detect truncation.
|
||||||
int querySizeLimit = getStandardQuerySizeLimit();
|
int querySizeLimit = getStandardQuerySizeLimit();
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
Query<HostResource> query =
|
Query<Host> query =
|
||||||
queryItems(
|
queryItems(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
"fullyQualifiedHostName",
|
"fullyQualifiedHostName",
|
||||||
partialStringQuery,
|
partialStringQuery,
|
||||||
cursorString,
|
cursorString,
|
||||||
|
@ -236,9 +234,9 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
return replicaJpaTm()
|
return replicaJpaTm()
|
||||||
.transact(
|
.transact(
|
||||||
() -> {
|
() -> {
|
||||||
CriteriaQueryBuilder<HostResource> queryBuilder =
|
CriteriaQueryBuilder<Host> queryBuilder =
|
||||||
queryItemsSql(
|
queryItemsSql(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
"fullyQualifiedHostName",
|
"fullyQualifiedHostName",
|
||||||
partialStringQuery,
|
partialStringQuery,
|
||||||
cursorString,
|
cursorString,
|
||||||
|
@ -254,11 +252,11 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
private NameserverSearchResponse searchByIp(InetAddress inetAddress) {
|
private NameserverSearchResponse searchByIp(InetAddress inetAddress) {
|
||||||
// Add 1 so we can detect truncation.
|
// Add 1 so we can detect truncation.
|
||||||
int querySizeLimit = getStandardQuerySizeLimit();
|
int querySizeLimit = getStandardQuerySizeLimit();
|
||||||
RdapResultSet<HostResource> rdapResultSet;
|
RdapResultSet<Host> rdapResultSet;
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
Query<HostResource> query =
|
Query<Host> query =
|
||||||
queryItems(
|
queryItems(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
"inetAddresses",
|
"inetAddresses",
|
||||||
inetAddress.getHostAddress(),
|
inetAddress.getHostAddress(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
|
@ -296,11 +294,11 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
javax.persistence.Query query =
|
javax.persistence.Query query =
|
||||||
replicaJpaTm()
|
replicaJpaTm()
|
||||||
.getEntityManager()
|
.getEntityManager()
|
||||||
.createNativeQuery(queryBuilder.toString(), HostResource.class)
|
.createNativeQuery(queryBuilder.toString(), Host.class)
|
||||||
.setMaxResults(querySizeLimit);
|
.setMaxResults(querySizeLimit);
|
||||||
parameters.build().forEach(query::setParameter);
|
parameters.build().forEach(query::setParameter);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<HostResource> resultList = query.getResultList();
|
List<Host> resultList = query.getResultList();
|
||||||
return filterResourcesByVisibility(resultList, querySizeLimit);
|
return filterResourcesByVisibility(resultList, querySizeLimit);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -309,7 +307,7 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
|
|
||||||
/** Output JSON for a lists of hosts contained in an {@link RdapResultSet}. */
|
/** Output JSON for a lists of hosts contained in an {@link RdapResultSet}. */
|
||||||
private NameserverSearchResponse makeSearchResults(
|
private NameserverSearchResponse makeSearchResults(
|
||||||
RdapResultSet<HostResource> resultSet, CursorType cursorType) {
|
RdapResultSet<Host> resultSet, CursorType cursorType) {
|
||||||
return makeSearchResults(
|
return makeSearchResults(
|
||||||
resultSet.resources(),
|
resultSet.resources(),
|
||||||
resultSet.incompletenessWarningType(),
|
resultSet.incompletenessWarningType(),
|
||||||
|
@ -319,7 +317,7 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
|
|
||||||
/** Output JSON for a list of hosts. */
|
/** Output JSON for a list of hosts. */
|
||||||
private NameserverSearchResponse makeSearchResults(
|
private NameserverSearchResponse makeSearchResults(
|
||||||
List<HostResource> hosts,
|
List<Host> hosts,
|
||||||
IncompletenessWarningType incompletenessWarningType,
|
IncompletenessWarningType incompletenessWarningType,
|
||||||
int numHostsRetrieved,
|
int numHostsRetrieved,
|
||||||
CursorType cursorType) {
|
CursorType cursorType) {
|
||||||
|
@ -329,7 +327,7 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase {
|
||||||
NameserverSearchResponse.Builder builder =
|
NameserverSearchResponse.Builder builder =
|
||||||
NameserverSearchResponse.builder().setIncompletenessWarningType(incompletenessWarningType);
|
NameserverSearchResponse.builder().setIncompletenessWarningType(incompletenessWarningType);
|
||||||
Optional<String> newCursor = Optional.empty();
|
Optional<String> newCursor = Optional.empty();
|
||||||
for (HostResource host : Iterables.limit(hosts, rdapResultSetMaxSize)) {
|
for (Host host : Iterables.limit(hosts, rdapResultSetMaxSize)) {
|
||||||
newCursor =
|
newCursor =
|
||||||
Optional.of((cursorType == CursorType.NAME) ? host.getHostName() : host.getRepoId());
|
Optional.of((cursorType == CursorType.NAME) ? host.getHostName() : host.getRepoId());
|
||||||
builder
|
builder
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.xjc.host.XjcHostAddrType;
|
import google.registry.xjc.host.XjcHostAddrType;
|
||||||
import google.registry.xjc.host.XjcHostIpType;
|
import google.registry.xjc.host.XjcHostIpType;
|
||||||
import google.registry.xjc.host.XjcHostStatusType;
|
import google.registry.xjc.host.XjcHostStatusType;
|
||||||
|
@ -30,23 +30,23 @@ import java.net.Inet6Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
/** Utility class that turns {@link HostResource} as {@link XjcRdeHostElement}. */
|
/** Utility class that turns a {@link Host} resource into {@link XjcRdeHostElement}. */
|
||||||
final class HostResourceToXjcConverter {
|
final class HostToXjcConverter {
|
||||||
|
|
||||||
/** Converts a subordinate {@link HostResource} to {@link XjcRdeHostElement}. */
|
/** Converts a subordinate {@link Host} to {@link XjcRdeHostElement}. */
|
||||||
static XjcRdeHostElement convertSubordinate(HostResource host, Domain superordinateDomain) {
|
static XjcRdeHostElement convertSubordinate(Host host, Domain superordinateDomain) {
|
||||||
checkArgument(superordinateDomain.createVKey().equals(host.getSuperordinateDomain()));
|
checkArgument(superordinateDomain.createVKey().equals(host.getSuperordinateDomain()));
|
||||||
return new XjcRdeHostElement(convertSubordinateHost(host, superordinateDomain));
|
return new XjcRdeHostElement(convertSubordinateHost(host, superordinateDomain));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Converts an external {@link HostResource} to {@link XjcRdeHostElement}. */
|
/** Converts an external {@link Host} to {@link XjcRdeHostElement}. */
|
||||||
static XjcRdeHostElement convertExternal(HostResource host) {
|
static XjcRdeHostElement convertExternal(Host host) {
|
||||||
checkArgument(!host.isSubordinate());
|
checkArgument(!host.isSubordinate());
|
||||||
return new XjcRdeHostElement(convertExternalHost(host));
|
return new XjcRdeHostElement(convertExternalHost(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Converts {@link HostResource} to {@link XjcRdeHost}. */
|
/** Converts {@link Host} to {@link XjcRdeHost}. */
|
||||||
static XjcRdeHost convertSubordinateHost(HostResource model, Domain superordinateDomain) {
|
static XjcRdeHost convertSubordinateHost(Host model, Domain superordinateDomain) {
|
||||||
XjcRdeHost bean =
|
XjcRdeHost bean =
|
||||||
convertHostCommon(
|
convertHostCommon(
|
||||||
model,
|
model,
|
||||||
|
@ -58,14 +58,14 @@ final class HostResourceToXjcConverter {
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Converts {@link HostResource} to {@link XjcRdeHost}. */
|
/** Converts {@link Host} to {@link XjcRdeHost}. */
|
||||||
static XjcRdeHost convertExternalHost(HostResource model) {
|
static XjcRdeHost convertExternalHost(Host model) {
|
||||||
return convertHostCommon(
|
return convertHostCommon(
|
||||||
model, model.getPersistedCurrentSponsorRegistrarId(), model.getLastTransferTime());
|
model, model.getPersistedCurrentSponsorRegistrarId(), model.getLastTransferTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static XjcRdeHost convertHostCommon(
|
private static XjcRdeHost convertHostCommon(
|
||||||
HostResource model, String registrarId, DateTime lastTransferTime) {
|
Host model, String registrarId, DateTime lastTransferTime) {
|
||||||
XjcRdeHost bean = new XjcRdeHost();
|
XjcRdeHost bean = new XjcRdeHost();
|
||||||
bean.setName(model.getHostName());
|
bean.setName(model.getHostName());
|
||||||
bean.setRoid(model.getRepoId());
|
bean.setRoid(model.getRepoId());
|
||||||
|
@ -105,5 +105,5 @@ final class HostResourceToXjcConverter {
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HostResourceToXjcConverter() {}
|
private HostToXjcConverter() {}
|
||||||
}
|
}
|
|
@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -71,8 +71,8 @@ public class RdeFragmenter {
|
||||||
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;
|
||||||
} else if (resource instanceof HostResource) {
|
} else if (resource instanceof Host) {
|
||||||
HostResource host = (HostResource) resource;
|
Host host = (Host) resource;
|
||||||
result =
|
result =
|
||||||
Optional.of(
|
Optional.of(
|
||||||
host.isSubordinate()
|
host.isSubordinate()
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.googlecode.objectify.Key;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.tldconfig.idn.IdnTable;
|
import google.registry.tldconfig.idn.IdnTable;
|
||||||
|
@ -129,16 +129,17 @@ public final class RdeMarshaller implements Serializable {
|
||||||
RdeResourceType.DOMAIN, domain, DomainToXjcConverter.convert(domain, mode));
|
RdeResourceType.DOMAIN, domain, DomainToXjcConverter.convert(domain, mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Turns {@link HostResource} object into an XML fragment. */
|
/** Turns {@link Host} object into an XML fragment. */
|
||||||
public DepositFragment marshalSubordinateHost(HostResource host, Domain superordinateDomain) {
|
public DepositFragment marshalSubordinateHost(Host host, Domain superordinateDomain) {
|
||||||
return marshalResource(RdeResourceType.HOST, host,
|
return marshalResource(
|
||||||
HostResourceToXjcConverter.convertSubordinate(host, superordinateDomain));
|
RdeResourceType.HOST,
|
||||||
|
host,
|
||||||
|
HostToXjcConverter.convertSubordinate(host, superordinateDomain));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Turns {@link HostResource} object into an XML fragment. */
|
/** Turns {@link Host} object into an XML fragment. */
|
||||||
public DepositFragment marshalExternalHost(HostResource host) {
|
public DepositFragment marshalExternalHost(Host host) {
|
||||||
return marshalResource(RdeResourceType.HOST, host,
|
return marshalResource(RdeResourceType.HOST, host, HostToXjcConverter.convertExternal(host));
|
||||||
HostResourceToXjcConverter.convertExternal(host));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Turns {@link Registrar} object into an XML fragment. */
|
/** Turns {@link Registrar} object into an XML fragment. */
|
||||||
|
|
|
@ -47,7 +47,7 @@ import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.common.Cursor.CursorType;
|
import google.registry.model.common.Cursor.CursorType;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
|
@ -82,8 +82,8 @@ import org.joda.time.Duration;
|
||||||
* type and loads the embedded resource from it, which is then projected to watermark time to
|
* type and loads the embedded resource from it, which is then projected to watermark time to
|
||||||
* account for things like pending transfer.
|
* account for things like pending transfer.
|
||||||
*
|
*
|
||||||
* <p>Only {@link ContactResource}s and {@link HostResource}s that are referenced by an included
|
* <p>Only {@link ContactResource}s and {@link Host}s that are referenced by an included {@link
|
||||||
* {@link Domain} will be included in the corresponding pending deposit.
|
* Domain} will be included in the corresponding pending deposit.
|
||||||
*
|
*
|
||||||
* <p>{@link Registrar} entities, both active and inactive, are included in all deposits. They are
|
* <p>{@link Registrar} entities, both active and inactive, are included in all deposits. They are
|
||||||
* not rewinded point-in-time.
|
* not rewinded point-in-time.
|
||||||
|
|
|
@ -21,7 +21,7 @@ import com.google.common.base.Strings;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -32,7 +32,7 @@ class CommandUtilities {
|
||||||
/** A useful parameter enum for commands that operate on {@link EppResource} objects. */
|
/** A useful parameter enum for commands that operate on {@link EppResource} objects. */
|
||||||
public enum ResourceType {
|
public enum ResourceType {
|
||||||
CONTACT(ContactResource.class),
|
CONTACT(ContactResource.class),
|
||||||
HOST(HostResource.class),
|
HOST(Host.class),
|
||||||
DOMAIN(Domain.class);
|
DOMAIN(Domain.class);
|
||||||
|
|
||||||
private final Class<? extends EppResource> clazz;
|
private final Class<? extends EppResource> clazz;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.beust.jcommander.Parameters;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.transaction.QueryComposer.Comparator;
|
import google.registry.persistence.transaction.QueryComposer.Comparator;
|
||||||
import google.registry.tools.params.PathParameter;
|
import google.registry.tools.params.PathParameter;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
|
@ -87,8 +87,8 @@ final class GenerateDnsReportCommand implements CommandWithRemoteApi {
|
||||||
write(domain);
|
write(domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterable<HostResource> nameservers = tm().transact(() -> tm().loadAllOf(HostResource.class));
|
Iterable<Host> nameservers = tm().transact(() -> tm().loadAllOf(Host.class));
|
||||||
for (HostResource nameserver : nameservers) {
|
for (Host nameserver : nameservers) {
|
||||||
// Skip deleted hosts and external hosts.
|
// Skip deleted hosts and external hosts.
|
||||||
if (isBeforeOrAt(nameserver.getDeletionTime(), now)
|
if (isBeforeOrAt(nameserver.getDeletionTime(), now)
|
||||||
|| nameserver.getInetAddresses().isEmpty()) {
|
|| nameserver.getInetAddresses().isEmpty()) {
|
||||||
|
@ -126,7 +126,7 @@ final class GenerateDnsReportCommand implements CommandWithRemoteApi {
|
||||||
writeJson(mapBuilder.build());
|
writeJson(mapBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void write(HostResource nameserver) {
|
private void write(Host nameserver) {
|
||||||
ImmutableList<String> ipAddresses =
|
ImmutableList<String> ipAddresses =
|
||||||
nameserver
|
nameserver
|
||||||
.getInetAddresses()
|
.getInetAddresses()
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||||
|
|
||||||
import com.beust.jcommander.Parameter;
|
import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.util.DomainNameUtils;
|
import google.registry.util.DomainNameUtils;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ final class GetHostCommand extends GetEppResourceCommand {
|
||||||
public void runAndPrint() {
|
public void runAndPrint() {
|
||||||
mainParameters.stream()
|
mainParameters.stream()
|
||||||
.map(DomainNameUtils::canonicalizeHostname)
|
.map(DomainNameUtils::canonicalizeHostname)
|
||||||
.forEach(
|
.forEach(h -> printResource("Host", h, loadByForeignKey(Host.class, h, readTimestamp)));
|
||||||
h -> printResource("Host", h, loadByForeignKey(HostResource.class, h, readTimestamp)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.tools;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
import google.registry.tools.server.ListHostsAction;
|
import google.registry.tools.server.ListHostsAction;
|
||||||
|
|
||||||
/** Command to list all HostResource entities in the system. */
|
/** Command to list all Host entities in the system. */
|
||||||
@Parameters(separators = " =", commandDescription = "List all hosts.")
|
@Parameters(separators = " =", commandDescription = "List all hosts.")
|
||||||
final class ListHostsCommand extends ListObjectsCommand {
|
final class ListHostsCommand extends ListObjectsCommand {
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import com.google.template.soy.data.SoyMapData;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.tools.soy.DomainRenewSoyInfo;
|
import google.registry.tools.soy.DomainRenewSoyInfo;
|
||||||
import google.registry.tools.soy.UniformRapidSuspensionSoyInfo;
|
import google.registry.tools.soy.UniformRapidSuspensionSoyInfo;
|
||||||
import google.registry.util.DomainNameUtils;
|
import google.registry.util.DomainNameUtils;
|
||||||
|
@ -130,7 +130,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
|
||||||
checkArgumentPresent(domainOpt, "Domain '%s' does not exist or is deleted", domainName);
|
checkArgumentPresent(domainOpt, "Domain '%s' does not exist or is deleted", domainName);
|
||||||
Domain domain = domainOpt.get();
|
Domain domain = domainOpt.get();
|
||||||
Set<String> missingHosts =
|
Set<String> missingHosts =
|
||||||
difference(newHostsSet, checkResourcesExist(HostResource.class, newCanonicalHosts, now));
|
difference(newHostsSet, checkResourcesExist(Host.class, newCanonicalHosts, now));
|
||||||
checkArgument(missingHosts.isEmpty(), "Hosts do not exist: %s", missingHosts);
|
checkArgument(missingHosts.isEmpty(), "Hosts do not exist: %s", missingHosts);
|
||||||
checkArgument(
|
checkArgument(
|
||||||
locksToPreserve.isEmpty() || undo,
|
locksToPreserve.isEmpty() || undo,
|
||||||
|
@ -204,8 +204,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
|
||||||
|
|
||||||
private ImmutableSortedSet<String> getExistingNameservers(Domain domain) {
|
private ImmutableSortedSet<String> getExistingNameservers(Domain domain) {
|
||||||
ImmutableSortedSet.Builder<String> nameservers = ImmutableSortedSet.naturalOrder();
|
ImmutableSortedSet.Builder<String> nameservers = ImmutableSortedSet.naturalOrder();
|
||||||
for (HostResource host :
|
for (Host host : tm().transact(() -> tm().loadByKeys(domain.getNameservers()).values())) {
|
||||||
tm().transact(() -> tm().loadByKeys(domain.getNameservers()).values())) {
|
|
||||||
nameservers.add(host.getForeignKey());
|
nameservers.add(host.getForeignKey());
|
||||||
}
|
}
|
||||||
return nameservers.build();
|
return nameservers.build();
|
||||||
|
|
|
@ -17,13 +17,13 @@ package google.registry.tools.params;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
|
|
||||||
/** Enum to make it easy for a command to accept a flag that specifies an EppResource subclass. */
|
/** Enum to make it easy for a command to accept a flag that specifies an EppResource subclass. */
|
||||||
public enum EppResourceTypeParameter {
|
public enum EppResourceTypeParameter {
|
||||||
CONTACT(ContactResource.class),
|
CONTACT(ContactResource.class),
|
||||||
DOMAIN(Domain.class),
|
DOMAIN(Domain.class),
|
||||||
HOST(HostResource.class);
|
HOST(Host.class);
|
||||||
|
|
||||||
private final Class<? extends EppResource> type;
|
private final Class<? extends EppResource> type;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.gcs.GcsUtils;
|
import google.registry.gcs.GcsUtils;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.HttpException.BadRequestException;
|
import google.registry.request.HttpException.BadRequestException;
|
||||||
import google.registry.request.JsonActionRunner;
|
import google.registry.request.JsonActionRunner;
|
||||||
|
@ -196,8 +196,8 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
Domain domain, DateTime exportTime, ImmutableList.Builder<String> result) {
|
Domain domain, DateTime exportTime, ImmutableList.Builder<String> result) {
|
||||||
ImmutableSet<String> subordinateHosts = domain.getSubordinateHosts();
|
ImmutableSet<String> subordinateHosts = domain.getSubordinateHosts();
|
||||||
if (!subordinateHosts.isEmpty()) {
|
if (!subordinateHosts.isEmpty()) {
|
||||||
for (HostResource unprojectedHost : tm().loadByKeys(domain.getNameservers()).values()) {
|
for (Host unprojectedHost : tm().loadByKeys(domain.getNameservers()).values()) {
|
||||||
HostResource host = loadAtPointInTime(unprojectedHost, exportTime);
|
Host host = loadAtPointInTime(unprojectedHost, exportTime);
|
||||||
// A null means the host was deleted (or not created) at this time.
|
// A null means the host was deleted (or not created) at this time.
|
||||||
if (host != null && subordinateHosts.contains(host.getHostName())) {
|
if (host != null && subordinateHosts.contains(host.getHostName())) {
|
||||||
String stanza = hostStanza(host, domain.getTld());
|
String stanza = hostStanza(host, domain.getTld());
|
||||||
|
@ -232,7 +232,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
private String domainStanza(Domain domain, DateTime exportTime) {
|
private String domainStanza(Domain domain, DateTime exportTime) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
String domainLabel = stripTld(domain.getDomainName(), domain.getTld());
|
String domainLabel = stripTld(domain.getDomainName(), domain.getTld());
|
||||||
for (HostResource nameserver : tm().loadByKeys(domain.getNameservers()).values()) {
|
for (Host nameserver : tm().loadByKeys(domain.getNameservers()).values()) {
|
||||||
result.append(
|
result.append(
|
||||||
String.format(
|
String.format(
|
||||||
NS_FORMAT,
|
NS_FORMAT,
|
||||||
|
@ -267,7 +267,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
private String hostStanza(HostResource host, String tld) {
|
private String hostStanza(Host host, String tld) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (InetAddress addr : host.getInetAddresses()) {
|
for (InetAddress addr : host.getInetAddresses()) {
|
||||||
// must be either IPv4 or IPv6
|
// must be either IPv4 or IPv6
|
||||||
|
|
|
@ -22,7 +22,7 @@ import static java.util.Comparator.comparing;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import google.registry.model.EppResourceUtils;
|
import google.registry.model.EppResourceUtils;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.auth.Auth;
|
import google.registry.request.auth.Auth;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
|
@ -35,7 +35,7 @@ import org.joda.time.DateTime;
|
||||||
path = ListHostsAction.PATH,
|
path = ListHostsAction.PATH,
|
||||||
method = {GET, POST},
|
method = {GET, POST},
|
||||||
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
|
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
|
||||||
public final class ListHostsAction extends ListObjectsAction<HostResource> {
|
public final class ListHostsAction extends ListObjectsAction<Host> {
|
||||||
|
|
||||||
public static final String PATH = "/_dr/admin/list/hosts";
|
public static final String PATH = "/_dr/admin/list/hosts";
|
||||||
|
|
||||||
|
@ -48,10 +48,10 @@ public final class ListHostsAction extends ListObjectsAction<HostResource> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableSet<HostResource> loadObjects() {
|
public ImmutableSet<Host> loadObjects() {
|
||||||
final DateTime now = clock.nowUtc();
|
final DateTime now = clock.nowUtc();
|
||||||
return tm().transact(() -> tm().loadAllOf(HostResource.class)).stream()
|
return tm().transact(() -> tm().loadAllOf(Host.class)).stream()
|
||||||
.filter(host -> EppResourceUtils.isActive(host, now))
|
.filter(host -> EppResourceUtils.isActive(host, now))
|
||||||
.collect(toImmutableSortedSet(comparing(HostResource::getHostName)));
|
.collect(toImmutableSortedSet(comparing(Host::getHostName)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||||
import static google.registry.model.EppResourceUtils.loadByForeignKeyCached;
|
import static google.registry.model.EppResourceUtils.loadByForeignKeyCached;
|
||||||
|
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ public class NameserverLookupByHostCommand extends DomainOrHostLookupCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Optional<WhoisResponse> getResponse(InternetDomainName hostName, DateTime now) {
|
protected Optional<WhoisResponse> getResponse(InternetDomainName hostName, DateTime now) {
|
||||||
Optional<HostResource> hostResource =
|
Optional<Host> host =
|
||||||
cached
|
cached
|
||||||
? loadByForeignKeyCached(HostResource.class, hostName.toString(), now)
|
? loadByForeignKeyCached(Host.class, hostName.toString(), now)
|
||||||
: loadByForeignKey(HostResource.class, hostName.toString(), now);
|
: loadByForeignKey(Host.class, hostName.toString(), now);
|
||||||
return hostResource.map(host -> new NameserverWhoisResponse(host, now));
|
return host.map(h -> new NameserverWhoisResponse(h, now));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Streams;
|
import com.google.common.collect.Streams;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.tld.Registries;
|
import google.registry.model.tld.Registries;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -51,12 +51,12 @@ final class NameserverLookupByIpCommand implements WhoisCommand {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public WhoisResponse executeQuery(DateTime now) throws WhoisException {
|
public WhoisResponse executeQuery(DateTime now) throws WhoisException {
|
||||||
Iterable<HostResource> hostsFromDb;
|
Iterable<Host> hostsFromDb;
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
hostsFromDb =
|
hostsFromDb =
|
||||||
auditedOfy()
|
auditedOfy()
|
||||||
.load()
|
.load()
|
||||||
.type(HostResource.class)
|
.type(Host.class)
|
||||||
.filter("inetAddresses", ipAddress)
|
.filter("inetAddresses", ipAddress)
|
||||||
.filter("deletionTime >", now.toDate());
|
.filter("deletionTime >", now.toDate());
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,12 +76,12 @@ final class NameserverLookupByIpCommand implements WhoisCommand {
|
||||||
"SELECT * From \"Host\" WHERE "
|
"SELECT * From \"Host\" WHERE "
|
||||||
+ "ARRAY[ CAST(:address AS TEXT) ] <@ inet_addresses AND "
|
+ "ARRAY[ CAST(:address AS TEXT) ] <@ inet_addresses AND "
|
||||||
+ "deletion_time > CAST(:now AS timestamptz)",
|
+ "deletion_time > CAST(:now AS timestamptz)",
|
||||||
HostResource.class)
|
Host.class)
|
||||||
.setParameter("address", InetAddresses.toAddrString(ipAddress))
|
.setParameter("address", InetAddresses.toAddrString(ipAddress))
|
||||||
.setParameter("now", now.toString())
|
.setParameter("now", now.toString())
|
||||||
.getResultList());
|
.getResultList());
|
||||||
}
|
}
|
||||||
ImmutableList<HostResource> hosts =
|
ImmutableList<Host> hosts =
|
||||||
Streams.stream(hostsFromDb)
|
Streams.stream(hostsFromDb)
|
||||||
.filter(
|
.filter(
|
||||||
host ->
|
host ->
|
||||||
|
|
|
@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -32,15 +32,15 @@ import org.joda.time.DateTime;
|
||||||
final class NameserverWhoisResponse extends WhoisResponseImpl {
|
final class NameserverWhoisResponse extends WhoisResponseImpl {
|
||||||
|
|
||||||
/** Nameserver(s) which were the target of this WHOIS command. */
|
/** Nameserver(s) which were the target of this WHOIS command. */
|
||||||
private final ImmutableList<HostResource> hosts;
|
private final ImmutableList<Host> hosts;
|
||||||
|
|
||||||
/** Creates new WHOIS nameserver response on the given host. */
|
/** Creates new WHOIS nameserver response on the given host. */
|
||||||
NameserverWhoisResponse(HostResource host, DateTime timestamp) {
|
NameserverWhoisResponse(Host host, DateTime timestamp) {
|
||||||
this(ImmutableList.of(checkNotNull(host, "host")), timestamp);
|
this(ImmutableList.of(checkNotNull(host, "host")), timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates new WHOIS nameserver response on the given list of hosts. */
|
/** Creates new WHOIS nameserver response on the given list of hosts. */
|
||||||
NameserverWhoisResponse(ImmutableList<HostResource> hosts, DateTime timestamp) {
|
NameserverWhoisResponse(ImmutableList<Host> hosts, DateTime timestamp) {
|
||||||
super(timestamp);
|
super(timestamp);
|
||||||
this.hosts = checkNotNull(hosts, "hosts");
|
this.hosts = checkNotNull(hosts, "hosts");
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,9 @@ final class NameserverWhoisResponse extends WhoisResponseImpl {
|
||||||
@Override
|
@Override
|
||||||
public WhoisResponseResults getResponse(boolean preferUnicode, String disclaimer) {
|
public WhoisResponseResults getResponse(boolean preferUnicode, String disclaimer) {
|
||||||
// If we have subordinate hosts, load their registrar ids in a single transaction up-front.
|
// If we have subordinate hosts, load their registrar ids in a single transaction up-front.
|
||||||
ImmutableList<HostResource> subordinateHosts =
|
ImmutableList<Host> subordinateHosts =
|
||||||
hosts.stream().filter(HostResource::isSubordinate).collect(toImmutableList());
|
hosts.stream().filter(Host::isSubordinate).collect(toImmutableList());
|
||||||
ImmutableMap<HostResource, String> hostRegistrars =
|
ImmutableMap<Host, String> hostRegistrars =
|
||||||
subordinateHosts.isEmpty()
|
subordinateHosts.isEmpty()
|
||||||
? ImmutableMap.of()
|
? ImmutableMap.of()
|
||||||
: tm().transact(
|
: tm().transact(
|
||||||
|
@ -64,7 +64,7 @@ final class NameserverWhoisResponse extends WhoisResponseImpl {
|
||||||
|
|
||||||
BasicEmitter emitter = new BasicEmitter();
|
BasicEmitter emitter = new BasicEmitter();
|
||||||
for (int i = 0; i < hosts.size(); i++) {
|
for (int i = 0; i < hosts.size(); i++) {
|
||||||
HostResource host = hosts.get(i);
|
Host host = hosts.get(i);
|
||||||
String registrarId =
|
String registrarId =
|
||||||
host.isSubordinate()
|
host.isSubordinate()
|
||||||
? hostRegistrars.get(host)
|
? hostRegistrars.get(host)
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<class>google.registry.model.domain.secdns.DomainDsDataHistory</class>
|
<class>google.registry.model.domain.secdns.DomainDsDataHistory</class>
|
||||||
<class>google.registry.model.domain.token.AllocationToken</class>
|
<class>google.registry.model.domain.token.AllocationToken</class>
|
||||||
<class>google.registry.model.host.HostHistory</class>
|
<class>google.registry.model.host.HostHistory</class>
|
||||||
<class>google.registry.model.host.HostResource</class>
|
<class>google.registry.model.host.Host</class>
|
||||||
<class>google.registry.model.poll.PollMessage</class>
|
<class>google.registry.model.poll.PollMessage</class>
|
||||||
<class>google.registry.model.poll.PollMessage$OneTime</class>
|
<class>google.registry.model.poll.PollMessage$OneTime</class>
|
||||||
<class>google.registry.model.poll.PollMessage$Autorenew</class>
|
<class>google.registry.model.poll.PollMessage$Autorenew</class>
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
<class>google.registry.model.contact.VKeyConverter_ContactResource</class>
|
<class>google.registry.model.contact.VKeyConverter_ContactResource</class>
|
||||||
<class>google.registry.model.domain.VKeyConverter_Domain</class>
|
<class>google.registry.model.domain.VKeyConverter_Domain</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_Host</class>
|
||||||
<class>google.registry.model.poll.VKeyConverter_Autorenew</class>
|
<class>google.registry.model.poll.VKeyConverter_Autorenew</class>
|
||||||
<class>google.registry.model.poll.VKeyConverter_OneTime</class>
|
<class>google.registry.model.poll.VKeyConverter_OneTime</class>
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import com.google.cloud.tasks.v2.HttpMethod;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.RegistryLock;
|
import google.registry.model.domain.RegistryLock;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import google.registry.testing.CloudTasksHelper;
|
import google.registry.testing.CloudTasksHelper;
|
||||||
import google.registry.testing.CloudTasksHelper.TaskMatcher;
|
import google.registry.testing.CloudTasksHelper.TaskMatcher;
|
||||||
|
@ -95,7 +95,7 @@ public class RelockDomainActionTest {
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach() throws Exception {
|
void beforeEach() throws Exception {
|
||||||
createTlds("tld", "net");
|
createTlds("tld", "net");
|
||||||
HostResource host = persistActiveHost("ns1.example.net");
|
Host host = persistActiveHost("ns1.example.net");
|
||||||
domain = persistResource(DatabaseHelper.newDomain(DOMAIN_NAME, host));
|
domain = persistResource(DatabaseHelper.newDomain(DOMAIN_NAME, host));
|
||||||
|
|
||||||
oldLock = domainLockUtils.administrativelyApplyLock(DOMAIN_NAME, CLIENT_ID, POC_ID, false);
|
oldLock = domainLockUtils.administrativelyApplyLock(DOMAIN_NAME, CLIENT_ID, POC_ID, false);
|
||||||
|
|
|
@ -62,9 +62,9 @@ import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostBase;
|
import google.registry.model.host.HostBase;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
import google.registry.model.rde.RdeRevision;
|
import google.registry.model.rde.RdeRevision;
|
||||||
import google.registry.model.rde.RdeRevision.RdeRevisionId;
|
import google.registry.model.rde.RdeRevision.RdeRevisionId;
|
||||||
|
@ -272,7 +272,7 @@ public class RdePipelineTest {
|
||||||
|
|
||||||
// This host is never referenced.
|
// This host is never referenced.
|
||||||
persistHostHistory(persistActiveHost("ns0.domain.tld"));
|
persistHostHistory(persistActiveHost("ns0.domain.tld"));
|
||||||
HostResource host1 = persistActiveHost("ns1.external.tld");
|
Host host1 = persistActiveHost("ns1.external.tld");
|
||||||
persistHostHistory(host1);
|
persistHostHistory(host1);
|
||||||
Domain helloDomain =
|
Domain helloDomain =
|
||||||
persistEppResource(
|
persistEppResource(
|
||||||
|
@ -282,7 +282,7 @@ public class RdePipelineTest {
|
||||||
.build());
|
.build());
|
||||||
persistDomainHistory(helloDomain);
|
persistDomainHistory(helloDomain);
|
||||||
persistHostHistory(persistActiveHost("not-used-subordinate.hello.soy"));
|
persistHostHistory(persistActiveHost("not-used-subordinate.hello.soy"));
|
||||||
HostResource host2 = persistActiveHost("ns1.hello.soy");
|
Host host2 = persistActiveHost("ns1.hello.soy");
|
||||||
persistHostHistory(host2);
|
persistHostHistory(host2);
|
||||||
Domain kittyDomain =
|
Domain kittyDomain =
|
||||||
persistEppResource(
|
persistEppResource(
|
||||||
|
@ -306,7 +306,7 @@ public class RdePipelineTest {
|
||||||
persistContactHistory(contact3);
|
persistContactHistory(contact3);
|
||||||
// This is a subordinate domain in TLD .cat, which is not included in any pending deposit. But
|
// This is a subordinate domain in TLD .cat, which is not included in any pending deposit. But
|
||||||
// it should still be included as a subordinate host in the pendign deposit for .soy.
|
// it should still be included as a subordinate host in the pendign deposit for .soy.
|
||||||
HostResource host3 = persistActiveHost("ns1.lol.cat");
|
Host host3 = persistActiveHost("ns1.lol.cat");
|
||||||
persistHostHistory(host3);
|
persistHostHistory(host3);
|
||||||
persistDomainHistory(
|
persistDomainHistory(
|
||||||
helloDomain
|
helloDomain
|
||||||
|
@ -331,7 +331,7 @@ public class RdePipelineTest {
|
||||||
persistDomainHistory(kittyDomain.asBuilder().setDeletionTime(clock.nowUtc()).build());
|
persistDomainHistory(kittyDomain.asBuilder().setDeletionTime(clock.nowUtc()).build());
|
||||||
ContactResource futureContact = persistActiveContact("future-contact");
|
ContactResource futureContact = persistActiveContact("future-contact");
|
||||||
persistContactHistory(futureContact);
|
persistContactHistory(futureContact);
|
||||||
HostResource futureHost = persistActiveHost("ns1.future.tld");
|
Host futureHost = persistActiveHost("ns1.future.tld");
|
||||||
persistHostHistory(futureHost);
|
persistHostHistory(futureHost);
|
||||||
persistDomainHistory(
|
persistDomainHistory(
|
||||||
persistEppResource(
|
persistEppResource(
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||||
import static com.google.common.io.BaseEncoding.base16;
|
import static com.google.common.io.BaseEncoding.base16;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doThrow;
|
import static org.mockito.Mockito.doThrow;
|
||||||
|
@ -41,7 +41,7 @@ import google.registry.dns.writer.clouddns.CloudDnsWriter.ZoneStateException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -283,31 +283,28 @@ public class CloudDnsWriterTest {
|
||||||
|
|
||||||
/** Returns a domain to be persisted in Datastore. */
|
/** Returns a domain to be persisted in Datastore. */
|
||||||
private static Domain fakeDomain(
|
private static Domain fakeDomain(
|
||||||
String domainName, ImmutableSet<HostResource> nameservers, int numDsRecords) {
|
String domainName, ImmutableSet<Host> nameservers, int numDsRecords) {
|
||||||
ImmutableSet.Builder<DelegationSignerData> dsDataBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<DelegationSignerData> dsDataBuilder = new ImmutableSet.Builder<>();
|
||||||
|
|
||||||
for (int i = 0; i < numDsRecords; i++) {
|
for (int i = 0; i < numDsRecords; i++) {
|
||||||
dsDataBuilder.add(DelegationSignerData.create(i, 3, 1, base16().decode("1234567890ABCDEF")));
|
dsDataBuilder.add(DelegationSignerData.create(i, 3, 1, base16().decode("1234567890ABCDEF")));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet.Builder<VKey<HostResource>> hostResourceRefBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<VKey<Host>> hostRefBuilder = new ImmutableSet.Builder<>();
|
||||||
for (HostResource nameserver : nameservers) {
|
for (Host nameserver : nameservers) {
|
||||||
hostResourceRefBuilder.add(nameserver.createVKey());
|
hostRefBuilder.add(nameserver.createVKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
return DatabaseHelper.newDomain(domainName)
|
return DatabaseHelper.newDomain(domainName)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(hostResourceRefBuilder.build())
|
.setNameservers(hostRefBuilder.build())
|
||||||
.setDsData(dsDataBuilder.build())
|
.setDsData(dsDataBuilder.build())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a nameserver used for its NS record. */
|
/** Returns a nameserver used for its NS record. */
|
||||||
private static HostResource fakeHost(String nameserver, InetAddress... addresses) {
|
private static Host fakeHost(String nameserver, InetAddress... addresses) {
|
||||||
return newHostResource(nameserver)
|
return newHost(nameserver).asBuilder().setInetAddresses(ImmutableSet.copyOf(addresses)).build();
|
||||||
.asBuilder()
|
|
||||||
.setInetAddresses(ImmutableSet.copyOf(addresses))
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.io.BaseEncoding.base16;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveSubordinateHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveSubordinateHost;
|
||||||
|
@ -38,7 +38,7 @@ import com.google.common.net.InetAddresses;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.ofy.Ofy;
|
import google.registry.model.ofy.Ofy;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -98,8 +98,8 @@ public class DnsUpdateWriterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPublishDomainCreate_publishesNameServers() throws Exception {
|
void testPublishDomainCreate_publishesNameServers() throws Exception {
|
||||||
HostResource host1 = persistActiveHost("ns1.example.tld");
|
Host host1 = persistActiveHost("ns1.example.tld");
|
||||||
HostResource host2 = persistActiveHost("ns2.example.tld");
|
Host host2 = persistActiveHost("ns2.example.tld");
|
||||||
Domain domain =
|
Domain domain =
|
||||||
persistActiveDomain("example.tld")
|
persistActiveDomain("example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -121,7 +121,7 @@ public class DnsUpdateWriterTest {
|
||||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||||
@Test
|
@Test
|
||||||
void testPublishAtomic_noCommit() {
|
void testPublishAtomic_noCommit() {
|
||||||
HostResource host1 = persistActiveHost("ns.example1.tld");
|
Host host1 = persistActiveHost("ns.example1.tld");
|
||||||
Domain domain1 =
|
Domain domain1 =
|
||||||
persistActiveDomain("example1.tld")
|
persistActiveDomain("example1.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -129,7 +129,7 @@ public class DnsUpdateWriterTest {
|
||||||
.build();
|
.build();
|
||||||
persistResource(domain1);
|
persistResource(domain1);
|
||||||
|
|
||||||
HostResource host2 = persistActiveHost("ns.example2.tld");
|
Host host2 = persistActiveHost("ns.example2.tld");
|
||||||
Domain domain2 =
|
Domain domain2 =
|
||||||
persistActiveDomain("example2.tld")
|
persistActiveDomain("example2.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -145,7 +145,7 @@ public class DnsUpdateWriterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPublishAtomic_oneUpdate() throws Exception {
|
void testPublishAtomic_oneUpdate() throws Exception {
|
||||||
HostResource host1 = persistActiveHost("ns.example1.tld");
|
Host host1 = persistActiveHost("ns.example1.tld");
|
||||||
Domain domain1 =
|
Domain domain1 =
|
||||||
persistActiveDomain("example1.tld")
|
persistActiveDomain("example1.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -153,7 +153,7 @@ public class DnsUpdateWriterTest {
|
||||||
.build();
|
.build();
|
||||||
persistResource(domain1);
|
persistResource(domain1);
|
||||||
|
|
||||||
HostResource host2 = persistActiveHost("ns.example2.tld");
|
Host host2 = persistActiveHost("ns.example2.tld");
|
||||||
Domain domain2 =
|
Domain domain2 =
|
||||||
persistActiveDomain("example2.tld")
|
persistActiveDomain("example2.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -235,9 +235,9 @@ public class DnsUpdateWriterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPublishHostCreate_publishesAddressRecords() throws Exception {
|
void testPublishHostCreate_publishesAddressRecords() throws Exception {
|
||||||
HostResource host =
|
Host host =
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setInetAddresses(
|
.setInetAddresses(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
|
@ -305,10 +305,10 @@ public class DnsUpdateWriterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPublishDomainExternalAndInBailiwickNameServer() throws Exception {
|
void testPublishDomainExternalAndInBailiwickNameServer() throws Exception {
|
||||||
HostResource externalNameserver = persistResource(newHostResource("ns1.example.com"));
|
Host externalNameserver = persistResource(newHost("ns1.example.com"));
|
||||||
HostResource inBailiwickNameserver =
|
Host inBailiwickNameserver =
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setInetAddresses(
|
.setInetAddresses(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
|
@ -342,9 +342,9 @@ public class DnsUpdateWriterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPublishDomainDeleteOrphanGlues() throws Exception {
|
void testPublishDomainDeleteOrphanGlues() throws Exception {
|
||||||
HostResource inBailiwickNameserver =
|
Host inBailiwickNameserver =
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setInetAddresses(
|
.setInetAddresses(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
|
@ -401,7 +401,7 @@ public class DnsUpdateWriterTest {
|
||||||
@SuppressWarnings("AssertThrowsMultipleStatements")
|
@SuppressWarnings("AssertThrowsMultipleStatements")
|
||||||
@Test
|
@Test
|
||||||
void testPublishHostFails_whenDnsUpdateReturnsError() throws Exception {
|
void testPublishHostFails_whenDnsUpdateReturnsError() throws Exception {
|
||||||
HostResource host =
|
Host host =
|
||||||
persistActiveSubordinateHost("ns1.example.tld", persistActiveDomain("example.tld"))
|
persistActiveSubordinateHost("ns1.example.tld", persistActiveDomain("example.tld"))
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("10.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("10.0.0.1")))
|
||||||
|
|
|
@ -20,11 +20,11 @@ import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||||
import static google.registry.testing.EppMetricSubject.assertThat;
|
import static google.registry.testing.EppMetricSubject.assertThat;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -210,8 +210,8 @@ class EppLifecycleHostTest extends EppTestCase {
|
||||||
|
|
||||||
DateTime timeAfterCreates = DateTime.parse("2000-06-01T00:06:00Z");
|
DateTime timeAfterCreates = DateTime.parse("2000-06-01T00:06:00Z");
|
||||||
|
|
||||||
HostResource exampleBarFooTldHost =
|
Host exampleBarFooTldHost =
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.bar.foo.tld", timeAfterCreates).get();
|
loadByForeignKey(Host.class, "ns1.example.bar.foo.tld", timeAfterCreates).get();
|
||||||
Domain exampleBarFooTldDomain =
|
Domain exampleBarFooTldDomain =
|
||||||
loadByForeignKey(Domain.class, "example.bar.foo.tld", timeAfterCreates).get();
|
loadByForeignKey(Domain.class, "example.bar.foo.tld", timeAfterCreates).get();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
|
@ -220,8 +220,8 @@ class EppLifecycleHostTest extends EppTestCase {
|
||||||
assertThat(exampleBarFooTldDomain.getSubordinateHosts())
|
assertThat(exampleBarFooTldDomain.getSubordinateHosts())
|
||||||
.containsExactly("ns1.example.bar.foo.tld");
|
.containsExactly("ns1.example.bar.foo.tld");
|
||||||
|
|
||||||
HostResource exampleFooTldHost =
|
Host exampleFooTldHost =
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.foo.tld", timeAfterCreates).get();
|
loadByForeignKey(Host.class, "ns1.example.foo.tld", timeAfterCreates).get();
|
||||||
Domain exampleFooTldDomain =
|
Domain exampleFooTldDomain =
|
||||||
loadByForeignKey(Domain.class, "example.foo.tld", timeAfterCreates).get();
|
loadByForeignKey(Domain.class, "example.foo.tld", timeAfterCreates).get();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
|
@ -229,8 +229,7 @@ class EppLifecycleHostTest extends EppTestCase {
|
||||||
.hasSuperordinateDomain(exampleFooTldDomain.createVKey());
|
.hasSuperordinateDomain(exampleFooTldDomain.createVKey());
|
||||||
assertThat(exampleFooTldDomain.getSubordinateHosts()).containsExactly("ns1.example.foo.tld");
|
assertThat(exampleFooTldDomain.getSubordinateHosts()).containsExactly("ns1.example.foo.tld");
|
||||||
|
|
||||||
HostResource exampleTldHost =
|
Host exampleTldHost = loadByForeignKey(Host.class, "ns1.example.tld", timeAfterCreates).get();
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.tld", timeAfterCreates).get();
|
|
||||||
Domain exampleTldDomain = loadByForeignKey(Domain.class, "example.tld", timeAfterCreates).get();
|
Domain exampleTldDomain = loadByForeignKey(Domain.class, "example.tld", timeAfterCreates).get();
|
||||||
assertAboutHosts().that(exampleTldHost).hasSuperordinateDomain(exampleTldDomain.createVKey());
|
assertAboutHosts().that(exampleTldHost).hasSuperordinateDomain(exampleTldDomain.createVKey());
|
||||||
assertThat(exampleTldDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
assertThat(exampleTldDomain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
||||||
|
|
|
@ -43,7 +43,7 @@ import static google.registry.testing.DatabaseHelper.deleteTld;
|
||||||
import static google.registry.testing.DatabaseHelper.getHistoryEntries;
|
import static google.registry.testing.DatabaseHelper.getHistoryEntries;
|
||||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatabaseHelper.newContactResource;
|
import static google.registry.testing.DatabaseHelper.newContactResource;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||||
|
@ -1698,8 +1698,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||||
persistActiveHost("ns1.example.net");
|
persistActiveHost("ns1.example.net");
|
||||||
persistActiveContact("jd1234");
|
persistActiveContact("jd1234");
|
||||||
persistActiveContact("sh8013");
|
persistActiveContact("sh8013");
|
||||||
persistResource(
|
persistResource(newHost("ns2.example.net").asBuilder().addStatusValue(PENDING_DELETE).build());
|
||||||
newHostResource("ns2.example.net").asBuilder().addStatusValue(PENDING_DELETE).build());
|
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
|
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
|
||||||
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
|
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
|
||||||
|
|
|
@ -44,7 +44,7 @@ import static google.registry.testing.DatabaseHelper.loadByKey;
|
||||||
import static google.registry.testing.DatabaseHelper.loadByKeyIfPresent;
|
import static google.registry.testing.DatabaseHelper.loadByKeyIfPresent;
|
||||||
import static google.registry.testing.DatabaseHelper.loadByKeysIfPresent;
|
import static google.registry.testing.DatabaseHelper.loadByKeysIfPresent;
|
||||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistDeletedDomain;
|
import static google.registry.testing.DatabaseHelper.persistDeletedDomain;
|
||||||
|
@ -88,7 +88,7 @@ import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
|
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
|
@ -732,7 +732,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
setUpGracePeriods(
|
setUpGracePeriods(
|
||||||
GracePeriod.forBillingEvent(GracePeriodStatus.ADD, domain.getRepoId(), graceBillingEvent));
|
GracePeriod.forBillingEvent(GracePeriodStatus.ADD, domain.getRepoId(), graceBillingEvent));
|
||||||
// Add a nameserver.
|
// Add a nameserver.
|
||||||
HostResource host = persistResource(newHostResource("ns1.example.tld"));
|
Host host = persistResource(newHost("ns1.example.tld"));
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByForeignKey(Domain.class, getUniqueIdFromCommand(), clock.nowUtc())
|
loadByForeignKey(Domain.class, getUniqueIdFromCommand(), clock.nowUtc())
|
||||||
.get()
|
.get()
|
||||||
|
@ -763,7 +763,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
void testSuccess_deletedSubordinateDomain() throws Exception {
|
void testSuccess_deletedSubordinateDomain() throws Exception {
|
||||||
setUpSuccessfulTest();
|
setUpSuccessfulTest();
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1." + getUniqueIdFromCommand())
|
newHost("ns1." + getUniqueIdFromCommand())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(reloadResourceByForeignKey().createVKey())
|
.setSuperordinateDomain(reloadResourceByForeignKey().createVKey())
|
||||||
.setDeletionTime(clock.nowUtc().minusDays(1))
|
.setDeletionTime(clock.nowUtc().minusDays(1))
|
||||||
|
@ -809,9 +809,9 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||||
@Test
|
@Test
|
||||||
void testFailure_hasSubordinateHosts() throws Exception {
|
void testFailure_hasSubordinateHosts() throws Exception {
|
||||||
Domain domain = persistActiveDomain(getUniqueIdFromCommand());
|
Domain domain = persistActiveDomain(getUniqueIdFromCommand());
|
||||||
HostResource subordinateHost =
|
Host subordinateHost =
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1." + getUniqueIdFromCommand())
|
newHost("ns1." + getUniqueIdFromCommand())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(reloadResourceByForeignKey().createVKey())
|
.setSuperordinateDomain(reloadResourceByForeignKey().createVKey())
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -64,7 +64,7 @@ import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
|
@ -101,9 +101,9 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
|
|
||||||
private ContactResource registrant;
|
private ContactResource registrant;
|
||||||
private ContactResource contact;
|
private ContactResource contact;
|
||||||
private HostResource host1;
|
private Host host1;
|
||||||
private HostResource host2;
|
private Host host2;
|
||||||
private HostResource host3;
|
private Host host3;
|
||||||
private Domain domain;
|
private Domain domain;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
@ -147,7 +147,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||||
// 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 Host.Builder()
|
||||||
.setHostName("ns2.example.tld")
|
.setHostName("ns2.example.tld")
|
||||||
.setRepoId("3FF-TLD")
|
.setRepoId("3FF-TLD")
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
|
|
@ -39,7 +39,7 @@ import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
import google.registry.model.transfer.TransferData;
|
import google.registry.model.transfer.TransferData;
|
||||||
|
@ -73,7 +73,7 @@ abstract class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||||
|
|
||||||
protected ContactResource contact;
|
protected ContactResource contact;
|
||||||
protected Domain domain;
|
protected Domain domain;
|
||||||
HostResource subordinateHost;
|
Host subordinateHost;
|
||||||
private DomainHistory historyEntryDomainCreate;
|
private DomainHistory historyEntryDomainCreate;
|
||||||
|
|
||||||
DomainTransferFlowTestCase() {
|
DomainTransferFlowTestCase() {
|
||||||
|
@ -111,7 +111,7 @@ abstract class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||||
REGISTRATION_EXPIRATION_TIME);
|
REGISTRATION_EXPIRATION_TIME);
|
||||||
subordinateHost =
|
subordinateHost =
|
||||||
persistResource(
|
persistResource(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setRepoId("2-".concat(Ascii.toUpperCase(tld)))
|
.setRepoId("2-".concat(Ascii.toUpperCase(tld)))
|
||||||
.setHostName("ns1." + label + "." + tld)
|
.setHostName("ns1." + label + "." + tld)
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
|
|
@ -41,7 +41,7 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
import static org.joda.money.CurrencyUnit.JPY;
|
import static org.joda.money.CurrencyUnit.JPY;
|
||||||
import static org.joda.money.CurrencyUnit.USD;
|
import static org.joda.money.CurrencyUnit.USD;
|
||||||
|
|
|
@ -99,7 +99,7 @@ import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
|
@ -148,8 +148,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
}
|
}
|
||||||
|
|
||||||
private Domain persistDomainWithRegistrant() throws Exception {
|
private Domain persistDomainWithRegistrant() throws Exception {
|
||||||
HostResource host =
|
Host host = loadByForeignKey(Host.class, "ns1.example.foo", clock.nowUtc()).get();
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()).get();
|
|
||||||
Domain domain =
|
Domain domain =
|
||||||
persistResource(
|
persistResource(
|
||||||
DatabaseHelper.newDomain(getUniqueIdFromCommand())
|
DatabaseHelper.newDomain(getUniqueIdFromCommand())
|
||||||
|
@ -174,8 +173,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
}
|
}
|
||||||
|
|
||||||
private Domain persistDomain() throws Exception {
|
private Domain persistDomain() throws Exception {
|
||||||
HostResource host =
|
Host host = loadByForeignKey(Host.class, "ns1.example.foo", clock.nowUtc()).get();
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()).get();
|
|
||||||
Domain domain =
|
Domain domain =
|
||||||
persistResource(
|
persistResource(
|
||||||
DatabaseHelper.newDomain(getUniqueIdFromCommand())
|
DatabaseHelper.newDomain(getUniqueIdFromCommand())
|
||||||
|
@ -289,12 +287,11 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modifyDomainToHave13Nameservers() throws Exception {
|
private void modifyDomainToHave13Nameservers() throws Exception {
|
||||||
ImmutableSet.Builder<VKey<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<VKey<Host>> nameservers = new ImmutableSet.Builder<>();
|
||||||
for (int i = 1; i < 15; i++) {
|
for (int i = 1; i < 15; i++) {
|
||||||
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
||||||
nameservers.add(
|
nameservers.add(
|
||||||
loadByForeignKey(
|
loadByForeignKey(Host.class, String.format("ns%d.example.foo", i), clock.nowUtc())
|
||||||
HostResource.class, String.format("ns%d.example.foo", i), clock.nowUtc())
|
|
||||||
.get()
|
.get()
|
||||||
.createVKey());
|
.createVKey());
|
||||||
}
|
}
|
||||||
|
@ -318,9 +315,9 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistDomain();
|
persistDomain();
|
||||||
setEppInput("domain_update_max_everything.xml");
|
setEppInput("domain_update_max_everything.xml");
|
||||||
// Create 26 hosts and 8 contacts. Start the domain with half of them.
|
// Create 26 hosts and 8 contacts. Start the domain with half of them.
|
||||||
ImmutableSet.Builder<VKey<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<VKey<Host>> nameservers = new ImmutableSet.Builder<>();
|
||||||
for (int i = 0; i < 26; i++) {
|
for (int i = 0; i < 26; i++) {
|
||||||
HostResource host = persistActiveHost(String.format("max_test_%d.example.tld", i));
|
Host host = persistActiveHost(String.format("max_test_%d.example.tld", i));
|
||||||
if (i < 13) {
|
if (i < 13) {
|
||||||
nameservers.add(host.createVKey());
|
nameservers.add(host.createVKey());
|
||||||
}
|
}
|
||||||
|
@ -394,7 +391,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
Domain domain = persistDomain();
|
Domain domain = persistDomain();
|
||||||
persistActiveSubordinateHost("ns1.example.tld", domain);
|
persistActiveSubordinateHost("ns1.example.tld", domain);
|
||||||
HostResource addedHost = persistActiveSubordinateHost("ns2.example.tld", domain);
|
Host addedHost = persistActiveSubordinateHost("ns2.example.tld", domain);
|
||||||
persistResource(
|
persistResource(
|
||||||
domain
|
domain
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -402,7 +399,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
.addSubordinateHost("ns2.example.tld")
|
.addSubordinateHost("ns2.example.tld")
|
||||||
.setNameservers(
|
.setNameservers(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc())
|
loadByForeignKey(Host.class, "ns1.example.tld", clock.nowUtc())
|
||||||
.get()
|
.get()
|
||||||
.createVKey()))
|
.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -412,9 +409,8 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
assertThat(domain.getNameservers()).containsExactly(addedHost.createVKey());
|
assertThat(domain.getNameservers()).containsExactly(addedHost.createVKey());
|
||||||
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld", "ns2.example.tld");
|
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld", "ns2.example.tld");
|
||||||
HostResource existingHost =
|
Host existingHost = loadByForeignKey(Host.class, "ns1.example.tld", clock.nowUtc()).get();
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()).get();
|
addedHost = loadByForeignKey(Host.class, "ns2.example.tld", clock.nowUtc()).get();
|
||||||
addedHost = loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc()).get();
|
|
||||||
assertThat(existingHost.getSuperordinateDomain()).isEqualTo(domain.createVKey());
|
assertThat(existingHost.getSuperordinateDomain()).isEqualTo(domain.createVKey());
|
||||||
assertThat(addedHost.getSuperordinateDomain()).isEqualTo(domain.createVKey());
|
assertThat(addedHost.getSuperordinateDomain()).isEqualTo(domain.createVKey());
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1417,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(
|
.setNameservers(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())
|
loadByForeignKey(Host.class, "ns1.example.foo", clock.nowUtc())
|
||||||
.get()
|
.get()
|
||||||
.createVKey()))
|
.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1507,7 +1503,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
persistActiveContact("mak21");
|
persistActiveContact("mak21");
|
||||||
persistActiveContact("sh8013");
|
persistActiveContact("sh8013");
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())
|
loadByForeignKey(Host.class, "ns2.example.foo", clock.nowUtc())
|
||||||
.get()
|
.get()
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||||
|
@ -1562,15 +1558,11 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
.build());
|
.build());
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers())
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
.doesNotContain(
|
.doesNotContain(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())
|
loadByForeignKey(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey());
|
||||||
.get()
|
|
||||||
.createVKey());
|
|
||||||
runFlow();
|
runFlow();
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers())
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
.contains(
|
.contains(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())
|
loadByForeignKey(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey());
|
||||||
.get()
|
|
||||||
.createVKey());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1637,9 +1629,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
reloadResourceByForeignKey()
|
reloadResourceByForeignKey()
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.addNameserver(
|
.addNameserver(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())
|
loadByForeignKey(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey())
|
||||||
.get()
|
|
||||||
.createVKey())
|
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld")
|
Registry.get("tld")
|
||||||
|
@ -1649,15 +1639,12 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||||
.build());
|
.build());
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers())
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
.contains(
|
.contains(
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())
|
loadByForeignKey(Host.class, "ns1.example.foo", clock.nowUtc()).get().createVKey());
|
||||||
.get()
|
|
||||||
.createVKey());
|
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlow();
|
runFlow();
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers())
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
.doesNotContain(
|
.doesNotContain(
|
||||||
Key.create(
|
Key.create(loadByForeignKey(Host.class, "ns1.example.foo", clock.nowUtc()).get()));
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()).get()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -24,11 +24,11 @@ import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowUtils.NotLoggedInException;
|
import google.registry.flows.FlowUtils.NotLoggedInException;
|
||||||
import google.registry.flows.ResourceCheckFlowTestCase;
|
import google.registry.flows.ResourceCheckFlowTestCase;
|
||||||
import google.registry.flows.exceptions.TooManyResourceChecksException;
|
import google.registry.flows.exceptions.TooManyResourceChecksException;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link HostCheckFlow}. */
|
/** Unit tests for {@link HostCheckFlow}. */
|
||||||
class HostCheckFlowTest extends ResourceCheckFlowTestCase<HostCheckFlow, HostResource> {
|
class HostCheckFlowTest extends ResourceCheckFlowTestCase<HostCheckFlow, Host> {
|
||||||
|
|
||||||
HostCheckFlowTest() {
|
HostCheckFlowTest() {
|
||||||
setEppInput("host_check.xml");
|
setEppInput("host_check.xml");
|
||||||
|
|
|
@ -19,13 +19,13 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistDeletedHost;
|
import static google.registry.testing.DatabaseHelper.persistDeletedHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
@ -51,14 +51,14 @@ import google.registry.flows.host.HostFlowUtils.SuperordinateDomainDoesNotExistE
|
||||||
import google.registry.flows.host.HostFlowUtils.SuperordinateDomainInPendingDeleteException;
|
import google.registry.flows.host.HostFlowUtils.SuperordinateDomainInPendingDeleteException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link HostCreateFlow}. */
|
/** Unit tests for {@link HostCreateFlow}. */
|
||||||
class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, HostResource> {
|
class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Host> {
|
||||||
|
|
||||||
private void setEppHostCreateInput(String hostName, String hostAddrs) {
|
private void setEppHostCreateInput(String hostName, String hostAddrs) {
|
||||||
setEppInput(
|
setEppInput(
|
||||||
|
@ -83,7 +83,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, HostResour
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
runFlowAssertResponse(loadFile("host_create_response.xml"));
|
runFlowAssertResponse(loadFile("host_create_response.xml"));
|
||||||
HostResource host = reloadResourceByForeignKey();
|
Host host = reloadResourceByForeignKey();
|
||||||
// Check that the host was created and persisted with a history entry.
|
// Check that the host was created and persisted with a history entry.
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(host)
|
.that(host)
|
||||||
|
@ -124,7 +124,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, HostResour
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_internalNeverExisted() throws Exception {
|
void testSuccess_internalNeverExisted() throws Exception {
|
||||||
doSuccessfulInternalTest("tld");
|
doSuccessfulInternalTest("tld");
|
||||||
HostResource host = reloadResourceByForeignKey();
|
Host host = reloadResourceByForeignKey();
|
||||||
Domain superordinateDomain =
|
Domain superordinateDomain =
|
||||||
loadByForeignKey(Domain.class, "example.tld", clock.nowUtc()).get();
|
loadByForeignKey(Domain.class, "example.tld", clock.nowUtc()).get();
|
||||||
assertAboutHosts().that(host).hasSuperordinateDomain(superordinateDomain.createVKey());
|
assertAboutHosts().that(host).hasSuperordinateDomain(superordinateDomain.createVKey());
|
||||||
|
@ -153,7 +153,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, HostResour
|
||||||
void testSuccess_internalExistedButWasDeleted() throws Exception {
|
void testSuccess_internalExistedButWasDeleted() throws Exception {
|
||||||
persistDeletedHost(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
persistDeletedHost(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||||
doSuccessfulInternalTest("tld");
|
doSuccessfulInternalTest("tld");
|
||||||
HostResource host = reloadResourceByForeignKey();
|
Host host = reloadResourceByForeignKey();
|
||||||
Domain superordinateDomain =
|
Domain superordinateDomain =
|
||||||
loadByForeignKey(Domain.class, "example.tld", clock.nowUtc()).get();
|
loadByForeignKey(Domain.class, "example.tld", clock.nowUtc()).get();
|
||||||
assertAboutHosts().that(host).hasSuperordinateDomain(superordinateDomain.createVKey());
|
assertAboutHosts().that(host).hasSuperordinateDomain(superordinateDomain.createVKey());
|
||||||
|
@ -223,7 +223,7 @@ class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, HostResour
|
||||||
setEppHostCreateInput("ns1.example.tld", null);
|
setEppHostCreateInput("ns1.example.tld", null);
|
||||||
String targetId = getUniqueIdFromCommand();
|
String targetId = getUniqueIdFromCommand();
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(targetId)
|
newHost(targetId)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -19,12 +19,12 @@ import static google.registry.batch.AsyncTaskEnqueuer.QUEUE_ASYNC_DELETE;
|
||||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.loadByKey;
|
import static google.registry.testing.DatabaseHelper.loadByKey;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistDeletedHost;
|
import static google.registry.testing.DatabaseHelper.persistDeletedHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
||||||
|
@ -44,7 +44,7 @@ import google.registry.flows.host.HostFlowUtils.HostNameNotNormalizedException;
|
||||||
import google.registry.flows.host.HostFlowUtils.HostNameNotPunyCodedException;
|
import google.registry.flows.host.HostFlowUtils.HostNameNotPunyCodedException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry.Type;
|
import google.registry.model.reporting.HistoryEntry.Type;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
import google.registry.model.transfer.DomainTransferData;
|
import google.registry.model.transfer.DomainTransferData;
|
||||||
|
@ -55,7 +55,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link HostDeleteFlow}. */
|
/** Unit tests for {@link HostDeleteFlow}. */
|
||||||
class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResource> {
|
class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Host> {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void initFlowTest() {
|
void initFlowTest() {
|
||||||
|
@ -111,7 +111,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
|
|
||||||
private void doFailingStatusTest(StatusValue statusValue, Class<? extends Exception> exception) {
|
private void doFailingStatusTest(StatusValue statusValue, Class<? extends Exception> exception) {
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(statusValue))
|
.setStatusValues(ImmutableSet.of(statusValue))
|
||||||
.build());
|
.build());
|
||||||
|
@ -166,7 +166,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -187,7 +187,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -220,7 +220,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -254,7 +254,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -307,7 +307,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResour
|
||||||
|
|
||||||
private void assertSqlDeleteSuccess(boolean isSubordinate) throws Exception {
|
private void assertSqlDeleteSuccess(boolean isSubordinate) throws Exception {
|
||||||
assertThat(reloadResourceByForeignKey()).isNull();
|
assertThat(reloadResourceByForeignKey()).isNull();
|
||||||
HostResource deletedHost = reloadResourceByForeignKey(clock.nowUtc().minusMillis(1));
|
Host deletedHost = reloadResourceByForeignKey(clock.nowUtc().minusMillis(1));
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(deletedHost)
|
.that(deletedHost)
|
||||||
.isNotActiveAt(clock.nowUtc())
|
.isNotActiveAt(clock.nowUtc())
|
||||||
|
|
|
@ -35,7 +35,7 @@ import google.registry.flows.host.HostFlowUtils.HostNameNotNormalizedException;
|
||||||
import google.registry.flows.host.HostFlowUtils.HostNameNotPunyCodedException;
|
import google.registry.flows.host.HostFlowUtils.HostNameNotPunyCodedException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -43,7 +43,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link HostInfoFlow}. */
|
/** Unit tests for {@link HostInfoFlow}. */
|
||||||
class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource> {
|
class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, Host> {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void initHostTest() {
|
void initHostTest() {
|
||||||
|
@ -51,9 +51,9 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource>
|
||||||
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));
|
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private HostResource persistHostResource() throws Exception {
|
private Host persistHost() throws Exception {
|
||||||
return persistResource(
|
return persistResource(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setHostName(getUniqueIdFromCommand())
|
.setHostName(getUniqueIdFromCommand())
|
||||||
.setRepoId("1FF-FOOBAR")
|
.setRepoId("1FF-FOOBAR")
|
||||||
.setPersistedCurrentSponsorRegistrarId("my sponsor")
|
.setPersistedCurrentSponsorRegistrarId("my sponsor")
|
||||||
|
@ -81,7 +81,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource>
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSuccess() throws Exception {
|
void testSuccess() throws Exception {
|
||||||
persistHostResource();
|
persistHost();
|
||||||
assertTransactionalFlow(false);
|
assertTransactionalFlow(false);
|
||||||
// Check that the persisted host info was returned.
|
// Check that the persisted host info was returned.
|
||||||
runFlowAssertResponse(
|
runFlowAssertResponse(
|
||||||
|
@ -94,11 +94,11 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource>
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_linked() throws Exception {
|
void testSuccess_linked() throws Exception {
|
||||||
persistHostResource();
|
persistHost();
|
||||||
persistResource(
|
persistResource(
|
||||||
DatabaseHelper.newDomain("example.foobar")
|
DatabaseHelper.newDomain("example.foobar")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.addNameserver(persistHostResource().createVKey())
|
.addNameserver(persistHost().createVKey())
|
||||||
.build());
|
.build());
|
||||||
assertTransactionalFlow(false);
|
assertTransactionalFlow(false);
|
||||||
// Check that the persisted host info was returned.
|
// Check that the persisted host info was returned.
|
||||||
|
@ -121,7 +121,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource>
|
||||||
.setLastTransferTime(domainTransferTime)
|
.setLastTransferTime(domainTransferTime)
|
||||||
.setPersistedCurrentSponsorRegistrarId("superclientid")
|
.setPersistedCurrentSponsorRegistrarId("superclientid")
|
||||||
.build());
|
.build());
|
||||||
HostResource firstHost = persistHostResource();
|
Host firstHost = persistHost();
|
||||||
persistResource(
|
persistResource(
|
||||||
firstHost
|
firstHost
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -166,8 +166,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource>
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testFailure_existedButWasDeleted() throws Exception {
|
void testFailure_existedButWasDeleted() throws Exception {
|
||||||
persistResource(
|
persistResource(persistHost().asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
persistHostResource().asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||||
|
@ -197,7 +196,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource>
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testIcannActivityReportField_getsLogged() throws Exception {
|
void testIcannActivityReportField_getsLogged() throws Exception {
|
||||||
persistHostResource();
|
persistHost();
|
||||||
runFlow();
|
runFlow();
|
||||||
assertIcannReportingActivityFieldLogged("srs-host-info");
|
assertIcannReportingActivityFieldLogged("srs-host-info");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType;
|
import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType;
|
||||||
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveSubordinateHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveSubordinateHost;
|
||||||
|
@ -34,7 +34,7 @@ import static google.registry.testing.DomainSubject.assertAboutDomains;
|
||||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources;
|
import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources;
|
||||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||||
|
@ -71,7 +71,7 @@ import google.registry.flows.host.HostUpdateFlow.HostAlreadyExistsException;
|
||||||
import google.registry.flows.host.HostUpdateFlow.RenameHostToExternalRemoveIpException;
|
import google.registry.flows.host.HostUpdateFlow.RenameHostToExternalRemoveIpException;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
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.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
|
@ -84,7 +84,7 @@ import org.joda.time.DateTime;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link HostUpdateFlow}. */
|
/** Unit tests for {@link HostUpdateFlow}. */
|
||||||
class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResource> {
|
class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||||
|
|
||||||
private void setEppHostUpdateInput(
|
private void setEppHostUpdateInput(
|
||||||
String oldHostName, String newHostName, String ipOrStatusToAdd, String ipOrStatusToRem) {
|
String oldHostName, String newHostName, String ipOrStatusToAdd, String ipOrStatusToRem) {
|
||||||
|
@ -148,15 +148,15 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
dryRunFlowAssertResponse(loadFile("generic_success_response.xml"));
|
dryRunFlowAssertResponse(loadFile("generic_success_response.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private HostResource doSuccessfulTest() throws Exception {
|
private Host doSuccessfulTest() throws Exception {
|
||||||
return doSuccessfulTest(false); // default to normal user privileges
|
return doSuccessfulTest(false); // default to normal user privileges
|
||||||
}
|
}
|
||||||
|
|
||||||
private HostResource doSuccessfulTestAsSuperuser() throws Exception {
|
private Host doSuccessfulTestAsSuperuser() throws Exception {
|
||||||
return doSuccessfulTest(true);
|
return doSuccessfulTest(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private HostResource doSuccessfulTest(boolean isSuperuser) throws Exception {
|
private Host doSuccessfulTest(boolean isSuperuser) throws Exception {
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
runFlowAssertResponse(
|
runFlowAssertResponse(
|
||||||
|
@ -167,8 +167,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
// should now return null.
|
// should now return null.
|
||||||
assertThat(reloadResourceByForeignKey()).isNull();
|
assertThat(reloadResourceByForeignKey()).isNull();
|
||||||
// However, it should load correctly if we use the new name (taken from the xml).
|
// However, it should load correctly if we use the new name (taken from the xml).
|
||||||
HostResource renamedHost =
|
Host renamedHost = loadByForeignKey(Host.class, "ns2.example.tld", clock.nowUtc()).get();
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc()).get();
|
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasOnlyOneHistoryEntryWhich()
|
.hasOnlyOneHistoryEntryWhich()
|
||||||
|
@ -182,11 +181,11 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testSuccess_rename_noOtherHostEverUsedTheOldName() throws Exception {
|
void testSuccess_rename_noOtherHostEverUsedTheOldName() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
|
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertThat(renamedHost.isSubordinate()).isTrue();
|
assertThat(renamedHost.isSubordinate()).isTrue();
|
||||||
assertDnsTasksEnqueued("ns1.example.tld", "ns2.example.tld");
|
assertDnsTasksEnqueued("ns1.example.tld", "ns2.example.tld");
|
||||||
ForeignKeyIndex<HostResource> oldFkiAfterRename =
|
ForeignKeyIndex<Host> oldFkiAfterRename =
|
||||||
ForeignKeyIndex.load(HostResource.class, oldHostName(), clock.nowUtc());
|
ForeignKeyIndex.load(Host.class, oldHostName(), clock.nowUtc());
|
||||||
assertThat(oldFkiAfterRename).isNull();
|
assertThat(oldFkiAfterRename).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,15 +193,14 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testSuccess_withReferencingDomain() throws Exception {
|
void testSuccess_withReferencingDomain() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
createTld("xn--q9jyb4c");
|
createTld("xn--q9jyb4c");
|
||||||
HostResource host =
|
Host host = persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
|
||||||
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
|
|
||||||
persistResource(
|
persistResource(
|
||||||
DatabaseHelper.newDomain("test.xn--q9jyb4c")
|
DatabaseHelper.newDomain("test.xn--q9jyb4c")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDeletionTime(END_OF_TIME)
|
.setDeletionTime(END_OF_TIME)
|
||||||
.setNameservers(ImmutableSet.of(host.createVKey()))
|
.setNameservers(ImmutableSet.of(host.createVKey()))
|
||||||
.build());
|
.build());
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertThat(renamedHost.isSubordinate()).isTrue();
|
assertThat(renamedHost.isSubordinate()).isTrue();
|
||||||
// Task enqueued to change the NS record of the referencing domain.
|
// Task enqueued to change the NS record of the referencing domain.
|
||||||
assertTasksEnqueued(
|
assertTasksEnqueued(
|
||||||
|
@ -217,7 +215,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
setEppInput("host_update_name_unchanged.xml");
|
setEppInput("host_update_name_unchanged.xml");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
Domain domain = persistActiveDomain("example.tld");
|
Domain domain = persistActiveDomain("example.tld");
|
||||||
HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain);
|
Host oldHost = persistActiveSubordinateHost(oldHostName(), domain);
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(loadFile("generic_success_response.xml"));
|
runFlowAssertResponse(loadFile("generic_success_response.xml"));
|
||||||
// The example xml doesn't do a host rename, so reloading the host should work.
|
// The example xml doesn't do a host rename, so reloading the host should work.
|
||||||
|
@ -243,7 +241,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||||
HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain);
|
Host oldHost = persistActiveSubordinateHost(oldHostName(), domain);
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(loadFile("generic_success_response.xml"));
|
runFlowAssertResponse(loadFile("generic_success_response.xml"));
|
||||||
// The example xml doesn't do a host rename, so reloading the host should work.
|
// The example xml doesn't do a host rename, so reloading the host should work.
|
||||||
|
@ -279,9 +277,9 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||||
.setLastTransferTime(oneDayAgo)
|
.setLastTransferTime(oneDayAgo)
|
||||||
.build());
|
.build());
|
||||||
HostResource oldHost = persistActiveSubordinateHost(oldHostName(), domain);
|
Host oldHost = persistActiveSubordinateHost(oldHostName(), domain);
|
||||||
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld");
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasSuperordinateDomain(domain.createVKey())
|
.hasSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -314,7 +312,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
persistActiveSubordinateHost(oldHostName(), foo);
|
persistActiveSubordinateHost(oldHostName(), foo);
|
||||||
assertThat(foo.getSubordinateHosts()).containsExactly("ns2.foo.tld");
|
assertThat(foo.getSubordinateHosts()).containsExactly("ns2.foo.tld");
|
||||||
assertThat(example.getSubordinateHosts()).isEmpty();
|
assertThat(example.getSubordinateHosts()).isEmpty();
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
|
@ -350,7 +348,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
persistActiveSubordinateHost(oldHostName(), fooDomain);
|
persistActiveSubordinateHost(oldHostName(), fooDomain);
|
||||||
assertThat(fooDomain.getSubordinateHosts()).containsExactly("ns1.example.foo");
|
assertThat(fooDomain.getSubordinateHosts()).containsExactly("ns1.example.foo");
|
||||||
assertThat(tldDomain.getSubordinateHosts()).isEmpty();
|
assertThat(tldDomain.getSubordinateHosts()).isEmpty();
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
|
@ -386,7 +384,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.build());
|
.build());
|
||||||
assertThat(domain.getCurrentSponsorRegistrarId()).isEqualTo("TheRegistrar");
|
assertThat(domain.getCurrentSponsorRegistrarId()).isEqualTo("TheRegistrar");
|
||||||
DateTime oneDayAgo = clock.nowUtc().minusDays(1);
|
DateTime oneDayAgo = clock.nowUtc().minusDays(1);
|
||||||
HostResource oldHost =
|
Host oldHost =
|
||||||
persistResource(
|
persistResource(
|
||||||
persistActiveSubordinateHost(oldHostName(), domain)
|
persistActiveSubordinateHost(oldHostName(), domain)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
@ -395,7 +393,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.build());
|
.build());
|
||||||
assertThat(oldHost.isSubordinate()).isTrue();
|
assertThat(oldHost.isSubordinate()).isTrue();
|
||||||
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.foo");
|
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.foo");
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasSuperordinateDomain(null)
|
.hasSuperordinateDomain(null)
|
||||||
|
@ -431,7 +429,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
Domain domain = persistActiveDomain("example.tld");
|
Domain domain = persistActiveDomain("example.tld");
|
||||||
persistActiveHost(oldHostName());
|
persistActiveHost(oldHostName());
|
||||||
assertThat(domain.getSubordinateHosts()).isEmpty();
|
assertThat(domain.getSubordinateHosts()).isEmpty();
|
||||||
HostResource renamedHost = doSuccessfulTestAsSuperuser();
|
Host renamedHost = doSuccessfulTestAsSuperuser();
|
||||||
DateTime now = clock.nowUtc();
|
DateTime now = clock.nowUtc();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
|
@ -459,7 +457,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testSuccess_superuserExternalToExternal() throws Exception {
|
void testSuccess_superuserExternalToExternal() throws Exception {
|
||||||
setEppHostUpdateInput("ns1.example.foo", "ns2.example.tld", null, null);
|
setEppHostUpdateInput("ns1.example.foo", "ns2.example.tld", null, null);
|
||||||
persistActiveHost(oldHostName());
|
persistActiveHost(oldHostName());
|
||||||
HostResource renamedHost = doSuccessfulTestAsSuperuser();
|
Host renamedHost = doSuccessfulTestAsSuperuser();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasSuperordinateDomain(null)
|
.hasSuperordinateDomain(null)
|
||||||
|
@ -476,7 +474,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testSuccess_superuserClientUpdateProhibited() throws Exception {
|
void testSuccess_superuserClientUpdateProhibited() throws Exception {
|
||||||
setEppInput("host_update_add_status.xml");
|
setEppInput("host_update_add_status.xml");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.build());
|
.build());
|
||||||
|
@ -519,14 +517,14 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(foo.createVKey())
|
.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());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
@ -555,9 +553,9 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setLastTransferTime(clock.nowUtc().minusDays(10))
|
.setLastTransferTime(clock.nowUtc().minusDays(10))
|
||||||
.build());
|
.build());
|
||||||
HostResource host =
|
Host host =
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setLastTransferTime(clock.nowUtc().minusDays(20))
|
.setLastTransferTime(clock.nowUtc().minusDays(20))
|
||||||
|
@ -565,7 +563,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.build());
|
.build());
|
||||||
DateTime lastTransferTime = host.getLastTransferTime();
|
DateTime lastTransferTime = host.getLastTransferTime();
|
||||||
persistResource(domain.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
persistResource(domain.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
@ -594,7 +592,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
DateTime lastTransferTime = clock.nowUtc().minusDays(20);
|
DateTime lastTransferTime = clock.nowUtc().minusDays(20);
|
||||||
|
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(foo.createVKey())
|
.setSuperordinateDomain(foo.createVKey())
|
||||||
.setLastTransferTime(lastTransferTime)
|
.setLastTransferTime(lastTransferTime)
|
||||||
|
@ -602,7 +600,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.build());
|
.build());
|
||||||
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
@ -628,7 +626,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
DateTime lastTransferTime = clock.nowUtc().minusDays(20);
|
DateTime lastTransferTime = clock.nowUtc().minusDays(20);
|
||||||
|
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(foo.createVKey())
|
.setSuperordinateDomain(foo.createVKey())
|
||||||
.setLastTransferTime(lastTransferTime)
|
.setLastTransferTime(lastTransferTime)
|
||||||
|
@ -636,7 +634,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.build());
|
.build());
|
||||||
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
@ -662,14 +660,14 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
persistResource(
|
persistResource(
|
||||||
DatabaseHelper.newDomain("example.tld").asBuilder().setLastTransferTime(null).build());
|
DatabaseHelper.newDomain("example.tld").asBuilder().setLastTransferTime(null).build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(foo.createVKey())
|
.setSuperordinateDomain(foo.createVKey())
|
||||||
.setLastTransferTime(null)
|
.setLastTransferTime(null)
|
||||||
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
.setLastSuperordinateChange(clock.nowUtc().minusDays(3))
|
||||||
.build());
|
.build());
|
||||||
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
persistResource(foo.asBuilder().setSubordinateHosts(ImmutableSet.of(oldHostName())).build());
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
@ -688,10 +686,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
createTld("foo");
|
createTld("foo");
|
||||||
Domain domain = persistActiveDomain("example.foo");
|
Domain domain = persistActiveDomain("example.foo");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName()).asBuilder().setSuperordinateDomain(domain.createVKey()).build());
|
||||||
.asBuilder()
|
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
|
||||||
.build());
|
|
||||||
DateTime lastTransferTime = clock.nowUtc().minusDays(2);
|
DateTime lastTransferTime = clock.nowUtc().minusDays(2);
|
||||||
persistResource(
|
persistResource(
|
||||||
domain
|
domain
|
||||||
|
@ -700,7 +695,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
persistResource(domain.asBuilder().setLastTransferTime(clock.nowUtc().minusDays(1)).build());
|
persistResource(domain.asBuilder().setLastTransferTime(clock.nowUtc().minusDays(1)).build());
|
||||||
// The last transfer time should be what was on the superordinate domain at the time of the host
|
// The last transfer time should be what was on the superordinate domain at the time of the host
|
||||||
|
@ -727,7 +722,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
Domain domain = persistActiveDomain("example.foo");
|
Domain domain = persistActiveDomain("example.foo");
|
||||||
DateTime lastTransferTime = clock.nowUtc().minusDays(12);
|
DateTime lastTransferTime = clock.nowUtc().minusDays(12);
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setLastTransferTime(lastTransferTime)
|
.setLastTransferTime(lastTransferTime)
|
||||||
|
@ -740,7 +735,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
// The last transfer time should be what was on the host, because the host's old superordinate
|
// The last transfer time should be what was on the host, because the host's old superordinate
|
||||||
// domain wasn't transferred more recently than when the host was changed to have that
|
// domain wasn't transferred more recently than when the host was changed to have that
|
||||||
// superordinate domain.
|
// superordinate domain.
|
||||||
|
@ -762,7 +757,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
createTld("foo");
|
createTld("foo");
|
||||||
Domain domain = persistActiveDomain("example.foo");
|
Domain domain = persistActiveDomain("example.foo");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
.setLastTransferTime(clock.nowUtc().minusDays(12))
|
.setLastTransferTime(clock.nowUtc().minusDays(12))
|
||||||
|
@ -775,7 +770,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.setLastTransferTime(clock.nowUtc().minusDays(2))
|
.setLastTransferTime(clock.nowUtc().minusDays(2))
|
||||||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||||
.build());
|
.build());
|
||||||
HostResource renamedHost = doSuccessfulTest();
|
Host renamedHost = doSuccessfulTest();
|
||||||
// The last transfer time should be what was on the superordinate domain, because the domain
|
// The last transfer time should be what was on the superordinate domain, because the domain
|
||||||
// was transferred more recently than the last time the host's superordinate domain was changed.
|
// was transferred more recently than the last time the host's superordinate domain was changed.
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
|
@ -796,8 +791,8 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.setLastTransferTime(domainTransferTime)
|
.setLastTransferTime(domainTransferTime)
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName()).asBuilder().setLastTransferTime(hostTransferTime).build());
|
newHost(oldHostName()).asBuilder().setLastTransferTime(hostTransferTime).build());
|
||||||
HostResource renamedHost = doSuccessfulTestAsSuperuser();
|
Host renamedHost = doSuccessfulTestAsSuperuser();
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(renamedHost)
|
.that(renamedHost)
|
||||||
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.hasPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
@ -1015,7 +1010,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testSuccess_clientUpdateProhibited_removed() throws Exception {
|
void testSuccess_clientUpdateProhibited_removed() throws Exception {
|
||||||
setEppInput("host_update_remove_client_update_prohibited.xml");
|
setEppInput("host_update_remove_client_update_prohibited.xml");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1030,7 +1025,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testFailure_clientUpdateProhibited() throws Exception {
|
void testFailure_clientUpdateProhibited() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
||||||
|
@ -1044,7 +1039,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testFailure_serverUpdateProhibited() throws Exception {
|
void testFailure_serverUpdateProhibited() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
|
||||||
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
||||||
|
@ -1058,7 +1053,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
void testFailure_pendingDelete() throws Exception {
|
void testFailure_pendingDelete() throws Exception {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource(oldHostName())
|
newHost(oldHostName())
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||||
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
.setSuperordinateDomain(persistActiveDomain("example.tld").createVKey())
|
||||||
|
@ -1118,7 +1113,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -1140,7 +1135,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -1158,7 +1153,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't hurt.
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't hurt.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -1176,7 +1171,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
// Create a domain that will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.tld")
|
newHost("ns1.example.tld")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't help.
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar") // Shouldn't help.
|
||||||
.setSuperordinateDomain(domain.createVKey())
|
.setSuperordinateDomain(domain.createVKey())
|
||||||
|
@ -1199,8 +1194,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
||||||
.build());
|
.build());
|
||||||
HostResource host =
|
Host host = persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo"));
|
||||||
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo"));
|
|
||||||
assertAboutHosts().that(host).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
assertAboutHosts().that(host).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
||||||
|
|
||||||
EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow);
|
EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow);
|
||||||
|
@ -1214,8 +1208,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
sessionMetadata.setRegistrarId("TheRegistrar");
|
sessionMetadata.setRegistrarId("TheRegistrar");
|
||||||
createTld("foo");
|
createTld("foo");
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
HostResource host =
|
Host host = persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo"));
|
||||||
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo"));
|
|
||||||
// The domain will belong to NewRegistrar after cloneProjectedAtTime is called.
|
// The domain will belong to NewRegistrar after cloneProjectedAtTime is called.
|
||||||
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
Domain domain = persistResource(createDomainWithServerApprovedTransfer("example.tld"));
|
||||||
assertAboutDomains().that(domain).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
assertAboutDomains().that(domain).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
||||||
|
@ -1242,7 +1235,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
|
||||||
.build());
|
.build());
|
||||||
assertAboutDomains().that(domain).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
assertAboutDomains().that(domain).hasPersistedCurrentSponsorRegistrarId("TheRegistrar");
|
||||||
persistResource(
|
persistResource(
|
||||||
newHostResource("ns1.example.foo")
|
newHost("ns1.example.foo")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(superordinate.createVKey())
|
.setSuperordinateDomain(superordinate.createVKey())
|
||||||
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("NewRegistrar")
|
||||||
|
|
|
@ -31,8 +31,8 @@ import google.registry.model.contact.ContactHistory;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -55,7 +55,7 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
|
||||||
|
|
||||||
private Domain domain;
|
private Domain domain;
|
||||||
private ContactResource contact;
|
private ContactResource contact;
|
||||||
private HostResource host;
|
private Host host;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.testing.TestCacheExtension;
|
import google.registry.testing.TestCacheExtension;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -51,15 +51,15 @@ public class EppResourceTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test_loadCached_ignoresHostChange() {
|
void test_loadCached_ignoresHostChange() {
|
||||||
HostResource originalHost = persistActiveHost("ns1.example.com");
|
Host originalHost = persistActiveHost("ns1.example.com");
|
||||||
assertThat(EppResource.loadCached(ImmutableList.of(originalHost.createVKey())))
|
assertThat(EppResource.loadCached(ImmutableList.of(originalHost.createVKey())))
|
||||||
.containsExactly(originalHost.createVKey(), originalHost);
|
.containsExactly(originalHost.createVKey(), originalHost);
|
||||||
HostResource modifiedHost =
|
Host modifiedHost =
|
||||||
persistResource(
|
persistResource(
|
||||||
originalHost.asBuilder().setLastTransferTime(fakeClock.nowUtc().minusDays(60)).build());
|
originalHost.asBuilder().setLastTransferTime(fakeClock.nowUtc().minusDays(60)).build());
|
||||||
assertThat(EppResource.loadCached(ImmutableList.of(originalHost.createVKey())))
|
assertThat(EppResource.loadCached(ImmutableList.of(originalHost.createVKey())))
|
||||||
.containsExactly(originalHost.createVKey(), originalHost);
|
.containsExactly(originalHost.createVKey(), originalHost);
|
||||||
assertThat(loadByForeignKey(HostResource.class, "ns1.example.com", fakeClock.nowUtc()))
|
assertThat(loadByForeignKey(Host.class, "ns1.example.com", fakeClock.nowUtc()))
|
||||||
.hasValue(modifiedHost);
|
.hasValue(modifiedHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,12 @@ package google.registry.model;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.model.EppResourceUtils.loadAtPointInTime;
|
import static google.registry.model.EppResourceUtils.loadAtPointInTime;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
import static org.joda.time.DateTimeZone.UTC;
|
import static org.joda.time.DateTimeZone.UTC;
|
||||||
|
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.ofy.Ofy;
|
import google.registry.model.ofy.Ofy;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
|
@ -54,10 +54,9 @@ class EppResourceUtilsTest {
|
||||||
void testLoadAtPointInTime_beforeCreated_returnsNull() {
|
void testLoadAtPointInTime_beforeCreated_returnsNull() {
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
// Don't save a commit log, we shouldn't need one.
|
// Don't save a commit log, we shouldn't need one.
|
||||||
HostResource host = persistResource(
|
Host host =
|
||||||
newHostResource("ns1.cat.tld").asBuilder()
|
persistResource(
|
||||||
.setCreationTimeForTest(clock.nowUtc())
|
newHost("ns1.cat.tld").asBuilder().setCreationTimeForTest(clock.nowUtc()).build());
|
||||||
.build());
|
|
||||||
assertThat(loadAtPointInTime(host, clock.nowUtc().minus(Duration.millis(1)))).isNull();
|
assertThat(loadAtPointInTime(host, clock.nowUtc().minus(Duration.millis(1)))).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +64,9 @@ class EppResourceUtilsTest {
|
||||||
void testLoadAtPointInTime_atOrAfterLastAutoUpdateTime_returnsResource() {
|
void testLoadAtPointInTime_atOrAfterLastAutoUpdateTime_returnsResource() {
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
// Don't save a commit log, we shouldn't need one.
|
// Don't save a commit log, we shouldn't need one.
|
||||||
HostResource host = persistResource(
|
Host host =
|
||||||
newHostResource("ns1.cat.tld").asBuilder()
|
persistResource(
|
||||||
.setCreationTimeForTest(START_OF_TIME)
|
newHost("ns1.cat.tld").asBuilder().setCreationTimeForTest(START_OF_TIME).build());
|
||||||
.build());
|
|
||||||
assertThat(loadAtPointInTime(host, clock.nowUtc())).isEqualTo(host);
|
assertThat(loadAtPointInTime(host, clock.nowUtc())).isEqualTo(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
|
@ -75,7 +75,7 @@ public final class TestSetupHelper {
|
||||||
public ContactResource contact;
|
public ContactResource contact;
|
||||||
public Domain domain;
|
public Domain domain;
|
||||||
public DomainHistory domainHistory;
|
public DomainHistory domainHistory;
|
||||||
public HostResource host;
|
public Host host;
|
||||||
|
|
||||||
private JpaTransactionManager originalJpaTm;
|
private JpaTransactionManager originalJpaTm;
|
||||||
private JpaTransactionManager bulkQueryJpaTm;
|
private JpaTransactionManager bulkQueryJpaTm;
|
||||||
|
@ -135,7 +135,7 @@ public final class TestSetupHelper {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Domain createFullDomain(ContactResource contact, HostResource host, FakeClock fakeClock) {
|
static Domain createFullDomain(ContactResource contact, Host host, FakeClock fakeClock) {
|
||||||
return createSimpleDomain(contact)
|
return createSimpleDomain(contact)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDomainName(DOMAIN_NAME)
|
.setDomainName(DOMAIN_NAME)
|
||||||
|
@ -169,8 +169,8 @@ public final class TestSetupHelper {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HostResource createHost() {
|
static Host createHost() {
|
||||||
return new HostResource.Builder()
|
return new Host.Builder()
|
||||||
.setRepoId("host1")
|
.setRepoId("host1")
|
||||||
.setHostName("ns1.example.com")
|
.setHostName("ns1.example.com")
|
||||||
.setCreationRegistrarId(REGISTRAR_ID)
|
.setCreationRegistrarId(REGISTRAR_ID)
|
||||||
|
|
|
@ -21,7 +21,7 @@ import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.token.AllocationToken;
|
import google.registry.model.domain.token.AllocationToken;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
import google.registry.model.index.EppResourceIndexBucket;
|
import google.registry.model.index.EppResourceIndexBucket;
|
||||||
import google.registry.model.index.ForeignKeyIndex.ForeignKeyContactIndex;
|
import google.registry.model.index.ForeignKeyIndex.ForeignKeyContactIndex;
|
||||||
|
@ -53,7 +53,7 @@ public class ClassPathManagerTest {
|
||||||
.isEqualTo(ForeignKeyContactIndex.class);
|
.isEqualTo(ForeignKeyContactIndex.class);
|
||||||
assertThat(ClassPathManager.getClass("AllocationToken")).isEqualTo(AllocationToken.class);
|
assertThat(ClassPathManager.getClass("AllocationToken")).isEqualTo(AllocationToken.class);
|
||||||
assertThat(ClassPathManager.getClass("RdeRevision")).isEqualTo(RdeRevision.class);
|
assertThat(ClassPathManager.getClass("RdeRevision")).isEqualTo(RdeRevision.class);
|
||||||
assertThat(ClassPathManager.getClass("HostResource")).isEqualTo(HostResource.class);
|
assertThat(ClassPathManager.getClass("Host")).isEqualTo(Host.class);
|
||||||
assertThat(ClassPathManager.getClass("Registrar")).isEqualTo(Registrar.class);
|
assertThat(ClassPathManager.getClass("Registrar")).isEqualTo(Registrar.class);
|
||||||
assertThat(ClassPathManager.getClass("ContactResource")).isEqualTo(ContactResource.class);
|
assertThat(ClassPathManager.getClass("ContactResource")).isEqualTo(ContactResource.class);
|
||||||
assertThat(ClassPathManager.getClass("GaeUserIdConverter")).isEqualTo(GaeUserIdConverter.class);
|
assertThat(ClassPathManager.getClass("GaeUserIdConverter")).isEqualTo(GaeUserIdConverter.class);
|
||||||
|
@ -106,7 +106,7 @@ public class ClassPathManagerTest {
|
||||||
.isEqualTo("ForeignKeyContactIndex");
|
.isEqualTo("ForeignKeyContactIndex");
|
||||||
assertThat(ClassPathManager.getClassName(AllocationToken.class)).isEqualTo("AllocationToken");
|
assertThat(ClassPathManager.getClassName(AllocationToken.class)).isEqualTo("AllocationToken");
|
||||||
assertThat(ClassPathManager.getClassName(RdeRevision.class)).isEqualTo("RdeRevision");
|
assertThat(ClassPathManager.getClassName(RdeRevision.class)).isEqualTo("RdeRevision");
|
||||||
assertThat(ClassPathManager.getClassName(HostResource.class)).isEqualTo("HostResource");
|
assertThat(ClassPathManager.getClassName(Host.class)).isEqualTo("Host");
|
||||||
assertThat(ClassPathManager.getClassName(Registrar.class)).isEqualTo("Registrar");
|
assertThat(ClassPathManager.getClassName(Registrar.class)).isEqualTo("Registrar");
|
||||||
assertThat(ClassPathManager.getClassName(ContactResource.class)).isEqualTo("ContactResource");
|
assertThat(ClassPathManager.getClassName(ContactResource.class)).isEqualTo("ContactResource");
|
||||||
assertThat(ClassPathManager.getClassName(GaeUserIdConverter.class))
|
assertThat(ClassPathManager.getClassName(GaeUserIdConverter.class))
|
||||||
|
|
|
@ -47,7 +47,7 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.transfer.ContactTransferData;
|
import google.registry.model.transfer.ContactTransferData;
|
||||||
|
@ -81,8 +81,8 @@ public class DomainSqlTest {
|
||||||
private DomainHistory historyEntry;
|
private DomainHistory historyEntry;
|
||||||
private VKey<ContactResource> contactKey;
|
private VKey<ContactResource> contactKey;
|
||||||
private VKey<ContactResource> contact2Key;
|
private VKey<ContactResource> contact2Key;
|
||||||
private VKey<HostResource> host1VKey;
|
private VKey<Host> host1VKey;
|
||||||
private HostResource host;
|
private Host host;
|
||||||
private ContactResource contact;
|
private ContactResource contact;
|
||||||
private ContactResource contact2;
|
private ContactResource contact2;
|
||||||
private ImmutableSet<GracePeriod> gracePeriods;
|
private ImmutableSet<GracePeriod> gracePeriods;
|
||||||
|
@ -95,7 +95,7 @@ public class DomainSqlTest {
|
||||||
contactKey = createKey(ContactResource.class, "contact_id1");
|
contactKey = createKey(ContactResource.class, "contact_id1");
|
||||||
contact2Key = createKey(ContactResource.class, "contact_id2");
|
contact2Key = createKey(ContactResource.class, "contact_id2");
|
||||||
|
|
||||||
host1VKey = createKey(HostResource.class, "host1");
|
host1VKey = createKey(Host.class, "host1");
|
||||||
|
|
||||||
domain =
|
domain =
|
||||||
new Domain.Builder()
|
new Domain.Builder()
|
||||||
|
@ -130,7 +130,7 @@ public class DomainSqlTest {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
host =
|
host =
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setRepoId("host1")
|
.setRepoId("host1")
|
||||||
.setHostName("ns1.example.com")
|
.setHostName("ns1.example.com")
|
||||||
.setCreationRegistrarId("registrar1")
|
.setCreationRegistrarId("registrar1")
|
||||||
|
@ -676,8 +676,8 @@ public class DomainSqlTest {
|
||||||
jpaTm()
|
jpaTm()
|
||||||
.transact(
|
.transact(
|
||||||
() -> {
|
() -> {
|
||||||
HostResource host2 =
|
Host host2 =
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setRepoId("host2")
|
.setRepoId("host2")
|
||||||
.setHostName("ns2.example.com")
|
.setHostName("ns2.example.com")
|
||||||
.setCreationRegistrarId("registrar1")
|
.setCreationRegistrarId("registrar1")
|
||||||
|
|
|
@ -22,7 +22,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||||
import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps;
|
import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.insertInDb;
|
import static google.registry.testing.DatabaseHelper.insertInDb;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||||
|
@ -55,7 +55,7 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
|
@ -100,7 +100,7 @@ public class DomainTest {
|
||||||
saveRegistrar("gaining");
|
saveRegistrar("gaining");
|
||||||
createTld("com");
|
createTld("com");
|
||||||
domain = persistActiveDomain("example.com");
|
domain = persistActiveDomain("example.com");
|
||||||
VKey<HostResource> hostKey = persistActiveHost("ns1.example.com").createVKey();
|
VKey<Host> hostKey = persistActiveHost("ns1.example.com").createVKey();
|
||||||
contact1Key = persistActiveContact("contact_id1").createVKey();
|
contact1Key = persistActiveContact("contact_id1").createVKey();
|
||||||
contact2Key = persistActiveContact("contact_id1").createVKey();
|
contact2Key = persistActiveContact("contact_id1").createVKey();
|
||||||
domainHistory =
|
domainHistory =
|
||||||
|
@ -288,7 +288,7 @@ public class DomainTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
DatabaseHelper.newDomain("example.com")
|
DatabaseHelper.newDomain("example.com")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(ImmutableSet.of(newHostResource("foo.example.tld").createVKey()))
|
.setNameservers(ImmutableSet.of(newHost("foo.example.tld").createVKey()))
|
||||||
.build()
|
.build()
|
||||||
.nsHosts)
|
.nsHosts)
|
||||||
.isNotNull();
|
.isNotNull();
|
||||||
|
@ -336,8 +336,7 @@ public class DomainTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testImplicitStatusValues() {
|
void testImplicitStatusValues() {
|
||||||
ImmutableSet<VKey<HostResource>> nameservers =
|
ImmutableSet<VKey<Host>> nameservers = ImmutableSet.of(newHost("foo.example.tld").createVKey());
|
||||||
ImmutableSet.of(newHostResource("foo.example.tld").createVKey());
|
|
||||||
StatusValue[] statuses = {StatusValue.OK};
|
StatusValue[] statuses = {StatusValue.OK};
|
||||||
// OK is implicit if there's no other statuses but there are nameservers.
|
// OK is implicit if there's no other statuses but there are nameservers.
|
||||||
assertAboutDomains()
|
assertAboutDomains()
|
||||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.insertInDb;
|
import static google.registry.testing.DatabaseHelper.insertInDb;
|
||||||
import static google.registry.testing.DatabaseHelper.newContactResourceWithRoid;
|
import static google.registry.testing.DatabaseHelper.newContactResourceWithRoid;
|
||||||
import static google.registry.testing.DatabaseHelper.newDomain;
|
import static google.registry.testing.DatabaseHelper.newDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResourceWithRoid;
|
import static google.registry.testing.DatabaseHelper.newHostWithRoid;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import google.registry.model.domain.Period;
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord;
|
import google.registry.model.reporting.DomainTransactionRecord;
|
||||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -102,7 +102,7 @@ public class DomainHistoryTest extends EntityTestCase {
|
||||||
|
|
||||||
static Domain createDomainWithContactsAndHosts() {
|
static Domain createDomainWithContactsAndHosts() {
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
HostResource host = newHostResourceWithRoid("ns1.example.com", "host1");
|
Host host = newHostWithRoid("ns1.example.com", "host1");
|
||||||
ContactResource contact = newContactResourceWithRoid("contactId", "contact1");
|
ContactResource contact = newContactResourceWithRoid("contactId", "contact1");
|
||||||
|
|
||||||
jpaTm()
|
jpaTm()
|
||||||
|
|
|
@ -19,14 +19,14 @@ import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableO
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||||
import static google.registry.testing.DatabaseHelper.insertInDb;
|
import static google.registry.testing.DatabaseHelper.insertInDb;
|
||||||
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResourceWithRoid;
|
import static google.registry.testing.DatabaseHelper.newHostWithRoid;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
import google.registry.model.EntityTestCase;
|
import google.registry.model.EntityTestCase;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.host.HostBase;
|
import google.registry.model.host.HostBase;
|
||||||
import google.registry.model.host.HostHistory;
|
import google.registry.model.host.HostHistory;
|
||||||
import google.registry.model.host.HostResource;
|
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.util.SerializeUtils;
|
import google.registry.util.SerializeUtils;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -40,9 +40,9 @@ public class HostHistoryTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPersistence() {
|
void testPersistence() {
|
||||||
HostResource host = newHostResourceWithRoid("ns1.example.com", "host1");
|
Host host = newHostWithRoid("ns1.example.com", "host1");
|
||||||
insertInDb(host);
|
insertInDb(host);
|
||||||
HostResource hostFromDb = loadByEntity(host);
|
Host hostFromDb = loadByEntity(host);
|
||||||
HostHistory hostHistory = createHostHistory(hostFromDb);
|
HostHistory hostHistory = createHostHistory(hostFromDb);
|
||||||
insertInDb(hostHistory);
|
insertInDb(hostHistory);
|
||||||
jpaTm()
|
jpaTm()
|
||||||
|
@ -56,9 +56,9 @@ public class HostHistoryTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSerializable() {
|
void testSerializable() {
|
||||||
HostResource host = newHostResourceWithRoid("ns1.example.com", "host1");
|
Host host = newHostWithRoid("ns1.example.com", "host1");
|
||||||
insertInDb(host);
|
insertInDb(host);
|
||||||
HostResource hostFromDb = loadByEntity(host);
|
Host hostFromDb = loadByEntity(host);
|
||||||
HostHistory hostHistory = createHostHistory(hostFromDb);
|
HostHistory hostHistory = createHostHistory(hostFromDb);
|
||||||
insertInDb(hostHistory);
|
insertInDb(hostHistory);
|
||||||
HostHistory fromDatabase = jpaTm().transact(() -> jpaTm().loadByKey(hostHistory.createVKey()));
|
HostHistory fromDatabase = jpaTm().transact(() -> jpaTm().loadByKey(hostHistory.createVKey()));
|
||||||
|
@ -67,10 +67,10 @@ public class HostHistoryTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLegacyPersistence_nullHostBase() {
|
void testLegacyPersistence_nullHostBase() {
|
||||||
HostResource host = newHostResourceWithRoid("ns1.example.com", "host1");
|
Host host = newHostWithRoid("ns1.example.com", "host1");
|
||||||
insertInDb(host);
|
insertInDb(host);
|
||||||
|
|
||||||
HostResource hostFromDb = loadByEntity(host);
|
Host hostFromDb = loadByEntity(host);
|
||||||
HostHistory hostHistory = createHostHistory(hostFromDb).asBuilder().setHost(null).build();
|
HostHistory hostHistory = createHostHistory(hostFromDb).asBuilder().setHost(null).build();
|
||||||
insertInDb(hostHistory);
|
insertInDb(hostHistory);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrars;
|
import static google.registry.testing.DatabaseHelper.persistNewRegistrars;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostSubject.assertAboutHosts;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
@ -40,15 +40,15 @@ import org.joda.time.DateTime;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link HostResource}. */
|
/** Unit tests for {@link Host}. */
|
||||||
class HostResourceTest extends EntityTestCase {
|
class HostTest extends EntityTestCase {
|
||||||
|
|
||||||
private final DateTime day3 = fakeClock.nowUtc();
|
private final DateTime day3 = fakeClock.nowUtc();
|
||||||
private final DateTime day2 = day3.minusDays(1);
|
private final DateTime day2 = day3.minusDays(1);
|
||||||
private final DateTime day1 = day2.minusDays(1);
|
private final DateTime day1 = day2.minusDays(1);
|
||||||
|
|
||||||
private Domain domain;
|
private Domain domain;
|
||||||
private HostResource host;
|
private Host host;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
|
@ -73,7 +73,7 @@ class HostResourceTest extends EntityTestCase {
|
||||||
host =
|
host =
|
||||||
persistResource(
|
persistResource(
|
||||||
cloneAndSetAutoTimestamps(
|
cloneAndSetAutoTimestamps(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setRepoId("DEADBEEF-COM")
|
.setRepoId("DEADBEEF-COM")
|
||||||
.setHostName("ns1.example.com")
|
.setHostName("ns1.example.com")
|
||||||
.setCreationRegistrarId("thisRegistrar")
|
.setCreationRegistrarId("thisRegistrar")
|
||||||
|
@ -87,15 +87,15 @@ class HostResourceTest extends EntityTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testHostBaseToHostResource() {
|
void testHostBaseToHost() {
|
||||||
ImmutableObjectSubject.assertAboutImmutableObjects()
|
ImmutableObjectSubject.assertAboutImmutableObjects()
|
||||||
.that(new HostResource.Builder().copyFrom(host).build())
|
.that(new Host.Builder().copyFrom(host).build())
|
||||||
.isEqualExceptFields(host, "updateTimestamp", "revisions");
|
.isEqualExceptFields(host, "updateTimestamp", "revisions");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPersistence() {
|
void testPersistence() {
|
||||||
HostResource newHost = host.asBuilder().setRepoId("NEWHOST").build();
|
Host newHost = host.asBuilder().setRepoId("NEWHOST").build();
|
||||||
tm().transact(() -> tm().insert(newHost));
|
tm().transact(() -> tm().insert(newHost));
|
||||||
assertThat(ImmutableList.of(tm().transact(() -> tm().loadByKey(newHost.createVKey()))))
|
assertThat(ImmutableList.of(tm().transact(() -> tm().loadByKey(newHost.createVKey()))))
|
||||||
.comparingElementsUsing(immutableObjectCorrespondence("revisions"))
|
.comparingElementsUsing(immutableObjectCorrespondence("revisions"))
|
||||||
|
@ -104,28 +104,28 @@ class HostResourceTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSerializable() {
|
void testSerializable() {
|
||||||
HostResource newHost = host.asBuilder().setRepoId("NEWHOST").build();
|
Host newHost = host.asBuilder().setRepoId("NEWHOST").build();
|
||||||
tm().transact(() -> tm().insert(newHost));
|
tm().transact(() -> tm().insert(newHost));
|
||||||
HostResource persisted = tm().transact(() -> tm().loadByEntity(newHost));
|
Host persisted = tm().transact(() -> tm().loadByEntity(newHost));
|
||||||
assertThat(SerializeUtils.serializeDeserialize(persisted)).isEqualTo(persisted);
|
assertThat(SerializeUtils.serializeDeserialize(persisted)).isEqualTo(persisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEmptyStringsBecomeNull() {
|
void testEmptyStringsBecomeNull() {
|
||||||
assertThat(
|
assertThat(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setPersistedCurrentSponsorRegistrarId(null)
|
.setPersistedCurrentSponsorRegistrarId(null)
|
||||||
.build()
|
.build()
|
||||||
.getPersistedCurrentSponsorRegistrarId())
|
.getPersistedCurrentSponsorRegistrarId())
|
||||||
.isNull();
|
.isNull();
|
||||||
assertThat(
|
assertThat(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setPersistedCurrentSponsorRegistrarId("")
|
.setPersistedCurrentSponsorRegistrarId("")
|
||||||
.build()
|
.build()
|
||||||
.getPersistedCurrentSponsorRegistrarId())
|
.getPersistedCurrentSponsorRegistrarId())
|
||||||
.isNull();
|
.isNull();
|
||||||
assertThat(
|
assertThat(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setPersistedCurrentSponsorRegistrarId(" ")
|
.setPersistedCurrentSponsorRegistrarId(" ")
|
||||||
.build()
|
.build()
|
||||||
.getPersistedCurrentSponsorRegistrarId())
|
.getPersistedCurrentSponsorRegistrarId())
|
||||||
|
@ -134,11 +134,11 @@ class HostResourceTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEmptySetsBecomeNull() {
|
void testEmptySetsBecomeNull() {
|
||||||
assertThat(new HostResource.Builder().setInetAddresses(null).build().inetAddresses).isNull();
|
assertThat(new Host.Builder().setInetAddresses(null).build().inetAddresses).isNull();
|
||||||
assertThat(new HostResource.Builder().setInetAddresses(ImmutableSet.of()).build().inetAddresses)
|
assertThat(new Host.Builder().setInetAddresses(ImmutableSet.of()).build().inetAddresses)
|
||||||
.isNull();
|
.isNull();
|
||||||
assertThat(
|
assertThat(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||||
.build()
|
.build()
|
||||||
.inetAddresses)
|
.inetAddresses)
|
||||||
|
@ -148,20 +148,15 @@ class HostResourceTest extends EntityTestCase {
|
||||||
@Test
|
@Test
|
||||||
void testImplicitStatusValues() {
|
void testImplicitStatusValues() {
|
||||||
// OK is implicit if there's no other statuses.
|
// OK is implicit if there's no other statuses.
|
||||||
assertAboutHosts()
|
assertAboutHosts().that(new Host.Builder().build()).hasExactlyStatusValues(StatusValue.OK);
|
||||||
.that(new HostResource.Builder().build())
|
|
||||||
.hasExactlyStatusValues(StatusValue.OK);
|
|
||||||
// If there are other status values, OK should be suppressed.
|
// If there are other status values, OK should be suppressed.
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(
|
.that(new Host.Builder().setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD)).build())
|
||||||
new HostResource.Builder()
|
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD))
|
|
||||||
.build())
|
|
||||||
.hasExactlyStatusValues(StatusValue.CLIENT_HOLD);
|
.hasExactlyStatusValues(StatusValue.CLIENT_HOLD);
|
||||||
// When OK is suppressed, it should be removed even if it was originally there.
|
// When OK is suppressed, it should be removed even if it was originally there.
|
||||||
assertAboutHosts()
|
assertAboutHosts()
|
||||||
.that(
|
.that(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.OK, StatusValue.CLIENT_HOLD))
|
.setStatusValues(ImmutableSet.of(StatusValue.OK, StatusValue.CLIENT_HOLD))
|
||||||
.build())
|
.build())
|
||||||
.hasExactlyStatusValues(StatusValue.CLIENT_HOLD);
|
.hasExactlyStatusValues(StatusValue.CLIENT_HOLD);
|
||||||
|
@ -223,7 +218,7 @@ class HostResourceTest extends EntityTestCase {
|
||||||
host =
|
host =
|
||||||
persistResource(
|
persistResource(
|
||||||
cloneAndSetAutoTimestamps(
|
cloneAndSetAutoTimestamps(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationTime(day2)
|
.setCreationTime(day2)
|
||||||
.setRepoId("DEADBEEF-COM")
|
.setRepoId("DEADBEEF-COM")
|
||||||
.setHostName("ns1.example.com")
|
.setHostName("ns1.example.com")
|
|
@ -23,7 +23,7 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import google.registry.model.EntityTestCase;
|
import google.registry.model.EntityTestCase;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.index.ForeignKeyIndex.ForeignKeyHostIndex;
|
import google.registry.model.index.ForeignKeyIndex.ForeignKeyHostIndex;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import google.registry.testing.TestCacheExtension;
|
import google.registry.testing.TestCacheExtension;
|
||||||
|
@ -56,25 +56,23 @@ class ForeignKeyIndexTest extends EntityTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLoadForNonexistentForeignKey_returnsNull() {
|
void testLoadForNonexistentForeignKey_returnsNull() {
|
||||||
assertThat(ForeignKeyIndex.load(HostResource.class, "ns1.example.com", fakeClock.nowUtc()))
|
assertThat(ForeignKeyIndex.load(Host.class, "ns1.example.com", fakeClock.nowUtc())).isNull();
|
||||||
.isNull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLoadForDeletedForeignKey_returnsNull() {
|
void testLoadForDeletedForeignKey_returnsNull() {
|
||||||
HostResource host = persistActiveHost("ns1.example.com");
|
Host host = persistActiveHost("ns1.example.com");
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
persistResource(ForeignKeyIndex.create(host, fakeClock.nowUtc().minusDays(1)));
|
persistResource(ForeignKeyIndex.create(host, fakeClock.nowUtc().minusDays(1)));
|
||||||
} else {
|
} else {
|
||||||
persistResource(host.asBuilder().setDeletionTime(fakeClock.nowUtc().minusDays(1)).build());
|
persistResource(host.asBuilder().setDeletionTime(fakeClock.nowUtc().minusDays(1)).build());
|
||||||
}
|
}
|
||||||
assertThat(ForeignKeyIndex.load(HostResource.class, "ns1.example.com", fakeClock.nowUtc()))
|
assertThat(ForeignKeyIndex.load(Host.class, "ns1.example.com", fakeClock.nowUtc())).isNull();
|
||||||
.isNull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLoad_newerKeyHasBeenSoftDeleted() {
|
void testLoad_newerKeyHasBeenSoftDeleted() {
|
||||||
HostResource host1 = persistActiveHost("ns1.example.com");
|
Host host1 = persistActiveHost("ns1.example.com");
|
||||||
fakeClock.advanceOneMilli();
|
fakeClock.advanceOneMilli();
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
ForeignKeyHostIndex fki = new ForeignKeyHostIndex();
|
ForeignKeyHostIndex fki = new ForeignKeyHostIndex();
|
||||||
|
@ -85,14 +83,13 @@ class ForeignKeyIndexTest extends EntityTestCase {
|
||||||
} else {
|
} else {
|
||||||
persistResource(host1.asBuilder().setDeletionTime(fakeClock.nowUtc()).build());
|
persistResource(host1.asBuilder().setDeletionTime(fakeClock.nowUtc()).build());
|
||||||
}
|
}
|
||||||
assertThat(ForeignKeyIndex.load(HostResource.class, "ns1.example.com", fakeClock.nowUtc()))
|
assertThat(ForeignKeyIndex.load(Host.class, "ns1.example.com", fakeClock.nowUtc())).isNull();
|
||||||
.isNull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testBatchLoad_skipsDeletedAndNonexistent() {
|
void testBatchLoad_skipsDeletedAndNonexistent() {
|
||||||
persistActiveHost("ns1.example.com");
|
persistActiveHost("ns1.example.com");
|
||||||
HostResource host = persistActiveHost("ns2.example.com");
|
Host host = persistActiveHost("ns2.example.com");
|
||||||
if (tm().isOfy()) {
|
if (tm().isOfy()) {
|
||||||
persistResource(ForeignKeyIndex.create(host, fakeClock.nowUtc().minusDays(1)));
|
persistResource(ForeignKeyIndex.create(host, fakeClock.nowUtc().minusDays(1)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -100,7 +97,7 @@ class ForeignKeyIndexTest extends EntityTestCase {
|
||||||
}
|
}
|
||||||
assertThat(
|
assertThat(
|
||||||
ForeignKeyIndex.load(
|
ForeignKeyIndex.load(
|
||||||
HostResource.class,
|
Host.class,
|
||||||
ImmutableList.of("ns1.example.com", "ns2.example.com", "ns3.example.com"),
|
ImmutableList.of("ns1.example.com", "ns2.example.com", "ns3.example.com"),
|
||||||
fakeClock.nowUtc())
|
fakeClock.nowUtc())
|
||||||
.keySet())
|
.keySet())
|
||||||
|
@ -110,7 +107,7 @@ class ForeignKeyIndexTest extends EntityTestCase {
|
||||||
@Test
|
@Test
|
||||||
void testDeadCodeThatDeletedScrapCommandsReference() {
|
void testDeadCodeThatDeletedScrapCommandsReference() {
|
||||||
persistActiveHost("omg");
|
persistActiveHost("omg");
|
||||||
assertThat(ForeignKeyIndex.load(HostResource.class, "omg", fakeClock.nowUtc()).getForeignKey())
|
assertThat(ForeignKeyIndex.load(Host.class, "omg", fakeClock.nowUtc()).getForeignKey())
|
||||||
.isEqualTo("omg");
|
.isEqualTo("omg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import google.registry.model.EntityTestCase;
|
import google.registry.model.EntityTestCase;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.transfer.ContactTransferData;
|
import google.registry.model.transfer.ContactTransferData;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
|
@ -45,7 +45,7 @@ public final class Spec11ThreatMatchTest extends EntityTestCase {
|
||||||
|
|
||||||
private Spec11ThreatMatch threat;
|
private Spec11ThreatMatch threat;
|
||||||
private Domain domain;
|
private Domain domain;
|
||||||
private HostResource host;
|
private Host host;
|
||||||
private ContactResource registrantContact;
|
private ContactResource registrantContact;
|
||||||
|
|
||||||
Spec11ThreatMatchTest() {
|
Spec11ThreatMatchTest() {
|
||||||
|
@ -54,7 +54,7 @@ public final class Spec11ThreatMatchTest extends EntityTestCase {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
VKey<HostResource> hostVKey = VKey.createSql(HostResource.class, "host");
|
VKey<Host> hostVKey = VKey.createSql(Host.class, "host");
|
||||||
VKey<ContactResource> registrantContactVKey =
|
VKey<ContactResource> registrantContactVKey =
|
||||||
VKey.createSql(ContactResource.class, "contact_id");
|
VKey.createSql(ContactResource.class, "contact_id");
|
||||||
String domainRepoId = "4-TLD";
|
String domainRepoId = "4-TLD";
|
||||||
|
@ -84,7 +84,7 @@ public final class Spec11ThreatMatchTest extends EntityTestCase {
|
||||||
|
|
||||||
// Create a host for the purpose of testing a foreign key reference in the Domain table. */
|
// Create a host for the purpose of testing a foreign key reference in the Domain table. */
|
||||||
host =
|
host =
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setRepoId("host")
|
.setRepoId("host")
|
||||||
.setHostName("ns1.example.com")
|
.setHostName("ns1.example.com")
|
||||||
.setCreationRegistrarId(REGISTRAR_ID)
|
.setCreationRegistrarId(REGISTRAR_ID)
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
|
||||||
|
|
||||||
public class StatusValueAdapterTest {
|
public class StatusValueAdapterTest {
|
||||||
|
|
||||||
// Needed to create HostResources.
|
// Needed to create Hosts.
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
public AppEngineExtension appEngine = new AppEngineExtension.Builder().withCloudSql().build();
|
public AppEngineExtension appEngine = new AppEngineExtension.Builder().withCloudSql().build();
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import com.googlecode.objectify.annotation.Entity;
|
||||||
import google.registry.model.billing.BillingEvent.OneTime;
|
import google.registry.model.billing.BillingEvent.OneTime;
|
||||||
import google.registry.model.common.ClassPathManager;
|
import google.registry.model.common.ClassPathManager;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.RegistrarPoc;
|
import google.registry.model.registrar.RegistrarPoc;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import google.registry.testing.TestObject;
|
import google.registry.testing.TestObject;
|
||||||
|
@ -185,25 +185,15 @@ class VKeyTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCreate_stringifiedVKey_resourceKeyFromTaskQueue() throws Exception {
|
void testCreate_stringifiedVKey_resourceKeyFromTaskQueue() throws Exception {
|
||||||
VKey<HostResource> vkeyFromNewWebsafeKey =
|
VKey<Host> vkeyFromNewWebsafeKey =
|
||||||
VKey.create(
|
VKey.create(
|
||||||
"kind:HostResource@sql:rO0ABXQADzZCQjJGNDc2LUdPT0dMRQ@ofy:ahdzfm"
|
"kind:Host@sql:rO0ABXQADzZCQjJGNDc2LUdPT0dMRQ@ofy:ahdzfm"
|
||||||
+ "RvbWFpbi1yZWdpc3RyeS1hbHBoYXIhCxIMSG9zdFJlc291cmNlIg82QkIyRjQ3Ni1HT09HTEUM");
|
+ "RvbWFpbi1yZWdpc3RyeS1hbHBoYXIhCxIMSG9zdFJlc291cmNlIg82QkIyRjQ3Ni1HT09HTEUM");
|
||||||
|
|
||||||
assertThat(vkeyFromNewWebsafeKey.getSqlKey()).isEqualTo("6BB2F476-GOOGLE");
|
assertThat(vkeyFromNewWebsafeKey.getSqlKey()).isEqualTo("6BB2F476-GOOGLE");
|
||||||
assertThat(vkeyFromNewWebsafeKey.getOfyKey().getString())
|
assertThat(vkeyFromNewWebsafeKey.getOfyKey().getString())
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
"ahdzfmRvbWFpb"
|
"ahdzfmRvbWFpbi1yZWdpc3RyeS1hbHBoYXIhCxIMSG9zdFJlc291cmNlIg82QkIyRjQ3Ni1HT09HTEUM");
|
||||||
+ "i1yZWdpc3RyeS1hbHBoYXIhCxIMSG9zdFJlc291cmNlIg82QkIyRjQ3Ni1HT09HTEUM");
|
|
||||||
|
|
||||||
// the ofy portion of the new vkey string representation was the old vkey string representation
|
|
||||||
VKey<HostResource> vkeyFromOldWebsafeString =
|
|
||||||
VKey.fromWebsafeKey(
|
|
||||||
"ahdzfmRvbW"
|
|
||||||
+ "Fpbi1yZWdpc3RyeS1hbHBoYXIhCxIMSG9zdFJlc291cmNlIg82QkIyRjQ3Ni1HT09HTEUM");
|
|
||||||
|
|
||||||
// the following is assertion is ensure backwork compatibility
|
|
||||||
assertThat(vkeyFromNewWebsafeKey).isEqualTo(vkeyFromOldWebsafeString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHost;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
||||||
|
@ -31,7 +31,7 @@ import com.google.gson.JsonObject;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
|
@ -85,10 +85,10 @@ class RdapDomainActionTest extends RdapActionBaseTestCase<RdapDomainAction> {
|
||||||
"bog@cat.lol",
|
"bog@cat.lol",
|
||||||
clock.nowUtc().minusYears(3),
|
clock.nowUtc().minusYears(3),
|
||||||
registrarLol);
|
registrarLol);
|
||||||
HostResource host1 = makeAndPersistHostResource(
|
Host host1 = makeAndPersistHost("ns1.cat.lol", "1.2.3.4", null, clock.nowUtc().minusYears(1));
|
||||||
"ns1.cat.lol", "1.2.3.4", null, clock.nowUtc().minusYears(1));
|
Host host2 =
|
||||||
HostResource host2 = makeAndPersistHostResource(
|
makeAndPersistHost(
|
||||||
"ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2));
|
"ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2));
|
||||||
persistResource(
|
persistResource(
|
||||||
makeDomain(
|
makeDomain(
|
||||||
"cat.lol",
|
"cat.lol",
|
||||||
|
@ -104,8 +104,9 @@ class RdapDomainActionTest extends RdapActionBaseTestCase<RdapDomainAction> {
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
// deleted domain in lol
|
// deleted domain in lol
|
||||||
HostResource hostDodo2 = makeAndPersistHostResource(
|
Host hostDodo2 =
|
||||||
"ns2.dodo.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2));
|
makeAndPersistHost(
|
||||||
|
"ns2.dodo.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2));
|
||||||
Domain domainDeleted =
|
Domain domainDeleted =
|
||||||
persistResource(
|
persistResource(
|
||||||
makeDomain(
|
makeDomain(
|
||||||
|
|
|
@ -24,7 +24,6 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResources;
|
import static google.registry.testing.DatabaseHelper.persistResources;
|
||||||
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
|
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
||||||
|
@ -40,7 +39,7 @@ import com.google.gson.JsonObject;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
|
@ -50,6 +49,7 @@ import google.registry.rdap.RdapMetrics.SearchType;
|
||||||
import google.registry.rdap.RdapMetrics.WildcardType;
|
import google.registry.rdap.RdapMetrics.WildcardType;
|
||||||
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
||||||
import google.registry.testing.FakeResponse;
|
import google.registry.testing.FakeResponse;
|
||||||
|
import google.registry.testing.FullFieldsTestEntityHelper;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -73,9 +73,9 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
private ContactResource contact1;
|
private ContactResource contact1;
|
||||||
private ContactResource contact2;
|
private ContactResource contact2;
|
||||||
private ContactResource contact3;
|
private ContactResource contact3;
|
||||||
private HostResource hostNs1CatLol;
|
private Host hostNs1CatLol;
|
||||||
private HostResource hostNs2CatLol;
|
private Host hostNs2CatLol;
|
||||||
private HashMap<String, HostResource> hostNameToHostMap = new HashMap<>();
|
private HashMap<String, Host> hostNameToHostMap = new HashMap<>();
|
||||||
|
|
||||||
enum RequestType {
|
enum RequestType {
|
||||||
NONE,
|
NONE,
|
||||||
|
@ -120,7 +120,7 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
return parseJsonObject(response.getPayload());
|
return parseJsonObject(response.getPayload());
|
||||||
}
|
}
|
||||||
|
|
||||||
private HostResource addHostToMap(HostResource host) {
|
private Host addHostToMap(Host host) {
|
||||||
hostNameToHostMap.put(host.getHostName(), host);
|
hostNameToHostMap.put(host.getHostName(), host);
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,11 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
"5372808-TRL", "The Raven", "bog@cat.lol", clock.nowUtc().minusYears(3), registrar);
|
"5372808-TRL", "The Raven", "bog@cat.lol", clock.nowUtc().minusYears(3), registrar);
|
||||||
hostNs1CatLol =
|
hostNs1CatLol =
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource("ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1)));
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1)));
|
||||||
hostNs2CatLol =
|
hostNs2CatLol =
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2)));
|
"ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2)));
|
||||||
domainCatLol =
|
domainCatLol =
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -194,10 +195,10 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
clock.nowUtc().minusYears(3),
|
clock.nowUtc().minusYears(3),
|
||||||
registrar),
|
registrar),
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns1.cat.example", "10.20.30.40", clock.nowUtc().minusYears(1))),
|
"ns1.cat.example", "10.20.30.40", clock.nowUtc().minusYears(1))),
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns2.dog.lol",
|
"ns2.dog.lol",
|
||||||
"12:feed:5000:0:0:0:15:beef",
|
"12:feed:5000:0:0:0:15:beef",
|
||||||
clock.nowUtc().minusYears(2))),
|
clock.nowUtc().minusYears(2))),
|
||||||
|
@ -236,7 +237,7 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
registrar),
|
registrar),
|
||||||
hostNs1CatLol,
|
hostNs1CatLol,
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns2.external.tld",
|
"ns2.external.tld",
|
||||||
"bad:f00d:cafe:0:0:0:16:beef",
|
"bad:f00d:cafe:0:0:0:16:beef",
|
||||||
clock.nowUtc().minusYears(2))),
|
clock.nowUtc().minusYears(2))),
|
||||||
|
@ -272,10 +273,10 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
clock.nowUtc().minusYears(3),
|
clock.nowUtc().minusYears(3),
|
||||||
registrar),
|
registrar),
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns1.cat.みんな", "1.2.3.5", clock.nowUtc().minusYears(1))),
|
"ns1.cat.みんな", "1.2.3.5", clock.nowUtc().minusYears(1))),
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns2.cat.みんな",
|
"ns2.cat.みんな",
|
||||||
"bad:f00d:cafe:0:0:0:14:beef",
|
"bad:f00d:cafe:0:0:0:14:beef",
|
||||||
clock.nowUtc().minusYears(2))),
|
clock.nowUtc().minusYears(2))),
|
||||||
|
@ -311,10 +312,10 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
clock.nowUtc().minusYears(3),
|
clock.nowUtc().minusYears(3),
|
||||||
registrar),
|
registrar),
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns1.cat.1.test", "1.2.3.5", clock.nowUtc().minusYears(1))),
|
"ns1.cat.1.test", "1.2.3.5", clock.nowUtc().minusYears(1))),
|
||||||
addHostToMap(
|
addHostToMap(
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns2.cat.2.test",
|
"ns2.cat.2.test",
|
||||||
"bad:f00d:cafe:0:0:0:14:beef",
|
"bad:f00d:cafe:0:0:0:14:beef",
|
||||||
clock.nowUtc().minusYears(2))),
|
clock.nowUtc().minusYears(2))),
|
||||||
|
@ -400,20 +401,20 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||||
|
|
||||||
private void createManyDomainsAndHosts(
|
private void createManyDomainsAndHosts(
|
||||||
int numActiveDomains, int numTotalDomainsPerActiveDomain, int numHosts) {
|
int numActiveDomains, int numTotalDomainsPerActiveDomain, int numHosts) {
|
||||||
ImmutableSet.Builder<VKey<HostResource>> hostKeysBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<VKey<Host>> hostKeysBuilder = new ImmutableSet.Builder<>();
|
||||||
ImmutableSet.Builder<String> subordinateHostnamesBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<String> subordinateHostnamesBuilder = new ImmutableSet.Builder<>();
|
||||||
String mainDomainName = String.format("domain%d.lol", numTotalDomainsPerActiveDomain);
|
String mainDomainName = String.format("domain%d.lol", numTotalDomainsPerActiveDomain);
|
||||||
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 =
|
Host host =
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
hostName,
|
hostName,
|
||||||
String.format("5.5.%d.%d", 5 + i / 250, i % 250),
|
String.format("5.5.%d.%d", 5 + i / 250, i % 250),
|
||||||
clock.nowUtc().minusYears(1));
|
clock.nowUtc().minusYears(1));
|
||||||
hostKeysBuilder.add(host.createVKey());
|
hostKeysBuilder.add(host.createVKey());
|
||||||
}
|
}
|
||||||
ImmutableSet<VKey<HostResource>> hostKeys = hostKeysBuilder.build();
|
ImmutableSet<VKey<Host>> hostKeys = hostKeysBuilder.build();
|
||||||
// Create all the domains at once, then persist them in parallel, for increased efficiency.
|
// Create all the domains at once, then persist them in parallel, for increased efficiency.
|
||||||
ImmutableList.Builder<Domain> domainsBuilder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<Domain> domainsBuilder = new ImmutableList.Builder<>();
|
||||||
for (int i = numActiveDomains * numTotalDomainsPerActiveDomain; i >= 1; i--) {
|
for (int i = numActiveDomains * numTotalDomainsPerActiveDomain; i >= 1; i--) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistDeletedContactResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistDeletedContactResource;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeHost;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
@ -31,7 +31,7 @@ import static org.mockito.Mockito.verify;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.rdap.RdapMetrics.EndpointType;
|
import google.registry.rdap.RdapMetrics.EndpointType;
|
||||||
import google.registry.rdap.RdapMetrics.SearchType;
|
import google.registry.rdap.RdapMetrics.SearchType;
|
||||||
|
@ -85,10 +85,8 @@ class RdapEntityActionTest extends RdapActionBaseTestCase<RdapEntityAction> {
|
||||||
ImmutableList.of("1 Smiley Row", "Suite みんな"),
|
ImmutableList.of("1 Smiley Row", "Suite みんな"),
|
||||||
clock.nowUtc(),
|
clock.nowUtc(),
|
||||||
registrarLol);
|
registrarLol);
|
||||||
HostResource host1 =
|
Host host1 = persistResource(makeHost("ns1.cat.lol", "1.2.3.4"));
|
||||||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
Host host2 = persistResource(makeHost("ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef"));
|
||||||
HostResource host2 =
|
|
||||||
persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef"));
|
|
||||||
persistResource(
|
persistResource(
|
||||||
makeDomain("cat.lol", registrant, adminContact, techContact, host1, host2, registrarLol));
|
makeDomain("cat.lol", registrant, adminContact, techContact, host1, host2, registrarLol));
|
||||||
// xn--q9jyb4c
|
// xn--q9jyb4c
|
||||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHost;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
||||||
|
@ -37,7 +37,7 @@ import com.google.gson.JsonObject;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.ofy.Ofy;
|
import google.registry.model.ofy.Ofy;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.RegistrarPoc;
|
import google.registry.model.registrar.RegistrarPoc;
|
||||||
|
@ -72,12 +72,12 @@ class RdapJsonFormatterTest {
|
||||||
private Registrar registrar;
|
private Registrar registrar;
|
||||||
private Domain domainFull;
|
private Domain domainFull;
|
||||||
private Domain domainNoNameserversNoTransfers;
|
private Domain domainNoNameserversNoTransfers;
|
||||||
private HostResource hostResourceIpv4;
|
private Host hostIpv4;
|
||||||
private HostResource hostResourceIpv6;
|
private Host hostIpv6;
|
||||||
private HostResource hostResourceBoth;
|
private Host hostBoth;
|
||||||
private HostResource hostResourceNoAddresses;
|
private Host hostNoAddresses;
|
||||||
private HostResource hostResourceNotLinked;
|
private Host hostNotLinked;
|
||||||
private HostResource hostResourceSuperordinatePendingTransfer;
|
private Host hostSuperordinatePendingTransfer;
|
||||||
private ContactResource contactResourceRegistrant;
|
private ContactResource contactResourceRegistrant;
|
||||||
private ContactResource contactResourceAdmin;
|
private ContactResource contactResourceAdmin;
|
||||||
private ContactResource contactResourceTech;
|
private ContactResource contactResourceTech;
|
||||||
|
@ -128,32 +128,32 @@ class RdapJsonFormatterTest {
|
||||||
ImmutableList.of("Somewhere", "Over the Rainbow"),
|
ImmutableList.of("Somewhere", "Over the Rainbow"),
|
||||||
clock.nowUtc().minusYears(4),
|
clock.nowUtc().minusYears(4),
|
||||||
registrar);
|
registrar);
|
||||||
hostResourceIpv4 =
|
hostIpv4 =
|
||||||
makeAndPersistHostResource(
|
makeAndPersistHost(
|
||||||
"ns1.cat.みんな", "1.2.3.4", null, clock.nowUtc().minusYears(1), "unicoderegistrar");
|
"ns1.cat.みんな", "1.2.3.4", null, clock.nowUtc().minusYears(1), "unicoderegistrar");
|
||||||
hostResourceIpv6 =
|
hostIpv6 =
|
||||||
makeAndPersistHostResource(
|
makeAndPersistHost(
|
||||||
"ns2.cat.みんな",
|
"ns2.cat.みんな",
|
||||||
"bad:f00d:cafe:0:0:0:15:beef",
|
"bad:f00d:cafe:0:0:0:15:beef",
|
||||||
null,
|
null,
|
||||||
clock.nowUtc().minusYears(2),
|
clock.nowUtc().minusYears(2),
|
||||||
"unicoderegistrar");
|
"unicoderegistrar");
|
||||||
hostResourceBoth =
|
hostBoth =
|
||||||
makeAndPersistHostResource(
|
makeAndPersistHost(
|
||||||
"ns3.cat.みんな",
|
"ns3.cat.みんな",
|
||||||
"1.2.3.4",
|
"1.2.3.4",
|
||||||
"bad:f00d:cafe:0:0:0:15:beef",
|
"bad:f00d:cafe:0:0:0:15:beef",
|
||||||
clock.nowUtc().minusYears(3),
|
clock.nowUtc().minusYears(3),
|
||||||
"unicoderegistrar");
|
"unicoderegistrar");
|
||||||
hostResourceNoAddresses =
|
hostNoAddresses =
|
||||||
makeAndPersistHostResource(
|
makeAndPersistHost(
|
||||||
"ns4.cat.みんな", null, null, clock.nowUtc().minusYears(4), "unicoderegistrar");
|
"ns4.cat.みんな", null, null, clock.nowUtc().minusYears(4), "unicoderegistrar");
|
||||||
hostResourceNotLinked =
|
hostNotLinked =
|
||||||
makeAndPersistHostResource(
|
makeAndPersistHost(
|
||||||
"ns5.cat.みんな", null, null, clock.nowUtc().minusYears(5), "unicoderegistrar");
|
"ns5.cat.みんな", null, null, clock.nowUtc().minusYears(5), "unicoderegistrar");
|
||||||
hostResourceSuperordinatePendingTransfer =
|
hostSuperordinatePendingTransfer =
|
||||||
persistResource(
|
persistResource(
|
||||||
makeAndPersistHostResource(
|
makeAndPersistHost(
|
||||||
"ns1.dog.みんな", null, null, clock.nowUtc().minusYears(6), "unicoderegistrar")
|
"ns1.dog.みんな", null, null, clock.nowUtc().minusYears(6), "unicoderegistrar")
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(
|
.setSuperordinateDomain(
|
||||||
|
@ -189,8 +189,8 @@ class RdapJsonFormatterTest {
|
||||||
contactResourceRegistrant,
|
contactResourceRegistrant,
|
||||||
contactResourceAdmin,
|
contactResourceAdmin,
|
||||||
contactResourceTech,
|
contactResourceTech,
|
||||||
hostResourceIpv4,
|
hostIpv4,
|
||||||
hostResourceIpv6,
|
hostIpv6,
|
||||||
registrar)
|
registrar)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setCreationTimeForTest(clock.nowUtc().minusMonths(4))
|
.setCreationTimeForTest(clock.nowUtc().minusMonths(4))
|
||||||
|
@ -210,7 +210,7 @@ class RdapJsonFormatterTest {
|
||||||
.setCreationTimeForTest(clock.nowUtc())
|
.setCreationTimeForTest(clock.nowUtc())
|
||||||
.setLastEppUpdateTime(null)
|
.setLastEppUpdateTime(null)
|
||||||
.build());
|
.build());
|
||||||
// Create an unused domain that references hostResourceBoth and hostResourceNoAddresses so that
|
// Create an unused domain that references hostBoth and hostNoAddresses so that
|
||||||
// they will have "associated" (ie, StatusValue.LINKED) status.
|
// they will have "associated" (ie, StatusValue.LINKED) status.
|
||||||
persistResource(
|
persistResource(
|
||||||
makeDomain(
|
makeDomain(
|
||||||
|
@ -218,8 +218,8 @@ class RdapJsonFormatterTest {
|
||||||
contactResourceRegistrant,
|
contactResourceRegistrant,
|
||||||
contactResourceAdmin,
|
contactResourceAdmin,
|
||||||
contactResourceTech,
|
contactResourceTech,
|
||||||
hostResourceBoth,
|
hostBoth,
|
||||||
hostResourceNoAddresses,
|
hostNoAddresses,
|
||||||
registrar));
|
registrar));
|
||||||
|
|
||||||
// history entries
|
// history entries
|
||||||
|
@ -317,49 +317,38 @@ class RdapJsonFormatterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testHost_ipv4() {
|
void testHost_ipv4() {
|
||||||
assertThat(
|
assertThat(rdapJsonFormatter.createRdapNameserver(hostIpv4, OutputDataType.FULL).toJson())
|
||||||
rdapJsonFormatter.createRdapNameserver(hostResourceIpv4, OutputDataType.FULL).toJson())
|
|
||||||
.isEqualTo(loadJson("rdapjson_host_ipv4.json"));
|
.isEqualTo(loadJson("rdapjson_host_ipv4.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testHost_ipv6() {
|
void testHost_ipv6() {
|
||||||
assertThat(
|
assertThat(rdapJsonFormatter.createRdapNameserver(hostIpv6, OutputDataType.FULL).toJson())
|
||||||
rdapJsonFormatter.createRdapNameserver(hostResourceIpv6, OutputDataType.FULL).toJson())
|
|
||||||
.isEqualTo(loadJson("rdapjson_host_ipv6.json"));
|
.isEqualTo(loadJson("rdapjson_host_ipv6.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testHost_both() {
|
void testHost_both() {
|
||||||
assertThat(
|
assertThat(rdapJsonFormatter.createRdapNameserver(hostBoth, OutputDataType.FULL).toJson())
|
||||||
rdapJsonFormatter.createRdapNameserver(hostResourceBoth, OutputDataType.FULL).toJson())
|
|
||||||
.isEqualTo(loadJson("rdapjson_host_both.json"));
|
.isEqualTo(loadJson("rdapjson_host_both.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testHost_both_summary() {
|
void testHost_both_summary() {
|
||||||
assertThat(
|
assertThat(rdapJsonFormatter.createRdapNameserver(hostBoth, OutputDataType.SUMMARY).toJson())
|
||||||
rdapJsonFormatter
|
|
||||||
.createRdapNameserver(hostResourceBoth, OutputDataType.SUMMARY)
|
|
||||||
.toJson())
|
|
||||||
.isEqualTo(loadJson("rdapjson_host_both_summary.json"));
|
.isEqualTo(loadJson("rdapjson_host_both_summary.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testHost_noAddresses() {
|
void testHost_noAddresses() {
|
||||||
assertThat(
|
assertThat(
|
||||||
rdapJsonFormatter
|
rdapJsonFormatter.createRdapNameserver(hostNoAddresses, OutputDataType.FULL).toJson())
|
||||||
.createRdapNameserver(hostResourceNoAddresses, OutputDataType.FULL)
|
|
||||||
.toJson())
|
|
||||||
.isEqualTo(loadJson("rdapjson_host_no_addresses.json"));
|
.isEqualTo(loadJson("rdapjson_host_no_addresses.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testHost_notLinked() {
|
void testHost_notLinked() {
|
||||||
assertThat(
|
assertThat(rdapJsonFormatter.createRdapNameserver(hostNotLinked, OutputDataType.FULL).toJson())
|
||||||
rdapJsonFormatter
|
|
||||||
.createRdapNameserver(hostResourceNotLinked, OutputDataType.FULL)
|
|
||||||
.toJson())
|
|
||||||
.isEqualTo(loadJson("rdapjson_host_not_linked.json"));
|
.isEqualTo(loadJson("rdapjson_host_not_linked.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +356,7 @@ class RdapJsonFormatterTest {
|
||||||
void testHost_superordinateHasPendingTransfer() {
|
void testHost_superordinateHasPendingTransfer() {
|
||||||
assertThat(
|
assertThat(
|
||||||
rdapJsonFormatter
|
rdapJsonFormatter
|
||||||
.createRdapNameserver(hostResourceSuperordinatePendingTransfer, OutputDataType.FULL)
|
.createRdapNameserver(hostSuperordinatePendingTransfer, OutputDataType.FULL)
|
||||||
.toJson())
|
.toJson())
|
||||||
.isEqualTo(loadJson("rdapjson_host_pending_transfer.json"));
|
.isEqualTo(loadJson("rdapjson_host_pending_transfer.json"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import static google.registry.rdap.RdapTestHelper.assertThat;
|
||||||
import static google.registry.rdap.RdapTestHelper.loadJsonFile;
|
import static google.registry.rdap.RdapTestHelper.loadJsonFile;
|
||||||
import static google.registry.testing.DatabaseHelper.createTld;
|
import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
|
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
@ -31,6 +30,7 @@ import google.registry.rdap.RdapMetrics.SearchType;
|
||||||
import google.registry.rdap.RdapMetrics.WildcardType;
|
import google.registry.rdap.RdapMetrics.WildcardType;
|
||||||
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
|
import google.registry.testing.FullFieldsTestEntityHelper;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -47,19 +47,20 @@ class RdapNameserverActionTest extends RdapActionBaseTestCase<RdapNameserverActi
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
// normal
|
// normal
|
||||||
createTld("lol");
|
createTld("lol");
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
|
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
|
||||||
// idn
|
// idn
|
||||||
createTld("xn--q9jyb4c");
|
createTld("xn--q9jyb4c");
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns1.cat.xn--q9jyb4c", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(1));
|
"ns1.cat.xn--q9jyb4c", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(1));
|
||||||
// multilevel
|
// multilevel
|
||||||
createTld("1.tld");
|
createTld("1.tld");
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns1.domain.1.tld", "5.6.7.8", clock.nowUtc().minusYears(1));
|
"ns1.domain.1.tld", "5.6.7.8", clock.nowUtc().minusYears(1));
|
||||||
// deleted
|
// deleted
|
||||||
persistResource(
|
persistResource(
|
||||||
makeAndPersistHostResource("nsdeleted.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1))
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"nsdeleted.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1))
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDeletionTime(clock.nowUtc().minusMonths(1))
|
.setDeletionTime(clock.nowUtc().minusMonths(1))
|
||||||
.build());
|
.build());
|
||||||
|
@ -67,7 +68,8 @@ class RdapNameserverActionTest extends RdapActionBaseTestCase<RdapNameserverActi
|
||||||
persistResource(
|
persistResource(
|
||||||
makeRegistrar("otherregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE, 102L));
|
makeRegistrar("otherregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE, 102L));
|
||||||
// external
|
// external
|
||||||
makeAndPersistHostResource("ns1.domain.external", "9.10.11.12", clock.nowUtc().minusYears(1));
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"ns1.domain.external", "9.10.11.12", clock.nowUtc().minusYears(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JsonObject generateExpectedJson(
|
private JsonObject generateExpectedJson(
|
||||||
|
|
|
@ -23,10 +23,8 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResources;
|
import static google.registry.testing.DatabaseHelper.persistResources;
|
||||||
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
|
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
|
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
|
||||||
|
|
||||||
|
@ -37,13 +35,14 @@ 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 google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.rdap.RdapMetrics.EndpointType;
|
import google.registry.rdap.RdapMetrics.EndpointType;
|
||||||
import google.registry.rdap.RdapMetrics.SearchType;
|
import google.registry.rdap.RdapMetrics.SearchType;
|
||||||
import google.registry.rdap.RdapMetrics.WildcardType;
|
import google.registry.rdap.RdapMetrics.WildcardType;
|
||||||
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
||||||
import google.registry.testing.FakeResponse;
|
import google.registry.testing.FakeResponse;
|
||||||
|
import google.registry.testing.FullFieldsTestEntityHelper;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -57,8 +56,8 @@ class RdapNameserverSearchActionTest extends RdapSearchActionTestCase<RdapNamese
|
||||||
}
|
}
|
||||||
|
|
||||||
private Domain domainCatLol;
|
private Domain domainCatLol;
|
||||||
private HostResource hostNs1CatLol;
|
private Host hostNs1CatLol;
|
||||||
private HostResource hostNs2CatLol;
|
private Host hostNs2CatLol;
|
||||||
|
|
||||||
private JsonObject generateActualJsonWithName(String name) {
|
private JsonObject generateActualJsonWithName(String name) {
|
||||||
return generateActualJsonWithName(name, null);
|
return generateActualJsonWithName(name, null);
|
||||||
|
@ -107,25 +106,29 @@ class RdapNameserverSearchActionTest extends RdapSearchActionTestCase<RdapNamese
|
||||||
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
|
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
|
||||||
persistSimpleResources(makeRegistrarContacts(registrar));
|
persistSimpleResources(makeRegistrarContacts(registrar));
|
||||||
hostNs1CatLol =
|
hostNs1CatLol =
|
||||||
makeAndPersistHostResource("ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
|
||||||
hostNs2CatLol =
|
hostNs2CatLol =
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"ns2.cat.lol", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
|
"ns2.cat.lol", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
|
||||||
makeAndPersistHostResource(
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
"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));
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"ns1.cat.external", null, null, clock.nowUtc().minusYears(1));
|
||||||
|
|
||||||
// cat.みんな
|
// cat.みんな
|
||||||
createTld("xn--q9jyb4c");
|
createTld("xn--q9jyb4c");
|
||||||
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
|
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
|
||||||
persistSimpleResources(makeRegistrarContacts(registrar));
|
persistSimpleResources(makeRegistrarContacts(registrar));
|
||||||
makeAndPersistHostResource("ns1.cat.みんな", "1.2.3.5", clock.nowUtc().minusYears(1));
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"ns1.cat.みんな", "1.2.3.5", clock.nowUtc().minusYears(1));
|
||||||
|
|
||||||
// cat.1.test
|
// cat.1.test
|
||||||
createTld("1.test");
|
createTld("1.test");
|
||||||
registrar = persistResource(makeRegistrar("multiregistrar", "1.test", Registrar.State.ACTIVE));
|
registrar = persistResource(makeRegistrar("multiregistrar", "1.test", Registrar.State.ACTIVE));
|
||||||
persistSimpleResources(makeRegistrarContacts(registrar));
|
persistSimpleResources(makeRegistrarContacts(registrar));
|
||||||
makeAndPersistHostResource("ns1.cat.1.test", "1.2.3.6", clock.nowUtc().minusYears(1));
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"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 =
|
domainCatLol =
|
||||||
|
@ -178,12 +181,12 @@ class RdapNameserverSearchActionTest extends RdapSearchActionTestCase<RdapNamese
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createManyHosts(int numHosts) {
|
private void createManyHosts(int numHosts) {
|
||||||
ImmutableList.Builder<HostResource> hostsBuilder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<Host> hostsBuilder = new ImmutableList.Builder<>();
|
||||||
ImmutableSet.Builder<String> subordinateHostsBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<String> subordinateHostsBuilder = new ImmutableSet.Builder<>();
|
||||||
for (int i = 1; i <= numHosts; i++) {
|
for (int i = 1; i <= numHosts; i++) {
|
||||||
String hostName = String.format("nsx%d.cat.lol", i);
|
String hostName = String.format("nsx%d.cat.lol", i);
|
||||||
subordinateHostsBuilder.add(hostName);
|
subordinateHostsBuilder.add(hostName);
|
||||||
hostsBuilder.add(makeHostResource(hostName, "5.5.5.1", "5.5.5.2"));
|
hostsBuilder.add(FullFieldsTestEntityHelper.makeHost(hostName, "5.5.5.1", "5.5.5.2"));
|
||||||
}
|
}
|
||||||
persistResources(hostsBuilder.build());
|
persistResources(hostsBuilder.build());
|
||||||
domainCatLol =
|
domainCatLol =
|
||||||
|
@ -193,7 +196,8 @@ class RdapNameserverSearchActionTest extends RdapSearchActionTestCase<RdapNamese
|
||||||
|
|
||||||
private void createDeletedHost() {
|
private void createDeletedHost() {
|
||||||
persistResource(
|
persistResource(
|
||||||
makeAndPersistHostResource("nsdeleted.cat.lol", "4.3.2.1", clock.nowUtc().minusYears(1))
|
FullFieldsTestEntityHelper.makeAndPersistHost(
|
||||||
|
"nsdeleted.cat.lol", "4.3.2.1", clock.nowUtc().minusYears(1))
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setDeletionTime(clock.nowUtc().minusMonths(1))
|
.setDeletionTime(clock.nowUtc().minusMonths(1))
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -47,7 +47,7 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.poll.PollMessage.Autorenew;
|
import google.registry.model.poll.PollMessage.Autorenew;
|
||||||
import google.registry.model.rde.RdeMode;
|
import google.registry.model.rde.RdeMode;
|
||||||
|
@ -275,9 +275,8 @@ public class DomainToXjcConverterTest {
|
||||||
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
.setLastEppUpdateTime(DateTime.parse("1920-01-01T00:00:00Z"))
|
||||||
.setNameservers(
|
.setNameservers(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
makeHostResource(clock, "3-Q9JYB4C", "bird.or.devil.みんな", "1.2.3.4")
|
makeHost(clock, "3-Q9JYB4C", "bird.or.devil.みんな", "1.2.3.4").createVKey(),
|
||||||
.createVKey(),
|
makeHost(clock, "4-Q9JYB4C", "ns2.cat.みんな", "bad:f00d:cafe::15:beef")
|
||||||
makeHostResource(clock, "4-Q9JYB4C", "ns2.cat.みんな", "bad:f00d:cafe::15:beef")
|
|
||||||
.createVKey()))
|
.createVKey()))
|
||||||
.setRegistrant(
|
.setRegistrant(
|
||||||
makeContactResource(
|
makeContactResource(
|
||||||
|
@ -412,11 +411,10 @@ public class DomainToXjcConverterTest {
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HostResource makeHostResource(
|
private static Host makeHost(FakeClock clock, String repoId, String fqhn, String ip) {
|
||||||
FakeClock clock, String repoId, String fqhn, String ip) {
|
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
return persistEppResource(
|
return persistEppResource(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationRegistrarId("TheRegistrar")
|
.setCreationRegistrarId("TheRegistrar")
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import google.registry.xjc.host.XjcHostStatusType;
|
import google.registry.xjc.host.XjcHostStatusType;
|
||||||
|
@ -38,12 +38,12 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link HostResourceToXjcConverter}.
|
* Unit tests for {@link HostToXjcConverter}.
|
||||||
*
|
*
|
||||||
* <p>This tests the mapping between {@link HostResource} and {@link XjcRdeHost} as well as some
|
* <p>This tests the mapping between {@link Host} and {@link XjcRdeHost} as well as some exceptional
|
||||||
* exceptional conditions.
|
* conditions.
|
||||||
*/
|
*/
|
||||||
public class HostResourceToXjcConverterTest {
|
public class HostToXjcConverterTest {
|
||||||
|
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
public final AppEngineExtension appEngine = AppEngineExtension.builder().withCloudSql().build();
|
public final AppEngineExtension appEngine = AppEngineExtension.builder().withCloudSql().build();
|
||||||
|
@ -63,8 +63,8 @@ public class HostResourceToXjcConverterTest {
|
||||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||||
.build();
|
.build();
|
||||||
XjcRdeHost bean =
|
XjcRdeHost bean =
|
||||||
HostResourceToXjcConverter.convertSubordinateHost(
|
HostToXjcConverter.convertSubordinateHost(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationRegistrarId("LawyerCat")
|
.setCreationRegistrarId("LawyerCat")
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
||||||
|
@ -119,8 +119,8 @@ public class HostResourceToXjcConverterTest {
|
||||||
@Test
|
@Test
|
||||||
void testConvertExternalHost() {
|
void testConvertExternalHost() {
|
||||||
XjcRdeHost bean =
|
XjcRdeHost bean =
|
||||||
HostResourceToXjcConverter.convertExternalHost(
|
HostToXjcConverter.convertExternalHost(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationRegistrarId("LawyerCat")
|
.setCreationRegistrarId("LawyerCat")
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
||||||
|
@ -168,8 +168,8 @@ public class HostResourceToXjcConverterTest {
|
||||||
@Test
|
@Test
|
||||||
void testConvertExternalHost_ipv6() {
|
void testConvertExternalHost_ipv6() {
|
||||||
XjcRdeHost bean =
|
XjcRdeHost bean =
|
||||||
HostResourceToXjcConverter.convertExternalHost(
|
HostToXjcConverter.convertExternalHost(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationRegistrarId("LawyerCat")
|
.setCreationRegistrarId("LawyerCat")
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
||||||
|
@ -191,8 +191,8 @@ public class HostResourceToXjcConverterTest {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() ->
|
() ->
|
||||||
HostResourceToXjcConverter.convertExternalHost(
|
HostToXjcConverter.convertExternalHost(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationRegistrarId("LawyerCat")
|
.setCreationRegistrarId("LawyerCat")
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
||||||
|
@ -210,8 +210,8 @@ public class HostResourceToXjcConverterTest {
|
||||||
void testMarshal() throws Exception {
|
void testMarshal() throws Exception {
|
||||||
// Bean! Bean! Bean!
|
// Bean! Bean! Bean!
|
||||||
XjcRdeHostElement bean =
|
XjcRdeHostElement bean =
|
||||||
HostResourceToXjcConverter.convertExternal(
|
HostToXjcConverter.convertExternal(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setCreationRegistrarId("LawyerCat")
|
.setCreationRegistrarId("LawyerCat")
|
||||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||||
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
.setPersistedCurrentSponsorRegistrarId("BusinessCat")
|
|
@ -42,7 +42,7 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.poll.PollMessage.Autorenew;
|
import google.registry.model.poll.PollMessage.Autorenew;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -121,8 +121,8 @@ final class RdeFixtures {
|
||||||
.setIdnTableName("extended_latin")
|
.setIdnTableName("extended_latin")
|
||||||
.setNameservers(
|
.setNameservers(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
makeHostResource(clock, "bird.or.devil.みんな", "1.2.3.4").createVKey(),
|
makeHost(clock, "bird.or.devil.みんな", "1.2.3.4").createVKey(),
|
||||||
makeHostResource(clock, "ns2.cat.みんな", "bad:f00d:cafe::15:beef").createVKey()))
|
makeHost(clock, "ns2.cat.みんな", "bad:f00d:cafe::15:beef").createVKey()))
|
||||||
.setRegistrationExpirationTime(DateTime.parse("1994-01-01T00:00:00Z"))
|
.setRegistrationExpirationTime(DateTime.parse("1994-01-01T00:00:00Z"))
|
||||||
.setGracePeriods(
|
.setGracePeriods(
|
||||||
ImmutableSet.of(
|
ImmutableSet.of(
|
||||||
|
@ -253,10 +253,10 @@ final class RdeFixtures {
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
static HostResource makeHostResource(FakeClock clock, String fqhn, String ip) {
|
static Host makeHost(FakeClock clock, String fqhn, String ip) {
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
return persistResource(
|
return persistResource(
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setRepoId(generateNewContactHostRoid())
|
.setRepoId(generateNewContactHostRoid())
|
||||||
.setCreationRegistrarId("LawyerCat")
|
.setCreationRegistrarId("LawyerCat")
|
||||||
.setCreationTimeForTest(clock.nowUtc())
|
.setCreationTimeForTest(clock.nowUtc())
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
|
||||||
DomainToXjcConverterTest.class,
|
DomainToXjcConverterTest.class,
|
||||||
GhostrydeGpgIntegrationTest.class,
|
GhostrydeGpgIntegrationTest.class,
|
||||||
GhostrydeTest.class,
|
GhostrydeTest.class,
|
||||||
HostResourceToXjcConverterTest.class,
|
HostToXjcConverterTest.class,
|
||||||
RdeStagingActionTest.class,
|
RdeStagingActionTest.class,
|
||||||
RdeUploadActionTest.class,
|
RdeUploadActionTest.class,
|
||||||
RdeReportActionTest.class,
|
RdeReportActionTest.class,
|
||||||
|
|
|
@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.net.MediaType;
|
import com.google.common.net.MediaType;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.reporting.spec11.soy.Spec11EmailSoyInfo;
|
import google.registry.reporting.spec11.soy.Spec11EmailSoyInfo;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
|
@ -121,7 +121,7 @@ class Spec11EmailUtilsTest {
|
||||||
"Super Cool Registry");
|
"Super Cool Registry");
|
||||||
|
|
||||||
createTld("com");
|
createTld("com");
|
||||||
HostResource host = persistActiveHost("ns1.example.com");
|
Host host = persistActiveHost("ns1.example.com");
|
||||||
aDomain = persistDomainWithHost("a.com", host);
|
aDomain = persistDomainWithHost("a.com", host);
|
||||||
bDomain = persistDomainWithHost("b.com", host);
|
bDomain = persistDomainWithHost("b.com", host);
|
||||||
persistDomainWithHost("c.com", host);
|
persistDomainWithHost("c.com", host);
|
||||||
|
@ -238,7 +238,7 @@ class Spec11EmailUtilsTest {
|
||||||
void testSuccess_dealsWithDeletedDomains() throws Exception {
|
void testSuccess_dealsWithDeletedDomains() throws Exception {
|
||||||
// Create an inactive domain and an active domain with the same name.
|
// Create an inactive domain and an active domain with the same name.
|
||||||
persistResource(loadByEntity(aDomain).asBuilder().addStatusValue(SERVER_HOLD).build());
|
persistResource(loadByEntity(aDomain).asBuilder().addStatusValue(SERVER_HOLD).build());
|
||||||
HostResource host = persistActiveHost("ns1.example.com");
|
Host host = persistActiveHost("ns1.example.com");
|
||||||
aDomain = persistDomainWithHost("a.com", host);
|
aDomain = persistDomainWithHost("a.com", host);
|
||||||
|
|
||||||
emailUtils.emailSpec11Reports(
|
emailUtils.emailSpec11Reports(
|
||||||
|
@ -408,7 +408,7 @@ class Spec11EmailUtilsTest {
|
||||||
assertThat(message).isEqualTo(expectedContentBuilder.build());
|
assertThat(message).isEqualTo(expectedContentBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Domain persistDomainWithHost(String domainName, HostResource host) {
|
private static Domain persistDomainWithHost(String domainName, Host host) {
|
||||||
return persistResource(
|
return persistResource(
|
||||||
DatabaseHelper.newDomain(domainName)
|
DatabaseHelper.newDomain(domainName)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
|
|
|
@ -88,7 +88,7 @@ import google.registry.model.domain.token.AllocationToken;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.index.EppResourceIndex;
|
import google.registry.model.index.EppResourceIndex;
|
||||||
import google.registry.model.index.EppResourceIndexBucket;
|
import google.registry.model.index.EppResourceIndexBucket;
|
||||||
import google.registry.model.index.ForeignKeyIndex;
|
import google.registry.model.index.ForeignKeyIndex;
|
||||||
|
@ -154,12 +154,12 @@ public class DatabaseHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource newHostResource(String hostName) {
|
public static Host newHost(String hostName) {
|
||||||
return newHostResourceWithRoid(hostName, generateNewContactHostRoid());
|
return newHostWithRoid(hostName, generateNewContactHostRoid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource newHostResourceWithRoid(String hostName, String repoId) {
|
public static Host newHostWithRoid(String hostName, String repoId) {
|
||||||
return new HostResource.Builder()
|
return new Host.Builder()
|
||||||
.setHostName(hostName)
|
.setHostName(hostName)
|
||||||
.setCreationRegistrarId("TheRegistrar")
|
.setCreationRegistrarId("TheRegistrar")
|
||||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||||
|
@ -177,9 +177,9 @@ public class DatabaseHelper {
|
||||||
return newDomain(domainName, generateNewDomainRoid(getTldFromDomainName(domainName)), contact);
|
return newDomain(domainName, generateNewDomainRoid(getTldFromDomainName(domainName)), contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Domain newDomain(String domainName, HostResource... hosts) {
|
public static Domain newDomain(String domainName, Host... hosts) {
|
||||||
ImmutableSet<VKey<HostResource>> hostKeys =
|
ImmutableSet<VKey<Host>> hostKeys =
|
||||||
Arrays.stream(hosts).map(HostResource::createVKey).collect(toImmutableSet());
|
Arrays.stream(hosts).map(Host::createVKey).collect(toImmutableSet());
|
||||||
return newDomain(domainName).asBuilder().setNameservers(hostKeys).build();
|
return newDomain(domainName).asBuilder().setNameservers(hostKeys).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,15 +269,14 @@ public class DatabaseHelper {
|
||||||
newContactResource(contactId).asBuilder().setDeletionTime(deletionTime).build());
|
newContactResource(contactId).asBuilder().setDeletionTime(deletionTime).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource persistActiveHost(String hostName) {
|
public static Host persistActiveHost(String hostName) {
|
||||||
return persistResource(newHostResource(hostName));
|
return persistResource(newHost(hostName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource persistActiveSubordinateHost(
|
public static Host persistActiveSubordinateHost(String hostName, Domain superordinateDomain) {
|
||||||
String hostName, Domain superordinateDomain) {
|
|
||||||
checkNotNull(superordinateDomain);
|
checkNotNull(superordinateDomain);
|
||||||
return persistResource(
|
return persistResource(
|
||||||
newHostResource(hostName)
|
newHost(hostName)
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setSuperordinateDomain(superordinateDomain.createVKey())
|
.setSuperordinateDomain(superordinateDomain.createVKey())
|
||||||
.setInetAddresses(
|
.setInetAddresses(
|
||||||
|
@ -286,9 +285,8 @@ public class DatabaseHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Persists a host resource with the given hostname deleted at the specified time. */
|
/** Persists a host resource with the given hostname deleted at the specified time. */
|
||||||
public static HostResource persistDeletedHost(String hostName, DateTime deletionTime) {
|
public static Host persistDeletedHost(String hostName, DateTime deletionTime) {
|
||||||
return persistResource(
|
return persistResource(newHost(hostName).asBuilder().setDeletionTime(deletionTime).build());
|
||||||
newHostResource(hostName).asBuilder().setDeletionTime(deletionTime).build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Domain persistActiveDomain(String domainName) {
|
public static Domain persistActiveDomain(String domainName) {
|
||||||
|
@ -484,8 +482,7 @@ public class DatabaseHelper {
|
||||||
.forEach(
|
.forEach(
|
||||||
hostname ->
|
hostname ->
|
||||||
deleteResource(
|
deleteResource(
|
||||||
EppResourceUtils.loadByForeignKey(HostResource.class, hostname, now)
|
EppResourceUtils.loadByForeignKey(Host.class, hostname, now).get()));
|
||||||
.get()));
|
|
||||||
for (HistoryEntry hist : historyEntries) {
|
for (HistoryEntry hist : historyEntries) {
|
||||||
deleteResource(hist);
|
deleteResource(hist);
|
||||||
}
|
}
|
||||||
|
@ -1158,7 +1155,7 @@ public class DatabaseHelper {
|
||||||
return resource.getRepoId() != null
|
return resource.getRepoId() != null
|
||||||
? HistoryEntry.Type.CONTACT_CREATE
|
? HistoryEntry.Type.CONTACT_CREATE
|
||||||
: HistoryEntry.Type.CONTACT_UPDATE;
|
: HistoryEntry.Type.CONTACT_UPDATE;
|
||||||
} else if (resource instanceof HostResource) {
|
} else if (resource instanceof Host) {
|
||||||
return resource.getRepoId() != null
|
return resource.getRepoId() != null
|
||||||
? HistoryEntry.Type.HOST_CREATE
|
? HistoryEntry.Type.HOST_CREATE
|
||||||
: HistoryEntry.Type.HOST_UPDATE;
|
: HistoryEntry.Type.HOST_UPDATE;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import google.registry.model.domain.Period;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.RegistrarAddress;
|
import google.registry.model.registrar.RegistrarAddress;
|
||||||
import google.registry.model.registrar.RegistrarPoc;
|
import google.registry.model.registrar.RegistrarPoc;
|
||||||
|
@ -125,19 +125,18 @@ public final class FullFieldsTestEntityHelper {
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource makeHostResource(String fqhn, String ip) {
|
public static Host makeHost(String fqhn, String ip) {
|
||||||
return makeHostResource(fqhn, ip, null);
|
return makeHost(fqhn, ip, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource makeHostResource(
|
public static Host makeHost(String fqhn, @Nullable String ip1, @Nullable String ip2) {
|
||||||
String fqhn, @Nullable String ip1, @Nullable String ip2) {
|
return makeHost(fqhn, ip1, ip2, "TheRegistrar");
|
||||||
return makeHostResource(fqhn, ip1, ip2, "TheRegistrar");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource makeHostResource(
|
public static Host makeHost(
|
||||||
String fqhn, @Nullable String ip1, @Nullable String ip2, String registrarClientId) {
|
String fqhn, @Nullable String ip1, @Nullable String ip2, String registrarClientId) {
|
||||||
HostResource.Builder builder =
|
Host.Builder builder =
|
||||||
new HostResource.Builder()
|
new Host.Builder()
|
||||||
.setRepoId(generateNewContactHostRoid())
|
.setRepoId(generateNewContactHostRoid())
|
||||||
.setHostName(Idn.toASCII(fqhn))
|
.setHostName(Idn.toASCII(fqhn))
|
||||||
.setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z"))
|
.setCreationTimeForTest(DateTime.parse("2000-10-08T00:45:00Z"))
|
||||||
|
@ -155,29 +154,28 @@ public final class FullFieldsTestEntityHelper {
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource makeAndPersistHostResource(
|
public static Host makeAndPersistHost(
|
||||||
String fqhn, @Nullable String ip, @Nullable DateTime creationTime) {
|
String fqhn, @Nullable String ip, @Nullable DateTime creationTime) {
|
||||||
return makeAndPersistHostResource(fqhn, ip, null, creationTime);
|
return makeAndPersistHost(fqhn, ip, null, creationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource makeAndPersistHostResource(
|
public static Host makeAndPersistHost(
|
||||||
String fqhn, @Nullable String ip1, @Nullable String ip2, @Nullable DateTime creationTime) {
|
String fqhn, @Nullable String ip1, @Nullable String ip2, @Nullable DateTime creationTime) {
|
||||||
return makeAndPersistHostResource(fqhn, ip1, ip2, creationTime, "TheRegistrar");
|
return makeAndPersistHost(fqhn, ip1, ip2, creationTime, "TheRegistrar");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HostResource makeAndPersistHostResource(
|
public static Host makeAndPersistHost(
|
||||||
String fqhn,
|
String fqhn,
|
||||||
@Nullable String ip1,
|
@Nullable String ip1,
|
||||||
@Nullable String ip2,
|
@Nullable String ip2,
|
||||||
@Nullable DateTime creationTime,
|
@Nullable DateTime creationTime,
|
||||||
String registrarClientId) {
|
String registrarClientId) {
|
||||||
HostResource hostResource =
|
Host host = persistResource(makeHost(fqhn, ip1, ip2, registrarClientId));
|
||||||
persistResource(makeHostResource(fqhn, ip1, ip2, registrarClientId));
|
|
||||||
if (creationTime != null) {
|
if (creationTime != null) {
|
||||||
persistResource(makeHistoryEntry(
|
persistResource(
|
||||||
hostResource, HistoryEntry.Type.HOST_CREATE, null, "created", creationTime));
|
makeHistoryEntry(host, HistoryEntry.Type.HOST_CREATE, null, "created", creationTime));
|
||||||
}
|
}
|
||||||
return hostResource;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ContactResource makeContactResource(
|
public static ContactResource makeContactResource(
|
||||||
|
@ -335,8 +333,8 @@ public final class FullFieldsTestEntityHelper {
|
||||||
@Nullable ContactResource registrant,
|
@Nullable ContactResource registrant,
|
||||||
@Nullable ContactResource admin,
|
@Nullable ContactResource admin,
|
||||||
@Nullable ContactResource tech,
|
@Nullable ContactResource tech,
|
||||||
@Nullable HostResource ns1,
|
@Nullable Host ns1,
|
||||||
@Nullable HostResource ns2,
|
@Nullable Host ns2,
|
||||||
Registrar registrar) {
|
Registrar registrar) {
|
||||||
Domain.Builder builder =
|
Domain.Builder builder =
|
||||||
new Domain.Builder()
|
new Domain.Builder()
|
||||||
|
@ -370,7 +368,7 @@ public final class FullFieldsTestEntityHelper {
|
||||||
builder.setContacts(contactsBuilder.build());
|
builder.setContacts(contactsBuilder.build());
|
||||||
}
|
}
|
||||||
if ((ns1 != null) || (ns2 != null)) {
|
if ((ns1 != null) || (ns2 != null)) {
|
||||||
ImmutableSet.Builder<VKey<HostResource>> nsBuilder = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<VKey<Host>> nsBuilder = new ImmutableSet.Builder<>();
|
||||||
if (ns1 != null) {
|
if (ns1 != null) {
|
||||||
nsBuilder.add(ns1.createVKey());
|
nsBuilder.add(ns1.createVKey());
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,44 +20,42 @@ 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 google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.persistence.VKey;
|
import google.registry.persistence.VKey;
|
||||||
import google.registry.testing.TruthChainer.And;
|
import google.registry.testing.TruthChainer.And;
|
||||||
import javax.annotation.Nullable;
|
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 Host} instances. */
|
||||||
public final class HostResourceSubject
|
public final class HostSubject extends AbstractEppResourceSubject<Host, HostSubject> {
|
||||||
extends AbstractEppResourceSubject<HostResource, HostResourceSubject> {
|
|
||||||
|
|
||||||
private final HostResource actual;
|
private final Host actual;
|
||||||
|
|
||||||
public HostResourceSubject(FailureMetadata failureMetadata, HostResource subject) {
|
public HostSubject(FailureMetadata failureMetadata, Host subject) {
|
||||||
super(failureMetadata, checkNotNull(subject));
|
super(failureMetadata, checkNotNull(subject));
|
||||||
this.actual = subject;
|
this.actual = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SimpleSubjectBuilder<HostResourceSubject, HostResource> assertAboutHosts() {
|
public static SimpleSubjectBuilder<HostSubject, Host> assertAboutHosts() {
|
||||||
return assertAbout(HostResourceSubject::new);
|
return assertAbout(HostSubject::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public And<HostResourceSubject> hasLastTransferTime(DateTime lastTransferTime) {
|
public And<HostSubject> hasLastTransferTime(DateTime lastTransferTime) {
|
||||||
return hasValue(lastTransferTime, actual.getLastTransferTime(), "has lastTransferTime");
|
return hasValue(lastTransferTime, actual.getLastTransferTime(), "has lastTransferTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
public And<HostResourceSubject> hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) {
|
public And<HostSubject> hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) {
|
||||||
return doesNotHaveValue(lastTransferTime, actual.getLastTransferTime(), "lastTransferTime");
|
return doesNotHaveValue(lastTransferTime, actual.getLastTransferTime(), "lastTransferTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
public And<HostResourceSubject> hasLastSuperordinateChange(DateTime lastSuperordinateChange) {
|
public And<HostSubject> hasLastSuperordinateChange(DateTime lastSuperordinateChange) {
|
||||||
return hasValue(
|
return hasValue(
|
||||||
lastSuperordinateChange,
|
lastSuperordinateChange,
|
||||||
actual.getLastSuperordinateChange(),
|
actual.getLastSuperordinateChange(),
|
||||||
"has lastSuperordinateChange");
|
"has lastSuperordinateChange");
|
||||||
}
|
}
|
||||||
|
|
||||||
public And<HostResourceSubject> hasSuperordinateDomain(
|
public And<HostSubject> hasSuperordinateDomain(@Nullable VKey<Domain> superordinateDomain) {
|
||||||
@Nullable VKey<Domain> superordinateDomain) {
|
|
||||||
return hasValue(
|
return hasValue(
|
||||||
superordinateDomain, actual.getSuperordinateDomain(), "has superordinateDomain");
|
superordinateDomain, actual.getSuperordinateDomain(), "has superordinateDomain");
|
||||||
}
|
}
|
|
@ -40,7 +40,7 @@ import google.registry.model.billing.BillingEvent.Reason;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.DomainHistory;
|
import google.registry.model.domain.DomainHistory;
|
||||||
import google.registry.model.domain.RegistryLock;
|
import google.registry.model.domain.RegistryLock;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import google.registry.model.tld.Registry;
|
import google.registry.model.tld.Registry;
|
||||||
import google.registry.testing.AppEngineExtension;
|
import google.registry.testing.AppEngineExtension;
|
||||||
|
@ -87,7 +87,7 @@ public final class DomainLockUtilsTest {
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setup() {
|
void setup() {
|
||||||
createTlds("tld", "net");
|
createTlds("tld", "net");
|
||||||
HostResource host = persistActiveHost("ns1.example.net");
|
Host host = persistActiveHost("ns1.example.net");
|
||||||
domain = persistResource(DatabaseHelper.newDomain(DOMAIN_NAME, host));
|
domain = persistResource(DatabaseHelper.newDomain(DOMAIN_NAME, host));
|
||||||
|
|
||||||
domainLockUtils =
|
domainLockUtils =
|
||||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.tools;
|
||||||
import static com.google.common.io.BaseEncoding.base16;
|
import static com.google.common.io.BaseEncoding.base16;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||||
import static google.registry.testing.DatabaseHelper.newHostResource;
|
import static google.registry.testing.DatabaseHelper.newHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||||
|
@ -34,7 +34,7 @@ import com.google.common.net.InetAddresses;
|
||||||
import google.registry.model.domain.Domain;
|
import google.registry.model.domain.Domain;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.Host;
|
||||||
import google.registry.testing.DatabaseHelper;
|
import google.registry.testing.DatabaseHelper;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -61,10 +61,10 @@ class GenerateDnsReportCommandTest extends CommandTestCase<GenerateDnsReportComm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HostResource nameserver1;
|
private Host nameserver1;
|
||||||
private HostResource nameserver2;
|
private Host nameserver2;
|
||||||
private HostResource nameserver3;
|
private Host nameserver3;
|
||||||
private HostResource nameserver4;
|
private Host nameserver4;
|
||||||
private Domain domain1;
|
private Domain domain1;
|
||||||
|
|
||||||
private static final ImmutableList<?> DS_DATA_OUTPUT = ImmutableList.of(
|
private static final ImmutableList<?> DS_DATA_OUTPUT = ImmutableList.of(
|
||||||
|
@ -121,20 +121,24 @@ class GenerateDnsReportCommandTest extends CommandTestCase<GenerateDnsReportComm
|
||||||
clock.setTo(now);
|
clock.setTo(now);
|
||||||
|
|
||||||
createTlds("xn--q9jyb4c", "example");
|
createTlds("xn--q9jyb4c", "example");
|
||||||
nameserver1 = persistResource(
|
nameserver1 =
|
||||||
newHostResource("ns1.example.xn--q9jyb4c")
|
persistResource(
|
||||||
.asBuilder()
|
newHost("ns1.example.xn--q9jyb4c")
|
||||||
.setInetAddresses(ImmutableSet.of(
|
.asBuilder()
|
||||||
InetAddresses.forString("2607:f8b0:400d:c00::c0"),
|
.setInetAddresses(
|
||||||
InetAddresses.forString("192.168.1.2")))
|
ImmutableSet.of(
|
||||||
.build());
|
InetAddresses.forString("2607:f8b0:400d:c00::c0"),
|
||||||
nameserver2 = persistResource(
|
InetAddresses.forString("192.168.1.2")))
|
||||||
newHostResource("ns2.example.xn--q9jyb4c")
|
.build());
|
||||||
.asBuilder()
|
nameserver2 =
|
||||||
.setInetAddresses(ImmutableSet.of(
|
persistResource(
|
||||||
InetAddresses.forString("192.168.1.1"),
|
newHost("ns2.example.xn--q9jyb4c")
|
||||||
InetAddresses.forString("2607:f8b0:400d:c00::c1")))
|
.asBuilder()
|
||||||
.build());
|
.setInetAddresses(
|
||||||
|
ImmutableSet.of(
|
||||||
|
InetAddresses.forString("192.168.1.1"),
|
||||||
|
InetAddresses.forString("2607:f8b0:400d:c00::c1")))
|
||||||
|
.build());
|
||||||
nameserver3 = persistActiveHost("ns1.google.com");
|
nameserver3 = persistActiveHost("ns1.google.com");
|
||||||
nameserver4 = persistActiveHost("ns2.google.com");
|
nameserver4 = persistActiveHost("ns2.google.com");
|
||||||
domain1 =
|
domain1 =
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue