RDAP: Add "last update of RDAP database" event

The ICANN operational profile says:

1.4.12. An entity object within an RDAP response MUST contain an events
member with the following events:
o An event of eventAction type registration.
o An event of eventAction type last changed. The event of eventAction type last changed MUST be omitted if the Contact Object (as defined in RFC5733) has not been updated since it was created.
o An event of eventAction type last update of RDAP database.

It has similar wording for domains and hosts. The registration and last changed events are already being generated. This CL adds a "last update of RDAP database" event for all three object types. It's very redundant, and I have warned ICANN that "last update" doesn't mean what they might expect in the context of an eventually consistent database, but there we are.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130279688
This commit is contained in:
mountford 2016-08-15 07:40:37 -07:00 committed by Ben McIlwain
parent 82ab624b36
commit 19da9a1531
30 changed files with 302 additions and 67 deletions

View file

@ -25,6 +25,7 @@ import google.registry.request.HttpException;
import google.registry.request.HttpException.NotFoundException;
import google.registry.util.Clock;
import javax.inject.Inject;
import org.joda.time.DateTime;
/**
* RDAP (new WHOIS) action for domain requests.
@ -50,15 +51,16 @@ public class RdapDomainAction extends RdapActionBase {
@Override
public ImmutableMap<String, Object> getJsonObjectForResource(
String pathSearchString, boolean isHeadRequest, String linkBase) throws HttpException {
DateTime now = clock.nowUtc();
pathSearchString = canonicalizeName(pathSearchString);
validateDomainName(pathSearchString);
// The query string is not used; the RDAP syntax is /rdap/domain/mydomain.com.
DomainResource domainResource =
loadByUniqueId(DomainResource.class, pathSearchString, clock.nowUtc());
loadByUniqueId(DomainResource.class, pathSearchString, now);
if (domainResource == null) {
throw new NotFoundException(pathSearchString + " not found");
}
return RdapJsonFormatter.makeRdapJsonForDomain(
domainResource, true, rdapLinkBase, rdapWhoisServer);
domainResource, true, rdapLinkBase, rdapWhoisServer, now);
}
}

View file

@ -136,7 +136,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
}
return ImmutableList.of(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResource, false, rdapLinkBase, rdapWhoisServer));
domainResource, false, rdapLinkBase, rdapWhoisServer, now));
// Handle queries with a wildcard.
} else {
Query<DomainResource> query = ofy().load()
@ -153,7 +153,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
if (domainResource.getDeletionTime().isAfter(now)) {
builder.add(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResource, false, rdapLinkBase, rdapWhoisServer));
domainResource, false, rdapLinkBase, rdapWhoisServer, now));
}
}
return builder.build();
@ -168,7 +168,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
// Handle queries without a wildcard; just load the host by foreign key in the usual way.
if (!partialStringQuery.getHasWildcard()) {
Ref<HostResource> hostRef = loadAndGetReference(
HostResource.class, partialStringQuery.getInitialString(), clock.nowUtc());
HostResource.class, partialStringQuery.getInitialString(), now);
if (hostRef == null) {
return ImmutableList.of();
}
@ -196,7 +196,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
// looking for matches.
} else {
DomainResource domainResource = loadByUniqueId(
DomainResource.class, partialStringQuery.getSuffix(), clock.nowUtc());
DomainResource.class, partialStringQuery.getSuffix(), now);
if (domainResource == null) {
throw new NotFoundException("No domain found for specified nameserver suffix");
}
@ -205,7 +205,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
// 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.
if (partialStringQuery.matches(fqhn)) {
Ref<HostResource> hostRef = loadAndGetReference(HostResource.class, fqhn, clock.nowUtc());
Ref<HostResource> hostRef = loadAndGetReference(HostResource.class, fqhn, now);
if (hostRef != null) {
builder.add(hostRef);
}
@ -263,7 +263,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
for (DomainResource domainResource : query) {
builder.add(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResource, false, rdapLinkBase, rdapWhoisServer));
domainResource, false, rdapLinkBase, rdapWhoisServer, now));
}
}
return builder.build();

View file

@ -31,6 +31,7 @@ import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.NotFoundException;
import google.registry.util.Clock;
import javax.inject.Inject;
import org.joda.time.DateTime;
/**
* RDAP (new WHOIS) action for entity (contact and registrar) requests.
@ -58,6 +59,7 @@ public class RdapEntityAction extends RdapActionBase {
@Override
public ImmutableMap<String, Object> getJsonObjectForResource(
String pathSearchString, boolean isHeadRequest, String linkBase) throws HttpException {
DateTime now = clock.nowUtc();
// The query string is not used; the RDAP syntax is /rdap/entity/handle (the handle is the roid
// for contacts and the client identifier for registrars). Since RDAP's concept of an entity
// includes both contacts and registrars, search for one first, then the other.
@ -68,13 +70,14 @@ public class RdapEntityAction extends RdapActionBase {
ContactResource contactResource = ofy().load().key(contactKey).now();
// As per Andy Newton on the regext mailing list, contacts by themselves have no role, since
// they are global, and might have different roles for different domains.
if ((contactResource != null) && clock.nowUtc().isBefore(contactResource.getDeletionTime())) {
if ((contactResource != null) && now.isBefore(contactResource.getDeletionTime())) {
return RdapJsonFormatter.makeRdapJsonForContact(
contactResource,
true,
Optional.<DesignatedContact.Type>absent(),
rdapLinkBase,
rdapWhoisServer);
rdapWhoisServer,
now);
}
}
String clientId = pathSearchString.trim();
@ -83,7 +86,7 @@ public class RdapEntityAction extends RdapActionBase {
Registrar registrar = Registrar.loadByClientId(clientId);
if ((registrar != null) && registrar.isActiveAndPubliclyVisible()) {
return RdapJsonFormatter.makeRdapJsonForRegistrar(
registrar, true, rdapLinkBase, rdapWhoisServer);
registrar, true, rdapLinkBase, rdapWhoisServer, now);
}
}
throw !wasValidKey

View file

@ -39,6 +39,7 @@ import google.registry.request.HttpException.UnprocessableEntityException;
import google.registry.request.Parameter;
import google.registry.util.Clock;
import javax.inject.Inject;
import org.joda.time.DateTime;
/**
* RDAP (new WHOIS) action for entity (contact and registrar) search requests.
@ -75,6 +76,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
@Override
public ImmutableMap<String, Object> getJsonObjectForResource(
String pathSearchString, boolean isHeadRequest, String linkBase) throws HttpException {
DateTime now = clock.nowUtc();
// RDAP syntax example: /rdap/entities?fn=Bobby%20Joe*.
// The pathSearchString is not used by search commands.
if (pathSearchString.length() > 0) {
@ -98,7 +100,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
} else {
// syntax: /rdap/entities?handle=12345-*
// The handle is either the contact roid or the registrar clientId.
results = searchByHandle(RdapSearchPattern.create(handleParam.get(), false));
results = searchByHandle(RdapSearchPattern.create(handleParam.get(), false), now);
}
if (results.isEmpty()) {
throw new NotFoundException("No entities found");
@ -110,8 +112,8 @@ public class RdapEntitySearchAction extends RdapActionBase {
}
/** Searches for entities by handle, returning a JSON array of entity info maps. */
private ImmutableList<ImmutableMap<String, Object>>
searchByHandle(final RdapSearchPattern partialStringQuery) throws HttpException {
private ImmutableList<ImmutableMap<String, Object>> searchByHandle(
final RdapSearchPattern partialStringQuery, DateTime now) throws HttpException {
// Handle queries without a wildcard -- load by ID.
if (!partialStringQuery.getHasWildcard()) {
ContactResource contactResource = ofy().load()
@ -128,11 +130,12 @@ public class RdapEntitySearchAction extends RdapActionBase {
false,
Optional.<DesignatedContact.Type>absent(),
rdapLinkBase,
rdapWhoisServer));
rdapWhoisServer,
now));
}
if ((registrar != null) && registrar.isActiveAndPubliclyVisible()) {
builder.add(RdapJsonFormatter.makeRdapJsonForRegistrar(
registrar, false, rdapLinkBase, rdapWhoisServer));
registrar, false, rdapLinkBase, rdapWhoisServer, now));
}
return builder.build();
// Handle queries with a wildcard, but no suffix. For contact resources, the deletion time will
@ -154,7 +157,8 @@ public class RdapEntitySearchAction extends RdapActionBase {
false,
Optional.<DesignatedContact.Type>absent(),
rdapLinkBase,
rdapWhoisServer));
rdapWhoisServer,
now));
}
for (Registrar registrar
: Registrar.loadByClientIdRange(
@ -163,7 +167,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
rdapResultSetMaxSize)) {
if (registrar.isActiveAndPubliclyVisible()) {
builder.add(RdapJsonFormatter.makeRdapJsonForRegistrar(
registrar, false, rdapLinkBase, rdapWhoisServer));
registrar, false, rdapLinkBase, rdapWhoisServer, now));
}
}
// In theory, there could be more results than our max size, so limit the size.

