mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 18:55:58 +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
|
@ -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
Add a link
Reference in a new issue