mv com/google/domain/registry google/registry

This change renames directories in preparation for the great package
rename. The repository is now in a broken state because the code
itself hasn't been updated. However this should ensure that git
correctly preserves history for each file.
This commit is contained in:
Justine Tunney 2016-05-13 18:55:08 -04:00
parent a41677aea1
commit 5012893c1d
2396 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,38 @@
package(
default_visibility = ["//java/com/google/domain/registry:registry_project"],
)
load("//java/com/google/testing/builddefs:GenTestRules.bzl", "GenTestRules")
java_library(
name = "rdap",
srcs = glob(["*.java"]),
resources = glob(["testdata/*.json"]),
deps = [
"//java/com/google/common/base",
"//java/com/google/common/collect",
"//java/com/google/common/io",
"//java/com/google/common/net",
"//java/com/google/domain/registry/model",
"//java/com/google/domain/registry/rdap",
"//java/com/google/domain/registry/request",
"//javatests/com/google/domain/registry/testing",
"//third_party/java/appengine:appengine-api-testonly",
"//third_party/java/dagger",
"//third_party/java/joda_time",
"//third_party/java/json_simple",
"//third_party/java/jsr305_annotations",
"//third_party/java/junit",
"//third_party/java/mockito",
"//third_party/java/objectify:objectify-v4_1",
"//third_party/java/servlet/servlet_api",
"//third_party/java/truth",
],
)
GenTestRules(
name = "GeneratedTestRules",
test_files = glob(["*Test.java"]),
deps = [":rdap"],
)

View file

