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;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static com.google.common.base.Strings.emptyToNull;
|
||||
import static com.google.common.collect.Sets.difference;
|
||||
import static com.google.common.collect.Sets.union;
|
||||
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.union;
|
||||
import static google.registry.util.DomainNameUtils.getTldFromSld;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
@ -176,11 +176,7 @@ public abstract class DomainBase extends EppResource {
|
|||
}
|
||||
|
||||
public Ref<ContactResource> getRegistrant() {
|
||||
return registrant == null ? null : registrant.getLinked();
|
||||
}
|
||||
|
||||
public ContactResource loadRegistrant() {
|
||||
return getRegistrant().get();
|
||||
return registrant.getLinked();
|
||||
}
|
||||
|
||||
public ImmutableSet<DesignatedContact> getContacts() {
|
||||
|
@ -238,12 +234,11 @@ public abstract class DomainBase extends EppResource {
|
|||
@Override
|
||||
public T build() {
|
||||
T instance = getInstance();
|
||||
checkState(
|
||||
!isNullOrEmpty(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
|
||||
checkArgumentNotNull(
|
||||
emptyToNull(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
|
||||
checkArgumentNotNull(instance.registrant, "Missing registrant");
|
||||
instance.tld = getTldFromSld(instance.fullyQualifiedDomainName);
|
||||
instance.allContacts = instance.registrant == null
|
||||
? instance.contacts
|
||||
: union(
|
||||
instance.allContacts = union(
|
||||
instance.getContacts(),
|
||||
DesignatedContact.create(REGISTRANT, instance.registrant.getLinked()));
|
||||
return super.build();
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.google.common.collect.Ordering;
|
|||
import com.google.common.net.InetAddresses;
|
||||
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.ContactPhoneNumber;
|
||||
|
@ -54,12 +53,8 @@ import java.net.Inet4Address;
|
|||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -400,16 +395,9 @@ public class RdapJsonFormatter {
|
|||
Map<Key<HostResource>, HostResource> loadedHosts =
|
||||
ofy().load().refs(domainResource.getNameservers());
|
||||
// And the registrant and other contacts.
|
||||
List<DesignatedContact> allContacts = new ArrayList<>();
|
||||
if (domainResource.getRegistrant() != null) {
|
||||
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);
|
||||
Map<Key<ContactResource>, ContactResource> loadedContacts =
|
||||
ofy().load().refs(domainResource.getReferencedContacts());
|
||||
|
||||
// Now, assemble the results, using the loaded objects as needed.
|
||||
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
|
||||
builder.put("objectClassName", "domain");
|
||||
|
@ -438,8 +426,9 @@ public class RdapJsonFormatter {
|
|||
}
|
||||
// Contacts
|
||||
ImmutableList.Builder<Object> entitiesBuilder = new ImmutableList.Builder<>();
|
||||
for (DesignatedContact designatedContact
|
||||
: DESIGNATED_CONTACT_ORDERING.immutableSortedCopy(allContacts)) {
|
||||
for (DesignatedContact designatedContact : FluentIterable.from(domainResource.getContacts())
|
||||
.append(DesignatedContact.create(Type.REGISTRANT, domainResource.getRegistrant()))
|
||||
.toSortedList(DESIGNATED_CONTACT_ORDERING)) {
|
||||
ContactResource loadedContact =
|
||||
loadedContacts.get(designatedContact.getContactRef().key());
|
||||
entitiesBuilder.add(makeRdapJsonForContact(
|
||||
|
|
|
@ -146,7 +146,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
|
|||
"name", application.getFullyQualifiedDomainName(),
|
||||
"period", period.getValue(),
|
||||
"nameservers", application.loadNameserverFullyQualifiedHostNames(),
|
||||
"registrant", application.loadRegistrant().getForeignKey(),
|
||||
"registrant", application.getRegistrant().get().getForeignKey(),
|
||||
"contacts", contactsMapBuilder.build(),
|
||||
"authInfo", application.getAuthInfo().getPw().getValue(),
|
||||
"smdId", application.getEncodedSignedMarks().isEmpty()
|
||||
|
|
|
@ -104,7 +104,7 @@ final class AuctionStatusCommand implements RemoteApiCommand, GtechCommand {
|
|||
new Function<DomainApplication, String>() {
|
||||
@Override
|
||||
public String apply(DomainApplication app) {
|
||||
ContactResource registrant = checkNotNull(app.loadRegistrant());
|
||||
ContactResource registrant = checkNotNull(app.getRegistrant().get());
|
||||
Object[] keysAndValues = new Object[] {
|
||||
"Domain", app.getFullyQualifiedDomainName(),
|
||||
"Type", app.getEncodedSignedMarks().isEmpty() ? "Landrush" : "Sunrise",
|
||||
|
|
|
@ -177,7 +177,7 @@ final class GenerateApplicationsReportCommand implements RemoteApiCommand, Gtech
|
|||
domainApplication.getEncodedSignedMarks().isEmpty() ? "landrush" : "sunrise",
|
||||
domainApplication.getApplicationStatus(),
|
||||
domainApplication.getCurrentSponsorClientId(),
|
||||
domainApplication.loadRegistrant().getEmailAddress(),
|
||||
domainApplication.getRegistrant().get().getEmailAddress(),
|
||||
validityMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ final class GenerateAuctionDataCommand implements RemoteApiCommand, GtechCommand
|
|||
+ "Can't process contending applications for %s because some applications "
|
||||
+ "are not yet validated.", domainName);
|
||||
|
||||
ContactResource registrant = checkNotNull(domainApplication.loadRegistrant());
|
||||
ContactResource registrant = checkNotNull(domainApplication.getRegistrant().get());
|
||||
result.add(emitApplication(domainApplication, registrant));
|
||||
|
||||
// Ensure the registrant's email address is unique across the contending applications.
|
||||
|
|
|
@ -278,6 +278,7 @@ public class DomainApplicationInfoFlowTest
|
|||
.setRepoId("123-COM")
|
||||
.setFullyQualifiedDomainName("timber.com")
|
||||
.setDeletionTime(DateTime.now().minusDays(1))
|
||||
.setRegistrant(Ref.create(persistActiveContact("jd1234")))
|
||||
.build());
|
||||
runFlow();
|
||||
}
|
||||
|
@ -298,6 +299,7 @@ public class DomainApplicationInfoFlowTest
|
|||
persistResource(new DomainApplication.Builder()
|
||||
.setRepoId("123-TLD")
|
||||
.setFullyQualifiedDomainName("invalid.tld")
|
||||
.setRegistrant(Ref.create(persistActiveContact("jd1234")))
|
||||
.setPhase(LaunchPhase.SUNRUSH)
|
||||
.build());
|
||||
runFlow();
|
||||
|
|
|
@ -68,8 +68,6 @@ public class RdapJsonFormatterTest {
|
|||
|
||||
private Registrar registrar;
|
||||
private DomainResource domainResourceFull;
|
||||
private DomainResource domainResourceNoRegistrant;
|
||||
private DomainResource domainResourceNoContacts;
|
||||
private DomainResource domainResourceNoNameservers;
|
||||
private HostResource hostResourceIpv4;
|
||||
private HostResource hostResourceIpv6;
|
||||
|
@ -131,24 +129,6 @@ public class RdapJsonFormatterTest {
|
|||
hostResourceIpv4,
|
||||
hostResourceIpv6,
|
||||
registrar));
|
||||
domainResourceNoRegistrant = persistResource(
|
||||
makeDomainResource(
|
||||
"dog.みんな",
|
||||
null,
|
||||
contactResourceAdmin,
|
||||
contactResourceTech,
|
||||
hostResourceBoth,
|
||||
hostResourceNoAddresses,
|
||||
registrar));
|
||||
domainResourceNoContacts = persistResource(
|
||||
makeDomainResource(
|
||||
"bird.みんな",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
hostResourceIpv4,
|
||||
hostResourceIpv6,
|
||||
registrar));
|
||||
domainResourceNoNameservers = persistResource(
|
||||
makeDomainResource(
|
||||
"fish.みんな",
|
||||
|
@ -167,20 +147,6 @@ public class RdapJsonFormatterTest {
|
|||
Period.create(1, Period.Unit.YEARS),
|
||||
"created",
|
||||
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(
|
||||
makeHistoryEntry(
|
||||
domainResourceNoNameservers,
|
||||
|
@ -339,22 +305,6 @@ public class RdapJsonFormatterTest {
|
|||
.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
|
||||
public void testDomain_noNameservers() throws Exception {
|
||||
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",
|
||||
"handle" : "13-Q9JYB4C",
|
||||
"handle" : "11-Q9JYB4C",
|
||||
"ldhName" : "fish.xn--q9jyb4c",
|
||||
"unicodeName" : "fish.みんな",
|
||||
"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()
|
||||
.setFullyQualifiedDomainName("example." + tld)
|
||||
.setRepoId(generateNewDomainRoid(tld))
|
||||
.setRegistrant(Ref.create(
|
||||
makeContactResource(clock,
|
||||
"5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
|
||||
.build();
|
||||
HistoryEntry historyEntry =
|
||||
persistResource(new HistoryEntry.Builder().setParent(domain).build());
|
||||
|
@ -106,9 +109,6 @@ final class RdeFixtures {
|
|||
Ref.create(
|
||||
makeHostResource(
|
||||
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"))
|
||||
.setGracePeriods(ImmutableSet.of(
|
||||
GracePeriod.forBillingEvent(GracePeriodStatus.RENEW,
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
|
||||
<rdeHost:host>
|
||||
<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:addr ip="v4">1.2.3.4</rdeHost:addr>
|
||||
<rdeHost:clID>BusinessCat</rdeHost:clID>
|
||||
|
@ -116,7 +116,7 @@
|
|||
|
||||
<rdeHost:host>
|
||||
<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:addr ip="v6">bad:f00d:cafe::15:beef</rdeHost:addr>
|
||||
<rdeHost:clID>BusinessCat</rdeHost:clID>
|
||||
|
@ -171,7 +171,7 @@
|
|||
|
||||
<rdeContact:contact>
|
||||
<rdeContact:id>5372808-IRL</rdeContact:id>
|
||||
<rdeContact:roid>5-ROID</rdeContact:roid>
|
||||
<rdeContact:roid>6-ROID</rdeContact:roid>
|
||||
<rdeContact:status s="ok"/>
|
||||
<rdeContact:postalInfo type="int">
|
||||
<contact:name>be that word our sign in parting</contact:name>
|
||||
|
@ -194,7 +194,7 @@
|
|||
|
||||
<rdeContact:contact>
|
||||
<rdeContact:id>5372808-TRL</rdeContact:id>
|
||||
<rdeContact:roid>6-ROID</rdeContact:roid>
|
||||
<rdeContact:roid>7-ROID</rdeContact:roid>
|
||||
<rdeContact:status s="ok"/>
|
||||
<rdeContact:postalInfo type="int">
|
||||
<contact:name>bird or fiend!? i shrieked upstarting</contact:name>
|
||||
|
@ -217,7 +217,7 @@
|
|||
|
||||
<rdeContact:contact>
|
||||
<rdeContact:id>5372808-ERL</rdeContact:id>
|
||||
<rdeContact:roid>9-ROID</rdeContact:roid>
|
||||
<rdeContact:roid>3-ROID</rdeContact:roid>
|
||||
<rdeContact:status s="ok"/>
|
||||
<rdeContact:postalInfo type="int">
|
||||
<contact:name>(◕‿◕) nevermore</contact:name>
|
||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.tmch;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
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.TaskQueueHelper.assertTasksEnqueued;
|
||||
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.common.collect.ImmutableList;
|
||||
|
||||
import com.googlecode.objectify.Ref;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
|
||||
import google.registry.model.domain.DomainResource;
|
||||
|
@ -103,16 +105,19 @@ public class LordnTaskTest {
|
|||
LordnTask.convertTasksToCsv(null, clock.nowUtc(), "header");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_enqueueDomainResourceTask_sunrise() throws Exception {
|
||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
||||
DomainResource domain = new DomainResource.Builder()
|
||||
private DomainResource.Builder newDomainBuilder(DateTime applicationTime) {
|
||||
return new DomainResource.Builder()
|
||||
.setFullyQualifiedDomainName("fleece.example")
|
||||
.setRepoId("A-EXAMPLE")
|
||||
.setRegistrant(Ref.create(persistActiveContact("jd1234")))
|
||||
.setSmdId("smdzzzz")
|
||||
.setCreationClientId("TheRegistrar")
|
||||
.setApplicationTime(time)
|
||||
.setLaunchNotice(null)
|
||||
.setApplicationTime(applicationTime);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_enqueueDomainResourceTask_sunrise() throws Exception {
|
||||
DomainResource domain = newDomainBuilder(DateTime.parse("2010-05-01T10:11:12Z"))
|
||||
.setRepoId("A-EXAMPLE")
|
||||
.build();
|
||||
persistDomainAndEnqueueLordn(domain);
|
||||
String expectedPayload =
|
||||
|
@ -124,12 +129,8 @@ public class LordnTaskTest {
|
|||
@Test
|
||||
public void test_enqueueDomainResourceTask_claims() throws Exception {
|
||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
||||
DomainResource domain = new DomainResource.Builder()
|
||||
.setFullyQualifiedDomainName("fleece.example")
|
||||
DomainResource domain = newDomainBuilder(time)
|
||||
.setRepoId("11-EXAMPLE")
|
||||
.setSmdId("smdzzzz")
|
||||
.setCreationClientId("TheRegistrar")
|
||||
.setApplicationTime(time)
|
||||
.setLaunchNotice(LaunchNotice.create("landrush1tcn", null, null, time.minusHours(1)))
|
||||
.build();
|
||||
persistDomainAndEnqueueLordn(domain);
|
||||
|
@ -149,14 +150,8 @@ public class LordnTaskTest {
|
|||
.setIanaIdentifier(null)
|
||||
.build());
|
||||
}});
|
||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
||||
DomainResource domain = new DomainResource.Builder()
|
||||
.setFullyQualifiedDomainName("fleece.example")
|
||||
DomainResource domain = newDomainBuilder(DateTime.parse("2010-05-01T10:11:12Z"))
|
||||
.setRepoId("3-EXAMPLE")
|
||||
.setSmdId("smdzzzz")
|
||||
.setCreationClientId("TheRegistrar")
|
||||
.setApplicationTime(time)
|
||||
.setLaunchNotice(null)
|
||||
.build();
|
||||
persistDomainAndEnqueueLordn(domain);
|
||||
String expectedPayload =
|
||||
|
@ -168,13 +163,9 @@ public class LordnTaskTest {
|
|||
@Test
|
||||
public void test_enqueueDomainResourceTask_throwsExceptionOnInvalidRegistrar() throws Exception {
|
||||
DateTime time = DateTime.parse("2010-05-01T10:11:12Z");
|
||||
DomainResource domain = new DomainResource.Builder()
|
||||
.setFullyQualifiedDomainName("fleece.example")
|
||||
DomainResource domain = newDomainBuilder(time)
|
||||
.setRepoId("9000-EXAMPLE")
|
||||
.setSmdId("smdzzzz")
|
||||
.setCreationClientId("nonexistentRegistrar")
|
||||
.setApplicationTime(time)
|
||||
.setLaunchNotice(null)
|
||||
.build();
|
||||
thrown.expect(NullPointerException.class,
|
||||
"No registrar found for client id: nonexistentRegistrar");
|
||||
|
|
Loading…
Add table
Reference in a new issue