mirror of
https://github.com/google/nomulus.git
synced 2025-07-31 23:16:31 +02:00
Import code from internal repository to git
This commit is contained in:
commit
0ef0c933d2
2490 changed files with 281594 additions and 0 deletions
38
javatests/com/google/domain/registry/rdap/BUILD
Normal file
38
javatests/com/google/domain/registry/rdap/BUILD
Normal 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"],
|
||||
)
|
|
@ -0,0 +1,148 @@
|
|||
// Copyright 2016 Google Inc. 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 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;
|
||||
|
||||
/** 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 searchString) {
|
||||
if (searchString.equals("IllegalArgumentException")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (searchString.equals("RuntimeException")) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
return ImmutableMap.<String, Object>of("key", "value");
|
||||
}
|
||||
}
|
||||
|
||||
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.run();
|
||||
return JSONValue.parse(response.getPayload());
|
||||
}
|
||||
|
||||
private String generateHeadPayload(String domainName) {
|
||||
action.requestPath = RdapTestAction.PATH + domainName;
|
||||
action.requestMethod = HEAD;
|
||||
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(
|
||||
"{\"rdapConformance\":[\"rdap_level_0\"], \"key\":\"value\"}"));
|
||||
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("*");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,257 @@
|
|||
// Copyright 2016 Google Inc. 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.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.model.registry.Registry;
|
||||
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 =
|
||||
persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol"));
|
||||
ContactResource adminContact =
|
||||
persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol"));
|
||||
ContactResource techContact =
|
||||
persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol"));
|
||||
HostResource host1 =
|
||||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||
HostResource host2 =
|
||||
persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef"));
|
||||
persistResource(makeDomainResource("cat.lol",
|
||||
registrant,
|
||||
adminContact,
|
||||
techContact,
|
||||
host1,
|
||||
host2,
|
||||
registrarLol));
|
||||
// deleted domain in lol
|
||||
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));
|
||||
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));
|
||||
action = new RdapDomainAction();
|
||||
action.clock = clock;
|
||||
action.response = response;
|
||||
action.rdapLinkBase = "https://example.com/rdap/";
|
||||
action.rdapWhoisServer = "whois.example.tld";
|
||||
}
|
||||
|
||||
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("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, "7-LOL", "rdap_domain.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrailingDot_ignored() throws Exception {
|
||||
assertThat(generateActualJson("cat.lol.")).isEqualTo(
|
||||
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "7-LOL", "rdap_domain.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryParameter_ignored() throws Exception {
|
||||
assertThat(generateActualJson("cat.lol?key=value")).isEqualTo(
|
||||
generateExpectedJsonWithTopLevelEntries("cat.lol", null, "7-LOL", "rdap_domain.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdnDomain_works() throws Exception {
|
||||
assertThat(generateActualJson("cat.みんな")).isEqualTo(
|
||||
generateExpectedJsonWithTopLevelEntries(
|
||||
"cat.みんな", "cat.xn--q9jyb4c", "A-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", "A-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", "A-Q9JYB4C", "rdap_domain_unicode.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultilevelDomain_works() throws Exception {
|
||||
assertThat(generateActualJson("cat.1.tld")).isEqualTo(
|
||||
generateExpectedJsonWithTopLevelEntries("cat.1.tld", null, "C-1.TLD", "rdap_domain.json"));
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,584 @@
|
|||
// Copyright 2016 Google Inc. 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.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.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.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.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("2009-06-29T20:13: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 {
|
||||
// cat.lol and cat2.lol
|
||||
createTld("lol");
|
||||
Registrar registrar = persistResource(
|
||||
makeRegistrar("evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
|
||||
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
|
||||
domainCatLol = persistResource(makeDomainResource("cat.lol",
|
||||
persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol")),
|
||||
persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")),
|
||||
persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")),
|
||||
hostNs1CatLol = persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")),
|
||||
hostNs2CatLol = persistResource(
|
||||
makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")),
|
||||
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",
|
||||
persistResource(makeContactResource("6372808-ERL", "Siegmund", "siegmund@cat2.lol")),
|
||||
persistResource(makeContactResource("6372808-IRL", "Sieglinde", "sieglinde@cat2.lol")),
|
||||
persistResource(makeContactResource("6372808-TRL", "Siegfried", "siegfried@cat2.lol")),
|
||||
persistResource(makeHostResource("ns1.cat.example", "10.20.30.40")),
|
||||
persistResource(makeHostResource("ns2.dog.lol", "12:feed:5000::15:beef")),
|
||||
registrar));
|
||||
// cat.example
|
||||
createTld("example");
|
||||
registrar = persistResource(
|
||||
makeRegistrar("goodregistrar", "St. John Chrysostom", Registrar.State.ACTIVE));
|
||||
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
|
||||
domainCatExample = persistResource(makeDomainResource("cat.example",
|
||||
persistResource(makeContactResource("7372808-ERL", "Matthew", "lol@cat.lol")),
|
||||
persistResource(makeContactResource("7372808-IRL", "Mark", "BOFH@cat.lol")),
|
||||
persistResource(makeContactResource("7372808-TRL", "Luke", "bog@cat.lol")),
|
||||
hostNs1CatLol,
|
||||
persistResource(makeHostResource("ns2.external.tld", "bad:f00d:cafe::15:beef")),
|
||||
registrar));
|
||||
// cat.みんな
|
||||
createTld("xn--q9jyb4c");
|
||||
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
|
||||
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
|
||||
persistResource(makeDomainResource(
|
||||
"cat.みんな", persistResource(makeContactResource("8372808-ERL", "(◕‿◕)", "lol@cat.みんな")),
|
||||
persistResource(makeContactResource("8372808-IRL", "Santa Claus", "BOFH@cat.みんな")),
|
||||
persistResource(makeContactResource("8372808-TRL", "The Raven", "bog@cat.みんな")),
|
||||
persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.5")),
|
||||
persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::14:beef")),
|
||||
registrar));
|
||||
// cat.1.test
|
||||
createTld("1.test");
|
||||
registrar =
|
||||
persistResource(makeRegistrar("unicoderegistrar", "1.test", Registrar.State.ACTIVE));
|
||||
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
|
||||
persistResource(makeDomainResource(
|
||||
"cat.1.test",
|
||||
persistResource(makeContactResource("9372808-ERL", "(◕‿◕)", "lol@cat.みんな")),
|
||||
persistResource(makeContactResource("9372808-IRL", "Santa Claus", "BOFH@cat.みんな")),
|
||||
persistResource(makeContactResource("9372808-TRL", "The Raven", "bog@cat.みんな")),
|
||||
persistResource(makeHostResource("ns1.cat.1.test", "1.2.3.5")),
|
||||
persistResource(makeHostResource("ns2.cat.2.test", "bad:f00d:cafe::14:beef")),
|
||||
registrar)
|
||||
.asBuilder().setSubordinateHosts(ImmutableSet.of("ns1.cat.1.test")).build());
|
||||
|
||||
inject.setStaticField(Ofy.class, "clock", clock);
|
||||
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"));
|
||||
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, "7-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, "7-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, "7-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, "7-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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,255 @@
|
|||
// Copyright 2016 Google Inc. 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.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 = persistResource(makeContactResource(
|
||||
"8372808-ERL",
|
||||
"(◕‿◕)",
|
||||
"lol@cat.みんな",
|
||||
ImmutableList.of("1 Smiley Row", "Suite みんな")));
|
||||
adminContact = persistResource(makeContactResource(
|
||||
"8372808-ERL",
|
||||
"(◕‿◕)",
|
||||
"lol@cat.みんな",
|
||||
ImmutableList.of("1 Smiley Row", "Suite みんな")));
|
||||
techContact = persistResource(makeContactResource(
|
||||
"8372808-ERL",
|
||||
"(◕‿◕)",
|
||||
"lol@cat.みんな",
|
||||
ImmutableList.of("1 Smiley Row", "Suite みんな")));
|
||||
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 = persistResource(makeContactResource(
|
||||
"8372808-ERL",
|
||||
"(◕‿◕)",
|
||||
"lol@cat.みんな",
|
||||
ImmutableList.of("1 Smiley Row", "Suite みんな")));
|
||||
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");
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,303 @@
|
|||
// Copyright 2016 Google Inc. 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.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("2009-06-29T20:13: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 {
|
||||
createTld("tld");
|
||||
|
||||
contact = persistResource(
|
||||
makeContactResource(
|
||||
"blinky",
|
||||
"Blinky (赤ベイ)",
|
||||
"blinky@b.tld",
|
||||
ImmutableList.of("123 Blinky St", "Blinkyland")));
|
||||
|
||||
// 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));
|
||||
|
||||
inject.setStaticField(Ofy.class, "clock", clock);
|
||||
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"));
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
// Copyright 2016 Google Inc. 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 {
|
||||
generateActualJson("/tos");
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,382 @@
|
|||
// Copyright 2016 Google Inc. 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.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.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.host.HostResource;
|
||||
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.rdap.RdapJsonFormatter.MakeRdapJsonNoticeParameters;
|
||||
import com.google.domain.registry.testing.AppEngineRule;
|
||||
|
||||
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();
|
||||
|
||||
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 {
|
||||
createTld("xn--q9jyb4c", TldState.GENERAL_AVAILABILITY);
|
||||
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
|
||||
persistSimpleGlobalResources(makeMoreRegistrarContacts(registrar));
|
||||
contactResourceRegistrant = persistResource(
|
||||
makeContactResource(
|
||||
"8372808-ERL",
|
||||
"(◕‿◕)",
|
||||
"lol@cat.みんな",
|
||||
null));
|
||||
contactResourceAdmin = persistResource(
|
||||
makeContactResource(
|
||||
"8372808-IRL",
|
||||
"Santa Claus",
|
||||
null,
|
||||
ImmutableList.of("Santa Claus Tower", "41st floor", "Suite みんな")));
|
||||
contactResourceTech = persistResource(
|
||||
makeContactResource(
|
||||
"8372808-TRL",
|
||||
"The Raven",
|
||||
"bog@cat.みんな",
|
||||
ImmutableList.of("Chamber Door", "upper level")));
|
||||
hostResourceIpv4 = persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4"));
|
||||
hostResourceIpv6 =
|
||||
persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe:0:0:0:15:beef"));
|
||||
hostResourceBoth =
|
||||
persistResource(makeHostResource("ns3.cat.みんな", "1.2.3.4", "bad:f00d:cafe:0:0:0:15:beef"));
|
||||
hostResourceNoAddresses = persistResource(makeHostResource("ns4.cat.みんな", null));
|
||||
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));
|
||||
}
|
||||
|
||||
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, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_registrar.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHost_ipv4() throws Exception {
|
||||
assertThat(RdapJsonFormatter.makeRdapJsonForHost(hostResourceIpv4, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_host_ipv4.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHost_ipv6() throws Exception {
|
||||
assertThat(RdapJsonFormatter.makeRdapJsonForHost(hostResourceIpv6, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_host_ipv6.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHost_both() throws Exception {
|
||||
assertThat(RdapJsonFormatter.makeRdapJsonForHost(hostResourceBoth, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_host_both.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHost_noAddresses() throws Exception {
|
||||
assertThat(RdapJsonFormatter.makeRdapJsonForHost(
|
||||
hostResourceNoAddresses, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_host_no_addresses.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrant() throws Exception {
|
||||
assertThat(
|
||||
RdapJsonFormatter.makeRdapJsonForContact(
|
||||
contactResourceRegistrant,
|
||||
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,
|
||||
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,
|
||||
Optional.of(DesignatedContact.Type.REGISTRANT),
|
||||
null,
|
||||
WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_registrant_nobase.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdmin() throws Exception {
|
||||
assertThat(
|
||||
RdapJsonFormatter.makeRdapJsonForContact(
|
||||
contactResourceAdmin,
|
||||
Optional.of(DesignatedContact.Type.ADMIN),
|
||||
LINK_BASE,
|
||||
WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_admincontact.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTech() throws Exception {
|
||||
assertThat(
|
||||
RdapJsonFormatter.makeRdapJsonForContact(
|
||||
contactResourceTech,
|
||||
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, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_domain_full.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomain_noRegistrant() throws Exception {
|
||||
assertThat(
|
||||
RdapJsonFormatter.makeRdapJsonForDomain(
|
||||
domainResourceNoRegistrant, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_domain_no_registrant.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomain_noContacts() throws Exception {
|
||||
assertThat(
|
||||
RdapJsonFormatter.makeRdapJsonForDomain(
|
||||
domainResourceNoContacts, LINK_BASE, WHOIS_SERVER))
|
||||
.isEqualTo(loadJson("rdapjson_domain_no_contacts.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomain_noNameservers() throws Exception {
|
||||
assertThat(
|
||||
RdapJsonFormatter.makeRdapJsonForDomain(
|
||||
domainResourceNoNameservers, 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 {
|
||||
assertThat(
|
||||
RdapJsonFormatter.makeFinalRdapJson(ImmutableMap.<String, Object>of("key", "value")))
|
||||
.isEqualTo(loadJson("rdapjson_toplevel.json"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,218 @@
|
|||
// Copyright 2016 Google Inc. 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.FullFieldsTestEntityHelper.makeHostResource;
|
||||
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");
|
||||
persistResource(
|
||||
makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||
// idn
|
||||
createTld("xn--q9jyb4c");
|
||||
persistResource(
|
||||
makeHostResource("ns1.cat.xn--q9jyb4c", "bad:f00d:cafe:0:0:0:15:beef"));
|
||||
// multilevel
|
||||
createTld("1.tld");
|
||||
persistResource(
|
||||
makeHostResource("ns1.domain.1.tld", "5.6.7.8"));
|
||||
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");
|
||||
}
|
||||
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", "4-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", "4-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", "6-ROID", "ADDRESSTYPE", "v4", "ADDRESS", "5.6.7.8"),
|
||||
"rdap_host.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,384 @@
|
|||
// Copyright 2016 Google Inc. 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.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.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("2009-06-29T20:13: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 = persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||
hostNs2CatLol = persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef"));
|
||||
hostNs1Cat2Lol =
|
||||
persistResource(makeHostResource("ns1.cat2.lol", "1.2.3.3", "bad:f00d:cafe::15:beef"));
|
||||
persistResource(makeHostResource("ns1.cat.external", null));
|
||||
|
||||
// cat.みんな
|
||||
createTld("xn--q9jyb4c");
|
||||
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
|
||||
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
|
||||
persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.5"));
|
||||
|
||||
// cat.1.test
|
||||
createTld("1.test");
|
||||
registrar = persistResource(makeRegistrar("multiregistrar", "1.test", Registrar.State.ACTIVE));
|
||||
persistSimpleGlobalResources(makeRegistrarContacts(registrar));
|
||||
persistResource(makeHostResource("ns1.cat.1.test", "1.2.3.6"));
|
||||
|
||||
// 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"));
|
||||
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, "3-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, "5-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",
|
||||
"7-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, "9-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, "3-ROID", "v6", "bad:f00d:cafe::15:beef", "rdap_host.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
// Copyright 2016 Google Inc. 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.みんに");
|
||||
}
|
||||
}
|
39
javatests/com/google/domain/registry/rdap/testdata/rdap_contact.json
vendored
Normal file
39
javatests/com/google/domain/registry/rdap/testdata/rdap_contact.json
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
|
309
javatests/com/google/domain/registry/rdap/testdata/rdap_domain.json
vendored
Normal file
309
javatests/com/google/domain/registry/rdap/testdata/rdap_domain.json
vendored
Normal file
|
@ -0,0 +1,309 @@
|
|||
{
|
||||
"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%"
|
||||
}
|
||||
],
|
||||
"nameservers": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "5-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
},
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "6-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
}
|
||||
],
|
||||
"ldhName": "%NAME%",
|
||||
"entities": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "3-ROID",
|
||||
"roles": [
|
||||
"administrative"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/3-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/3-ROID"
|
||||
}
|
||||
],
|
||||
"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": "4-ROID",
|
||||
"roles": [
|
||||
"technical"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/4-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/4-ROID"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
310
javatests/com/google/domain/registry/rdap/testdata/rdap_domain_unicode.json
vendored
Normal file
310
javatests/com/google/domain/registry/rdap/testdata/rdap_domain_unicode.json
vendored
Normal file
|
@ -0,0 +1,310 @@
|
|||
{
|
||||
"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%"
|
||||
}
|
||||
],
|
||||
"nameservers": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "5-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
},
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "6-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
}
|
||||
],
|
||||
"ldhName": "%PUNYCODENAME%",
|
||||
"entities": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "3-ROID",
|
||||
"roles": [
|
||||
"administrative"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/3-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/3-ROID"
|
||||
}
|
||||
],
|
||||
"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": "4-ROID",
|
||||
"roles": [
|
||||
"technical"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/4-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/4-ROID"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_400.json
vendored
Normal file
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_400.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"lang": "en",
|
||||
"errorCode": 400,
|
||||
"title": "Bad Request",
|
||||
"description": [
|
||||
"%NAME%"
|
||||
],
|
||||
"rdapConformance": [
|
||||
"rdap_level_0"
|
||||
]
|
||||
}
|
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_404.json
vendored
Normal file
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_404.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"lang": "en",
|
||||
"errorCode": 404,
|
||||
"title": "Not Found",
|
||||
"description": [
|
||||
"%NAME%"
|
||||
],
|
||||
"rdapConformance": [
|
||||
"rdap_level_0"
|
||||
]
|
||||
}
|
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_422.json
vendored
Normal file
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_422.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"lang": "en",
|
||||
"errorCode": 422,
|
||||
"title": "Unprocessable Entity",
|
||||
"description": [
|
||||
"%NAME%"
|
||||
],
|
||||
"rdapConformance": [
|
||||
"rdap_level_0"
|
||||
]
|
||||
}
|
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_501.json
vendored
Normal file
11
javatests/com/google/domain/registry/rdap/testdata/rdap_error_501.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"lang": "en",
|
||||
"errorCode": 501,
|
||||
"title": "Not Implemented",
|
||||
"description": [
|
||||
"%NAME%"
|
||||
],
|
||||
"rdapConformance": [
|
||||
"rdap_level_0"
|
||||
]
|
||||
}
|
24
javatests/com/google/domain/registry/rdap/testdata/rdap_help_index.json
vendored
Normal file
24
javatests/com/google/domain/registry/rdap/testdata/rdap_help_index.json
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
22
javatests/com/google/domain/registry/rdap/testdata/rdap_host.json
vendored
Normal file
22
javatests/com/google/domain/registry/rdap/testdata/rdap_host.json
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"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%"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver",
|
||||
"port43": "whois.example.tld"
|
||||
}
|
17
javatests/com/google/domain/registry/rdap/testdata/rdap_host_external.json
vendored
Normal file
17
javatests/com/google/domain/registry/rdap/testdata/rdap_host_external.json
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"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%",
|
||||
"objectClassName": "nameserver",
|
||||
"port43": "whois.example.tld"
|
||||
}
|
23
javatests/com/google/domain/registry/rdap/testdata/rdap_host_unicode.json
vendored
Normal file
23
javatests/com/google/domain/registry/rdap/testdata/rdap_host_unicode.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"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%"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver",
|
||||
"port43": "whois.example.tld"
|
||||
}
|
124
javatests/com/google/domain/registry/rdap/testdata/rdap_multiple_contacts.json
vendored
Normal file
124
javatests/com/google/domain/registry/rdap/testdata/rdap_multiple_contacts.json
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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" ]
|
||||
}
|
625
javatests/com/google/domain/registry/rdap/testdata/rdap_multiple_domains.json
vendored
Normal file
625
javatests/com/google/domain/registry/rdap/testdata/rdap_multiple_domains.json
vendored
Normal file
|
@ -0,0 +1,625 @@
|
|||
{
|
||||
"domainSearchResults": [
|
||||
{
|
||||
"status": [
|
||||
"delete prohibited",
|
||||
"renew prohibited",
|
||||
"transfer prohibited",
|
||||
"update prohibited"
|
||||
],
|
||||
"handle": "13-EXAMPLE",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/domain/cat.example",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/domain/cat.example"
|
||||
}
|
||||
],
|
||||
"nameservers": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "5-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
},
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "12-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
}
|
||||
],
|
||||
"ldhName": "cat.example",
|
||||
"entities": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "10-ROID",
|
||||
"roles": [
|
||||
"administrative"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/10-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/10-ROID"
|
||||
}
|
||||
],
|
||||
"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": "11-ROID",
|
||||
"roles": [
|
||||
"technical"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/11-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/11-ROID"
|
||||
}
|
||||
],
|
||||
"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": "F-ROID",
|
||||
"roles": [
|
||||
"registrant"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/F-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/F-ROID"
|
||||
}
|
||||
],
|
||||
"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": "7-LOL",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/domain/cat.lol",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/domain/cat.lol"
|
||||
}
|
||||
],
|
||||
"nameservers": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "5-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
},
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "6-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"
|
||||
]
|
||||
},
|
||||
"objectClassName": "nameserver"
|
||||
}
|
||||
],
|
||||
"ldhName": "cat.lol",
|
||||
"entities": [
|
||||
{
|
||||
"status": [
|
||||
"active"
|
||||
],
|
||||
"handle": "3-ROID",
|
||||
"roles": [
|
||||
"administrative"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/3-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/3-ROID"
|
||||
}
|
||||
],
|
||||
"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": "4-ROID",
|
||||
"roles": [
|
||||
"technical"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://example.com/rdap/entity/4-ROID",
|
||||
"type": "application/rdap+json",
|
||||
"rel": "self",
|
||||
"value": "https://example.com/rdap/entity/4-ROID"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
]
|
||||
}
|
47
javatests/com/google/domain/registry/rdap/testdata/rdap_multiple_hosts.json
vendored
Normal file
47
javatests/com/google/domain/registry/rdap/testdata/rdap_multiple_hosts.json
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"nameserverSearchResults" :
|
||||
[
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "3-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"]
|
||||
},
|
||||
"port43": "whois.example.tld"
|
||||
},
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "4-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"]
|
||||
},
|
||||
"port43": "whois.example.tld"
|
||||
}
|
||||
],
|
||||
"rdapConformance" : ["rdap_level_0"]
|
||||
}
|
80
javatests/com/google/domain/registry/rdap/testdata/rdap_registrar.json
vendored
Normal file
80
javatests/com/google/domain/registry/rdap/testdata/rdap_registrar.json
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
39
javatests/com/google/domain/registry/rdap/testdata/rdapjson_admincontact.json
vendored
Normal file
39
javatests/com/google/domain/registry/rdap/testdata/rdapjson_admincontact.json
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"objectClassName" : "entity",
|
||||
"handle" : "3-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["administrative"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/3-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/3-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
172
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_full.json
vendored
Normal file
172
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_full.json
vendored
Normal file
|
@ -0,0 +1,172 @@
|
|||
{
|
||||
"objectClassName" : "domain",
|
||||
"handle" : "9-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"
|
||||
}
|
||||
],
|
||||
"nameservers" :
|
||||
[
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "5-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v4" : ["1.2.3.4"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "6-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v6" : ["bad:f00d:cafe::15:beef"]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entities" :
|
||||
[
|
||||
{
|
||||
"objectClassName" : "entity",
|
||||
"handle" : "3-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["administrative"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/3-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/3-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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" : "4-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["technical"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/4-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/4-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
66
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_no_contacts.json
vendored
Normal file
66
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_no_contacts.json
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"objectClassName" : "domain",
|
||||
"handle" : "B-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"
|
||||
}
|
||||
],
|
||||
"nameservers" :
|
||||
[
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "5-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v4" : ["1.2.3.4"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "6-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v6" : ["bad:f00d:cafe::15:beef"]
|
||||
}
|
||||
}
|
||||
],
|
||||
"port43": "whois.google.com"
|
||||
}
|
130
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_no_nameservers.json
vendored
Normal file
130
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_no_nameservers.json
vendored
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
"objectClassName" : "domain",
|
||||
"handle" : "C-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"
|
||||
}
|
||||
],
|
||||
"entities" :
|
||||
[
|
||||
{
|
||||
"objectClassName" : "entity",
|
||||
"handle" : "3-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["administrative"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/3-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/3-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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" : "4-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["technical"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/4-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/4-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
142
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_no_registrant.json
vendored
Normal file
142
javatests/com/google/domain/registry/rdap/testdata/rdapjson_domain_no_registrant.json
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
{
|
||||
"objectClassName" : "domain",
|
||||
"handle" : "A-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"
|
||||
}
|
||||
],
|
||||
"nameservers" :
|
||||
[
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "7-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v4" : ["1.2.3.4"]
|
||||
"v6" : ["bad:f00d:cafe::15:beef"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "8-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"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"entities" :
|
||||
[
|
||||
{
|
||||
"objectClassName" : "entity",
|
||||
"handle" : "3-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["administrative"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/3-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/3-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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" : "4-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["technical"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/4-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/4-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
13
javatests/com/google/domain/registry/rdap/testdata/rdapjson_error.json
vendored
Normal file
13
javatests/com/google/domain/registry/rdap/testdata/rdapjson_error.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"rdapConformance" :
|
||||
[
|
||||
"rdap_level_0"
|
||||
],
|
||||
"lang" : "en"
|
||||
"errorCode" : 400,
|
||||
"title" : "Invalid Domain Name",
|
||||
"description" :
|
||||
[
|
||||
"Not a valid domain name"
|
||||
]
|
||||
}
|
22
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_both.json
vendored
Normal file
22
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_both.json
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "7-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v4" : ["1.2.3.4"],
|
||||
"v6" : ["bad:f00d:cafe::15:beef"]
|
||||
},
|
||||
"port43": "whois.google.com"
|
||||
}
|
21
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_ipv4.json
vendored
Normal file
21
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_ipv4.json
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "5-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v4" : ["1.2.3.4"]
|
||||
},
|
||||
"port43": "whois.google.com"
|
||||
}
|
21
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_ipv6.json
vendored
Normal file
21
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_ipv6.json
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "6-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"
|
||||
}
|
||||
],
|
||||
"ipAddresses" :
|
||||
{
|
||||
"v6" : ["bad:f00d:cafe::15:beef"]
|
||||
},
|
||||
"port43": "whois.google.com"
|
||||
}
|
17
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_no_addresses.json
vendored
Normal file
17
javatests/com/google/domain/registry/rdap/testdata/rdapjson_host_no_addresses.json
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"objectClassName" : "nameserver",
|
||||
"handle" : "8-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"
|
||||
}
|
||||
],
|
||||
"port43": "whois.google.com"
|
||||
}
|
18
javatests/com/google/domain/registry/rdap/testdata/rdapjson_notice_alternate_link.json
vendored
Normal file
18
javatests/com/google/domain/registry/rdap/testdata/rdapjson_notice_alternate_link.json
vendored
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
18
javatests/com/google/domain/registry/rdap/testdata/rdapjson_notice_self_link.json
vendored
Normal file
18
javatests/com/google/domain/registry/rdap/testdata/rdapjson_notice_self_link.json
vendored
Normal 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",
|
||||
}
|
||||
]
|
||||
}
|
28
javatests/com/google/domain/registry/rdap/testdata/rdapjson_registrant.json
vendored
Normal file
28
javatests/com/google/domain/registry/rdap/testdata/rdapjson_registrant.json
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
28
javatests/com/google/domain/registry/rdap/testdata/rdapjson_registrant_nobase.json
vendored
Normal file
28
javatests/com/google/domain/registry/rdap/testdata/rdapjson_registrant_nobase.json
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"objectClassName" : "entity",
|
||||
"handle" : "2-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["registrant"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "entity/2-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "entity/2-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
91
javatests/com/google/domain/registry/rdap/testdata/rdapjson_registrar.json
vendored
Normal file
91
javatests/com/google/domain/registry/rdap/testdata/rdapjson_registrar.json
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
39
javatests/com/google/domain/registry/rdap/testdata/rdapjson_techcontact.json
vendored
Normal file
39
javatests/com/google/domain/registry/rdap/testdata/rdapjson_techcontact.json
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"objectClassName" : "entity",
|
||||
"handle" : "4-ROID",
|
||||
"status" : ["active"],
|
||||
"roles" : ["technical"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/4-ROID",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/4-ROID",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
7
javatests/com/google/domain/registry/rdap/testdata/rdapjson_toplevel.json
vendored
Normal file
7
javatests/com/google/domain/registry/rdap/testdata/rdapjson_toplevel.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"key" : "value",
|
||||
"rdapConformance" :
|
||||
[
|
||||
"rdap_level_0"
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue