RDAP: Add event records to responses

RFC 7483 defines a way to attach events (such as registration, renewal, etc.) to domains, nameservers and entities. The ICANN Profile calls out particular events: registration, expiration, last changed and last update. This CL implements all the ICANN-defined events except last update (defined to be the last update time of the database), which doesn't make so much sense in our system.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117546838
This commit is contained in:
mountford 2016-03-18 07:55:12 -07:00 committed by Justine Tunney
parent 2293be4079
commit 68c0f4647f
32 changed files with 1089 additions and 224 deletions

View file

@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Ordering;
import com.google.common.net.InetAddresses;
import com.google.domain.registry.model.EppResource;
import com.google.domain.registry.model.contact.ContactPhoneNumber;
import com.google.domain.registry.model.contact.ContactResource;
import com.google.domain.registry.model.contact.PostalInfo;
@ -41,11 +42,14 @@ import com.google.domain.registry.model.host.HostResource;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.model.registrar.RegistrarAddress;
import com.google.domain.registry.model.registrar.RegistrarContact;
import com.google.domain.registry.model.reporting.HistoryEntry;
import com.google.domain.registry.util.Idn;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Ref;
import org.joda.time.DateTime;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
@ -87,7 +91,7 @@ public class RdapJsonFormatter {
static final String NOTICES = "notices";
private static final String REMARKS = "remarks";
/** Status values specified in RFC 7483 10.2.2. */
/** Status values specified in RFC 7483 § 10.2.2. */
private enum RdapStatus {
VALIDATED("validated"),
RENEW_PROHIBITED("renew prohibited"),
@ -144,7 +148,7 @@ public class RdapJsonFormatter {
.put(StatusValue.SERVER_UPDATE_PROHIBITED, RdapStatus.UPDATE_PROHIBITED)
.build());
/** Role values specified in RFC 7483 10.2.4. */
/** Role values specified in RFC 7483 § 10.2.4. */
private enum RdapEntityRole {
REGISTRANT("registrant"),
TECH("technical"),
@ -166,6 +170,50 @@ public class RdapJsonFormatter {
}
}
/** Status values specified in RFC 7483 § 10.2.2. */
private enum RdapEventAction {
REGISTRATION("registration"),
REREGISTRATION("reregistration"),
LAST_CHANGED("last changed"),
EXPIRATION("expiration"),
DELETION("deletion"),
REINSTANTIATION("reinstantiation"),
TRANSFER("transfer"),
LOCKED("locked"),
UNLOCKED("unlocked");
/** Value as it appears in RDAP messages. */
private final String rfc7483String;
private RdapEventAction(String rfc7483String) {
this.rfc7483String = rfc7483String;
}
@Override
public String toString() {
return rfc7483String;
}
}
/** Map of EPP status values to the RDAP equivalents. */
private static final ImmutableMap<HistoryEntry.Type, RdapEventAction>
historyEntryTypeToRdapEventActionMap =
Maps.immutableEnumMap(
new ImmutableMap.Builder<HistoryEntry.Type, RdapEventAction>()
.put(HistoryEntry.Type.CONTACT_CREATE, RdapEventAction.REGISTRATION)
.put(HistoryEntry.Type.CONTACT_DELETE, RdapEventAction.DELETION)
.put(HistoryEntry.Type.CONTACT_TRANSFER_APPROVE, RdapEventAction.TRANSFER)
.put(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE, RdapEventAction.REGISTRATION)
.put(HistoryEntry.Type.DOMAIN_APPLICATION_DELETE, RdapEventAction.DELETION)
.put(HistoryEntry.Type.DOMAIN_CREATE, RdapEventAction.REGISTRATION)
.put(HistoryEntry.Type.DOMAIN_DELETE, RdapEventAction.DELETION)
.put(HistoryEntry.Type.DOMAIN_RENEW, RdapEventAction.REREGISTRATION)
.put(HistoryEntry.Type.DOMAIN_RESTORE, RdapEventAction.REINSTANTIATION)
.put(HistoryEntry.Type.DOMAIN_TRANSFER_APPROVE, RdapEventAction.TRANSFER)
.put(HistoryEntry.Type.HOST_CREATE, RdapEventAction.REGISTRATION)
.put(HistoryEntry.Type.HOST_DELETE, RdapEventAction.DELETION)
.build());
private static final ImmutableList<String> CONFORMANCE_LIST =
ImmutableList.of(RDAP_CONFORMANCE_LEVEL);
@ -262,7 +310,7 @@ public class RdapJsonFormatter {
}
/**
* Creates a JSON object containing a notice or remark object, as defined by RFC 7483 section 4.3.
* Creates a JSON object containing a notice or remark object, as defined by RFC 7483 § 4.3.
* The object should then be inserted into a notices or remarks array. The builder fields are:
*
* <p>title: the title of the notice; if null, the notice will have no title
@ -270,7 +318,7 @@ public class RdapJsonFormatter {
* <p>description: objects which will be converted to strings to form the description of the
* notice (this is the only required field; all others are optional)
*
* <p>typeString: the notice or remark type as defined in section 10.2.1; if null, no type
* <p>typeString: the notice or remark type as defined in § 10.2.1; if null, no type
*
* <p>linkValueSuffix: the path at the end of the URL used in the value field of the link,
* without any initial slash (e.g. a suffix of help/toc equates to a URL of
@ -365,7 +413,11 @@ public class RdapJsonFormatter {
builder.put("status", makeStatusValueList(domainResource.getStatusValues()));
builder.put("links", ImmutableList.of(
makeLink("domain", domainResource.getFullyQualifiedDomainName(), linkBase)));
// nameservers
ImmutableList<Object> events = makeEvents(domainResource);
if (!events.isEmpty()) {
builder.put("events", events);
}
// Nameservers
ImmutableList.Builder<Object> nsBuilder = new ImmutableList.Builder<>();
for (HostResource hostResource
: HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts.values())) {
@ -375,7 +427,7 @@ public class RdapJsonFormatter {
if (!ns.isEmpty()) {
builder.put("nameservers", ns);
}
// contacts
// Contacts
ImmutableList.Builder<Object> entitiesBuilder = new ImmutableList.Builder<>();
for (DesignatedContact designatedContact
: DESIGNATED_CONTACT_ORDERING.immutableSortedCopy(allContacts)) {
@ -421,6 +473,10 @@ public class RdapJsonFormatter {
builder.put("status", makeStatusValueList(hostResource.getStatusValues()));
builder.put("links", ImmutableList.of(
makeLink("nameserver", hostResource.getFullyQualifiedHostName(), linkBase)));
ImmutableList<Object> events = makeEvents(hostResource);
if (!events.isEmpty()) {
builder.put("events", events);
}
ImmutableSet<InetAddress> inetAddresses = hostResource.getInetAddresses();
if (!inetAddresses.isEmpty()) {
ImmutableList.Builder<String> v4AddressesBuilder = new ImmutableList.Builder<>();
@ -512,6 +568,10 @@ 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);
if (!events.isEmpty()) {
builder.put("events", events);
}
if (whoisServer != null) {
builder.put("port43", whoisServer);
}
@ -576,6 +636,10 @@ 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);
if (!events.isEmpty()) {
builder.put("events", events);
}
// include the registrar contacts as subentities
ImmutableList.Builder<Map<String, Object>> registrarContactsBuilder =
new ImmutableList.Builder<>();
@ -676,6 +740,69 @@ public class RdapJsonFormatter {
|| registrarContact.getVisibleInWhoisAsTech();
}
/**
* Creates an event list for a domain, host or contact resource.
*/
private static ImmutableList<Object> makeEvents(EppResource resource) {
ImmutableList.Builder<Object> eventsBuilder = new ImmutableList.Builder<>();
for (HistoryEntry historyEntry : ofy().load()
.type(HistoryEntry.class)
.ancestor(resource)
.order("modificationTime")) {
// Only create an event if this is a type we care about.
if (!historyEntryTypeToRdapEventActionMap.containsKey(historyEntry.getType())) {
continue;
}
RdapEventAction eventAction =
historyEntryTypeToRdapEventActionMap.get(historyEntry.getType());
eventsBuilder.add(makeEvent(
eventAction, historyEntry.getClientId(), historyEntry.getModificationTime()));
}
if (resource instanceof DomainResource) {
DateTime expirationTime = ((DomainResource) resource).getRegistrationExpirationTime();
if (expirationTime != null) {
eventsBuilder.add(makeEvent(RdapEventAction.EXPIRATION, null, expirationTime));
}
}
if ((resource.getLastEppUpdateTime() != null)
&& resource.getLastEppUpdateTime().isAfter(resource.getCreationTime())) {
eventsBuilder.add(makeEvent(
RdapEventAction.LAST_CHANGED, null, resource.getLastEppUpdateTime()));
}
return eventsBuilder.build();
}
/**
* Creates an event list for a {@link Registrar}.
*/
private static ImmutableList<Object> makeEvents(Registrar registrar) {
ImmutableList.Builder<Object> eventsBuilder = new ImmutableList.Builder<>();
eventsBuilder.add(makeEvent(
RdapEventAction.REGISTRATION,
registrar.getClientIdentifier(),
registrar.getCreationTime()));
if ((registrar.getLastUpdateTime() != null)
&& registrar.getLastUpdateTime().isAfter(registrar.getCreationTime())) {
eventsBuilder.add(makeEvent(
RdapEventAction.LAST_CHANGED, null, registrar.getLastUpdateTime()));
}
return eventsBuilder.build();
}
/**
* Creates an RDAP event object as defined by RFC 7483.
*/
private static ImmutableMap<String, Object> makeEvent(
RdapEventAction eventAction, @Nullable String eventActor, DateTime eventDate) {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("eventAction", eventAction.toString());
if (eventActor != null) {
builder.put("eventActor", eventActor);
}
builder.put("eventDate", eventDate.toString());
return builder.build();
}
/**
* Creates a vCard address entry: array of strings specifying the components of the address.
*

View file

@ -18,9 +18,10 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.testing.DatastoreHelper.persistSimpleGlobalResources;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeDomainResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
@ -28,10 +29,13 @@ import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubs
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.model.contact.ContactResource;
import com.google.domain.registry.model.domain.DomainBase;
import com.google.domain.registry.model.domain.Period;
import com.google.domain.registry.model.host.HostResource;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.model.registry.Registry;
import com.google.domain.registry.model.reporting.HistoryEntry;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
@ -73,25 +77,22 @@ public class RdapDomainActionTest {
Registrar registrarLol = persistResource(makeRegistrar(
"evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrarLol));
ContactResource registrant =
persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol"));
ContactResource adminContact =
persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol"));
ContactResource techContact =
persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol"));
HostResource host1 =
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
HostResource host2 =
persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef"));
ContactResource registrant = makeAndPersistContactResource(
"5372808-ERL", "Goblin Market", "lol@cat.lol", clock.nowUtc().minusYears(1));
ContactResource adminContact = makeAndPersistContactResource(
"5372808-IRL", "Santa Claus", "BOFH@cat.lol", clock.nowUtc().minusYears(2));
ContactResource techContact = makeAndPersistContactResource(
"5372808-TRL", "The Raven", "bog@cat.lol", clock.nowUtc().minusYears(3));
HostResource host1 = makeAndPersistHostResource(
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
HostResource host2 = makeAndPersistHostResource(
"ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2));
DomainBase domainCatLol =
persistResource(makeDomainResource("cat.lol",
registrant,
adminContact,
techContact,
host1,
host2,
registrarLol));
registrant, adminContact, techContact, host1, host2, registrarLol));
// deleted domain in lol
persistResource(makeDomainResource("dodo.lol",
DomainBase domainDeleted = persistResource(makeDomainResource("dodo.lol",
registrant,
adminContact,
techContact,
@ -103,7 +104,7 @@ public class RdapDomainActionTest {
Registrar registrarIdn =
persistResource(makeRegistrar("idnregistrar", "IDN Registrar", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrarIdn));
persistResource(makeDomainResource("cat.みんな",
DomainBase domainCatIdn = persistResource(makeDomainResource("cat.みんな",
registrant,
adminContact,
techContact,
@ -114,7 +115,7 @@ public class RdapDomainActionTest {
Registrar registrar1tld = persistResource(
makeRegistrar("1tldregistrar", "Multilevel Registrar", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar1tld));
persistResource(makeDomainResource("cat.1.tld",
DomainBase domainCat1Tld = persistResource(makeDomainResource("cat.1.tld",
registrant,
adminContact,
techContact,
@ -126,6 +127,36 @@ public class RdapDomainActionTest {
action.response = response;
action.rdapLinkBase = "https://example.com/rdap/";
action.rdapWhoisServer = "whois.example.tld";
// history entries
persistResource(
makeHistoryEntry(
domainCatLol,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
persistResource(
makeHistoryEntry(
domainDeleted,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
persistResource(
makeHistoryEntry(
domainCatIdn,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
persistResource(
makeHistoryEntry(
domainCat1Tld,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
}
private Object generateActualJson(String domainName) {
@ -203,21 +234,21 @@ public class RdapDomainActionTest {
@Test
public void testValidDomain_works() throws Exception {
assertThat(generateActualJson("cat.lol")).isEqualTo(
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "7-LOL", "rdap_domain.json"));
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testTrailingDot_ignored() throws Exception {
assertThat(generateActualJson("cat.lol.")).isEqualTo(
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "7-LOL", "rdap_domain.json"));
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testQueryParameter_ignored() throws Exception {
assertThat(generateActualJson("cat.lol?key=value")).isEqualTo(
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "7-LOL", "rdap_domain.json"));
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -225,7 +256,7 @@ public class RdapDomainActionTest {
public void testIdnDomain_works() throws Exception {
assertThat(generateActualJson("cat.みんな")).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
"cat.みんな", "cat.xn--q9jyb4c", "A-Q9JYB4C", "rdap_domain_unicode.json"));
"cat.みんな", "cat.xn--q9jyb4c", "F-Q9JYB4C", "rdap_domain_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -233,7 +264,7 @@ public class RdapDomainActionTest {
public void testIdnDomainWithPercentEncoding_works() throws Exception {
assertThat(generateActualJson("cat.%E3%81%BF%E3%82%93%E3%81%AA")).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
"cat.みんな", "cat.xn--q9jyb4c", "A-Q9JYB4C", "rdap_domain_unicode.json"));
"cat.みんな", "cat.xn--q9jyb4c", "F-Q9JYB4C", "rdap_domain_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -241,14 +272,14 @@ public class RdapDomainActionTest {
public void testPunycodeDomain_works() throws Exception {
assertThat(generateActualJson("cat.xn--q9jyb4c")).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
"cat.みんな", "cat.xn--q9jyb4c", "A-Q9JYB4C", "rdap_domain_unicode.json"));
"cat.みんな", "cat.xn--q9jyb4c", "F-Q9JYB4C", "rdap_domain_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testMultilevelDomain_works() throws Exception {
assertThat(generateActualJson("cat.1.tld")).isEqualTo(
generateExpectedJsonWithTopLevelEntries("cat.1.tld", null, "C-1.TLD", "rdap_domain.json"));
generateExpectedJsonWithTopLevelEntries("cat.1.tld", null, "11-1.TLD", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}

View file

@ -19,9 +19,10 @@ import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistDomainAsDeleted;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.testing.DatastoreHelper.persistSimpleGlobalResources;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeDomainResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
@ -33,10 +34,12 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Range;
import com.google.common.net.InetAddresses;
import com.google.domain.registry.model.domain.DomainResource;
import com.google.domain.registry.model.domain.Period;
import com.google.domain.registry.model.host.HostResource;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.model.registry.Registry;
import com.google.domain.registry.model.reporting.HistoryEntry;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
@ -66,7 +69,7 @@ public class RdapDomainSearchActionTest {
public final InjectRule inject = new InjectRule();
private final FakeResponse response = new FakeResponse();
private final FakeClock clock = new FakeClock(DateTime.parse("2009-06-29T20:13:00Z"));
private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01T00:00:00Z"));
private final RdapDomainSearchAction action = new RdapDomainSearchAction();
@ -108,18 +111,38 @@ public class RdapDomainSearchActionTest {
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
// cat.lol and cat2.lol
createTld("lol");
Registrar registrar = persistResource(
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
domainCatLol = persistResource(makeDomainResource("cat.lol",
persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol")),
persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")),
persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")),
hostNs1CatLol = persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")),
hostNs2CatLol = persistResource(
makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")),
domainCatLol = persistResource(makeDomainResource(
"cat.lol",
makeAndPersistContactResource(
"5372808-ERL",
"Goblin Market",
"lol@cat.lol",
clock.nowUtc().minusYears(1)),
makeAndPersistContactResource(
"5372808-IRL",
"Santa Claus",
"BOFH@cat.lol",
clock.nowUtc().minusYears(2)),
makeAndPersistContactResource(
"5372808-TRL",
"The Raven",
"bog@cat.lol",
clock.nowUtc().minusYears(3)),
hostNs1CatLol = makeAndPersistHostResource(
"ns1.cat.lol",
"1.2.3.4",
clock.nowUtc().minusYears(1)),
hostNs2CatLol = makeAndPersistHostResource(
"ns2.cat.lol",
"bad:f00d:cafe::15:beef",
clock.nowUtc().minusYears(2)),
registrar)
.asBuilder().setSubordinateHosts(ImmutableSet.of("ns1.cat.lol", "ns2.cat.lol")).build());
persistResource(
@ -128,34 +151,76 @@ public class RdapDomainSearchActionTest {
hostNs2CatLol.asBuilder().setSuperordinateDomain(Ref.create(domainCatLol)).build());
domainCatLol2 = persistResource(makeDomainResource(
"cat2.lol",
persistResource(makeContactResource("6372808-ERL", "Siegmund", "siegmund@cat2.lol")),
persistResource(makeContactResource("6372808-IRL", "Sieglinde", "sieglinde@cat2.lol")),
persistResource(makeContactResource("6372808-TRL", "Siegfried", "siegfried@cat2.lol")),
persistResource(makeHostResource("ns1.cat.example", "10.20.30.40")),
persistResource(makeHostResource("ns2.dog.lol", "12:feed:5000::15:beef")),
makeAndPersistContactResource(
"6372808-ERL",
"Siegmund",
"siegmund@cat2.lol",
clock.nowUtc().minusYears(1)),
makeAndPersistContactResource(
"6372808-IRL",
"Sieglinde",
"sieglinde@cat2.lol",
clock.nowUtc().minusYears(2)),
makeAndPersistContactResource(
"6372808-TRL",
"Siegfried",
"siegfried@cat2.lol",
clock.nowUtc().minusYears(3)),
makeAndPersistHostResource(
"ns1.cat.example", "10.20.30.40", clock.nowUtc().minusYears(1)),
makeAndPersistHostResource(
"ns2.dog.lol", "12:feed:5000::15:beef", clock.nowUtc().minusYears(2)),
registrar));
// cat.example
createTld("example");
registrar = persistResource(
makeRegistrar("goodregistrar", "St. John Chrysostom", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
domainCatExample = persistResource(makeDomainResource("cat.example",
persistResource(makeContactResource("7372808-ERL", "Matthew", "lol@cat.lol")),
persistResource(makeContactResource("7372808-IRL", "Mark", "BOFH@cat.lol")),
persistResource(makeContactResource("7372808-TRL", "Luke", "bog@cat.lol")),
domainCatExample = persistResource(makeDomainResource(
"cat.example",
makeAndPersistContactResource(
"7372808-ERL",
"Matthew",
"lol@cat.lol",
clock.nowUtc().minusYears(1)),
makeAndPersistContactResource(
"7372808-IRL",
"Mark",
"BOFH@cat.lol",
clock.nowUtc().minusYears(2)),
makeAndPersistContactResource(
"7372808-TRL",
"Luke",
"bog@cat.lol",
clock.nowUtc().minusYears(3)),
hostNs1CatLol,
persistResource(makeHostResource("ns2.external.tld", "bad:f00d:cafe::15:beef")),
makeAndPersistHostResource(
"ns2.external.tld", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(2)),
registrar));
// cat.みんな
createTld("xn--q9jyb4c");
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
persistResource(makeDomainResource(
"cat.みんな", persistResource(makeContactResource("8372808-ERL", "(◕‿◕)", "lol@cat.みんな")),
persistResource(makeContactResource("8372808-IRL", "Santa Claus", "BOFH@cat.みんな")),
persistResource(makeContactResource("8372808-TRL", "The Raven", "bog@cat.みんな")),
persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.5")),
persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::14:beef")),
"cat.みんな",
makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
clock.nowUtc().minusYears(1)),
makeAndPersistContactResource(
"8372808-IRL",
"Santa Claus",
"BOFH@cat.みんな",
clock.nowUtc().minusYears(2)),
makeAndPersistContactResource(
"8372808-TRL",
"The Raven",
"bog@cat.みんな",
clock.nowUtc().minusYears(3)),
makeAndPersistHostResource("ns1.cat.みんな", "1.2.3.5", clock.nowUtc().minusYears(1)),
makeAndPersistHostResource(
"ns2.cat.みんな", "bad:f00d:cafe::14:beef", clock.nowUtc().minusYears(2)),
registrar));
// cat.1.test
createTld("1.test");
@ -164,15 +229,50 @@ public class RdapDomainSearchActionTest {
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
persistResource(makeDomainResource(
"cat.1.test",
persistResource(makeContactResource("9372808-ERL", "(◕‿◕)", "lol@cat.みんな")),
persistResource(makeContactResource("9372808-IRL", "Santa Claus", "BOFH@cat.みんな")),
persistResource(makeContactResource("9372808-TRL", "The Raven", "bog@cat.みんな")),
persistResource(makeHostResource("ns1.cat.1.test", "1.2.3.5")),
persistResource(makeHostResource("ns2.cat.2.test", "bad:f00d:cafe::14:beef")),
makeAndPersistContactResource(
"9372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
clock.nowUtc().minusYears(1)),
makeAndPersistContactResource(
"9372808-IRL",
"Santa Claus",
"BOFH@cat.みんな",
clock.nowUtc().minusYears(2)),
makeAndPersistContactResource(
"9372808-TRL",
"The Raven",
"bog@cat.みんな",
clock.nowUtc().minusYears(3)),
makeAndPersistHostResource("ns1.cat.1.test", "1.2.3.5", clock.nowUtc().minusYears(1)),
makeAndPersistHostResource(
"ns2.cat.2.test", "bad:f00d:cafe::14:beef", clock.nowUtc().minusYears(2)),
registrar)
.asBuilder().setSubordinateHosts(ImmutableSet.of("ns1.cat.1.test")).build());
inject.setStaticField(Ofy.class, "clock", clock);
// history entries
persistResource(
makeHistoryEntry(
domainCatLol,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
persistResource(
makeHistoryEntry(
domainCatLol2,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
persistResource(
makeHistoryEntry(
domainCatExample,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
action.clock = clock;
action.response = response;
action.rdapLinkBase = "https://example.com/rdap/";
@ -264,7 +364,7 @@ public class RdapDomainSearchActionTest {
@Test
public void testDomainMatch_found() throws Exception {
assertThat(generateActualJson(RequestType.NAME, "cat.lol"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "7-LOL", "rdap_domain.json"));
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -402,7 +502,7 @@ public class RdapDomainSearchActionTest {
@Test
public void testNameserverMatchWithWildcard_found() throws Exception {
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns2.cat.l*"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "7-LOL", "rdap_domain.json"));
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -487,7 +587,7 @@ public class RdapDomainSearchActionTest {
public void testNameserverMatchOneDeletedDomain_foundTheOther() throws Exception {
persistDomainAsDeleted(domainCatExample, clock.nowUtc());
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.lol"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "7-LOL", "rdap_domain.json"));
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -563,7 +663,7 @@ public class RdapDomainSearchActionTest {
public void testAddressMatchOneDeletedDomain_foundTheOther() throws Exception {
persistDomainAsDeleted(domainCatExample, clock.nowUtc());
assertThat(generateActualJson(RequestType.NS_IP, "1.2.3.4"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "7-LOL", "rdap_domain.json"));
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}

View file

@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.testing.DatastoreHelper.persistSimpleGlobalResources;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeDomainResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
@ -78,21 +79,24 @@ public class RdapEntityActionTest {
registrarLol = persistResource(makeRegistrar(
"evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrarLol));
registrant = persistResource(makeContactResource(
registrant = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな")));
adminContact = persistResource(makeContactResource(
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
adminContact = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな")));
techContact = persistResource(makeContactResource(
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
techContact = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな")));
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
HostResource host1 =
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
HostResource host2 =
@ -127,13 +131,13 @@ public class RdapEntityActionTest {
host1,
host2,
registrar1tld));
disconnectedContact = persistResource(makeContactResource(
disconnectedContact = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな")));
deletedContact = persistResource(
makeContactResource(
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
deletedContact = persistResource(makeContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",

View file

@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.testing.DatastoreHelper.persistSimpleGlobalResources;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
@ -49,11 +50,10 @@ import javax.annotation.Nullable;
public class RdapEntitySearchActionTest {
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule public final InjectRule inject = new InjectRule();
private final FakeResponse response = new FakeResponse();
private final FakeClock clock = new FakeClock(DateTime.parse("2009-06-29T20:13:00Z"));
private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01T00:00:00Z"));
private final RdapEntitySearchAction action = new RdapEntitySearchAction();
@ -76,14 +76,16 @@ public class RdapEntitySearchActionTest {
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
createTld("tld");
contact = persistResource(
makeContactResource(
contact = makeAndPersistContactResource(
"blinky",
"Blinky (赤ベイ)",
"blinky@b.tld",
ImmutableList.of("123 Blinky St", "Blinkyland")));
ImmutableList.of("123 Blinky St", "Blinkyland"),
clock.nowUtc());
// deleted
persistResource(
@ -110,7 +112,6 @@ public class RdapEntitySearchActionTest {
.build());
persistSimpleGlobalResources(makeRegistrarContacts(registrarTest));
inject.setStaticField(Ofy.class, "clock", clock);
action.clock = clock;
action.requestPath = RdapEntitySearchAction.PATH;
action.response = response;

View file

@ -18,9 +18,10 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.testing.DatastoreHelper.persistSimpleGlobalResources;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeDomainResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
@ -32,13 +33,19 @@ import com.google.common.collect.ImmutableSet;
import com.google.domain.registry.model.contact.ContactResource;
import com.google.domain.registry.model.domain.DesignatedContact;
import com.google.domain.registry.model.domain.DomainResource;
import com.google.domain.registry.model.domain.Period;
import com.google.domain.registry.model.host.HostResource;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.model.registrar.RegistrarContact;
import com.google.domain.registry.model.registry.Registry.TldState;
import com.google.domain.registry.model.reporting.HistoryEntry;
import com.google.domain.registry.rdap.RdapJsonFormatter.MakeRdapJsonNoticeParameters;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.InjectRule;
import org.joda.time.DateTime;
import org.json.simple.JSONValue;
import org.junit.Before;
import org.junit.Rule;
@ -54,6 +61,9 @@ public class RdapJsonFormatterTest {
public final AppEngineRule appEngine = AppEngineRule.builder()
.withDatastore()
.build();
@Rule public final InjectRule inject = new InjectRule();
private final FakeClock clock = new FakeClock(DateTime.parse("1999-01-01T00:00:00Z"));
private Registrar registrar;
private DomainResource domainResourceFull;
@ -74,33 +84,43 @@ public class RdapJsonFormatterTest {
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
// Create the registrar in 1999, then update it in 2000.
clock.setTo(DateTime.parse("1999-01-01T00:00:00Z"));
createTld("xn--q9jyb4c", TldState.GENERAL_AVAILABILITY);
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
clock.setTo(DateTime.parse("2000-01-01T00:00:00Z"));
registrar = persistResource(registrar);
persistSimpleGlobalResources(makeMoreRegistrarContacts(registrar));
contactResourceRegistrant = persistResource(
makeContactResource(
contactResourceRegistrant = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
null));
contactResourceAdmin = persistResource(
makeContactResource(
null,
clock.nowUtc().minusYears(1));
contactResourceAdmin = makeAndPersistContactResource(
"8372808-IRL",
"Santa Claus",
null,
ImmutableList.of("Santa Claus Tower", "41st floor", "Suite みんな")));
contactResourceTech = persistResource(
makeContactResource(
ImmutableList.of("Santa Claus Tower", "41st floor", "Suite みんな"),
clock.nowUtc().minusYears(2));
contactResourceTech = makeAndPersistContactResource(
"8372808-TRL",
"The Raven",
"bog@cat.みんな",
ImmutableList.of("Chamber Door", "upper level")));
hostResourceIpv4 = persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4"));
hostResourceIpv6 =
persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe:0:0:0:15:beef"));
hostResourceBoth =
persistResource(makeHostResource("ns3.cat.みんな", "1.2.3.4", "bad:f00d:cafe:0:0:0:15:beef"));
hostResourceNoAddresses = persistResource(makeHostResource("ns4.cat.みんな", null));
ImmutableList.of("Chamber Door", "upper level"),
clock.nowUtc().minusYears(3));
hostResourceIpv4 = makeAndPersistHostResource(
"ns1.cat.みんな", "1.2.3.4", clock.nowUtc().minusYears(1));
hostResourceIpv6 = makeAndPersistHostResource(
"ns2.cat.みんな", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2));
hostResourceBoth = makeAndPersistHostResource(
"ns3.cat.みんな", "1.2.3.4", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(3));
hostResourceNoAddresses = makeAndPersistHostResource(
"ns4.cat.みんな", null, clock.nowUtc().minusYears(4));
domainResourceFull = persistResource(
makeDomainResource(
"cat.みんな",
@ -137,6 +157,36 @@ public class RdapJsonFormatterTest {
null,
null,
registrar));
// history entries
persistResource(
makeHistoryEntry(
domainResourceFull,
HistoryEntry.Type.DOMAIN_CREATE,
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,
HistoryEntry.Type.DOMAIN_CREATE,
Period.create(1, Period.Unit.YEARS),
"created",
clock.nowUtc()));
}
public static ImmutableList<RegistrarContact> makeMoreRegistrarContacts(Registrar registrar) {

View file

@ -16,8 +16,7 @@ package com.google.domain.registry.rdap;
import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.appengine.api.NamespaceManager;
@ -61,16 +60,16 @@ public class RdapNameserverActionTest {
inject.setStaticField(Ofy.class, "clock", clock);
// normal
createTld("lol");
persistResource(
makeHostResource("ns1.cat.lol", "1.2.3.4"));
makeAndPersistHostResource(
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
// idn
createTld("xn--q9jyb4c");
persistResource(
makeHostResource("ns1.cat.xn--q9jyb4c", "bad:f00d:cafe:0:0:0:15:beef"));
makeAndPersistHostResource(
"ns1.cat.xn--q9jyb4c", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(1));
// multilevel
createTld("1.tld");
persistResource(
makeHostResource("ns1.domain.1.tld", "5.6.7.8"));
makeAndPersistHostResource(
"ns1.domain.1.tld", "5.6.7.8", clock.nowUtc().minusYears(1));
NamespaceManager.set(null);
}
@ -191,7 +190,7 @@ public class RdapNameserverActionTest {
"ns1.cat.みんな",
ImmutableMap.of(
"PUNYCODENAME", "ns1.cat.xn--q9jyb4c",
"HANDLE", "4-ROID",
"HANDLE", "5-ROID",
"ADDRESSTYPE", "v6",
"ADDRESS", "bad:f00d:cafe::15:beef"),
"rdap_host_unicode.json"));
@ -205,7 +204,7 @@ public class RdapNameserverActionTest {
"ns1.cat.みんな",
ImmutableMap.of(
"PUNYCODENAME", "ns1.cat.xn--q9jyb4c",
"HANDLE", "4-ROID",
"HANDLE", "5-ROID",
"ADDRESSTYPE", "v6",
"ADDRESS", "bad:f00d:cafe::15:beef"),
"rdap_host_unicode.json"));
@ -217,7 +216,7 @@ public class RdapNameserverActionTest {
assertThat(generateActualJson("ns1.domain.1.tld"))
.isEqualTo(generateExpectedJsonWithTopLevelEntries(
"ns1.domain.1.tld",
ImmutableMap.of("HANDLE", "6-ROID", "ADDRESSTYPE", "v4", "ADDRESS", "5.6.7.8"),
ImmutableMap.of("HANDLE", "8-ROID", "ADDRESSTYPE", "v4", "ADDRESS", "5.6.7.8"),
"rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}

View file

@ -18,9 +18,9 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static com.google.domain.registry.testing.DatastoreHelper.persistSimpleGlobalResources;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeDomainResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeHostResource;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrar;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
@ -58,7 +58,7 @@ public class RdapNameserverSearchActionTest {
@Rule public final InjectRule inject = new InjectRule();
private final FakeResponse response = new FakeResponse();
private final FakeClock clock = new FakeClock(DateTime.parse("2009-06-29T20:13:00Z"));
private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01T00:00:00Z"));
private final RdapNameserverSearchAction action = new RdapNameserverSearchAction();
@ -86,23 +86,25 @@ public class RdapNameserverSearchActionTest {
persistResource(
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
hostNs1CatLol = persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
hostNs2CatLol = persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef"));
hostNs1Cat2Lol =
persistResource(makeHostResource("ns1.cat2.lol", "1.2.3.3", "bad:f00d:cafe::15:beef"));
persistResource(makeHostResource("ns1.cat.external", null));
hostNs1CatLol = makeAndPersistHostResource(
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
hostNs2CatLol = makeAndPersistHostResource(
"ns2.cat.lol", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
hostNs1Cat2Lol = makeAndPersistHostResource(
"ns1.cat2.lol", "1.2.3.3", "bad:f00d:cafe::15:beef", clock.nowUtc().minusYears(1));
makeAndPersistHostResource("ns1.cat.external", null, null, clock.nowUtc().minusYears(1));
// cat.みんな
createTld("xn--q9jyb4c");
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.5"));
makeAndPersistHostResource("ns1.cat.みんな", "1.2.3.5", clock.nowUtc().minusYears(1));
// cat.1.test
createTld("1.test");
registrar = persistResource(makeRegistrar("multiregistrar", "1.test", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
persistResource(makeHostResource("ns1.cat.1.test", "1.2.3.6"));
makeAndPersistHostResource("ns1.cat.1.test", "1.2.3.6", clock.nowUtc().minusYears(1));
// create a domain so that we can use it as a test nameserver search string suffix
DomainResource domainCatLol =
@ -249,7 +251,7 @@ public class RdapNameserverSearchActionTest {
assertThat(generateActualJsonWithName("ns2.cat.lol"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns2.cat.lol", null, "3-ROID", "v6", "bad:f00d:cafe::15:beef", "rdap_host.json"));
"ns2.cat.lol", null, "4-ROID", "v6", "bad:f00d:cafe::15:beef", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -265,7 +267,7 @@ public class RdapNameserverSearchActionTest {
assertThat(generateActualJsonWithName("ns1.cat.external"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns1.cat.external", null, "5-ROID", null, null, "rdap_host_external.json"));
"ns1.cat.external", null, "8-ROID", null, null, "rdap_host_external.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -279,9 +281,11 @@ public class RdapNameserverSearchActionTest {
@Test
public void testNameMatch_ns1_cat_idn_punycode_found() throws Exception {
assertThat(generateActualJsonWithName("ns1.cat.xn--q9jyb4c"))
.isEqualTo(generateExpectedJsonForNameserver(
"ns1.cat.みんな", "ns1.cat.xn--q9jyb4c",
"7-ROID",
.isEqualTo(
generateExpectedJsonForNameserver(
"ns1.cat.みんな",
"ns1.cat.xn--q9jyb4c",
"B-ROID",
"v4",
"1.2.3.5",
"rdap_host_unicode.json"));
@ -293,7 +297,7 @@ public class RdapNameserverSearchActionTest {
assertThat(generateActualJsonWithName("ns1.cat.1.test"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns1.cat.1.test", null, "9-ROID", "v4", "1.2.3.6", "rdap_host.json"));
"ns1.cat.1.test", null, "E-ROID", "v4", "1.2.3.6", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@ -380,7 +384,7 @@ public class RdapNameserverSearchActionTest {
assertThat(generateActualJsonWithIp("bad:f00d:cafe::15:beef"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns2.cat.lol", null, "3-ROID", "v6", "bad:f00d:cafe::15:beef", "rdap_host.json"));
"ns2.cat.lol", null, "4-ROID", "v6", "bad:f00d:cafe::15:beef", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
}

View file

@ -11,6 +11,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",

View file

@ -14,12 +14,27 @@
"value": "https://example.com/rdap/domain/%NAME%"
}
],
"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": [
{
"status": [
"active"
],
"handle": "5-ROID",
"handle": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
@ -34,13 +49,20 @@
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "6-ROID",
"handle": "A-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.cat.lol",
@ -55,6 +77,13 @@
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
@ -64,16 +93,23 @@
"status": [
"active"
],
"handle": "3-ROID",
"handle": "4-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/3-ROID",
"href": "https://example.com/rdap/entity/4-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/3-ROID"
"value": "https://example.com/rdap/entity/4-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -145,16 +181,23 @@
"status": [
"active"
],
"handle": "4-ROID",
"handle": "6-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/4-ROID",
"href": "https://example.com/rdap/entity/6-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/4-ROID"
"value": "https://example.com/rdap/entity/6-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -238,6 +281,13 @@
"value": "https://example.com/rdap/entity/2-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",

View file

@ -15,12 +15,27 @@
"value": "https://example.com/rdap/domain/%PUNYCODENAME%"
}
],
"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": [
{
"status": [
"active"
],
"handle": "5-ROID",
"handle": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
@ -35,13 +50,20 @@
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "6-ROID",
"handle": "A-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.cat.lol",
@ -56,6 +78,13 @@
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
@ -65,16 +94,23 @@
"status": [
"active"
],
"handle": "3-ROID",
"handle": "4-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/3-ROID",
"href": "https://example.com/rdap/entity/4-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/3-ROID"
"value": "https://example.com/rdap/entity/4-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -146,16 +182,23 @@
"status": [
"active"
],
"handle": "4-ROID",
"handle": "6-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/4-ROID",
"href": "https://example.com/rdap/entity/6-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/4-ROID"
"value": "https://example.com/rdap/entity/6-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -239,6 +282,13 @@
"value": "https://example.com/rdap/entity/2-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",

View file

@ -17,6 +17,13 @@
"%ADDRESS%"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"objectClassName": "nameserver",
"port43": "whois.example.tld"
}

View file

@ -12,6 +12,13 @@
}
],
"ldhName": "%NAME%",
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"objectClassName": "nameserver",
"port43": "whois.example.tld"
}

View file

@ -18,6 +18,13 @@
"%ADDRESS%"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"objectClassName": "nameserver",
"port43": "whois.example.tld"
}

View file

@ -14,6 +14,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
@ -53,6 +60,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "2-Registrar",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"publicIds" :
[
{

View file

@ -7,7 +7,7 @@
"transfer prohibited",
"update prohibited"
],
"handle": "13-EXAMPLE",
"handle": "21-EXAMPLE",
"links": [
{
"href": "https://example.com/rdap/domain/cat.example",
@ -16,12 +16,27 @@
"value": "https://example.com/rdap/domain/cat.example"
}
],
"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": [
{
"status": [
"active"
],
"handle": "5-ROID",
"handle": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
@ -36,13 +51,20 @@
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "12-ROID",
"handle": "1F-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.external.tld",
@ -57,6 +79,13 @@
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
@ -66,16 +95,23 @@
"status": [
"active"
],
"handle": "10-ROID",
"handle": "1B-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/10-ROID",
"href": "https://example.com/rdap/entity/1B-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/10-ROID"
"value": "https://example.com/rdap/entity/1B-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -147,16 +183,23 @@
"status": [
"active"
],
"handle": "11-ROID",
"handle": "1D-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/11-ROID",
"href": "https://example.com/rdap/entity/1D-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/11-ROID"
"value": "https://example.com/rdap/entity/1D-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -228,16 +271,23 @@
"status": [
"active"
],
"handle": "F-ROID",
"handle": "19-ROID",
"roles": [
"registrant"
],
"links": [
{
"href": "https://example.com/rdap/entity/F-ROID",
"href": "https://example.com/rdap/entity/19-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/F-ROID"
"value": "https://example.com/rdap/entity/19-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -316,7 +366,7 @@
"transfer prohibited",
"update prohibited"
],
"handle": "7-LOL",
"handle": "C-LOL",
"links": [
{
"href": "https://example.com/rdap/domain/cat.lol",
@ -325,12 +375,27 @@
"value": "https://example.com/rdap/domain/cat.lol"
}
],
"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": [
{
"status": [
"active"
],
"handle": "5-ROID",
"handle": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
@ -345,13 +410,20 @@
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "6-ROID",
"handle": "A-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.cat.lol",
@ -366,6 +438,13 @@
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
@ -375,16 +454,23 @@
"status": [
"active"
],
"handle": "3-ROID",
"handle": "4-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/3-ROID",
"href": "https://example.com/rdap/entity/4-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/3-ROID"
"value": "https://example.com/rdap/entity/4-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -456,16 +542,23 @@
"status": [
"active"
],
"handle": "4-ROID",
"handle": "6-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/4-ROID",
"href": "https://example.com/rdap/entity/6-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/4-ROID"
"value": "https://example.com/rdap/entity/6-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
@ -549,6 +642,13 @@
"value": "https://example.com/rdap/entity/2-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",

View file

@ -3,7 +3,7 @@
[
{
"objectClassName" : "nameserver",
"handle" : "3-ROID",
"handle" : "4-ROID",
"status" : ["active"],
"ldhName" : "ns2.cat.lol",
"links" :
@ -19,11 +19,18 @@
{
"v6" : ["bad:f00d:cafe::15:beef"]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"port43": "whois.example.tld"
},
{
"objectClassName" : "nameserver",
"handle" : "4-ROID",
"handle" : "6-ROID",
"status" : ["active"],
"ldhName" : "ns1.cat2.lol",
"links" :
@ -40,6 +47,13 @@
"v4" : ["1.2.3.3"]
"v6" : ["bad:f00d:cafe::15:beef"]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"port43": "whois.example.tld"
}
],

View file

@ -19,6 +19,13 @@
"identifier" : "1"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "%NAME%",
"eventDate": "2000-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",

View file

@ -1,17 +1,24 @@
{
"objectClassName" : "entity",
"handle" : "3-ROID",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/3-ROID",
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/3-ROID",
"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",

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "domain",
"handle" : "9-Q9JYB4C",
"handle" : "10-Q9JYB4C",
"ldhName" : "cat.xn--q9jyb4c",
"unicodeName" : "cat.みんな",
"status" :
@ -19,11 +19,26 @@
"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" : "5-ROID",
"handle" : "8-ROID",
"ldhName" : "ns1.cat.xn--q9jyb4c",
"unicodeName" : "ns1.cat.みんな",
"status" : ["active"],
@ -36,6 +51,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]
@ -43,7 +65,7 @@
},
{
"objectClassName" : "nameserver",
"handle" : "6-ROID",
"handle" : "A-ROID",
"ldhName" : "ns2.cat.xn--q9jyb4c",
"unicodeName" : "ns2.cat.みんな",
"status" : ["active"],
@ -56,6 +78,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v6" : ["bad:f00d:cafe::15:beef"]
@ -66,18 +95,25 @@
[
{
"objectClassName" : "entity",
"handle" : "3-ROID",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/3-ROID",
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/3-ROID",
"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",
@ -104,18 +140,25 @@
},
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"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",
@ -154,6 +197,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "domain",
"handle" : "B-Q9JYB4C",
"handle" : "12-Q9JYB4C",
"ldhName" : "bird.xn--q9jyb4c",
"unicodeName" : "bird.みんな",
"status" :
@ -19,11 +19,26 @@
"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" : "5-ROID",
"handle" : "8-ROID",
"ldhName" : "ns1.cat.xn--q9jyb4c",
"unicodeName" : "ns1.cat.みんな",
"status" : ["active"],
@ -36,6 +51,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]
@ -43,7 +65,7 @@
},
{
"objectClassName" : "nameserver",
"handle" : "6-ROID",
"handle" : "A-ROID",
"ldhName" : "ns2.cat.xn--q9jyb4c",
"unicodeName" : "ns2.cat.みんな",
"status" : ["active"],
@ -56,6 +78,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v6" : ["bad:f00d:cafe::15:beef"]

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "domain",
"handle" : "C-Q9JYB4C",
"handle" : "13-Q9JYB4C",
"ldhName" : "fish.xn--q9jyb4c",
"unicodeName" : "fish.みんな",
"status" :
@ -20,22 +20,44 @@
"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"
}
],
"entities" :
[
{
"objectClassName" : "entity",
"handle" : "3-ROID",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/3-ROID",
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/3-ROID",
"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",
@ -62,18 +84,25 @@
},
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"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",
@ -112,6 +141,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "domain",
"handle" : "A-Q9JYB4C",
"handle" : "11-Q9JYB4C",
"ldhName" : "dog.xn--q9jyb4c",
"unicodeName" : "dog.みんな",
"status" :
@ -19,11 +19,26 @@
"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" : "7-ROID",
"handle" : "C-ROID",
"ldhName" : "ns3.cat.xn--q9jyb4c",
"unicodeName" : "ns3.cat.みんな",
"status" : ["active"],
@ -36,6 +51,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]
@ -44,10 +66,17 @@
},
{
"objectClassName" : "nameserver",
"handle" : "8-ROID",
"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" :
[
{
@ -63,18 +92,25 @@
[
{
"objectClassName" : "entity",
"handle" : "3-ROID",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/3-ROID",
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/3-ROID",
"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",
@ -101,18 +137,25 @@
},
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"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",

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "nameserver",
"handle" : "7-ROID",
"handle" : "C-ROID",
"ldhName" : "ns3.cat.xn--q9jyb4c",
"unicodeName" : "ns3.cat.みんな",
"status" : ["active"],
@ -13,6 +13,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"],

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "nameserver",
"handle" : "5-ROID",
"handle" : "8-ROID",
"ldhName" : "ns1.cat.xn--q9jyb4c",
"unicodeName" : "ns1.cat.みんな",
"status" : ["active"],
@ -13,6 +13,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "nameserver",
"handle" : "6-ROID",
"handle" : "A-ROID",
"ldhName" : "ns2.cat.xn--q9jyb4c",
"unicodeName" : "ns2.cat.みんな",
"status" : ["active"],
@ -13,6 +13,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
],
"ipAddresses" :
{
"v6" : ["bad:f00d:cafe::15:beef"]

View file

@ -1,6 +1,6 @@
{
"objectClassName" : "nameserver",
"handle" : "8-ROID",
"handle" : "E-ROID",
"ldhName" : "ns4.cat.xn--q9jyb4c",
"unicodeName" : "ns4.cat.みんな",
"status" : ["active"],
@ -13,5 +13,12 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1996-01-01T00:00:00.000Z"
},
],
"port43": "whois.google.com"
}

View file

@ -12,6 +12,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",

View file

@ -12,6 +12,13 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",

View file

@ -12,6 +12,17 @@
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "unicoderegistrar",
"eventDate": "1999-01-01T00:00:00.000Z"
},
{
"eventAction": "last changed",
"eventDate": "2000-01-01T00:00:00.000Z"
},
],
"publicIds" :
[
{

View file

@ -1,17 +1,24 @@
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"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",

View file

@ -17,23 +17,29 @@ package com.google.domain.registry.testing;
import static com.google.domain.registry.model.domain.DomainUtils.getTldFromDomainName;
import static com.google.domain.registry.testing.DatastoreHelper.generateNewContactHostRoid;
import static com.google.domain.registry.testing.DatastoreHelper.generateNewDomainRoid;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.InetAddresses;
import com.google.domain.registry.model.EppResource;
import com.google.domain.registry.model.contact.ContactAddress;
import com.google.domain.registry.model.contact.ContactPhoneNumber;
import com.google.domain.registry.model.contact.ContactResource;
import com.google.domain.registry.model.contact.PostalInfo;
import com.google.domain.registry.model.domain.DesignatedContact;
import com.google.domain.registry.model.domain.DomainResource;
import com.google.domain.registry.model.domain.Period;
import com.google.domain.registry.model.domain.ReferenceUnion;
import com.google.domain.registry.model.domain.secdns.DelegationSignerData;
import com.google.domain.registry.model.eppcommon.StatusValue;
import com.google.domain.registry.model.eppcommon.Trid;
import com.google.domain.registry.model.host.HostResource;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.model.registrar.RegistrarAddress;
import com.google.domain.registry.model.registrar.RegistrarContact;
import com.google.domain.registry.model.reporting.HistoryEntry;
import com.google.domain.registry.util.Idn;
import org.joda.time.DateTime;
@ -128,6 +134,21 @@ public final class FullFieldsTestEntityHelper {
return builder.build();
}
public static HostResource makeAndPersistHostResource(
String fqhn, @Nullable String ip, @Nullable DateTime creationTime) {
return makeAndPersistHostResource(fqhn, ip, null, creationTime);
}
public static HostResource makeAndPersistHostResource(
String fqhn, @Nullable String ip1, @Nullable String ip2, @Nullable DateTime creationTime) {
HostResource hostResource = persistResource(makeHostResource(fqhn, ip1, ip2));
if (creationTime != null) {
persistResource(makeHistoryEntry(
hostResource, HistoryEntry.Type.HOST_CREATE, null, "created", creationTime));
}
return hostResource;
}
public static ContactResource makeContactResource(
String id, String name, @Nullable String email) {
return makeContactResource(
@ -168,6 +189,26 @@ public final class FullFieldsTestEntityHelper {
return builder.build();
}
public static ContactResource makeAndPersistContactResource(
String id, String name, @Nullable String email, @Nullable DateTime creationTime) {
return makeAndPersistContactResource(
id, name, email, ImmutableList.of("123 Example Boulevard <script>"), creationTime);
}
public static ContactResource makeAndPersistContactResource(
String id,
String name,
@Nullable String email,
@Nullable List<String> street,
@Nullable DateTime creationTime) {
ContactResource contactResource = persistResource(makeContactResource(id, name, email, street));
if (creationTime != null) {
persistResource(makeHistoryEntry(
contactResource, HistoryEntry.Type.CONTACT_CREATE, null, "created", creationTime));
}
return contactResource;
}
public static DomainResource makeDomainResource(
String domain,
@Nullable ContactResource registrant,
@ -216,4 +257,24 @@ public final class FullFieldsTestEntityHelper {
}
return builder.build();
}
public static HistoryEntry makeHistoryEntry(
EppResource resource,
HistoryEntry.Type type,
Period period,
String reason,
DateTime modificationTime) {
HistoryEntry.Builder builder = new HistoryEntry.Builder()
.setParent(resource)
.setType(type)
.setPeriod(period)
.setXmlBytes("<xml></xml>".getBytes(UTF_8))
.setModificationTime(modificationTime)
.setClientId("foo")
.setTrid(Trid.create("ABC-123"))
.setBySuperuser(false)
.setReason(reason)
.setRequestedByRegistrar(false);
return builder.build();
}
}