@ -0,0 +1,161 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.rdap;
import static com.google.common.net.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN;
import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.request.Action.Method.GET;
import static com.google.domain.registry.request.Action.Method.HEAD;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.rdap.RdapJsonFormatter.BoilerplateType;
import com.google.domain.registry.request.HttpException;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
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;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link RdapActionBase}. */
@RunWith(JUnit4.class)
public class RdapActionBaseTest {
@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("2000-01-01TZ"));
/**
* Dummy RdapActionBase subclass used for testing.
*/
class RdapTestAction extends RdapActionBase {
public static final String PATH = "/rdap/test/";
@Override
public String getHumanReadableObjectTypeName() {
return "human-readable string";
}
@Override
public String getActionPath() {
return PATH;
}
@Override
public ImmutableMap<String, Object> getJsonObjectForResource(
String pathSearchString, boolean isHeadRequest, String linkBase) throws HttpException {
if (pathSearchString.equals("IllegalArgumentException")) {
throw new IllegalArgumentException();
}
if (pathSearchString.equals("RuntimeException")) {
throw new RuntimeException();
}
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
builder.put("key", "value");
RdapJsonFormatter.addTopLevelEntries(
builder,
BoilerplateType.OTHER,
null,
"http://myserver.google.com/");
return builder.build();
}
}
private RdapTestAction action;
@Before
public void setUp() throws Exception {
createTld("thing");
inject.setStaticField(Ofy.class, "clock", clock);
action = new RdapTestAction();
action.response = response;
}
private Object generateActualJson(String domainName) {
action.requestPath = RdapTestAction.PATH + domainName;
action.requestMethod = GET;
action.rdapLinkBase = "http://myserver.google.com/";
action.run();
return JSONValue.parse(response.getPayload());
}
private String generateHeadPayload(String domainName) {
action.requestPath = RdapTestAction.PATH + domainName;
action.requestMethod = HEAD;
action.rdapLinkBase = "http://myserver.google.com/";
action.run();
return response.getPayload();
}
@Test
public void testIllegalValue_showsReadableTypeName() throws Exception {
assertThat(generateActualJson("IllegalArgumentException")).isEqualTo(JSONValue.parse(
"{\"lang\":\"en\", \"errorCode\":400, \"title\":\"Bad Request\","
+ "\"rdapConformance\":[\"rdap_level_0\"],"
+ "\"description\":[\"Not a valid human-readable string\"]}"));
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testRuntimeException_returns500Error() throws Exception {
assertThat(generateActualJson("RuntimeException")).isEqualTo(JSONValue.parse(
"{\"lang\":\"en\", \"errorCode\":500, \"title\":\"Internal Server Error\","
+ "\"rdapConformance\":[\"rdap_level_0\"],"
+ "\"description\":[\"An error was encountered\"]}"));
assertThat(response.getStatus()).isEqualTo(500);
}
@Test
public void testValidName_works() throws Exception {
assertThat(generateActualJson("no.thing")).isEqualTo(JSONValue.parse(
loadFileWithSubstitutions(this.getClass(), "rdapjson_toplevel.json", null)));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHeadRequest_returnsNoContent() throws Exception {
assertThat(generateHeadPayload("no.thing")).isEmpty();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHeadRequestIllegalValue_returnsNoContent() throws Exception {
assertThat(generateHeadPayload("IllegalArgumentException")).isEmpty();
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testRdapServer_allowsAllCrossOriginRequests() throws Exception {
generateActualJson("no.thing");
assertThat(response.getHeaders().get(ACCESS_CONTROL_ALLOW_ORIGIN)).isEqualTo("*");
}
}

View file

@ -0,0 +1,294 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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.DatastoreHelper.persistSimpleGlobalResources;
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.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;
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;
import com.google.domain.registry.testing.InjectRule;
import org.joda.time.DateTime;
import org.json.simple.JSONValue;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Map;
/** Unit tests for {@link RdapDomainAction}. */
@RunWith(JUnit4.class)
public class RdapDomainActionTest {
@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("2000-01-01TZ"));
private RdapDomainAction action;
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
// lol
createTld("lol");
Registrar registrarLol = persistResource(makeRegistrar(
"evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrarLol));
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));
// deleted domain in lol
DomainBase domainDeleted = persistResource(makeDomainResource("dodo.lol",
registrant,
adminContact,
techContact,
host1,
host2,
registrarLol).asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
// xn--q9jyb4c
createTld("xn--q9jyb4c");
Registrar registrarIdn =
persistResource(makeRegistrar("idnregistrar", "IDN Registrar", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrarIdn));
DomainBase domainCatIdn = persistResource(makeDomainResource("cat.みんな",
registrant,
adminContact,
techContact,
host1,
host2,
registrarIdn));
createTld("1.tld");
Registrar registrar1tld = persistResource(
makeRegistrar("1tldregistrar", "Multilevel Registrar", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar1tld));
DomainBase domainCat1Tld = persistResource(makeDomainResource("cat.1.tld",
registrant,
adminContact,
techContact,
host1,
host2,
registrar1tld));
action = new RdapDomainAction();
action.clock = clock;
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) {
action.requestPath = RdapDomainAction.PATH + domainName;
action.run();
return JSONValue.parse(response.getPayload());
}
private Object generateExpectedJson(
String name,
String punycodeName,
String handle,
String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions(
this.getClass(),
expectedOutputFile,
ImmutableMap.of(
"NAME", name,
"PUNYCODENAME", (punycodeName == null) ? name : punycodeName,
"HANDLE", handle,
"TYPE", "domain name")));
}
private Object generateExpectedJsonWithTopLevelEntries(
String name,
String punycodeName,
String handle,
String expectedOutputFile) {
Object obj = generateExpectedJson(
name, punycodeName, handle, expectedOutputFile);
if (obj instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) obj;
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.putAll(map);
if (!map.containsKey("rdapConformance")) {
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
}
if (!map.containsKey("notices")) {
RdapTestHelper.addTermsOfServiceNotice(builder, "https://example.com/rdap/");
}
if (!map.containsKey("remarks")) {
RdapTestHelper.addDomainBoilerplateRemarks(builder);
}
if (!map.containsKey("port43")) {
builder.put("port43", "whois.example.com");
}
obj = builder.build();
}
return obj;
}
@Test
public void testInvalidDomain_returns400() throws Exception {
assertThat(generateActualJson("invalid/domain/name")).isEqualTo(
generateExpectedJson(
"invalid/domain/name is not a valid domain name", null, "1", "rdap_error_400.json"));
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testUnknownDomain_returns404() throws Exception {
assertThat(generateActualJson("missingdomain.com")).isEqualTo(
generateExpectedJson("missingdomain.com not found", null, "1", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testDeletedDomain_returns404() throws Exception {
assertThat(generateActualJson("dodo.lol")).isEqualTo(
generateExpectedJson("dodo.lol not found", null, "1", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testValidDomain_works() throws Exception {
assertThat(generateActualJson("cat.lol")).isEqualTo(
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, "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, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testIdnDomain_works() throws Exception {
assertThat(generateActualJson("cat.みんな")).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
"cat.みんな", "cat.xn--q9jyb4c", "F-Q9JYB4C", "rdap_domain_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testIdnDomainWithPercentEncoding_works() throws Exception {
assertThat(generateActualJson("cat.%E3%81%BF%E3%82%93%E3%81%AA")).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
"cat.みんな", "cat.xn--q9jyb4c", "F-Q9JYB4C", "rdap_domain_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testPunycodeDomain_works() throws Exception {
assertThat(generateActualJson("cat.xn--q9jyb4c")).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
"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, "11-1.TLD", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
// todo (b/27378695): reenable or delete this test
@Ignore
@Test
public void testDomainInTestTld_notFound() throws Exception {
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
generateActualJson("cat.lol");
assertThat(response.getStatus()).isEqualTo(404);
}
}

View file

@ -0,0 +1,686 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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.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.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.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;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
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;
import com.google.domain.registry.testing.InjectRule;
import com.googlecode.objectify.Ref;
import org.joda.time.DateTime;
import org.json.simple.JSONValue;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link RdapDomainSearchAction}. */
@RunWith(JUnit4.class)
public class RdapDomainSearchActionTest {
@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("2000-01-01T00:00:00Z"));
private final RdapDomainSearchAction action = new RdapDomainSearchAction();
private DomainResource domainCatLol;
private DomainResource domainCatLol2;
private DomainResource domainCatExample;
private HostResource hostNs1CatLol;
private HostResource hostNs2CatLol;
enum RequestType { NONE, NAME, NS_LDH_NAME, NS_IP }
private Object generateActualJson(RequestType requestType, String paramValue) {
action.requestPath = RdapDomainSearchAction.PATH;
switch (requestType) {
case NAME:
action.nameParam = Optional.of(paramValue);
action.nsLdhNameParam = Optional.absent();
action.nsIpParam = Optional.absent();
break;
case NS_LDH_NAME:
action.nameParam = Optional.absent();
action.nsLdhNameParam = Optional.of(paramValue);
action.nsIpParam = Optional.absent();
break;
case NS_IP:
action.nameParam = Optional.absent();
action.nsLdhNameParam = Optional.absent();
action.nsIpParam = Optional.of(InetAddresses.forString(paramValue));
break;
default:
action.nameParam = Optional.absent();
action.nsLdhNameParam = Optional.absent();
action.nsIpParam = Optional.absent();
break;
}
action.run();
return JSONValue.parse(response.getPayload());
}
@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",
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(
hostNs1CatLol.asBuilder().setSuperordinateDomain(Ref.create(domainCatLol)).build());
persistResource(
hostNs2CatLol.asBuilder().setSuperordinateDomain(Ref.create(domainCatLol)).build());
domainCatLol2 = persistResource(makeDomainResource(
"cat2.lol",
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",
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,
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.みんな",
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");
registrar =
persistResource(makeRegistrar("unicoderegistrar", "1.test", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
persistResource(makeDomainResource(
"cat.1.test",
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());
// 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/";
action.rdapWhoisServer = "whois.example.tld";
}
private Object generateExpectedJson(String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions(
this.getClass(),
expectedOutputFile,
ImmutableMap.of("TYPE", "domain name")));
}
private Object generateExpectedJson(
String name,
String punycodeName,
String handle,
String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions(
this.getClass(),
expectedOutputFile,
ImmutableMap.of(
"NAME", name,
"PUNYCODENAME", (punycodeName == null) ? name : punycodeName,
"HANDLE", (handle == null) ? "(null)" : handle,
"TYPE", "domain name")));
}
private Object generateExpectedJsonForDomain(
String name,
String punycodeName,
String handle,
String expectedOutputFile) {
Object obj = generateExpectedJson(name, punycodeName, handle, expectedOutputFile);
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("domainSearchResults", ImmutableList.of(obj));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addTermsOfServiceNotice(builder, "https://example.com/rdap/");
RdapTestHelper.addDomainBoilerplateRemarks(builder);
return builder.build();
}
@Test
public void testInvalidPath_rejected() throws Exception {
action.requestPath = RdapDomainSearchAction.PATH + "/path";
action.run();
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testInvalidRequest_rejected() throws Exception {
assertThat(generateActualJson(RequestType.NONE, null))
.isEqualTo(generateExpectedJson(
"You must specify either name=XXXX, nsLdhName=YYYY or nsIp=ZZZZ",
null,
null,
"rdap_error_400.json"));
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testInvalidWildcard_rejected() throws Exception {
assertThat(generateActualJson(RequestType.NAME, "exam*ple"))
.isEqualTo(generateExpectedJson(
"Suffix after wildcard must be one or more domain"
+ " name labels, e.g. exam*.tld, ns*.example.tld",
null,
null,
"rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testMultipleWildcards_rejected() throws Exception {
assertThat(generateActualJson(RequestType.NAME, "*.*"))
.isEqualTo(generateExpectedJson(
"Only one wildcard allowed", null, null, "rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testFewerThanTwoCharactersToMatch_rejected() throws Exception {
assertThat(generateActualJson(RequestType.NAME, "a*"))
.isEqualTo(generateExpectedJson(
"At least two characters must be specified", null, null, "rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testDomainMatch_found() throws Exception {
assertThat(generateActualJson(RequestType.NAME, "cat.lol"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
/*
* This test is flaky because IDN.toASCII may or may not remove the trailing dot of its own
* accord. If it does, the test will pass.
*/
@Ignore
@Test
public void testDomainMatchWithTrailingDot_notFound() throws Exception {
generateActualJson(RequestType.NAME, "cat.lol.");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testDomainMatch_cat2_lol_found() throws Exception {
generateActualJson(RequestType.NAME, "cat2.lol");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_cat_example_found() throws Exception {
generateActualJson(RequestType.NAME, "cat.example");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_cat_idn_unicode_found() throws Exception {
generateActualJson(RequestType.NAME, "cat.みんな");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_cat_idn_punycode_found() throws Exception {
generateActualJson(RequestType.NAME, "cat.xn--q9jyb4c");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_cat_1_test_found() throws Exception {
generateActualJson(RequestType.NAME, "cat.1.test");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_castar_1_test_found() throws Exception {
generateActualJson(RequestType.NAME, "ca*.1.test");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_castar_test_notFound() throws Exception {
generateActualJson(RequestType.NAME, "ca*.test");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testDomainMatch_catstar_lol_found() throws Exception {
generateActualJson(RequestType.NAME, "cat*.lol");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_cat_star_found() throws Exception {
generateActualJson(RequestType.NAME, "cat.*");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_cat_lstar_found() throws Exception {
generateActualJson(RequestType.NAME, "cat.l*");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatch_catstar_found() throws Exception {
generateActualJson(RequestType.NAME, "cat*");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDomainMatchWithWildcardAndEmptySuffix_fails() throws Exception {
// Unfortunately, we can't be sure which error is going to be returned. The version of
// IDN.toASCII used in Eclipse drops a trailing dot, if any. But the version linked in by
generateActualJson(RequestType.NAME, "exam*..");
assertThat(response.getStatus()).isIn(Range.closed(400, 499));
}
@Test
public void testDomainMatch_dog_notFound() throws Exception {
generateActualJson(RequestType.NAME, "dog*");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testDomainMatchDeletedDomain_notFound() throws Exception {
persistDomainAsDeleted(domainCatLol, clock.nowUtc());
assertThat(generateActualJson(RequestType.NAME, "cat.lol"))
.isEqualTo(generateExpectedJson("No domains found", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testDomainMatchDeletedDomainWithWildcard_notFound() throws Exception {
persistDomainAsDeleted(domainCatLol, clock.nowUtc());
assertThat(generateActualJson(RequestType.NAME, "cat.lo*"))
.isEqualTo(generateExpectedJson("No domains found", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testDomainMatchDeletedDomainsWithWildcardAndTld_notFound() throws Exception {
persistDomainAsDeleted(domainCatLol, clock.nowUtc());
persistDomainAsDeleted(domainCatLol2, clock.nowUtc());
generateActualJson(RequestType.NAME, "cat*.lol");
assertThat(response.getStatus()).isEqualTo(404);
}
// todo (b/27378695): reenable or delete this test
@Ignore
@Test
public void testDomainMatchDomainInTestTld_notFound() throws Exception {
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
generateActualJson(RequestType.NAME, "cat.lol");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameserverMatch_foundMultiple() throws Exception {
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.lol"))
.isEqualTo(generateExpectedJson("rdap_multiple_domains.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatchWithWildcard_found() throws Exception {
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns2.cat.l*"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatchWithWildcardAndTldSuffix_notFound() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns2.cat*.lol");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameserverMatchWithWildcardAndDomainSuffix_found() throws Exception {
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns*.cat.lol"))
.isEqualTo(generateExpectedJson("rdap_multiple_domains.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatchWithWildcardAndEmptySuffix_unprocessable() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns*.");
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testNameserverMatch_ns2_cat_lol_found() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns2.cat.lol");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatch_ns2_dog_lol_found() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns2.dog.lol");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatch_ns1_cat_idn_unicode_badRequest() throws Exception {
// nsLdhName must use punycode.
generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.みんな");
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testNameserverMatch_ns1_cat_idn_punycode_found() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.xn--q9jyb4c");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatch_ns1_cat_1_test_found() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.1.test");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatch_nsstar_cat_1_test_found() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns*.cat.1.test");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatch_nsstar_test_notFound() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns*.1.test");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameserverMatchMissing_notFound() throws Exception {
generateActualJson(RequestType.NS_LDH_NAME, "ns1.missing.com");
assertThat(response.getStatus()).isEqualTo(404);
}
// todo (b/27378695): reenable or delete this test
@Ignore
@Test
public void testNameserverMatchDomainsInTestTld_notFound() throws Exception {
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
generateActualJson(RequestType.NS_LDH_NAME, "ns2.cat.lol");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameserverMatchOneDeletedDomain_foundTheOther() throws Exception {
persistDomainAsDeleted(domainCatExample, clock.nowUtc());
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.lol"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameserverMatchTwoDeletedDomains_notFound() throws Exception {
persistDomainAsDeleted(domainCatLol, clock.nowUtc());
persistDomainAsDeleted(domainCatExample, clock.nowUtc());
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.lol"))
.isEqualTo(generateExpectedJson("No domains found", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameserverMatchDeletedNameserver_notFound() throws Exception {
persistResource(
hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.lol"))
.isEqualTo(generateExpectedJson("No domains found", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameserverMatchDeletedNameserverWithWildcard_notFound() throws Exception {
persistResource(
hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.l*"))
.isEqualTo(generateExpectedJson(
"No matching nameservers found", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameserverMatchDeletedNameserverWithWildcardAndTld_notFound() throws Exception {
persistResource(
hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat*.lol"))
.isEqualTo(generateExpectedJson(
"No domain found for specified nameserver suffix", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testAddressMatchV4Address_foundMultiple() throws Exception {
assertThat(generateActualJson(RequestType.NS_IP, "1.2.3.4"))
.isEqualTo(generateExpectedJson("rdap_multiple_domains.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testAddressMatchV6Address_foundMultiple() throws Exception {
assertThat(generateActualJson(RequestType.NS_IP, "bad:f00d:cafe::15:beef"))
.isEqualTo(generateExpectedJson("rdap_multiple_domains.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testAddressMatchLocalhost_notFound() throws Exception {
generateActualJson(RequestType.NS_IP, "127.0.0.1");
assertThat(response.getStatus()).isEqualTo(404);
}
// todo (b/27378695): reenable or delete this test
@Ignore
@Test
public void testAddressMatchDomainsInTestTld_notFound() throws Exception {
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
persistResource(Registry.get("example").asBuilder().setTldType(Registry.TldType.TEST).build());
generateActualJson(RequestType.NS_IP, "1.2.3.4");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testAddressMatchOneDeletedDomain_foundTheOther() throws Exception {
persistDomainAsDeleted(domainCatExample, clock.nowUtc());
assertThat(generateActualJson(RequestType.NS_IP, "1.2.3.4"))
.isEqualTo(generateExpectedJsonForDomain("cat.lol", null, "C-LOL", "rdap_domain.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testAddressMatchTwoDeletedDomains_notFound() throws Exception {
persistDomainAsDeleted(domainCatLol, clock.nowUtc());
persistDomainAsDeleted(domainCatExample, clock.nowUtc());
assertThat(generateActualJson(RequestType.NS_IP, "1.2.3.4"))
.isEqualTo(generateExpectedJson("No domains found", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testAddressMatchDeletedNameserver_notFound() throws Exception {
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJson(RequestType.NS_IP, "1.2.3.4"))
.isEqualTo(generateExpectedJson("No domains found", null, null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
}

View file

@ -0,0 +1,265 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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.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;
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;
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.host.HostResource;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
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;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Map;
/** Unit tests for {@link RdapEntityAction}. */
@RunWith(JUnit4.class)
public class RdapEntityActionTest {
@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("2000-01-01TZ"));
private RdapEntityAction action;
private Registrar registrarLol;
private ContactResource registrant;
private ContactResource adminContact;
private ContactResource techContact;
private ContactResource disconnectedContact;
private ContactResource deletedContact;
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
// lol
createTld("lol");
registrarLol = persistResource(makeRegistrar(
"evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrarLol));
registrant = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
adminContact = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
techContact = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
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"));
persistResource(makeDomainResource("cat.lol",
registrant,
adminContact,
techContact,
host1,
host2,
registrarLol));
// xn--q9jyb4c
createTld("xn--q9jyb4c");
Registrar registrarIdn =
persistResource(makeRegistrar("idnregistrar", "IDN Registrar", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrarIdn));
persistResource(makeDomainResource("cat.みんな",
registrant,
adminContact,
techContact,
host1,
host2,
registrarIdn));
createTld("1.tld");
Registrar registrar1tld = persistResource(
makeRegistrar("1tldregistrar", "Multilevel Registrar", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar1tld));
persistResource(makeDomainResource("cat.1.tld",
registrant,
adminContact,
techContact,
host1,
host2,
registrar1tld));
disconnectedContact = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな"),
clock.nowUtc());
deletedContact = persistResource(makeContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
ImmutableList.of("1 Smiley Row", "Suite みんな"))
.asBuilder().setDeletionTime(clock.nowUtc()).build());
action = new RdapEntityAction();
action.clock = clock;
action.response = response;
action.rdapLinkBase = "https://example.com/rdap/";
action.rdapWhoisServer = "whois.example.tld";
}
private Object generateActualJson(String name) {
action.requestPath = RdapEntityAction.PATH + name;
action.run();
return JSONValue.parse(response.getPayload());
}
private Object generateExpectedJson(
String handle,
String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions(
this.getClass(),
expectedOutputFile,
ImmutableMap.of(
"NAME", handle,
"FULLNAME", "(◕‿◕)",
"ADDRESS", "\"1 Smiley Row\", \"Suite みんな\"",
"EMAIL", "lol@cat.みんな",
"TYPE", "entity")));
}
private Object generateExpectedJsonWithTopLevelEntries(
String handle,
String expectedOutputFile) {
Object obj = generateExpectedJson(handle, expectedOutputFile);
if (obj instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) obj;
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.putAll(map);
if (!map.containsKey("rdapConformance")) {
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
}
if (!map.containsKey("port43")) {
builder.put("port43", "whois.example.tld");
}
if (!map.containsKey("notices")) {
RdapTestHelper.addTermsOfServiceNotice(builder, "https://example.com/rdap/");
}
if (!map.containsKey("remarks")) {
RdapTestHelper.addNonDomainBoilerplateRemarks(builder);
}
obj = builder.build();
}
return obj;
}
@Test
public void testInvalidEntity_returns400() throws Exception {
assertThat(generateActualJson("invalid/entity/handle")).isEqualTo(
generateExpectedJson(
"invalid/entity/handle is not a valid entity handle",
"rdap_error_400.json"));
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testUnknownEntity_returns404() throws Exception {
assertThat(generateActualJson("MISSING-ENTITY")).isEqualTo(
generateExpectedJson("MISSING-ENTITY not found", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testValidRegistrantContact_works() throws Exception {
assertThat(generateActualJson(registrant.getRepoId())).isEqualTo(
generateExpectedJsonWithTopLevelEntries(registrant.getRepoId(), "rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testValidAdminContact_works() throws Exception {
assertThat(generateActualJson(adminContact.getRepoId())).isEqualTo(
generateExpectedJsonWithTopLevelEntries(adminContact.getRepoId(), "rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testValidTechContact_works() throws Exception {
assertThat(generateActualJson(techContact.getRepoId())).isEqualTo(
generateExpectedJsonWithTopLevelEntries(techContact.getRepoId(), "rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testValidDisconnectedContact_works() throws Exception {
assertThat(generateActualJson(disconnectedContact.getRepoId())).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
disconnectedContact.getRepoId(), "rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testRegistrar_works() throws Exception {
assertThat(generateActualJson(registrarLol.getClientIdentifier())).isEqualTo(
generateExpectedJsonWithTopLevelEntries(
registrarLol.getClientIdentifier(), "rdap_registrar.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testDeletedContact_returns404() throws Exception {
assertThat(generateActualJson(deletedContact.getRepoId())).isEqualTo(
generateExpectedJson(deletedContact.getRepoId() + " not found", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testQueryParameter_ignored() throws Exception {
assertThat(generateActualJson(techContact.getRepoId() + "?key=value")).isEqualTo(
generateExpectedJsonWithTopLevelEntries(techContact.getRepoId(), "rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
}

View file

@ -0,0 +1,306 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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.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;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.common.base.Optional;
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.ofy.Ofy;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
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;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import javax.annotation.Nullable;
/** Unit tests for {@link RdapEntitySearchAction}. */
@RunWith(JUnit4.class)
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("2000-01-01T00:00:00Z"));
private final RdapEntitySearchAction action = new RdapEntitySearchAction();
private ContactResource contact;
private Registrar registrar;
private Registrar registrarInactive;
private Registrar registrarTest;
private Object generateActualJsonWithFullName(String fn) {
action.fnParam = Optional.of(fn);
action.run();
return JSONValue.parse(response.getPayload());
}
private Object generateActualJsonWithHandle(String handle) {
action.handleParam = Optional.of(handle);
action.run();
return JSONValue.parse(response.getPayload());
}
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
createTld("tld");
contact = makeAndPersistContactResource(
"blinky",
"Blinky (赤ベイ)",
"blinky@b.tld",
ImmutableList.of("123 Blinky St", "Blinkyland"),
clock.nowUtc());
// deleted
persistResource(
makeContactResource("clyde", "Clyde (愚図た)", "clyde@c.tld")
.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
registrar =
persistResource(
makeRegistrar("2-Registrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
// inactive
registrarInactive =
persistResource(makeRegistrar("2-RegistrarInact", "No Way", Registrar.State.PENDING));
persistSimpleGlobalResources(makeRegistrarContacts(registrarInactive));
// test
registrarTest =
persistResource(
makeRegistrar("2-RegistrarTest", "No Way", Registrar.State.ACTIVE)
.asBuilder()
.setType(Registrar.Type.TEST)
.setIanaIdentifier(null)
.build());
persistSimpleGlobalResources(makeRegistrarContacts(registrarTest));
action.clock = clock;
action.requestPath = RdapEntitySearchAction.PATH;
action.response = response;
action.rdapResultSetMaxSize = 100;
action.rdapLinkBase = "https://example.com/rdap/";
action.rdapWhoisServer = "whois.example.tld";
action.fnParam = Optional.absent();
action.handleParam = Optional.absent();
}
private Object generateExpectedJson(String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions(
this.getClass(),
expectedOutputFile,
ImmutableMap.of("TYPE", "entity")));
}
private Object generateExpectedJson(String name, String expectedOutputFile) {
return generateExpectedJson(name, null, null, null, expectedOutputFile);
}
private Object generateExpectedJson(
String handle,
@Nullable String fullName,
@Nullable String email,
@Nullable String address,
String expectedOutputFile) {
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>();
builder.put("NAME", handle);
if (fullName != null) {
builder.put("FULLNAME", fullName);
}
if (email != null) {
builder.put("EMAIL", email);
}
if (address != null) {
builder.put("ADDRESS", address);
}
builder.put("TYPE", "entity");
return JSONValue.parse(
loadFileWithSubstitutions(this.getClass(), expectedOutputFile, builder.build()));
}
private Object generateExpectedJsonForEntity(
String handle,
String fullName,
@Nullable String email,
@Nullable String address,
String expectedOutputFile) {
Object obj =
generateExpectedJson(
handle, fullName, email, address, expectedOutputFile);
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("entitySearchResults", ImmutableList.of(obj));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addTermsOfServiceNotice(builder, "https://example.com/rdap/");
RdapTestHelper.addNonDomainBoilerplateRemarks(builder);
return builder.build();
}
@Test
public void testInvalidPath_rejected() throws Exception {
action.requestPath = RdapEntitySearchAction.PATH + "/path";
action.run();
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testInvalidRequest_rejected() throws Exception {
action.run();
assertThat(JSONValue.parse(response.getPayload()))
.isEqualTo(
generateExpectedJson(
"You must specify either fn=XXXX or handle=YYYY", "rdap_error_400.json"));
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testSuffix_rejected() throws Exception {
assertThat(generateActualJsonWithHandle("exam*ple"))
.isEqualTo(
generateExpectedJson("Suffix not allowed after wildcard", "rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testMultipleWildcards_rejected() throws Exception {
assertThat(generateActualJsonWithHandle("*.*"))
.isEqualTo(generateExpectedJson("Only one wildcard allowed", "rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testFewerThanTwoCharactersToMatch_rejected() throws Exception {
assertThat(generateActualJsonWithHandle("a*"))
.isEqualTo(
generateExpectedJson(
"At least two characters must be specified", "rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testNameMatch_notImplemented() throws Exception {
assertThat(generateActualJsonWithFullName("hello"))
.isEqualTo(
generateExpectedJson("Entity name search not implemented", "rdap_error_501.json"));
assertThat(response.getStatus()).isEqualTo(501);
}
@Test
public void testHandleMatch_2roid_found() throws Exception {
assertThat(generateActualJsonWithHandle("2-ROID"))
.isEqualTo(
generateExpectedJsonForEntity(
"2-ROID",
"Blinky (赤ベイ)",
"blinky@b.tld",
"\"123 Blinky St\", \"Blinkyland\"",
"rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHandleMatch_registrar_found() throws Exception {
assertThat(generateActualJsonWithHandle("2-Registrar"))
.isEqualTo(
generateExpectedJsonForEntity(
"2-Registrar", "Yes Virginia <script>", null, null, "rdap_registrar.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_2registrarInactive_notFound() throws Exception {
generateActualJsonWithHandle("2-RegistrarInact");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameMatch_2registrarTest_notFound() throws Exception {
generateActualJsonWithHandle("2-RegistrarTest");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testHandleMatch_2rstar_found() throws Exception {
assertThat(generateActualJsonWithHandle("2-R*"))
.isEqualTo(generateExpectedJson("rdap_multiple_contacts.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHandleMatch_2rstarWithResultSetSize1_foundOne() throws Exception {
action.rdapResultSetMaxSize = 1;
assertThat(generateActualJsonWithHandle("2-R*"))
.isEqualTo(
generateExpectedJsonForEntity(
"2-ROID",
"Blinky (赤ベイ)",
"blinky@b.tld",
"\"123 Blinky St\", \"Blinkyland\"",
"rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHandleMatch_2rostar_found() throws Exception {
assertThat(generateActualJsonWithHandle("2-RO*"))
.isEqualTo(
generateExpectedJsonForEntity(
contact.getRepoId(),
"Blinky (赤ベイ)",
"blinky@b.tld",
"\"123 Blinky St\", \"Blinkyland\"",
"rdap_contact.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHandleMatch_2registstar_found() throws Exception {
assertThat(generateActualJsonWithHandle("2-Regist*"))
.isEqualTo(
generateExpectedJsonForEntity(
"2-Registrar", "Yes Virginia <script>", null, null, "rdap_registrar.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHandleMatch_3teststar_notFound() throws Exception {
generateActualJsonWithHandle("3test*");
assertThat(response.getStatus()).isEqualTo(404);
}
}

View file

@ -0,0 +1,116 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.rdap;
import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
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;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link RdapHelpAction}. */
@RunWith(JUnit4.class)
public class RdapHelpActionTest {
@Rule
public final InjectRule inject = new InjectRule();
private final FakeResponse response = new FakeResponse();
private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ"));
private RdapHelpAction action;
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
action = new RdapHelpAction();
action.clock = clock;
action.response = response;
action.rdapLinkBase = "https://example.tld/rdap/";
action.rdapWhoisServer = "whois.example.tld";
}
private Object generateActualJson(String helpPath) {
action.requestPath = RdapHelpAction.PATH + helpPath;
action.run();
return JSONValue.parse(response.getPayload());
}
private Object generateExpectedJson(String name, String expectedOutputFile) {
return JSONValue.parse(loadFileWithSubstitutions(
this.getClass(), expectedOutputFile, ImmutableMap.of("NAME", name)));
}
@Test
public void testHelpActionMaliciousPath_notFound() throws Exception {
assertThat(generateActualJson("../passwd")).isEqualTo(
generateExpectedJson(
"no help found for ../passwd", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testHelpActionUnknownPath_notFound() throws Exception {
assertThat(generateActualJson("hlarg")).isEqualTo(
generateExpectedJson("no help found for hlarg", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testHelpActionIndex_works() throws Exception {
assertThat(generateActualJson("/index"))
.isEqualTo(generateExpectedJson("index", "rdap_help_index.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHelpActionDefault_getsIndex() throws Exception {
assertThat(generateActualJson(""))
.isEqualTo(generateExpectedJson("", "rdap_help_index.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHelpActionSlash_getsIndex() throws Exception {
assertThat(generateActualJson("/"))
.isEqualTo(generateExpectedJson("", "rdap_help_index.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHelpActionSyntax_works() throws Exception {
generateActualJson("/syntax");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testHelpActionTos_works() throws Exception {
assertThat(generateActualJson("/tos"))
.isEqualTo(generateExpectedJson("", "rdap_help_tos.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
}

View file

@ -0,0 +1,483 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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.DatastoreHelper.persistSimpleGlobalResources;
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.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;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
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;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link RdapJsonFormatter}. */
@RunWith(JUnit4.class)
public class RdapJsonFormatterTest {
@Rule
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;
private DomainResource domainResourceNoRegistrant;
private DomainResource domainResourceNoContacts;
private DomainResource domainResourceNoNameservers;
private HostResource hostResourceIpv4;
private HostResource hostResourceIpv6;
private HostResource hostResourceBoth;
private HostResource hostResourceNoAddresses;
private ContactResource contactResourceRegistrant;
private ContactResource contactResourceAdmin;
private ContactResource contactResourceTech;
private static final String LINK_BASE = "http://myserver.google.com/";
private static final String LINK_BASE_NO_TRAILING_SLASH = "http://myserver.google.com";
private static final String WHOIS_SERVER = "whois.google.com";
@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 = makeAndPersistContactResource(
"8372808-ERL",
"(◕‿◕)",
"lol@cat.みんな",
null,
clock.nowUtc().minusYears(1));
contactResourceAdmin = makeAndPersistContactResource(
"8372808-IRL",
"Santa Claus",
null,
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"),
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.みんな",
contactResourceRegistrant,
contactResourceAdmin,
contactResourceTech,
hostResourceIpv4,
hostResourceIpv6,
registrar));
domainResourceNoRegistrant = persistResource(
makeDomainResource(
"dog.みんな",
null,
contactResourceAdmin,
contactResourceTech,
hostResourceBoth,
hostResourceNoAddresses,
registrar));
domainResourceNoContacts = persistResource(
makeDomainResource(
"bird.みんな",
null,
null,
null,
hostResourceIpv4,
hostResourceIpv6,
registrar));
domainResourceNoNameservers = persistResource(
makeDomainResource(
"fish.みんな",
contactResourceRegistrant,
contactResourceAdmin,
contactResourceTech,
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) {
return ImmutableList.of(
new RegistrarContact.Builder()
.setParent(registrar)
.setName("Baby Doe")
.setEmailAddress("babydoe@example.com")
.setPhoneNumber("+1.2125551217")
.setFaxNumber("+1.2125551218")
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
.setVisibleInWhoisAsAdmin(false)
.setVisibleInWhoisAsTech(false)
.build(),
new RegistrarContact.Builder()
.setParent(registrar)
.setName("John Doe")
.setEmailAddress("johndoe@example.com")
.setFaxNumber("+1.2125551213")
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
.setVisibleInWhoisAsAdmin(false)
.setVisibleInWhoisAsTech(true)
.build(),
new RegistrarContact.Builder()
.setParent(registrar)
.setName("Jane Doe")
.setEmailAddress("janedoe@example.com")
.setPhoneNumber("+1.2125551215")
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH, RegistrarContact.Type.ADMIN))
.setVisibleInWhoisAsAdmin(true)
.setVisibleInWhoisAsTech(false)
.build(),
new RegistrarContact.Builder()
.setParent(registrar)
.setName("Play Doe")
.setEmailAddress("playdoe@example.com")
.setPhoneNumber("+1.2125551217")
.setFaxNumber("+1.2125551218")
.setTypes(ImmutableSet.of(RegistrarContact.Type.BILLING))
.setVisibleInWhoisAsAdmin(true)
.setVisibleInWhoisAsTech(true)
.build());
}
private Object loadJson(String expectedFileName) {
return JSONValue.parse(loadFileWithSubstitutions(this.getClass(), expectedFileName, null));
}
@Test
public void testRegistrar() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForRegistrar(registrar, false, LINK_BASE, WHOIS_SERVER))
.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"));
}
@Test
public void testHost_ipv6() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForHost(hostResourceIpv6, false, LINK_BASE, WHOIS_SERVER))
.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"));
}
@Test
public void testHost_noAddresses() throws Exception {
assertThat(RdapJsonFormatter.makeRdapJsonForHost(
hostResourceNoAddresses, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_host_no_addresses.json"));
}
@Test
public void testRegistrant() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForContact(
contactResourceRegistrant,
false,
Optional.of(DesignatedContact.Type.REGISTRANT),
LINK_BASE,
WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_registrant.json"));
}
@Test
public void testRegistrant_baseHasNoTrailingSlash() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForContact(
contactResourceRegistrant,
false,
Optional.of(DesignatedContact.Type.REGISTRANT),
LINK_BASE_NO_TRAILING_SLASH,
WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_registrant.json"));
}
@Test
public void testRegistrant_noBase() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForContact(
contactResourceRegistrant,
false,
Optional.of(DesignatedContact.Type.REGISTRANT),
null,
WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_registrant_nobase.json"));
}
@Test
public void testAdmin() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForContact(
contactResourceAdmin,
false,
Optional.of(DesignatedContact.Type.ADMIN),
LINK_BASE,
WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_admincontact.json"));
}
@Test
public void testTech() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForContact(
contactResourceTech,
false,
Optional.of(DesignatedContact.Type.TECH),
LINK_BASE,
WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_techcontact.json"));
}
@Test
public void testDomain_full() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceFull, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_domain_full.json"));
}
@Test
public void testDomain_noRegistrant() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceNoRegistrant, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_domain_no_registrant.json"));
}
@Test
public void testDomain_noContacts() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceNoContacts, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_domain_no_contacts.json"));
}
@Test
public void testDomain_noNameservers() throws Exception {
assertThat(
RdapJsonFormatter.makeRdapJsonForDomain(
domainResourceNoNameservers, false, LINK_BASE, WHOIS_SERVER))
.isEqualTo(loadJson("rdapjson_domain_no_nameservers.json"));
}
@Test
public void testError() throws Exception {
assertThat(
RdapJsonFormatter
.makeError(SC_BAD_REQUEST, "Invalid Domain Name", "Not a valid domain name"))
.isEqualTo(loadJson("rdapjson_error.json"));
}
@Test
public void testHelp_absoluteHtmlUrl() throws Exception {
assertThat(RdapJsonFormatter.makeRdapJsonNotice(
MakeRdapJsonNoticeParameters.builder()
.title("RDAP Help")
.description(ImmutableList.of(
"RDAP Help Topics (use /help/topic for information)",
"syntax",
"tos (Terms of Service)"))
.linkValueSuffix("help/index")
.linkHrefUrlString(LINK_BASE + "about/rdap/index.html")
.build(),
LINK_BASE))
.isEqualTo(loadJson("rdapjson_notice_alternate_link.json"));
}
@Test
public void testHelp_relativeHtmlUrlWithStartingSlash() throws Exception {
assertThat(RdapJsonFormatter.makeRdapJsonNotice(
MakeRdapJsonNoticeParameters.builder()
.title("RDAP Help")
.description(ImmutableList.of(
"RDAP Help Topics (use /help/topic for information)",
"syntax",
"tos (Terms of Service)"))
.linkValueSuffix("help/index")
.linkHrefUrlString("/about/rdap/index.html")
.build(),
LINK_BASE))
.isEqualTo(loadJson("rdapjson_notice_alternate_link.json"));
}
@Test
public void testHelp_relativeHtmlUrlWithoutStartingSlash() throws Exception {
assertThat(RdapJsonFormatter.makeRdapJsonNotice(
MakeRdapJsonNoticeParameters.builder()
.title("RDAP Help")
.description(ImmutableList.of(
"RDAP Help Topics (use /help/topic for information)",
"syntax",
"tos (Terms of Service)"))
.linkValueSuffix("help/index")
.linkHrefUrlString("about/rdap/index.html")
.build(),
LINK_BASE))
.isEqualTo(loadJson("rdapjson_notice_alternate_link.json"));
}
@Test
public void testHelp_noHtmlUrl() throws Exception {
assertThat(RdapJsonFormatter.makeRdapJsonNotice(
MakeRdapJsonNoticeParameters.builder()
.title("RDAP Help")
.description(ImmutableList.of(
"RDAP Help Topics (use /help/topic for information)",
"syntax",
"tos (Terms of Service)"))
.linkValueSuffix("help/index")
.build(),
LINK_BASE))
.isEqualTo(loadJson("rdapjson_notice_self_link.json"));
}
@Test
public void testTopLevel() throws Exception {
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
builder.put("key", "value");
RdapJsonFormatter.addTopLevelEntries(
builder,
RdapJsonFormatter.BoilerplateType.OTHER,
null,
LINK_BASE);
assertThat(builder.build()).isEqualTo(loadJson("rdapjson_toplevel.json"));
}
@Test
public void testTopLevel_withTermsOfService() throws Exception {
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
builder.put("key", "value");
RdapJsonFormatter.addTopLevelEntries(
builder,
RdapJsonFormatter.BoilerplateType.OTHER,
ImmutableList.of(RdapHelpAction.getJsonHelpNotice("/tos", LINK_BASE)),
LINK_BASE);
assertThat(builder.build()).isEqualTo(loadJson("rdapjson_toplevel.json"));
}
@Test
public void testTopLevel_domain() throws Exception {
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
builder.put("key", "value");
RdapJsonFormatter.addTopLevelEntries(
builder,
RdapJsonFormatter.BoilerplateType.DOMAIN,
null,
LINK_BASE);
assertThat(builder.build()).isEqualTo(loadJson("rdapjson_toplevel_domain.json"));
}
@Test
public void testTopLevel_domainWithTermsOfService() throws Exception {
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
builder.put("key", "value");
RdapJsonFormatter.addTopLevelEntries(
builder,
RdapJsonFormatter.BoilerplateType.DOMAIN,
ImmutableList.of(RdapHelpAction.getJsonHelpNotice("/tos", LINK_BASE)),
LINK_BASE);
assertThat(builder.build()).isEqualTo(loadJson("rdapjson_toplevel_domain.json"));
}
}

View file

@ -0,0 +1,223 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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.FullFieldsTestEntityHelper.makeAndPersistHostResource;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.appengine.api.NamespaceManager;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
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;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Map;
import javax.annotation.Nullable;
/** Unit tests for {@link RdapNameserverAction}. */
@RunWith(JUnit4.class)
public class RdapNameserverActionTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
.withDatastore()
.build();
@Rule
public final InjectRule inject = new InjectRule();
private final FakeResponse response = new FakeResponse();
final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ"));
@Before
public void setUp() throws Exception {
inject.setStaticField(Ofy.class, "clock", clock);
// normal
createTld("lol");
makeAndPersistHostResource(
"ns1.cat.lol", "1.2.3.4", clock.nowUtc().minusYears(1));
// idn
createTld("xn--q9jyb4c");
makeAndPersistHostResource(
"ns1.cat.xn--q9jyb4c", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(1));
// multilevel
createTld("1.tld");
makeAndPersistHostResource(
"ns1.domain.1.tld", "5.6.7.8", clock.nowUtc().minusYears(1));
NamespaceManager.set(null);
}
private RdapNameserverAction newRdapNameserverAction(String input) {
RdapNameserverAction action = new RdapNameserverAction();
action.clock = clock;
action.response = response;
action.requestPath = RdapNameserverAction.PATH.concat(input);
action.rdapLinkBase = "https://example.tld/rdap/";
action.rdapWhoisServer = "whois.example.tld";
return action;
}
private Object generateActualJson(String name) {
newRdapNameserverAction(name).run();
return JSONValue.parse(response.getPayload());
}
private Object generateExpectedJson(
String name,
@Nullable ImmutableMap<String, String> otherSubstitutions,
String expectedOutputFile) {
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>();
builder.put("TYPE", "nameserver");
builder.put("NAME", name);
boolean punycodeSet = false;
if (otherSubstitutions != null) {
builder.putAll(otherSubstitutions);
if (otherSubstitutions.containsKey("PUNYCODENAME")) {
punycodeSet = true;
}
}
if (!punycodeSet) {
builder.put("PUNYCODENAME", name);
}
return JSONValue.parse(loadFileWithSubstitutions(
this.getClass(),
expectedOutputFile,
builder.build()));
}
private Object generateExpectedJsonWithTopLevelEntries(
String name,
@Nullable ImmutableMap<String, String> otherSubstitutions,
String expectedOutputFile) {
Object obj = generateExpectedJson(name, otherSubstitutions, expectedOutputFile);
if (obj instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) obj;
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.putAll(map);
if (!map.containsKey("rdapConformance")) {
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
}
if (!map.containsKey("port43")) {
builder.put("port43", "whois.example.tld");
}
if (!map.containsKey("notices")) {
RdapTestHelper.addTermsOfServiceNotice(builder, "https://example.tld/rdap/");
}
if (!map.containsKey("remarks")) {
RdapTestHelper.addNonDomainBoilerplateRemarks(builder);
}
obj = builder.build();
}
return obj;
}
@Test
public void testInvalidNameserver_returns400() throws Exception {
assertThat(generateActualJson("invalid/host/name")).isEqualTo(
generateExpectedJson(
"invalid/host/name is not a valid nameserver", null, "rdap_error_400.json"));
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testUnknownNameserver_returns404() throws Exception {
assertThat(generateActualJson("ns1.missing.com")).isEqualTo(
generateExpectedJson("ns1.missing.com not found", null, "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testValidNameserver_works() throws Exception {
assertThat(generateActualJson("ns1.cat.lol"))
.isEqualTo(generateExpectedJsonWithTopLevelEntries(
"ns1.cat.lol",
ImmutableMap.of("HANDLE", "2-ROID", "ADDRESSTYPE", "v4", "ADDRESS", "1.2.3.4"),
"rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testTrailingDot_getsIgnored() throws Exception {
assertThat(generateActualJson("ns1.cat.lol."))
.isEqualTo(generateExpectedJsonWithTopLevelEntries(
"ns1.cat.lol",
ImmutableMap.of("HANDLE", "2-ROID", "ADDRESSTYPE", "v4", "ADDRESS", "1.2.3.4"),
"rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testQueryParameter_getsIgnored() throws Exception {
assertThat(generateActualJson("ns1.cat.lol?key=value"))
.isEqualTo(generateExpectedJsonWithTopLevelEntries(
"ns1.cat.lol",
ImmutableMap.of("HANDLE", "2-ROID", "ADDRESSTYPE", "v4", "ADDRESS", "1.2.3.4"),
"rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testIdnNameserver_works() throws Exception {
assertThat(generateActualJson("ns1.cat.みんな"))
.isEqualTo(generateExpectedJsonWithTopLevelEntries(
"ns1.cat.みんな",
ImmutableMap.of(
"PUNYCODENAME", "ns1.cat.xn--q9jyb4c",
"HANDLE", "5-ROID",
"ADDRESSTYPE", "v6",
"ADDRESS", "bad:f00d:cafe::15:beef"),
"rdap_host_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testPunycodeNameserver_works() throws Exception {
assertThat(generateActualJson("ns1.cat.xn--q9jyb4c"))
.isEqualTo(generateExpectedJsonWithTopLevelEntries(
"ns1.cat.みんな",
ImmutableMap.of(
"PUNYCODENAME", "ns1.cat.xn--q9jyb4c",
"HANDLE", "5-ROID",
"ADDRESSTYPE", "v6",
"ADDRESS", "bad:f00d:cafe::15:beef"),
"rdap_host_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testMultilevelNameserver_works() throws Exception {
assertThat(generateActualJson("ns1.domain.1.tld"))
.isEqualTo(generateExpectedJsonWithTopLevelEntries(
"ns1.domain.1.tld",
ImmutableMap.of("HANDLE", "8-ROID", "ADDRESSTYPE", "v4", "ADDRESS", "5.6.7.8"),
"rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
}

View file

@ -0,0 +1,390 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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.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.makeRegistrar;
import static com.google.domain.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts;
import static com.google.domain.registry.testing.TestDataHelper.loadFileWithSubstitutions;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.InetAddresses;
import com.google.domain.registry.model.domain.DomainResource;
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.testing.AppEngineRule;
import com.google.domain.registry.testing.FakeClock;
import com.google.domain.registry.testing.FakeResponse;
import com.google.domain.registry.testing.InjectRule;
import com.googlecode.objectify.Ref;
import org.joda.time.DateTime;
import org.json.simple.JSONValue;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link RdapNameserverSearchAction}. */
@RunWith(JUnit4.class)
public class RdapNameserverSearchActionTest {
@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("2000-01-01T00:00:00Z"));
private final RdapNameserverSearchAction action = new RdapNameserverSearchAction();
private HostResource hostNs1CatLol;
private HostResource hostNs2CatLol;
private HostResource hostNs1Cat2Lol;
private Object generateActualJsonWithName(String name) {
action.nameParam = Optional.of(name);
action.run();
return JSONValue.parse(response.getPayload());
}
private Object generateActualJsonWithIp(String ipString) {
action.ipParam = Optional.of(InetAddresses.forString(ipString));
action.run();
return JSONValue.parse(response.getPayload());
}
@Before
public void setUp() throws Exception {
// cat.lol and cat2.lol
createTld("lol");
Registrar registrar =
persistResource(
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
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));
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));
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 =
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,
hostNs2CatLol,
registrar)
.asBuilder()
.setSubordinateHosts(ImmutableSet.of("ns1.cat.lol", "ns2.cat.lol"))
.build());
persistResource(
hostNs1CatLol.asBuilder().setSuperordinateDomain(Ref.create(domainCatLol)).build());
persistResource(
hostNs2CatLol.asBuilder().setSuperordinateDomain(Ref.create(domainCatLol)).build());
inject.setStaticField(Ofy.class, "clock", clock);
action.clock = clock;
action.requestPath = RdapNameserverSearchAction.PATH;
action.response = response;
action.rdapResultSetMaxSize = 100;
action.rdapLinkBase = "https://example.tld/rdap/";
action.rdapWhoisServer = "whois.example.tld";
action.ipParam = Optional.absent();
action.nameParam = Optional.absent();
}
private Object generateExpectedJson(String name, String expectedOutputFile) {
return generateExpectedJson(name, null, null, null, null, expectedOutputFile);
}
private Object generateExpectedJson(
String name,
String punycodeName,
String handle,
String ipAddressType,
String ipAddress,
String expectedOutputFile) {
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>();
builder.put("NAME", name);
builder.put("PUNYCODENAME", (punycodeName == null) ? name : punycodeName);
if (handle != null) {
builder.put("HANDLE", handle);
}
if (ipAddressType != null) {
builder.put("ADDRESSTYPE", ipAddressType);
}
if (ipAddress != null) {
builder.put("ADDRESS", ipAddress);
}
builder.put("TYPE", "nameserver");
return JSONValue.parse(
loadFileWithSubstitutions(this.getClass(), expectedOutputFile, builder.build()));
}
private Object generateExpectedJsonForNameserver(
String name,
String punycodeName,
String handle,
String ipAddressType,
String ipAddress,
String expectedOutputFile) {
Object obj =
generateExpectedJson(
name, punycodeName, handle, ipAddressType, ipAddress, expectedOutputFile);
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("nameserverSearchResults", ImmutableList.of(obj));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addTermsOfServiceNotice(builder, "https://example.tld/rdap/");
RdapTestHelper.addNonDomainBoilerplateRemarks(builder);
return builder.build();
}
@Test
public void testInvalidPath_rejected() throws Exception {
action.requestPath = RdapDomainSearchAction.PATH + "/path";
action.run();
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testInvalidRequest_rejected() throws Exception {
action.run();
assertThat(JSONValue.parse(response.getPayload()))
.isEqualTo(
generateExpectedJson(
"You must specify either name=XXXX or ip=YYYY", "rdap_error_400.json"));
assertThat(response.getStatus()).isEqualTo(400);
}
@Test
public void testInvalidSuffix_rejected() throws Exception {
assertThat(generateActualJsonWithName("exam*ple"))
.isEqualTo(
generateExpectedJson(
"Suffix after wildcard must be one or more domain"
+ " name labels, e.g. exam*.tld, ns*.example.tld",
"rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testNonexistentDomainSuffix_notFound() throws Exception {
assertThat(generateActualJsonWithName("exam*.foo.bar"))
.isEqualTo(
generateExpectedJson(
"No domain found for specified nameserver suffix", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testMultipleWildcards_rejected() throws Exception {
assertThat(generateActualJsonWithName("*.*"))
.isEqualTo(generateExpectedJson("Only one wildcard allowed", "rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testFewerThanTwoCharactersToMatch_rejected() throws Exception {
assertThat(generateActualJsonWithName("a*"))
.isEqualTo(
generateExpectedJson(
"At least two characters must be specified", "rdap_error_422.json"));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testNameMatch_ns1_cat_lol_found() throws Exception {
assertThat(generateActualJsonWithName("ns1.cat.lol"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns1.cat.lol", null, "2-ROID", "v4", "1.2.3.4", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_ns2_cat_lol_found() throws Exception {
assertThat(generateActualJsonWithName("ns2.cat.lol"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns2.cat.lol", null, "4-ROID", "v6", "bad:f00d:cafe::15:beef", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_ns1_cat2_lol_found() throws Exception {
// ns1.cat2.lol has two IP addresses; just test that we are able to find it
generateActualJsonWithName("ns1.cat2.lol");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_ns1_cat_external_found() throws Exception {
assertThat(generateActualJsonWithName("ns1.cat.external"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns1.cat.external", null, "8-ROID", null, null, "rdap_host_external.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_ns1_cat_idn_unicode_badRequest() throws Exception {
// name must use punycode.
generateActualJsonWithName("ns1.cat.みんな");
assertThat(response.getStatus()).isEqualTo(400);
}
@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",
"B-ROID",
"v4",
"1.2.3.5",
"rdap_host_unicode.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_ns1_cat_1_test_found() throws Exception {
assertThat(generateActualJsonWithName("ns1.cat.1.test"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns1.cat.1.test", null, "E-ROID", "v4", "1.2.3.6", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_nsstar_cat_lol_found() throws Exception {
generateActualJsonWithName("ns*.cat.lol");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_nsstar_found() throws Exception {
generateActualJsonWithName("ns*");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_ns1_cat_lstar_found() throws Exception {
generateActualJsonWithName("ns1.cat.l*");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_ns1_castar_found() throws Exception {
generateActualJsonWithName("ns1.ca*");
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testNameMatch_dogstar_notFound() throws Exception {
generateActualJsonWithName("dog*");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testAddressMatchV4Address_found() throws Exception {
assertThat(generateActualJsonWithIp("1.2.3.4"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns1.cat.lol", null, "2-ROID", "v4", "1.2.3.4", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testAddressMatchV6Address_foundMultiple() throws Exception {
assertThat(generateActualJsonWithIp("bad:f00d:cafe::15:beef"))
.isEqualTo(generateExpectedJson("ns1.cat.external", "rdap_multiple_hosts.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
public void testAddressMatchLocalhost_notFound() throws Exception {
generateActualJsonWithIp("127.0.0.1");
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameMatchDeletedHost_notFound() throws Exception {
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJsonWithName("ns1.cat.lol"))
.isEqualTo(generateExpectedJson("No nameservers found", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameMatchDeletedHostWithWildcard_notFound() throws Exception {
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJsonWithName("cat.lo*"))
.isEqualTo(generateExpectedJson("No nameservers found", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testAddressMatchDeletedHost_notFound() throws Exception {
persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJsonWithIp("1.2.3.4"))
.isEqualTo(generateExpectedJson("No nameservers found", "rdap_error_404.json"));
assertThat(response.getStatus()).isEqualTo(404);
}
@Test
public void testNameMatchDeletedHost_foundTheOtherHost() throws Exception {
persistResource(
hostNs1Cat2Lol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
assertThat(generateActualJsonWithIp("bad:f00d:cafe::15:beef"))
.isEqualTo(
generateExpectedJsonForNameserver(
"ns2.cat.lol", null, "4-ROID", "v6", "bad:f00d:cafe::15:beef", "rdap_host.json"));
assertThat(response.getStatus()).isEqualTo(200);
}
}

View file

@ -0,0 +1,105 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.rdap;
import static com.google.common.truth.Truth.assertThat;
import com.google.domain.registry.request.HttpException.UnprocessableEntityException;
import com.google.domain.registry.testing.ExceptionRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link RdapSearchPattern}. */
@RunWith(JUnit4.class)
public class RdapSearchPatternTest {
@Rule
public final ExceptionRule thrown = new ExceptionRule();
@Test
public void testNoWildcards_ok() throws Exception {
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("example.lol", true);
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("example.lol");
assertThat(rdapSearchPattern.getHasWildcard()).isFalse();
assertThat(rdapSearchPattern.getSuffix()).isNull();
}
@Test
public void testWildcardNoTld_ok() throws Exception {
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("exam*", true);
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("exam");
assertThat(rdapSearchPattern.getHasWildcard()).isTrue();
assertThat(rdapSearchPattern.getSuffix()).isNull();
}
@Test
public void testWildcardTld_ok() throws Exception {
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("exam*.lol", true);
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("exam");
assertThat(rdapSearchPattern.getHasWildcard()).isTrue();
assertThat(rdapSearchPattern.getSuffix()).isEqualTo("lol");
}
@Test
public void testMultipleWildcards_unprocessable() throws Exception {
thrown.expect(UnprocessableEntityException.class);
RdapSearchPattern.create("ex*am*.lol", true);
}
@Test
public void testWildcardNotAtEnd_unprocessable() throws Exception {
thrown.expect(UnprocessableEntityException.class);
RdapSearchPattern.create("ex*am", true);
}
@Test
public void testWildcardNotAtEndWithTld_unprocessable() throws Exception {
thrown.expect(UnprocessableEntityException.class);
RdapSearchPattern.create("ex*am.lol", true);
}
@Test
public void testPrefixTooShort_unprocessable() throws Exception {
thrown.expect(UnprocessableEntityException.class);
RdapSearchPattern.create("e*", true);
}
@Test
public void testZeroLengthSuffix_unprocessable() throws Exception {
thrown.expect(UnprocessableEntityException.class);
RdapSearchPattern.create("exam*.", true);
}
@Test
public void testDisallowedSuffix_unprocessable() throws Exception {
thrown.expect(UnprocessableEntityException.class);
RdapSearchPattern.create("exam*.lol", false);
}
@Test
public void testNextInitialString_alpha() throws Exception {
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("exam*.lol", true);
assertThat(rdapSearchPattern.getNextInitialString()).isEqualTo("exan");
}
@Test
public void testNextInitialString_unicode() throws Exception {
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("cat.みんな", true);
assertThat(rdapSearchPattern.getNextInitialString()).isEqualTo("cat.みんに");
}
}

View file

@ -0,0 +1,103 @@
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.domain.registry.rdap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public class RdapTestHelper {
static void addTermsOfServiceNotice(
ImmutableMap.Builder<String, Object> builder, String linkBase) {
builder.put("notices",
ImmutableList.of(
ImmutableMap.of(
"title", "RDAP Terms of Service",
"description", ImmutableList.of(
"By querying our Domain Database, you are agreeing to comply with these terms"
+ " so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for"
+ " query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the"
+ " transmission of mass unsolicited, commercial advertising or"
+ " solicitations.",
"Don't access our Domain Database through the use of high volume, automated"
+ " electronic processes that send queries or data to the systems of"
+ " Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful"
+ " purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information"
+ " contained in the Domain Database in its entirety, or in any substantial"
+ " portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the"
+ " purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we"
+ " suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."),
"links", ImmutableList.of(
ImmutableMap.of(
"value", linkBase + "help/tos",
"rel", "alternate",
"href", "https://www.registry.google/about/rdap/tos.html",
"type", "text/html")))));
}
static void addNonDomainBoilerplateRemarks(ImmutableMap.Builder<String, Object> builder) {
builder.put("remarks",
ImmutableList.of(
ImmutableMap.of(
"description",
ImmutableList.of(
"This response conforms to the RDAP Operational Profile for gTLD Registries and"
+ " Registrars version 1.0"))));
}
static void addDomainBoilerplateRemarks(ImmutableMap.Builder<String, Object> builder) {
builder.put("remarks",
ImmutableList.of(
ImmutableMap.of(
"description",
ImmutableList.of(
"This response conforms to the RDAP Operational Profile for gTLD Registries and"
+ " Registrars version 1.0")),
ImmutableMap.of(
"title",
"EPP Status Codes",
"description",
ImmutableList.of(
"For more information on domain status codes, please visit"
+ " https://icann.org/epp"),
"links",
ImmutableList.of(
ImmutableMap.of(
"value", "https://icann.org/epp",
"rel", "alternate",
"href", "https://icann.org/epp",
"type", "text/html"))),
ImmutableMap.of(
"description",
ImmutableList.of(
"URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf"),
"links",
ImmutableList.of(
ImmutableMap.of(
"value", "https://www.icann.org/wicf",
"rel", "alternate",
"href", "https://www.icann.org/wicf",
"type", "text/html")))));
}
}

View file

@ -0,0 +1,46 @@
{
"objectClassName" : "entity",
"handle" : "%NAME%",
"status" : ["active"],
"links" :
[
{
"value" : "https://example.com/rdap/entity/%NAME%",
"rel" : "self",
"href": "https://example.com/rdap/entity/%NAME%",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "%FULLNAME%"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text",
[
"",
"",
[ %ADDRESS% ],
"KOKOMO",
"BM",
"31337",
"United States"
]
],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "%EMAIL%"]
]
],
"port43": "whois.example.tld"
}

View file

@ -0,0 +1,359 @@
{
"status": [
"delete prohibited",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"handle": "%HANDLE%",
"links": [
{
"href": "https://example.com/rdap/domain/%NAME%",
"type": "application/rdap+json",
"rel": "self",
"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": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns1.cat.lol"
}
],
"ldhName": "ns1.cat.lol",
"ipAddresses": {
"v4": [
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "A-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.cat.lol",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns2.cat.lol"
}
],
"ldhName": "ns2.cat.lol",
"ipAddresses": {
"v6": [
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
"ldhName": "%NAME%",
"entities": [
{
"status": [
"active"
],
"handle": "4-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/4-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/4-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Santa Claus"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"BOFH@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "6-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/6-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/6-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"The Raven"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"bog@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "2-ROID",
"roles": [
"registrant"
],
"links": [
{
"href": "https://example.com/rdap/entity/2-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/2-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Goblin Market"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"lol@cat.lol"
]
]
]
}
],
"objectClassName": "domain",
"port43": "whois.example.tld"
}

View file

@ -0,0 +1,360 @@
{
"status": [
"delete prohibited",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"unicodeName": "%NAME%",
"handle": "%HANDLE%",
"links": [
{
"href": "https://example.com/rdap/domain/%PUNYCODENAME%",
"type": "application/rdap+json",
"rel": "self",
"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": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns1.cat.lol"
}
],
"ldhName": "ns1.cat.lol",
"ipAddresses": {
"v4": [
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "A-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.cat.lol",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns2.cat.lol"
}
],
"ldhName": "ns2.cat.lol",
"ipAddresses": {
"v6": [
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
"ldhName": "%PUNYCODENAME%",
"entities": [
{
"status": [
"active"
],
"handle": "4-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/4-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/4-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Santa Claus"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"BOFH@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "6-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/6-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/6-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"The Raven"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"bog@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "2-ROID",
"roles": [
"registrant"
],
"links": [
{
"href": "https://example.com/rdap/entity/2-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/2-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Goblin Market"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"lol@cat.lol"
]
]
]
}
],
"objectClassName": "domain",
"port43": "whois.example.tld"
}

View file

@ -0,0 +1,11 @@
{
"lang": "en",
"errorCode": 400,
"title": "Bad Request",
"description": [
"%NAME%"
],
"rdapConformance": [
"rdap_level_0"
]
}

View file

@ -0,0 +1,11 @@
{
"lang": "en",
"errorCode": 404,
"title": "Not Found",
"description": [
"%NAME%"
],
"rdapConformance": [
"rdap_level_0"
]
}

View file

@ -0,0 +1,11 @@
{
"lang": "en",
"errorCode": 422,
"title": "Unprocessable Entity",
"description": [
"%NAME%"
],
"rdapConformance": [
"rdap_level_0"
]
}

View file

@ -0,0 +1,11 @@
{
"lang": "en",
"errorCode": 501,
"title": "Not Implemented",
"description": [
"%NAME%"
],
"rdapConformance": [
"rdap_level_0"
]
}

View file

@ -0,0 +1,49 @@
{
"rdapConformance" : ["rdap_level_0"],
"notices" :
[
{
"title" : "RDAP Help",
"description" :
[
"RDAP Help Topics (use \/help\/topic for information)",
"syntax",
"tos (Terms of Service)"
],
"links" :
[
{
"value" : "https://example.tld/rdap/help/%NAME%",
"rel" : "alternate",
"type" : "text/html",
"href" : "https://www.registry.google/about/rdap/index.html"
}
]
},
{
"title" : "RDAP Terms of Service",
"description" :
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links" :
[
{
"value" : "https://example.tld/rdap/help/tos",
"rel" : "alternate",
"href" : "https://www.registry.google/about/rdap/tos.html",
"type" : "text/html"
}
]
}
]
}

View file

@ -0,0 +1,31 @@
{
"rdapConformance" : ["rdap_level_0"],
"notices" :
[
{
"title" : "RDAP Terms of Service",
"description" :
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links" :
[
{
"value" : "https://example.tld/rdap/help/tos",
"rel" : "alternate",
"href" : "https://www.registry.google/about/rdap/tos.html",
"type" : "text/html"
}
]
}
]
}

View file

@ -0,0 +1,29 @@
{
"status": [
"active"
],
"ldhName": "%NAME%",
"handle": "%HANDLE%",
"links": [
{
"href": "https://example.tld/rdap/nameserver/%NAME%",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.tld/rdap/nameserver/%NAME%"
}
],
"ipAddresses": {
"%ADDRESSTYPE%": [
"%ADDRESS%"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"objectClassName": "nameserver",
"port43": "whois.example.tld"
}

View file

@ -0,0 +1,24 @@
{
"status": [
"active"
],
"handle": "%HANDLE%",
"links": [
{
"href": "https://example.tld/rdap/nameserver/%NAME%",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.tld/rdap/nameserver/%NAME%"
}
],
"ldhName": "%NAME%",
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"objectClassName": "nameserver",
"port43": "whois.example.tld"
}

View file

@ -0,0 +1,30 @@
{
"status": [
"active"
],
"unicodeName": "%NAME%",
"handle": "%HANDLE%",
"links": [
{
"href": "https://example.tld/rdap/nameserver/%PUNYCODENAME%",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.tld/rdap/nameserver/%PUNYCODENAME%"
}
],
"ldhName": "%PUNYCODENAME%",
"ipAddresses": {
"%ADDRESSTYPE%": [
"%ADDRESS%"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"objectClassName": "nameserver",
"port43": "whois.example.tld"
}

View file

@ -0,0 +1,175 @@
{
"entitySearchResults":
[
{
"objectClassName" : "entity",
"handle" : "2-ROID",
"status" : ["active"],
"links" :
[
{
"value" : "https://example.com/rdap/entity/2-ROID",
"rel" : "self",
"href": "https://example.com/rdap/entity/2-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Blinky (赤ベイ)"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text",
[
"",
"",
["123 Blinky St", "Blinkyland"],
"KOKOMO",
"BM",
"31337",
"United States"
]
],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "blinky@b.tld"]
]
],
"port43": "whois.example.tld"
},
{
"objectClassName" : "entity",
"handle" : "2-Registrar",
"status" : ["active"],
"roles" : ["registrar"],
"links" :
[
{
"value" : "https://example.com/rdap/entity/2-Registrar",
"rel" : "self",
"href": "https://example.com/rdap/entity/2-Registrar",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "2-Registrar",
"eventDate": "2000-01-01T00:00:00.000Z"
}
],
"publicIds" :
[
{
"type" : "IANA Registrar ID",
"identifier" : "1"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Yes Virginia <script>"],
["adr", {}, "text",
[
"",
"",
"123 Example Boulevard <script>"
"Williamsburg <script>",
"NY",
"11211",
"United States"
]
],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551212"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551213"],
["email", {}, "text", "contact-us@example.com"]
]
],
"entities" :
[
{
"objectClassName" : "entity",
"status" : ["active"],
"roles" : ["administrative"],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Jane Doe"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551215"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551216"],
["email", {}, "text", "janedoe@example.com"]
]
],
},
{
"objectClassName" : "entity",
"status" : ["active"],
"roles" : ["technical"],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "John Doe"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551213"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551213"],
["email", {}, "text", "johndoe@example.com"]
]
],
}
],
"port43": "whois.example.tld"
}
],
"rdapConformance": [ "rdap_level_0" ],
"notices" :
[
{
"title" : "RDAP Terms of Service",
"description" :
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links" :
[
{
"value" : "https://example.com/rdap/help/tos",
"rel" : "alternate",
"href" : "https://www.registry.google/about/rdap/tos.html",
"type" : "text/html"
}
]
}
],
"remarks" :
[
{
"description" :
[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
]
}
]
}

View file

@ -0,0 +1,793 @@
{
"domainSearchResults": [
{
"status": [
"delete prohibited",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"handle": "21-EXAMPLE",
"links": [
{
"href": "https://example.com/rdap/domain/cat.example",
"type": "application/rdap+json",
"rel": "self",
"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": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns1.cat.lol"
}
],
"ldhName": "ns1.cat.lol",
"ipAddresses": {
"v4": [
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "1F-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.external.tld",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns2.external.tld"
}
],
"ldhName": "ns2.external.tld",
"ipAddresses": {
"v6": [
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
"ldhName": "cat.example",
"entities": [
{
"status": [
"active"
],
"handle": "1B-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/1B-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/1B-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Mark"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"BOFH@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "1D-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/1D-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/1D-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Luke"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"bog@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "19-ROID",
"roles": [
"registrant"
],
"links": [
{
"href": "https://example.com/rdap/entity/19-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/19-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Matthew"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"lol@cat.lol"
]
]
]
}
],
"objectClassName": "domain",
"port43": "whois.example.tld"
},
{
"status": [
"delete prohibited",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"handle": "C-LOL",
"links": [
{
"href": "https://example.com/rdap/domain/cat.lol",
"type": "application/rdap+json",
"rel": "self",
"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": "8-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns1.cat.lol",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns1.cat.lol"
}
],
"ldhName": "ns1.cat.lol",
"ipAddresses": {
"v4": [
"1.2.3.4"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
},
{
"status": [
"active"
],
"handle": "A-ROID",
"links": [
{
"href": "https://example.com/rdap/nameserver/ns2.cat.lol",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/nameserver/ns2.cat.lol"
}
],
"ldhName": "ns2.cat.lol",
"ipAddresses": {
"v6": [
"bad:f00d:cafe::15:beef"
]
},
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "nameserver"
}
],
"ldhName": "cat.lol",
"entities": [
{
"status": [
"active"
],
"handle": "4-ROID",
"roles": [
"administrative"
],
"links": [
{
"href": "https://example.com/rdap/entity/4-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/4-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Santa Claus"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"BOFH@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "6-ROID",
"roles": [
"technical"
],
"links": [
{
"href": "https://example.com/rdap/entity/6-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/6-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"The Raven"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"bog@cat.lol"
]
]
]
},
{
"status": [
"active"
],
"handle": "2-ROID",
"roles": [
"registrant"
],
"links": [
{
"href": "https://example.com/rdap/entity/2-ROID",
"type": "application/rdap+json",
"rel": "self",
"value": "https://example.com/rdap/entity/2-ROID"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"objectClassName": "entity",
"vcardArray": [
"vcard",
[
[
"version",
{},
"text",
"4.0"
],
[
"fn",
{},
"text",
"Goblin Market"
],
[
"org",
{},
"text",
"GOOGLE INCORPORATED <script>"
],
[
"adr",
{},
"text",
[
"",
"",
"123 Example Boulevard <script>",
"KOKOMO",
"BM",
"31337",
"United States"
]
],
[
"tel",
{
"type": [
"voice"
]
},
"uri",
"tel:+1.2126660420"
],
[
"tel",
{
"type": [
"fax"
]
},
"uri",
"tel:+1.2126660420"
],
[
"email",
{},
"text",
"lol@cat.lol"
]
]
]
}
],
"objectClassName": "domain",
"port43": "whois.example.tld"
}
],
"rdapConformance": [
"rdap_level_0"
],
"notices" :
[
{
"title" : "RDAP Terms of Service",
"description" :
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links" :
[
{
"value" : "https://example.com/rdap/help/tos",
"rel" : "alternate",
"href" : "https://www.registry.google/about/rdap/tos.html",
"type" : "text/html"
}
]
}
],
"remarks" :
[
{
"description" :
[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
]
},
{
"title" : "EPP Status Codes",
"description" :
[
"For more information on domain status codes, please visit https://icann.org/epp"
],
"links" :
[
{
"value" : "https://icann.org/epp",
"rel" : "alternate",
"href" : "https://icann.org/epp",
"type" : "text/html"
}
]
},
{
"description" :
[
"URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf"
],
"links" :
[
{
"value" : "https://www.icann.org/wicf",
"rel" : "alternate",
"href" : "https://www.icann.org/wicf",
"type" : "text/html"
}
]
}
]
}

View file

@ -0,0 +1,98 @@
{
"nameserverSearchResults" :
[
{
"objectClassName" : "nameserver",
"handle" : "4-ROID",
"status" : ["active"],
"ldhName" : "ns2.cat.lol",
"links" :
[
{
"value" : "https://example.tld/rdap/nameserver/ns2.cat.lol",
"rel" : "self",
"type" : "application/rdap+json",
"href" : "https://example.tld/rdap/nameserver/ns2.cat.lol"
}
],
"ipAddresses" :
{
"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" : "6-ROID",
"status" : ["active"],
"ldhName" : "ns1.cat2.lol",
"links" :
[
{
"value" : "https://example.tld/rdap/nameserver/ns1.cat2.lol",
"rel" : "self",
"type" : "application/rdap+json",
"href" : "https://example.tld/rdap/nameserver/ns1.cat2.lol"
}
],
"ipAddresses" :
{
"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"
}
],
"rdapConformance" : ["rdap_level_0"],
"notices" :
[
{
"title" : "RDAP Terms of Service",
"description" :
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links" :
[
{
"value" : "https://example.tld/rdap/help/tos",
"rel" : "alternate",
"href" : "https://www.registry.google/about/rdap/tos.html",
"type" : "text/html"
}
]
}
],
"remarks" :
[
{
"description" :
[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
]
}
]
}

View file

@ -0,0 +1,87 @@
{
"objectClassName" : "entity",
"handle" : "%NAME%",
"status" : ["active"],
"roles" : ["registrar"],
"links" :
[
{
"value" : "https://example.com/rdap/entity/%NAME%",
"rel" : "self",
"href": "https://example.com/rdap/entity/%NAME%",
"type" : "application/rdap+json"
}
],
"publicIds" :
[
{
"type" : "IANA Registrar ID",
"identifier" : "1"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "%NAME%",
"eventDate": "2000-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Yes Virginia <script>"],
["adr", {}, "text",
[
"",
"",
"123 Example Boulevard <script>"
"Williamsburg <script>",
"NY",
"11211",
"United States"
]
],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551212"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551213"],
["email", {}, "text", "contact-us@example.com"]
]
],
"entities" :
[
{
"objectClassName" : "entity",
"status" : ["active"],
"roles" : ["administrative"],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Jane Doe"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551215"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551216"],
["email", {}, "text", "janedoe@example.com"]
]
],
},
{
"objectClassName" : "entity",
"status" : ["active"],
"roles" : ["technical"],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "John Doe"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551213"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551213"],
["email", {}, "text", "johndoe@example.com"]
]
],
}
],
"port43": "whois.example.tld"
}

View file

@ -0,0 +1,46 @@
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Santa Claus"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Santa Claus Tower",
"41st floor",
"Suite みんな"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"]
]
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,222 @@
{
"objectClassName" : "domain",
"handle" : "10-Q9JYB4C",
"ldhName" : "cat.xn--q9jyb4c",
"unicodeName" : "cat.みんな",
"status" :
[
"delete prohibited",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"links" :
[
{
"value" : "http://myserver.google.com/domain/cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/domain/cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "expiration",
"eventDate": "2110-10-08T00:44:59.000Z"
},
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
}
],
"nameservers" :
[
{
"objectClassName" : "nameserver",
"handle" : "8-ROID",
"ldhName" : "ns1.cat.xn--q9jyb4c",
"unicodeName" : "ns1.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]
}
},
{
"objectClassName" : "nameserver",
"handle" : "A-ROID",
"ldhName" : "ns2.cat.xn--q9jyb4c",
"unicodeName" : "ns2.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v6" : ["bad:f00d:cafe::15:beef"]
}
}
],
"entities" :
[
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Santa Claus"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Santa Claus Tower",
"41st floor",
"Suite みんな"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"]
]
]
},
{
"objectClassName" : "entity",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/6-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "The Raven"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Chamber Door",
"upper level"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "bog@cat.みんな"]
]
]
},
{
"objectClassName" : "entity",
"handle" : "2-ROID",
"status" : ["active"],
"roles" : ["registrant"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/2-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/2-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "(◕‿◕)"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"]
["email", {}, "text", "lol@cat.みんな"]
]
]
}
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,95 @@
{
"objectClassName" : "domain",
"handle" : "12-Q9JYB4C",
"ldhName" : "bird.xn--q9jyb4c",
"unicodeName" : "bird.みんな",
"status" :
[
"delete prohibited",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"links" :
[
{
"value" : "http://myserver.google.com/domain/bird.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/domain/bird.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "expiration",
"eventDate": "2110-10-08T00:44:59.000Z"
},
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
}
],
"nameservers" :
[
{
"objectClassName" : "nameserver",
"handle" : "8-ROID",
"ldhName" : "ns1.cat.xn--q9jyb4c",
"unicodeName" : "ns1.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]
}
},
{
"objectClassName" : "nameserver",
"handle" : "A-ROID",
"ldhName" : "ns2.cat.xn--q9jyb4c",
"unicodeName" : "ns2.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v6" : ["bad:f00d:cafe::15:beef"]
}
}
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,166 @@
{
"objectClassName" : "domain",
"handle" : "13-Q9JYB4C",
"ldhName" : "fish.xn--q9jyb4c",
"unicodeName" : "fish.みんな",
"status" :
[
"delete prohibited",
"inactive",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"links" :
[
{
"value" : "http://myserver.google.com/domain/fish.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/domain/fish.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "expiration",
"eventDate": "2110-10-08T00:44:59.000Z"
},
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
}
],
"entities" :
[
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Santa Claus"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Santa Claus Tower",
"41st floor",
"Suite みんな"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"]
]
]
},
{
"objectClassName" : "entity",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/6-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "The Raven"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Chamber Door",
"upper level"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "bog@cat.みんな"]
]
]
},
{
"objectClassName" : "entity",
"handle" : "2-ROID",
"status" : ["active"],
"roles" : ["registrant"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/2-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/2-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "(◕‿◕)"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "lol@cat.みんな"]
]
]
}
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,185 @@
{
"objectClassName" : "domain",
"handle" : "11-Q9JYB4C",
"ldhName" : "dog.xn--q9jyb4c",
"unicodeName" : "dog.みんな",
"status" :
[
"delete prohibited",
"renew prohibited",
"transfer prohibited",
"update prohibited"
],
"links" :
[
{
"value" : "http://myserver.google.com/domain/dog.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/domain/dog.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "2000-01-01T00:00:00.000Z"
},
{
"eventAction": "expiration",
"eventDate": "2110-10-08T00:44:59.000Z"
},
{
"eventAction": "last changed",
"eventDate": "2009-05-29T20:13:00.000Z"
}
],
"nameservers" :
[
{
"objectClassName" : "nameserver",
"handle" : "C-ROID",
"ldhName" : "ns3.cat.xn--q9jyb4c",
"unicodeName" : "ns3.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns3.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns3.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]
"v6" : ["bad:f00d:cafe::15:beef"]
}
},
{
"objectClassName" : "nameserver",
"handle" : "E-ROID",
"ldhName" : "ns4.cat.xn--q9jyb4c",
"unicodeName" : "ns4.cat.みんな",
"status" : ["active"],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1996-01-01T00:00:00.000Z"
}
],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns4.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns4.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
]
}
],
"entities" :
[
{
"objectClassName" : "entity",
"handle" : "4-ROID",
"status" : ["active"],
"roles" : ["administrative"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/4-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/4-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Santa Claus"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Santa Claus Tower",
"41st floor",
"Suite みんな"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"]
]
]
},
{
"objectClassName" : "entity",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/6-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "The Raven"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Chamber Door",
"upper level"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "bog@cat.みんな"]
]
]
}
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,13 @@
{
"rdapConformance" :
[
"rdap_level_0"
],
"lang" : "en"
"errorCode" : 400,
"title" : "Invalid Domain Name",
"description" :
[
"Not a valid domain name"
]
}

View file

@ -0,0 +1,29 @@
{
"objectClassName" : "nameserver",
"handle" : "C-ROID",
"ldhName" : "ns3.cat.xn--q9jyb4c",
"unicodeName" : "ns3.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns3.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns3.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"],
"v6" : ["bad:f00d:cafe::15:beef"]
},
"port43": "whois.google.com"
}

View file

@ -0,0 +1,28 @@
{
"objectClassName" : "nameserver",
"handle" : "8-ROID",
"ldhName" : "ns1.cat.xn--q9jyb4c",
"unicodeName" : "ns1.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns1.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"ipAddresses" :
{
"v4" : ["1.2.3.4"]
},
"port43": "whois.google.com"
}

View file

@ -0,0 +1,28 @@
{
"objectClassName" : "nameserver",
"handle" : "A-ROID",
"ldhName" : "ns2.cat.xn--q9jyb4c",
"unicodeName" : "ns2.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns2.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1998-01-01T00:00:00.000Z"
},
],
"ipAddresses" :
{
"v6" : ["bad:f00d:cafe::15:beef"]
},
"port43": "whois.google.com"
}

View file

@ -0,0 +1,24 @@
{
"objectClassName" : "nameserver",
"handle" : "E-ROID",
"ldhName" : "ns4.cat.xn--q9jyb4c",
"unicodeName" : "ns4.cat.みんな",
"status" : ["active"],
"links" :
[
{
"value" : "http://myserver.google.com/nameserver/ns4.cat.xn--q9jyb4c",
"rel" : "self",
"href" : "http://myserver.google.com/nameserver/ns4.cat.xn--q9jyb4c",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1996-01-01T00:00:00.000Z"
},
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,18 @@
{
"title" : "RDAP Help",
"description" :
[
"RDAP Help Topics (use \/help\/topic for information)",
"syntax",
"tos (Terms of Service)"
],
"links" :
[
{
"value" : "http://myserver.google.com/help/index",
"rel" : "alternate",
"type" : "text/html",
"href" : "http://myserver.google.com/about/rdap/index.html"
}
]
}

View file

@ -0,0 +1,18 @@
{
"title" : "RDAP Help",
"description" :
[
"RDAP Help Topics (use \/help\/topic for information)",
"syntax",
"tos (Terms of Service)"
],
"links" :
[
{
"value" : "http://myserver.google.com/help/index",
"rel" : "self",
"type" : "application/rdap+json",
"href" : "http://myserver.google.com/help/index",
}
]
}

View file

@ -0,0 +1,35 @@
{
"objectClassName" : "entity",
"handle" : "2-ROID",
"status" : ["active"],
"roles" : ["registrant"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/2-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/2-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "(◕‿◕)"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "lol@cat.みんな"]
]
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,35 @@
{
"objectClassName" : "entity",
"handle" : "2-ROID",
"status" : ["active"],
"roles" : ["registrant"],
"links" :
[
{
"value" : "entity/2-ROID",
"rel" : "self",
"href" : "entity/2-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1999-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "(◕‿◕)"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "lol@cat.みんな"]
]
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,102 @@
{
"objectClassName" : "entity",
"handle" : "unicoderegistrar",
"status" : ["active"],
"roles" : ["registrar"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/unicoderegistrar",
"rel" : "self",
"href" : "http://myserver.google.com/entity/unicoderegistrar",
"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" :
[
{
"type" : "IANA Registrar ID",
"identifier" : "1"
}
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "みんな"],
["adr", {}, "text", [
"",
"",
"123 Example Boulevard <script>",
"Williamsburg <script>",
"NY",
"11211",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551212"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551213"],
["email", {}, "text", "contact-us@example.com"]
]
],
"entities" :
[
{
"objectClassName" : "entity",
"status" : ["active"],
"roles" : ["administrative"],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Jane Doe"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551215"],
["email", {}, "text", "janedoe@example.com"]
]
],
},
{
"objectClassName" : "entity",
"status" : ["active"],
"roles" : ["technical"],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "John Doe"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551213"],
["email", {}, "text", "johndoe@example.com"]
]
],
},
{
"objectClassName" : "entity",
"status" : ["active"],
"roles" : ["administrative", "technical"],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "Play Doe"],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2125551217"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2125551218"],
["email", {}, "text", "playdoe@example.com"]
]
],
}
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,46 @@
{
"objectClassName" : "entity",
"handle" : "6-ROID",
"status" : ["active"],
"roles" : ["technical"],
"links" :
[
{
"value" : "http://myserver.google.com/entity/6-ROID",
"rel" : "self",
"href" : "http://myserver.google.com/entity/6-ROID",
"type" : "application/rdap+json"
}
],
"events": [
{
"eventAction": "registration",
"eventActor": "foo",
"eventDate": "1997-01-01T00:00:00.000Z"
},
],
"vcardArray" :
[
"vcard",
[
["version", {}, "text", "4.0"],
["fn", {}, "text", "The Raven"],
["org", {}, "text", "GOOGLE INCORPORATED <script>"],
["adr", {}, "text", [
"",
"",
[
"Chamber Door",
"upper level"
],
"KOKOMO",
"BM",
"31337",
"United States"]],
["tel", {"type" : ["voice"]}, "uri", "tel:+1.2126660420"],
["tel", {"type" : ["fax"]}, "uri", "tel:+1.2126660420"],
["email", {}, "text", "bog@cat.みんな"]
]
],
"port43": "whois.google.com"
}

View file

@ -0,0 +1,35 @@
{
"key" : "value",
"rdapConformance" :
[
"rdap_level_0"
],
"notices" :
[
{
"title" : "RDAP Terms of Service",
"description" :
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links" :
[
{
"value" : "http://myserver.google.com/help/tos",
"rel" : "alternate",
"href" : "https://www.registry.google/about/rdap/tos.html",
"type" : "text/html"
}
]
}
]
}

View file

@ -0,0 +1,75 @@
{
"key" : "value",
"rdapConformance" :
[
"rdap_level_0"
],
"notices" :
[
{
"title" : "RDAP Terms of Service",
"description" :
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of Charleston Road Registry or any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links" :
[
{
"value" : "http://myserver.google.com/help/tos",
"rel" : "alternate",
"href" : "https://www.registry.google/about/rdap/tos.html",
"type" : "text/html"
}
]
}
],
"remarks" :
[
{
"description" :
[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
]
},
{
"title" : "EPP Status Codes",
"description" :
[
"For more information on domain status codes, please visit https://icann.org/epp"
],
"links" :
[
{
"value" : "https://icann.org/epp",
"rel" : "alternate",
"href" : "https://icann.org/epp",
"type" : "text/html"
}
]
},
{
"description" :
[
"URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf"
],
"links" :
[
{
"value" : "https://www.icann.org/wicf",
"rel" : "alternate",
"href" : "https://www.icann.org/wicf",
"type" : "text/html"
}
]
}
]
}