mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Registrant of a domain can never be null
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=122630609
This commit is contained in:
parent
68b75461db
commit
d2a66e9d1f
14 changed files with 43 additions and 396 deletions
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
package google.registry.model.domain;
|
package google.registry.model.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Strings.emptyToNull;
|
||||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
|
||||||
import static com.google.common.collect.Sets.difference;
|
import static com.google.common.collect.Sets.difference;
|
||||||
import static com.google.common.collect.Sets.union;
|
import static com.google.common.collect.Sets.union;
|
||||||
import static google.registry.model.domain.DesignatedContact.Type.REGISTRANT;
|
import static google.registry.model.domain.DesignatedContact.Type.REGISTRANT;
|
||||||
|
@ -25,6 +24,7 @@ import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
||||||
import static google.registry.util.CollectionUtils.union;
|
import static google.registry.util.CollectionUtils.union;
|
||||||
import static google.registry.util.DomainNameUtils.getTldFromSld;
|
import static google.registry.util.DomainNameUtils.getTldFromSld;
|
||||||
|
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
|
@ -176,11 +176,7 @@ public abstract class DomainBase extends EppResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ref<ContactResource> getRegistrant() {
|
public Ref<ContactResource> getRegistrant() {
|
||||||
return registrant == null ? null : registrant.getLinked();
|
return registrant.getLinked();
|
||||||
}
|
|
||||||
|
|
||||||
public ContactResource loadRegistrant() {
|
|
||||||
return getRegistrant().get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableSet<DesignatedContact> getContacts() {
|
public ImmutableSet<DesignatedContact> getContacts() {
|
||||||
|
@ -238,12 +234,11 @@ public abstract class DomainBase extends EppResource {
|
||||||
@Override
|
@Override
|
||||||
public T build() {
|
public T build() {
|
||||||
T instance = getInstance();
|
T instance = getInstance();
|
||||||
checkState(
|
checkArgumentNotNull(
|
||||||
!isNullOrEmpty(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
|
emptyToNull(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
|
||||||
|
checkArgumentNotNull(instance.registrant, "Missing registrant");
|
||||||
instance.tld = getTldFromSld(instance.fullyQualifiedDomainName);
|
instance.tld = getTldFromSld(instance.fullyQualifiedDomainName);
|
||||||
instance.allContacts = instance.registrant == null
|
instance.allContacts = union(
|
||||||
? instance.contacts
|
|
||||||
: union(
|
|
||||||
instance.getContacts(),
|
instance.getContacts(),
|
||||||
DesignatedContact.create(REGISTRANT, instance.registrant.getLinked()));
|
DesignatedContact.create(REGISTRANT, instance.registrant.getLinked()));
|
||||||
return super.build();
|
return super.build();
|
||||||
|
|
|
@ -30,7 +30,6 @@ import com.google.common.collect.Ordering;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import com.googlecode.objectify.Ref;
|
|
||||||
|
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.contact.ContactPhoneNumber;
|
import google.registry.model.contact.ContactPhoneNumber;
|
||||||
|
@ -54,12 +53,8 @@ import java.net.Inet4Address;
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -400,16 +395,9 @@ public class RdapJsonFormatter {
|
||||||
Map<Key<HostResource>, HostResource> loadedHosts =
|
Map<Key<HostResource>, HostResource> loadedHosts =
|
||||||
ofy().load().refs(domainResource.getNameservers());
|
ofy().load().refs(domainResource.getNameservers());
|
||||||
// And the registrant and other contacts.
|
// And the registrant and other contacts.
|
||||||
List<DesignatedContact> allContacts = new ArrayList<>();
|
Map<Key<ContactResource>, ContactResource> loadedContacts =
|
||||||
if (domainResource.getRegistrant() != null) {
|
ofy().load().refs(domainResource.getReferencedContacts());
|
||||||
allContacts.add(DesignatedContact.create(Type.REGISTRANT, domainResource.getRegistrant()));
|
|
||||||
}
|
|
||||||
allContacts.addAll(domainResource.getContacts());
|
|
||||||
Set<Ref<ContactResource>> contactRefs = new LinkedHashSet<>();
|
|
||||||
for (DesignatedContact designatedContact : allContacts) {
|
|
||||||
contactRefs.add(designatedContact.getContactRef());
|
|
||||||
}
|
|
||||||
Map<Key<ContactResource>, ContactResource> loadedContacts = ofy().load().refs(contactRefs);
|
|
||||||
// Now, assemble the results, using the loaded objects as needed.
|
// Now, assemble the results, using the loaded objects as needed.
|
||||||
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
|
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
|
||||||
builder.put("objectClassName", "domain");
|
builder.put("objectClassName", "domain");
|
||||||
|
@ -438,8 +426,9 @@ public class RdapJsonFormatter {
|
||||||
}
|
}
|
||||||
// Contacts
|
// Contacts
|
||||||
ImmutableList.Builder<Object> entitiesBuilder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<Object> entitiesBuilder = new ImmutableList.Builder<>();
|
||||||
for (DesignatedContact designatedContact
|
for (DesignatedContact designatedContact : FluentIterable.from(domainResource.getContacts())
|
||||||
: DESIGNATED_CONTACT_ORDERING.immutableSortedCopy(allContacts)) {
|
.append(DesignatedContact.create(Type.REGISTRANT, domainResource.getRegistrant()))
|
||||||
|
.toSortedList(DESIGNATED_CONTACT_ORDERING)) {
|
||||||
ContactResource loadedContact =
|
ContactResource loadedContact =
|
||||||
loadedContacts.get(designatedContact.getContactRef().key());
|
loadedContacts.get(designatedContact.getContactRef().key());
|
||||||
entitiesBuilder.add(makeRdapJsonForContact(
|
entitiesBuilder.add(makeRdapJsonForContact(
|
||||||
|
|
|
@ -146,7 +146,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
|
||||||
"name", application.getFullyQualifiedDomainName(),
|
"name", application.getFullyQualifiedDomainName(),
|
||||||
"period", period.getValue(),
|
"period", period.getValue(),
|
||||||
"nameservers", application.loadNameserverFullyQualifiedHostNames(),
|
"nameservers", application.loadNameserverFullyQualifiedHostNames(),
|
||||||
"registrant", application.loadRegistrant().getForeignKey(),
|
"registrant", application.getRegistrant().get().getForeignKey(),
|
||||||
"contacts", contactsMapBuilder.build(),
|
"contacts", contactsMapBuilder.build(),
|
||||||
"authInfo", application.getAuthInfo().getPw().getValue(),
|
"authInfo", application.getAuthInfo().getPw().getValue(),
|
||||||
"smdId", application.getEncodedSignedMarks().isEmpty()
|
"smdId", application.getEncodedSignedMarks().isEmpty()
|
||||||
|
|
|
@ -104,7 +104,7 @@ final class AuctionStatusCommand implements RemoteApiCommand, GtechCommand {
|
||||||
new Function<DomainApplication, String>() {
|
new Function<DomainApplication, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String apply(DomainApplication app) {
|
public String apply(DomainApplication app) {
|
||||||
ContactResource registrant = checkNotNull(app.loadRegistrant());
|
ContactResource registrant = checkNotNull(app.getRegistrant().get());
|
||||||
Object[] keysAndValues = new Object[] {
|
Object[] keysAndValues = new Object[] {
|
||||||
"Domain", app.getFullyQualifiedDomainName(),
|
"Domain", app.getFullyQualifiedDomainName(),
|
||||||
"Type", app.getEncodedSignedMarks().isEmpty() ? "Landrush" : "Sunrise",
|
"Type", app.getEncodedSignedMarks().isEmpty() ? "Landrush" : "Sunrise",
|
||||||
|
|
|
@ -177,7 +177,7 @@ final class GenerateApplicationsReportCommand implements RemoteApiCommand, Gtech
|
||||||
domainApplication.getEncodedSignedMarks().isEmpty() ? "landrush" : "sunrise",
|
domainApplication.getEncodedSignedMarks().isEmpty() ? "landrush" : "sunrise",
|
||||||
domainApplication.getApplicationStatus(),
|
domainApplication.getApplicationStatus(),
|
||||||
domainApplication.getCurrentSponsorClientId(),
|
domainApplication.getCurrentSponsorClientId(),
|
||||||
domainApplication.loadRegistrant().getEmailAddress(),
|
domainApplication.getRegistrant().get().getEmailAddress(),
|
||||||
validityMessage);
|
validityMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ final class GenerateAuctionDataCommand implements RemoteApiCommand, GtechCommand
|
||||||
+ "Can't process contending applications for %s because some applications "
|
+ "Can't process contending applications for %s because some applications "
|
||||||
+ "are not yet validated.", domainName);
|
+ "are not yet validated.", domainName);
|
||||||
|
|
||||||
ContactResource registrant = checkNotNull(domainApplication.loadRegistrant());
|
ContactResource registrant = checkNotNull(domainApplication.getRegistrant().get());
|
||||||
result.add(emitApplication(domainApplication, registrant));
|
result.add(emitApplication(domainApplication, registrant));
|
||||||
|
|
||||||
// Ensure the registrant's email address is unique across the contending applications.
|
// Ensure the registrant's email address is unique across the contending applications.
|
||||||
|
|
|
@ -278,6 +278,7 @@ public class DomainApplicationInfoFlowTest
|
||||||
.setRepoId("123-COM")
|
.setRepoId("123-COM")
|
||||||
.setFullyQualifiedDomainName("timber.com")
|
.setFullyQualifiedDomainName("timber.com")
|
||||||
.setDeletionTime(DateTime.now().minusDays(1))
|
.setDeletionTime(DateTime.now().minusDays(1))
|
||||||
|
.setRegistrant(Ref.create(persistActiveContact("jd1234")))
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
@ -298,6 +299,7 @@ public class DomainApplicationInfoFlowTest
|
||||||
persistResource(new DomainApplication.Builder()
|
persistResource(new DomainApplication.Builder()
|
||||||
.setRepoId("123-TLD")
|
.setRepoId("123-TLD")
|
||||||
.setFullyQualifiedDomainName("invalid.tld")
|
.setFullyQualifiedDomainName("invalid.tld")
|
||||||
|
.setRegistrant(Ref.create(persistActiveContact("jd1234")))
|
||||||
.setPhase(LaunchPhase.SUNRUSH)
|
.setPhase(LaunchPhase.SUNRUSH)
|
||||||
.build());
|
.build());
|
||||||
runFlow();
|
runFlow();
|
||||||
|
|
|
@ -68,8 +68,6 @@ public class RdapJsonFormatterTest {
|
||||||
|
|
||||||
private Registrar registrar;
|
private Registrar registrar;
|
||||||
private DomainResource domainResourceFull;
|
private DomainResource domainResourceFull;
|
||||||
private DomainResource domainResourceNoRegistrant;
|
|
||||||
private DomainResource domainResourceNoContacts;
|
|
||||||
private DomainResource domainResourceNoNameservers;
|
private DomainResource domainResourceNoNameservers;
|
||||||
private HostResource hostResourceIpv4;
|
private HostResource hostResourceIpv4;
|
||||||
private HostResource hostResourceIpv6;
|
private HostResource hostResourceIpv6;
|
||||||
|
@ -131,24 +129,6 @@ public class RdapJsonFormatterTest {
|
||||||
hostResourceIpv4,
|
hostResourceIpv4,
|
||||||
hostResourceIpv6,
|
hostResourceIpv6,
|
||||||
registrar));
|
registrar));
|
||||||
domainResourceNoRegistrant = persistResource(
|
|
||||||
makeDomainResource(
|
|
||||||
"dog.みんな",
|
|
||||||
null,
|
|
||||||
contactResourceAdmin,
|
|
||||||
contactResourceTech,
|
|
||||||
hostResourceBoth,
|
|
||||||
hostResourceNoAddresses,
|
|
||||||
registrar));
|
|
||||||
domainResourceNoContacts = persistResource(
|
|
||||||
makeDomainResource(
|
|
||||||
"bird.みんな",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
hostResourceIpv4,
|
|
||||||
hostResourceIpv6,
|
|
||||||
registrar));
|
|
||||||
domainResourceNoNameservers = persistResource(
|
domainResourceNoNameservers = persistResource(
|
||||||
makeDomainResource(
|
makeDomainResource(
|
||||||
"fish.みんな",
|
"fish.みんな",
|
||||||
|
@ -167,20 +147,6 @@ public class RdapJsonFormatterTest {
|
||||||
Period.create(1, Period.Unit.YEARS),
|
Period.create(1, Period.Unit.YEARS),
|
||||||
"created",
|
"created",
|
||||||
clock.nowUtc()));
|
clock.nowUtc()));
|
||||||
persistResource(
|
|
||||||
makeHistoryEntry(
|
|
||||||
domainResourceNoRegistrant,
|
|
||||||
HistoryEntry.Type.DOMAIN_CREATE,
|
|
||||||
Period.create(1, Period.Unit.YEARS),
|
|
||||||
"created",
|
|
||||||
clock.nowUtc()));
|
|
||||||
persistResource(
|
|
||||||
makeHistoryEntry(
|
|
||||||
domainResourceNoContacts,
|
|
||||||
HistoryEntry.Type.DOMAIN_CREATE,
|
|
||||||
Period.create(1, Period.Unit.YEARS),
|
|
||||||
"created",
|
|
||||||
clock.nowUtc()));
|
|
||||||
persistResource(
|
persistResource(
|
||||||
makeHistoryEntry(
|
makeHistoryEntry(
|
||||||
domainResourceNoNameservers,
|
domainResourceNoNameservers,
|
||||||
|
@ -339,22 +305,6 @@ public class RdapJsonFormatterTest {
|
||||||
.isEqualTo(loadJson("rdapjson_domain_full.json"));
|
.isEqualTo(loadJson("rdapjson_domain_full.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDomain_noRegistrant() throws Exception {
|
|
||||||
assertThat(
|
|
||||||
RdapJsonFormatter.makeRdapJsonForDomain(
|
|
||||||
domainResourceNoRegistrant, false, LINK_BASE, WHOIS_SERVER))
|
|
||||||
.isEqualTo(loadJson("rdapjson_domain_no_registrant.json"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDomain_noContacts() throws Exception {
|
|
||||||
assertThat(
|
|
||||||
RdapJsonFormatter.makeRdapJsonForDomain(
|
|
||||||
domainResourceNoContacts, false, LINK_BASE, WHOIS_SERVER))
|
|
||||||
.isEqualTo(loadJson("rdapjson_domain_no_contacts.json"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDomain_noNameservers() throws Exception {
|
public void testDomain_noNameservers() throws Exception {
|
||||||
assertThat(
|
assertThat(
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
{
|
|
||||||
"objectClassName" : "domain",
|
|
||||||
"handle" : "12-Q9JYB4C",
|
|
||||||
"ldhName" : "bird.xn--q9jyb4c",
|
|
||||||
"unicodeName" : "bird.みんな",
|
|
||||||
"status" :
|
|
||||||
[
|
|
||||||
"delete prohibited",
|
|
||||||
"renew prohibited",
|
|
||||||
"transfer prohibited",
|
|
||||||
"update prohibited"
|
|
||||||
],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/domain/bird.xn--q9jyb4c",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/domain/bird.xn--q9jyb4c",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "2000-01-01T00:00:00.000Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"eventAction": "expiration",
|
|
||||||
"eventDate": "2110-10-08T00:44:59.000Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"eventAction": "last changed",
|
|
||||||
"eventDate": "2009-05-29T20:13:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"nameservers" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"objectClassName" : "nameserver",
|
|
||||||
"handle" : "8-ROID",
|
|
||||||
"ldhName" : "ns1.cat.xn--q9jyb4c",
|
|
||||||
"unicodeName" : "ns1.cat.みんな",
|
|
||||||
"status" : ["active"],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "1999-01-01T00:00:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ipAddresses" :
|
|
||||||
{
|
|
||||||
"v4" : ["1.2.3.4"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"objectClassName" : "nameserver",
|
|
||||||
"handle" : "A-ROID",
|
|
||||||
"ldhName" : "ns2.cat.xn--q9jyb4c",
|
|
||||||
"unicodeName" : "ns2.cat.みんな",
|
|
||||||
"status" : ["active"],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "1998-01-01T00:00:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ipAddresses" :
|
|
||||||
{
|
|
||||||
"v6" : ["bad:f00d:cafe::15:beef"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"port43": "whois.google.com"
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"objectClassName" : "domain",
|
"objectClassName" : "domain",
|
||||||
"handle" : "13-Q9JYB4C",
|
"handle" : "11-Q9JYB4C",
|
||||||
"ldhName" : "fish.xn--q9jyb4c",
|
"ldhName" : "fish.xn--q9jyb4c",
|
||||||
"unicodeName" : "fish.みんな",
|
"unicodeName" : "fish.みんな",
|
||||||
"status" :
|
"status" :
|
||||||
|
|
|
@ -1,185 +0,0 @@
|
||||||
{
|
|
||||||
"objectClassName" : "domain",
|
|
||||||
"handle" : "11-Q9JYB4C",
|
|
||||||
"ldhName" : "dog.xn--q9jyb4c",
|
|
||||||
"unicodeName" : "dog.みんな",
|
|
||||||
"status" :
|
|
||||||
[
|
|
||||||
"delete prohibited",
|
|
||||||
"renew prohibited",
|
|
||||||
"transfer prohibited",
|
|
||||||
"update prohibited"
|
|
||||||
],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/domain/dog.xn--q9jyb4c",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/domain/dog.xn--q9jyb4c",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "2000-01-01T00:00:00.000Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"eventAction": "expiration",
|
|
||||||
"eventDate": "2110-10-08T00:44:59.000Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"eventAction": "last changed",
|
|
||||||
"eventDate": "2009-05-29T20:13:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"nameservers" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"objectClassName" : "nameserver",
|
|
||||||
"handle" : "C-ROID",
|
|
||||||
"ldhName" : "ns3.cat.xn--q9jyb4c",
|
|
||||||
"unicodeName" : "ns3.cat.みんな",
|
|
||||||
"status" : ["active"],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/nameserver/ns3.cat.xn--q9jyb4c",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/nameserver/ns3.cat.xn--q9jyb4c",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "1997-01-01T00:00:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ipAddresses" :
|
|
||||||
{
|
|
||||||
"v4" : ["1.2.3.4"]
|
|
||||||
"v6" : ["bad:f00d:cafe::15:beef"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"objectClassName" : "nameserver",
|
|
||||||
"handle" : "E-ROID",
|
|
||||||
"ldhName" : "ns4.cat.xn--q9jyb4c",
|
|
||||||
"unicodeName" : "ns4.cat.みんな",
|
|
||||||
"status" : ["active"],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "1996-01-01T00:00:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/nameserver/ns4.cat.xn--q9jyb4c",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/nameserver/ns4.cat.xn--q9jyb4c",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"entities" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"objectClassName" : "entity",
|
|
||||||
"handle" : "4-ROID",
|
|
||||||
"status" : ["active"],
|
|
||||||
"roles" : ["administrative"],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/entity/4-ROID",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/entity/4-ROID",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "1998-01-01T00:00:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vcardArray" :
|
|
||||||
[
|
|
||||||
"vcard",
|
|
||||||
[
|
|
||||||
["version", {}, "text", "4.0"],
|
|
||||||
["fn", {}, "text", "Santa Claus"],
|
|
||||||
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
|
|
||||||
["adr", {}, "text", [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
[
|
|
||||||
"Santa Claus Tower",
|
|
||||||
"41st floor",
|
|
||||||
"Suite みんな"
|
|
||||||
],
|
|
||||||
"KOKOMO",
|
|
||||||
"BM",
|
|
||||||
"31337",
|
|
||||||
"United States"]],
|
|
||||||
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
|
|
||||||
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"objectClassName" : "entity",
|
|
||||||
"handle" : "6-ROID",
|
|
||||||
"status" : ["active"],
|
|
||||||
"roles" : ["technical"],
|
|
||||||
"links" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"value" : "http://myserver.google.com/entity/6-ROID",
|
|
||||||
"rel" : "self",
|
|
||||||
"href" : "http://myserver.google.com/entity/6-ROID",
|
|
||||||
"type" : "application/rdap+json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"events": [
|
|
||||||
{
|
|
||||||
"eventAction": "registration",
|
|
||||||
"eventActor": "foo",
|
|
||||||
"eventDate": "1997-01-01T00:00:00.000Z"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vcardArray" :
|
|
||||||
[
|
|
||||||
"vcard",
|
|
||||||
[
|
|
||||||
["version", {}, "text", "4.0"],
|
|
||||||
["fn", {}, "text", "The Raven"],
|
|
||||||
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
|
|
||||||
["adr", {}, "text", [
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
[
|
|
||||||
"Chamber Door",
|
|
||||||
"upper level"
|
|
||||||
],
|
|
||||||
"KOKOMO",
|
|
||||||
"BM",
|
|
||||||
"31337",
|
|
||||||
"United States"]],
|
|
||||||
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
|
|
||||||
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
|
|
||||||
["email", {}, "text", "bog@cat.みんな"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"port43": "whois.google.com"
|
|
||||||
}
|
|
|
@ -66,6 +66,9 @@ final class RdeFixtures {
|
||||||
DomainResource domain = new DomainResource.Builder()
|
DomainResource domain = new DomainResource.Builder()
|
||||||
.setFullyQualifiedDomainName("example." + tld)
|
.setFullyQualifiedDomainName("example." + tld)
|
||||||
.setRepoId(generateNewDomainRoid(tld))
|
.setRepoId(generateNewDomainRoid(tld))
|
||||||
|
.setRegistrant(Ref.create(
|
||||||
|
makeContactResource(clock,
|
||||||
|
"5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
|
||||||
.build();
|
.build();
|
||||||
HistoryEntry historyEntry =
|
HistoryEntry historyEntry =
|
||||||
persistResource(new HistoryEntry.Builder().setParent(domain).build());
|
persistResource(new HistoryEntry.Builder().setParent(domain).build());
|
||||||
|
@ -106,9 +109,6 @@ final class RdeFixtures {
|
||||||
Ref.create(
|
Ref.create(
|
||||||
makeHostResource(
|
makeHostResource(
|
||||||
clock, "ns2.cat.みんな", "bad:f00d:cafe::15:beef"))))
|
clock, "ns2.cat.みんな", "bad:f00d:cafe::15:beef"))))
|
||||||
.setRegistrant(Ref.create(
|
|
||||||
makeContactResource(clock,
|
|
||||||
"5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
|
|
||||||
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
|
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
|
||||||
.setGracePeriods(ImmutableSet.of(
|
.setGracePeriods(ImmutableSet.of(
|
||||||
GracePeriod.forBillingEvent(GracePeriodStatus.RENEW,
|
GracePeriod.forBillingEvent(GracePeriodStatus.RENEW,
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
|
|
||||||
<rdeHost:host>
|
<rdeHost:host>
|
||||||
<rdeHost:name>bird.or.devil.xn--q9jyb4c</rdeHost:name>
|
<rdeHost:name>bird.or.devil.xn--q9jyb4c</rdeHost:name>
|
||||||
<rdeHost:roid>7-ROID</rdeHost:roid>
|
<rdeHost:roid>8-ROID</rdeHost:roid>
|
||||||
<rdeHost:status s="pendingUpdate"/>
|
<rdeHost:status s="pendingUpdate"/>
|
||||||
<rdeHost:addr ip="v4">1.2.3.4</rdeHost:addr>
|
<rdeHost:addr ip="v4">1.2.3.4</rdeHost:addr>
|
||||||
<rdeHost:clID>BusinessCat</rdeHost:clID>
|
<rdeHost:clID>BusinessCat</rdeHost:clID>
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
|
|
||||||
<rdeHost:host>
|
<rdeHost:host>
|
||||||
<rdeHost:name>ns2.cat.xn--q9jyb4c</rdeHost:name>
|
<rdeHost:name>ns2.cat.xn--q9jyb4c</rdeHost:name>
|
||||||
<rdeHost:roid>8-ROID</rdeHost:roid>
|
<rdeHost:roid>9-ROID</rdeHost:roid>
|
||||||
<rdeHost:status s="pendingUpdate"/>
|
<rdeHost:status s="pendingUpdate"/>
|
||||||
<rdeHost:addr ip="v6">bad:f00d:cafe::15:beef</rdeHost:addr>
|
<rdeHost:addr ip="v6">bad:f00d:cafe::15:beef</rdeHost:addr>
|
||||||
<rdeHost:clID>BusinessCat</rdeHost:clID>
|
<rdeHost:clID>BusinessCat</rdeHost:clID>
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
|
|
||||||
<rdeContact:contact>
|
<rdeContact:contact>
|
||||||
<rdeContact:id>5372808-IRL</rdeContact:id>
|
<rdeContact:id>5372808-IRL</rdeContact:id>
|
||||||
<rdeContact:roid>5-ROID</rdeContact:roid>
|
<rdeContact:roid>6-ROID</rdeContact:roid>
|
||||||
<rdeContact:status s="ok"/>
|
<rdeContact:status s="ok"/>
|
||||||
<rdeContact:postalInfo type="int">
|
<rdeContact:postalInfo type="int">
|
||||||
<contact:name>be that word our sign in parting</contact:name>
|
<contact:name>be that word our sign in parting</contact:name>
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
|
|
||||||
<rdeContact:contact>
|
<rdeContact:contact>
|
||||||
<rdeContact:id>5372808-TRL</rdeContact:id>
|
<rdeContact:id>5372808-TRL</rdeContact:id>
|
||||||
<rdeContact:roid>6-ROID</rdeContact:roid>
|
<rdeContact:roid>7-ROID</rdeContact:roid>
|
||||||
<rdeContact:status s="ok"/>
|
<rdeContact:status s="ok"/>
|
||||||
<rdeContact:postalInfo type="int">
|
<rdeContact:postalInfo type="int">
|
||||||
<contact:name>bird or fiend!? i shrieked upstarting</contact:name>
|
<contact:name>bird or fiend!? i shrieked upstarting</contact:name>
|
||||||
|
@ -217,7 +217,7 @@
|
||||||
|
|
||||||
<rdeContact:contact>
|
<rdeContact:contact>
|
||||||
<rdeContact:id>5372808-ERL</rdeContact:id>
|
<rdeContact:id>5372808-ERL</rdeContact:id>
|
||||||
<rdeContact:roid>9-ROID</rdeContact:roid>
|
<rdeContact:roid>3-ROID</rdeContact:roid>
|
||||||
<rdeContact:status s="ok"/>
|
<rdeContact:status s="ok"/>
|
||||||
<rdeContact:postalInfo type="int">
|
<rdeContact:postalInfo type="int">
|
||||||
<contact:name>(◕‿◕) nevermore</contact:name>
|
<contact:name>(◕‿◕) nevermore</contact:name>
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.tmch;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
|
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||||
import static google.registry.testing.DatastoreHelper.persistDomainAndEnqueueLordn;
|
import static google.registry.testing.DatastoreHelper.persistDomainAndEnqueueLordn;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
|
@ -32,6 +33,7 @@ import com.google.appengine.api.taskqueue.TransientFailureException;
|
||||||
import com.google.apphosting.api.DeadlineExceededException;
|
import com.google.apphosting.api.DeadlineExceededException;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import com.googlecode.objectify.Ref;
|
||||||
import com.googlecode.objectify.VoidWork;
|
import com.googlecode.objectify.VoidWork;
|
||||||
|
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
|
@ -103,16 +105,19 @@ public class LordnTaskTest {
|
||||||
LordnTask.convertTasksToCsv(null, clock.nowUtc(), "header");
|
LordnTask.convertTasksToCsv(null, clock.nowUtc(), "header");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
private DomainResource.Builder newDomainBuilder(DateTime applicationTime) {
|
||||||
public void test_enqueueDomainResourceTask_sunrise() throws Exception {
|
return new DomainResource.Builder()
|
||||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
|
||||||
DomainResource domain = new DomainResource.Builder()
|
|
||||||
.setFullyQualifiedDomainName("fleece.example")
|
.setFullyQualifiedDomainName("fleece.example")
|
||||||
.setRepoId("A-EXAMPLE")
|
.setRegistrant(Ref.create(persistActiveContact("jd1234")))
|
||||||
.setSmdId("smdzzzz")
|
.setSmdId("smdzzzz")
|
||||||
.setCreationClientId("TheRegistrar")
|
.setCreationClientId("TheRegistrar")
|
||||||
.setApplicationTime(time)
|
.setApplicationTime(applicationTime);
|
||||||
.setLaunchNotice(null)
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_enqueueDomainResourceTask_sunrise() throws Exception {
|
||||||
|
DomainResource domain = newDomainBuilder(DateTime.parse("2010-05-01T10:11:12Z"))
|
||||||
|
.setRepoId("A-EXAMPLE")
|
||||||
.build();
|
.build();
|
||||||
persistDomainAndEnqueueLordn(domain);
|
persistDomainAndEnqueueLordn(domain);
|
||||||
String expectedPayload =
|
String expectedPayload =
|
||||||
|
@ -124,12 +129,8 @@ public class LordnTaskTest {
|
||||||
@Test
|
@Test
|
||||||
public void test_enqueueDomainResourceTask_claims() throws Exception {
|
public void test_enqueueDomainResourceTask_claims() throws Exception {
|
||||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
||||||
DomainResource domain = new DomainResource.Builder()
|
DomainResource domain = newDomainBuilder(time)
|
||||||
.setFullyQualifiedDomainName("fleece.example")
|
|
||||||
.setRepoId("11-EXAMPLE")
|
.setRepoId("11-EXAMPLE")
|
||||||
.setSmdId("smdzzzz")
|
|
||||||
.setCreationClientId("TheRegistrar")
|
|
||||||
.setApplicationTime(time)
|
|
||||||
.setLaunchNotice(LaunchNotice.create("landrush1tcn", null, null, time.minusHours(1)))
|
.setLaunchNotice(LaunchNotice.create("landrush1tcn", null, null, time.minusHours(1)))
|
||||||
.build();
|
.build();
|
||||||
persistDomainAndEnqueueLordn(domain);
|
persistDomainAndEnqueueLordn(domain);
|
||||||
|
@ -149,14 +150,8 @@ public class LordnTaskTest {
|
||||||
.setIanaIdentifier(null)
|
.setIanaIdentifier(null)
|
||||||
.build());
|
.build());
|
||||||
}});
|
}});
|
||||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
DomainResource domain = newDomainBuilder(DateTime.parse("2010-05-01T10:11:12Z"))
|
||||||
DomainResource domain = new DomainResource.Builder()
|
|
||||||
.setFullyQualifiedDomainName("fleece.example")
|
|
||||||
.setRepoId("3-EXAMPLE")
|
.setRepoId("3-EXAMPLE")
|
||||||
.setSmdId("smdzzzz")
|
|
||||||
.setCreationClientId("TheRegistrar")
|
|
||||||
.setApplicationTime(time)
|
|
||||||
.setLaunchNotice(null)
|
|
||||||
.build();
|
.build();
|
||||||
persistDomainAndEnqueueLordn(domain);
|
persistDomainAndEnqueueLordn(domain);
|
||||||
String expectedPayload =
|
String expectedPayload =
|
||||||
|
@ -168,13 +163,9 @@ public class LordnTaskTest {
|
||||||
@Test
|
@Test
|
||||||
public void test_enqueueDomainResourceTask_throwsExceptionOnInvalidRegistrar() throws Exception {
|
public void test_enqueueDomainResourceTask_throwsExceptionOnInvalidRegistrar() throws Exception {
|
||||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
||||||
DomainResource domain = new DomainResource.Builder()
|
DomainResource domain = newDomainBuilder(time)
|
||||||
.setFullyQualifiedDomainName("fleece.example")
|
|
||||||
.setRepoId("9000-EXAMPLE")
|
.setRepoId("9000-EXAMPLE")
|
||||||
.setSmdId("smdzzzz")
|
|
||||||
.setCreationClientId("nonexistentRegistrar")
|
.setCreationClientId("nonexistentRegistrar")
|
||||||
.setApplicationTime(time)
|
|
||||||
.setLaunchNotice(null)
|
|
||||||
.build();
|
.build();
|
||||||
thrown.expect(NullPointerException.class,
|
thrown.expect(NullPointerException.class,
|
||||||
"No registrar found for client id: nonexistentRegistrar");
|
"No registrar found for client id: nonexistentRegistrar");
|
||||||
|
|
Loading…
Add table
Reference in a new issue