View file

@ -201,7 +201,8 @@ public class RdapJsonFormatter {
REINSTANTIATION("reinstantiation"),
TRANSFER("transfer"),
LOCKED("locked"),
UNLOCKED("unlocked");
UNLOCKED("unlocked"),
LAST_UPDATE_OF_RDAP_DATABASE("last update of RDAP database");
/** Value as it appears in RDAP messages. */
private final String rfc7483String;
@ -412,7 +413,8 @@ public class RdapJsonFormatter {
DomainResource domainResource,
boolean isTopLevel,
@Nullable String linkBase,
@Nullable String whoisServer) {
@Nullable String whoisServer,
DateTime now) {
// Kick off the database loads of the nameservers that we will need.
Map<Key<HostResource>, HostResource> loadedHosts =
ofy().load().refs(domainResource.getNameservers());
@ -432,7 +434,7 @@ public class RdapJsonFormatter {
builder.put("status", makeStatusValueList(domainResource.getStatusValues()));
builder.put("links", ImmutableList.of(
makeLink("domain", domainResource.getFullyQualifiedDomainName(), linkBase)));
ImmutableList<Object> events = makeEvents(domainResource);
ImmutableList<Object> events = makeEvents(domainResource, now);
if (!events.isEmpty()) {
builder.put("events", events);
}
@ -440,7 +442,7 @@ public class RdapJsonFormatter {
ImmutableList.Builder<Object> nsBuilder = new ImmutableList.Builder<>();
for (HostResource hostResource
: HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts.values())) {
nsBuilder.add(makeRdapJsonForHost(hostResource, false, linkBase, null));
nsBuilder.add(makeRdapJsonForHost(hostResource, false, linkBase, null, now));
}
ImmutableList<Object> ns = nsBuilder.build();
if (!ns.isEmpty()) {
@ -454,7 +456,7 @@ public class RdapJsonFormatter {
ContactResource loadedContact =
loadedContacts.get(designatedContact.getContactRef().key());
entitiesBuilder.add(makeRdapJsonForContact(
loadedContact, false, Optional.of(designatedContact.getType()), linkBase, null));
loadedContact, false, Optional.of(designatedContact.getType()), linkBase, null, now));
}
ImmutableList<Object> entities = entitiesBuilder.build();
if (!entities.isEmpty()) {
@ -481,7 +483,8 @@ public class RdapJsonFormatter {
HostResource hostResource,
boolean isTopLevel,
@Nullable String linkBase,
@Nullable String whoisServer) {
@Nullable String whoisServer,
DateTime now) {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("objectClassName", "nameserver");
builder.put("handle", hostResource.getRepoId());
@ -493,7 +496,7 @@ public class RdapJsonFormatter {
builder.put("status", makeStatusValueList(hostResource.getStatusValues()));
builder.put("links", ImmutableList.of(
makeLink("nameserver", hostResource.getFullyQualifiedHostName(), linkBase)));
ImmutableList<Object> events = makeEvents(hostResource);
ImmutableList<Object> events = makeEvents(hostResource, now);
if (!events.isEmpty()) {
builder.put("events", events);
}
@ -546,7 +549,8 @@ public class RdapJsonFormatter {
boolean isTopLevel,
Optional<DesignatedContact.Type> contactType,
@Nullable String linkBase,
@Nullable String whoisServer) {
@Nullable String whoisServer,
DateTime now) {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("objectClassName", "entity");
builder.put("handle", contactResource.getRepoId());
@ -588,7 +592,7 @@ public class RdapJsonFormatter {
vcardBuilder.add(ImmutableList.of("email", ImmutableMap.of(), "text", emailAddress));
}
builder.put("vcardArray", ImmutableList.of("vcard", vcardBuilder.build()));
ImmutableList<Object> events = makeEvents(contactResource);
ImmutableList<Object> events = makeEvents(contactResource, now);
if (!events.isEmpty()) {
builder.put("events", events);
}
@ -613,7 +617,8 @@ public class RdapJsonFormatter {
Registrar registrar,
boolean isTopLevel,
@Nullable String linkBase,
@Nullable String whoisServer) {
@Nullable String whoisServer,
DateTime now) {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("objectClassName", "entity");
builder.put("handle", registrar.getClientIdentifier());
@ -656,7 +661,7 @@ public class RdapJsonFormatter {
vcardBuilder.add(ImmutableList.of("email", ImmutableMap.of(), "text", emailAddress));
}
builder.put("vcardArray", ImmutableList.of("vcard", vcardBuilder.build()));
ImmutableList<Object> events = makeEvents(registrar);
ImmutableList<Object> events = makeEvents(registrar, now);
if (!events.isEmpty()) {
builder.put("events", events);
}
@ -763,7 +768,7 @@ public class RdapJsonFormatter {
/**
* Creates an event list for a domain, host or contact resource.
*/
private static ImmutableList<Object> makeEvents(EppResource resource) {
private static ImmutableList<Object> makeEvents(EppResource resource, DateTime now) {
ImmutableList.Builder<Object> eventsBuilder = new ImmutableList.Builder<>();
for (HistoryEntry historyEntry : ofy().load()
.type(HistoryEntry.class)
@ -789,13 +794,14 @@ public class RdapJsonFormatter {
eventsBuilder.add(makeEvent(
RdapEventAction.LAST_CHANGED, null, resource.getLastEppUpdateTime()));
}
eventsBuilder.add(makeEvent(RdapEventAction.LAST_UPDATE_OF_RDAP_DATABASE, null, now));
return eventsBuilder.build();
}
/**
* Creates an event list for a {@link Registrar}.
*/
private static ImmutableList<Object> makeEvents(Registrar registrar) {
private static ImmutableList<Object> makeEvents(Registrar registrar, DateTime now) {
ImmutableList.Builder<Object> eventsBuilder = new ImmutableList.Builder<>();
eventsBuilder.add(makeEvent(
RdapEventAction.REGISTRATION,
@ -806,6 +812,7 @@ public class RdapJsonFormatter {
eventsBuilder.add(makeEvent(
RdapEventAction.LAST_CHANGED, null, registrar.getLastUpdateTime()));
}
eventsBuilder.add(makeEvent(RdapEventAction.LAST_UPDATE_OF_RDAP_DATABASE, null, now));
return eventsBuilder.build();
}

View file

@ -25,6 +25,7 @@ import google.registry.request.HttpException;
import google.registry.request.HttpException.NotFoundException;
import google.registry.util.Clock;
import javax.inject.Inject;
import org.joda.time.DateTime;
/**
* RDAP (new WHOIS) action for nameserver requests.
@ -50,14 +51,16 @@ public class RdapNameserverAction extends RdapActionBase {
@Override
public ImmutableMap<String, Object> getJsonObjectForResource(
String pathSearchString, boolean isHeadRequest, String linkBase) throws HttpException {
DateTime now = clock.nowUtc();
pathSearchString = canonicalizeName(pathSearchString);
// The RDAP syntax is /rdap/nameserver/ns1.mydomain.com.
validateDomainName(pathSearchString);
HostResource hostResource =
loadByUniqueId(HostResource.class, pathSearchString, clock.nowUtc());
loadByUniqueId(HostResource.class, pathSearchString, now);
if (hostResource == null) {
throw new NotFoundException(pathSearchString + " not found");
}
return RdapJsonFormatter.makeRdapJsonForHost(hostResource, true, rdapLinkBase, rdapWhoisServer);
return RdapJsonFormatter.makeRdapJsonForHost(
hostResource, true, rdapLinkBase, rdapWhoisServer, now);
}
}

View file

@ -96,7 +96,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
results = searchByName(RdapSearchPattern.create(Idn.toASCII(nameParam.get()), true), now);
} else {
// syntax: /rdap/nameservers?ip=1.2.3.4
results = searchByIp(ipParam.get());
results = searchByIp(ipParam.get(), now);
}
if (results.isEmpty()) {
throw new NotFoundException("No nameservers found");
@ -120,7 +120,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
}
return ImmutableList.of(
RdapJsonFormatter.makeRdapJsonForHost(
hostResource, false, rdapLinkBase, rdapWhoisServer));
hostResource, false, rdapLinkBase, rdapWhoisServer, now));
// Handle queries with a wildcard, but no suffix. There are no pending deletes for hosts, so we
// can call queryUndeleted.
} else if (partialStringQuery.getSuffix() == null) {
@ -132,7 +132,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
for (HostResource hostResource : query) {
builder.add(
RdapJsonFormatter.makeRdapJsonForHost(
hostResource, false, rdapLinkBase, rdapWhoisServer));
hostResource, false, rdapLinkBase, rdapWhoisServer, now));
}
return builder.build();
// Handle queries with a wildcard and a suffix. In this case, it is more efficient to do things
@ -140,7 +140,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
// looking for matches.
} else {
DomainResource domainResource =
loadByUniqueId(DomainResource.class, partialStringQuery.getSuffix(), clock.nowUtc());
loadByUniqueId(DomainResource.class, partialStringQuery.getSuffix(), now);
if (domainResource == null) {
throw new NotFoundException("No domain found for specified nameserver suffix");
}
@ -149,11 +149,11 @@ public class RdapNameserverSearchAction extends RdapActionBase {
// 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.
if (partialStringQuery.matches(fqhn)) {
HostResource hostResource = loadByUniqueId(HostResource.class, fqhn, clock.nowUtc());
HostResource hostResource = loadByUniqueId(HostResource.class, fqhn, now);
if (hostResource != null) {
builder.add(
RdapJsonFormatter.makeRdapJsonForHost(
hostResource, false, rdapLinkBase, rdapWhoisServer));
hostResource, false, rdapLinkBase, rdapWhoisServer, now));
}
}
}
@ -163,7 +163,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
/** Searches for nameservers by IP address, returning a JSON array of nameserver info maps. */
private ImmutableList<ImmutableMap<String, Object>>
searchByIp(final InetAddress inetAddress) throws HttpException {
searchByIp(final InetAddress inetAddress, DateTime now) throws HttpException {
// In theory, we could filter on deletion time being in the future. But we can't do that in the
// name query above (because we already have an inequality filter), and filtering on deletion
// time differently in the two cases seems like a recipe for future confusion.
@ -177,7 +177,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
for (HostResource hostResource : query) {
builder.add(
RdapJsonFormatter.makeRdapJsonForHost(
hostResource, false, rdapLinkBase, rdapWhoisServer));
hostResource, false, rdapLinkBase, rdapWhoisServer, now));
}
return builder.build();
}

View file

@ -203,36 +203,36 @@ public class RdapJsonFormatterTest {
@Test
public void testRegistrar() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForRegistrar(registrar, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_registrar.json"));
assertThat(RdapJsonFormatter.makeRdapJsonForRegistrar(
registrar, false, LINK_BASE, WHOIS_SERVER, clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_registrar.json"));
}
@Test
public void testHost_ipv4() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForHost(hostResourceIpv4, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_host_ipv4.json"));
assertThat(RdapJsonFormatter.makeRdapJsonForHost(
hostResourceIpv4, false, LINK_BASE, WHOIS_SERVER, clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_host_ipv4.json"));
}
@Test
public void testHost_ipv6() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForHost(hostResourceIpv6, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_host_ipv6.json"));
assertThat(RdapJsonFormatter.makeRdapJsonForHost(
hostResourceIpv6, false, LINK_BASE, WHOIS_SERVER, clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_host_ipv6.json"));
}
@Test
public void testHost_both() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForHost(hostResourceBoth, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_host_both.json"));
assertThat(RdapJsonFormatter.makeRdapJsonForHost(
hostResourceBoth, false, LINK_BASE, WHOIS_SERVER, clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_host_both.json"));
}
@Test
public void testHost_noAddresses() throws Exception {
assertThat(RdapJsonFormatter.makeRdapJsonForHost(
hostResourceNoAddresses, false, LINK_BASE, WHOIS_SERVER))
hostResourceNoAddresses, false, LINK_BASE, WHOIS_SERVER, clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_host_no_addresses.json"));
}
@ -244,7 +244,8 @@ public class RdapJsonFormatterTest {
false,
Optional.of(DesignatedContact.Type.REGISTRANT),
LINK_BASE,
WHOIS_SERVER))
WHOIS_SERVER,
clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_registrant.json"));
}
@ -256,7 +257,8 @@ public class RdapJsonFormatterTest {
false,
Optional.of(DesignatedContact.Type.REGISTRANT),
LINK_BASE_NO_TRAILING_SLASH,
WHOIS_SERVER))
WHOIS_SERVER,
clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_registrant.json"));
}
@ -268,7 +270,8 @@ public class RdapJsonFormatterTest {
false,
Optional.of(DesignatedContact.Type.REGISTRANT),
null,
WHOIS_SERVER))
WHOIS_SERVER,
clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_registrant_nobase.json"));
}
@ -280,7 +283,8 @@ public class RdapJsonFormatterTest {
false,
Optional.of(DesignatedContact.Type.ADMIN),
LINK_BASE,
WHOIS_SERVER))
WHOIS_SERVER,
clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_admincontact.json"));
}
@ -292,7 +296,8 @@ public class RdapJsonFormatterTest {
false,
Optional.of(DesignatedContact.Type.TECH),
LINK_BASE,
WHOIS_SERVER))
WHOIS_SERVER,
clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_techcontact.json"));
}
@ -304,23 +309,22 @@ public class RdapJsonFormatterTest {
false,
Optional.<DesignatedContact.Type>absent(),
LINK_BASE,
WHOIS_SERVER))
WHOIS_SERVER,
clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_rolelesscontact.json"));
}
@Test
public void testDomain_full() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceFull, false, LINK_BASE, WHOIS_SERVER))
assertThat(RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceFull, false, LINK_BASE, WHOIS_SERVER, clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_domain_full.json"));
}
@Test
public void testDomain_noNameservers() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceNoNameservers, false, LINK_BASE, WHOIS_SERVER))
assertThat(RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceNoNameservers, false, LINK_BASE, WHOIS_SERVER, clock.nowUtc()))
.isEqualTo(loadJson("rdapjson_domain_no_nameservers.json"));
}

View file

@ -17,6 +17,10 @@
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[

View file

@ -27,6 +27,10 @@
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"nameservers": [
@ -54,6 +58,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -82,6 +90,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -110,6 +122,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -198,6 +214,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -286,6 +306,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",

View file

@ -28,6 +28,10 @@
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"nameservers": [
@ -55,6 +59,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -83,6 +91,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -111,6 +123,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -199,6 +215,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -287,6 +307,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",

View file

@ -23,6 +23,10 @@
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}

View file

@ -18,6 +18,10 @@
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}

View file

@ -24,6 +24,10 @@
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}

View file

@ -19,6 +19,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
@ -64,6 +68,10 @@
"eventAction": "registration",
"eventActor": "2-Registrar",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"publicIds" :

View file

@ -29,6 +29,10 @@
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"nameservers": [
@ -56,6 +60,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -84,6 +92,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -112,6 +124,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -200,6 +216,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -288,6 +308,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -387,6 +411,10 @@
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"nameservers": [
@ -414,6 +442,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -442,6 +474,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
@ -470,6 +506,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -558,6 +598,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -646,6 +690,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",

View file

@ -24,6 +24,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
]
},
@ -51,6 +55,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
]
}

View file

@ -25,6 +25,10 @@
"eventActor": "%NAME%",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[

View file

@ -18,6 +18,10 @@
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[

View file

@ -32,6 +32,10 @@
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"nameservers" :
@ -56,6 +60,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
@ -83,6 +91,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
@ -112,6 +124,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
@ -157,6 +173,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
@ -202,6 +222,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :

View file

@ -33,6 +33,10 @@
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"entities" :
@ -56,6 +60,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
@ -101,6 +109,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
@ -146,6 +158,10 @@
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :

View file

@ -19,6 +19,10 @@
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{

View file

@ -19,6 +19,10 @@
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{

View file

@ -19,6 +19,10 @@
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{

View file

@ -19,5 +19,9 @@
"eventActor": "foo",
"eventDate": "1996-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
]
}

View file

@ -18,6 +18,10 @@
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[

View file

@ -18,6 +18,10 @@
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[

View file

@ -22,6 +22,10 @@
"eventAction": "last changed",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"publicIds" :
[

View file

@ -17,6 +17,10 @@
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[

View file

@ -18,6 +18,10 @@
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
{
"eventAction": "last update of RDAP database",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[