mirror of
https://github.com/google/nomulus.git
synced 2025-08-03 16:32:11 +02:00
RDAP: Use IANA identifier as the registrar handle
According to the ICAAN operation profile: 2.1.7. Registries MUST support lookup for entities with the registrar role within other objects using the handle (as described in 3.1.5 of RFC7482). The handle of the entity with the registrar role MUST be equal to IANA Registrar ID. The entity with the registrar role in the RDAP response MUST contain a publicIDs member to identify the IANA Registrar ID from the IANA’s Registrar ID registry. The type value of the publicID object MUST be equal to IANA Registrar ID. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130452501
This commit is contained in:
parent
27820c512e
commit
4a34807b1d
10 changed files with 114 additions and 53 deletions
|
@ -125,7 +125,7 @@ public class RegistrarTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testIndexing() throws Exception {
|
||||
verifyIndexing(registrar, "registrarName");
|
||||
verifyIndexing(registrar, "registrarName", "ianaIdentifier");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RdapEntityActionTest {
|
|||
// lol
|
||||
createTld("lol");
|
||||
registrarLol = persistResource(makeRegistrar(
|
||||
"evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
|
||||
"evilregistrar", "Yes Virginia <script>", Registrar.State.ACTIVE, 101L));
|
||||
persistSimpleResources(makeRegistrarContacts(registrarLol));
|
||||
registrant = makeAndPersistContactResource(
|
||||
"8372808-ERL",
|
||||
|
@ -108,8 +108,8 @@ public class RdapEntityActionTest {
|
|||
registrarLol));
|
||||
// xn--q9jyb4c
|
||||
createTld("xn--q9jyb4c");
|
||||
Registrar registrarIdn =
|
||||
persistResource(makeRegistrar("idnregistrar", "IDN Registrar", Registrar.State.ACTIVE));
|
||||
Registrar registrarIdn = persistResource(
|
||||
makeRegistrar("idnregistrar", "IDN Registrar", Registrar.State.ACTIVE, 102L));
|
||||
persistSimpleResources(makeRegistrarContacts(registrarIdn));
|
||||
persistResource(makeDomainResource("cat.みんな",
|
||||
registrant,
|
||||
|
@ -120,7 +120,7 @@ public class RdapEntityActionTest {
|
|||
registrarIdn));
|
||||
createTld("1.tld");
|
||||
Registrar registrar1tld = persistResource(
|
||||
makeRegistrar("1tldregistrar", "Multilevel Registrar", Registrar.State.ACTIVE));
|
||||
makeRegistrar("1tldregistrar", "Multilevel Registrar", Registrar.State.ACTIVE, 103L));
|
||||
persistSimpleResources(makeRegistrarContacts(registrar1tld));
|
||||
persistResource(makeDomainResource("cat.1.tld",
|
||||
registrant,
|
||||
|
@ -238,12 +238,29 @@ public class RdapEntityActionTest {
|
|||
|
||||
@Test
|
||||
public void testRegistrar_works() throws Exception {
|
||||
assertThat(generateActualJson(registrarLol.getClientIdentifier())).isEqualTo(
|
||||
generateExpectedJsonWithTopLevelEntries(
|
||||
registrarLol.getClientIdentifier(), "rdap_registrar.json"));
|
||||
assertThat(generateActualJson("101")).isEqualTo(
|
||||
generateExpectedJsonWithTopLevelEntries("101", "rdap_registrar.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrar102_works() throws Exception {
|
||||
generateActualJson("102");
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrar103_works() throws Exception {
|
||||
generateActualJson("103");
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrar104_doesNotExist() throws Exception {
|
||||
generateActualJson("104");
|
||||
assertThat(response.getStatus()).isEqualTo(404);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletedContact_returns404() throws Exception {
|
||||
assertThat(generateActualJson(deletedContact.getRepoId())).isEqualTo(
|
||||
|
|
|
@ -99,12 +99,12 @@ public class RdapEntitySearchActionTest {
|
|||
|
||||
registrar =
|
||||
persistResource(
|
||||
makeRegistrar("2-Registrar", "Yes Virginia <script>", Registrar.State.ACTIVE));
|
||||
makeRegistrar("2-Registrar", "Yes Virginia <script>", Registrar.State.ACTIVE, 20L));
|
||||
persistSimpleResources(makeRegistrarContacts(registrar));
|
||||
|
||||
// inactive
|
||||
registrarInactive =
|
||||
persistResource(makeRegistrar("2-RegistrarInact", "No Way", Registrar.State.PENDING));
|
||||
persistResource(makeRegistrar("2-RegistrarInact", "No Way", Registrar.State.PENDING, 21L));
|
||||
persistSimpleResources(makeRegistrarContacts(registrarInactive));
|
||||
|
||||
// test
|
||||
|
@ -270,7 +270,7 @@ public class RdapEntitySearchActionTest {
|
|||
assertThat(generateActualJsonWithFullName("Yes Virginia <script>"))
|
||||
.isEqualTo(
|
||||
generateExpectedJsonForEntity(
|
||||
"2-Registrar", "Yes Virginia <script>", null, null, "rdap_registrar.json"));
|
||||
"20", "Yes Virginia <script>", null, null, "rdap_registrar.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
|
@ -288,11 +288,11 @@ public class RdapEntitySearchActionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHandleMatch_registrar_found() throws Exception {
|
||||
assertThat(generateActualJsonWithHandle("2-Registrar"))
|
||||
public void testHandleMatch_20_found() throws Exception {
|
||||
assertThat(generateActualJsonWithHandle("20"))
|
||||
.isEqualTo(
|
||||
generateExpectedJsonForEntity(
|
||||
"2-Registrar", "Yes Virginia <script>", null, null, "rdap_registrar.json"));
|
||||
"20", "Yes Virginia <script>", null, null, "rdap_registrar.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
|
@ -314,13 +314,6 @@ public class RdapEntitySearchActionTest {
|
|||
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;
|
||||
|
@ -349,12 +342,9 @@ public class RdapEntitySearchActionTest {
|
|||
}
|
||||
|
||||
@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);
|
||||
public void testHandleMatch_20star_notFound() throws Exception {
|
||||
generateActualJsonWithHandle("20*");
|
||||
assertThat(response.getStatus()).isEqualTo(404);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
[
|
||||
{
|
||||
"type" : "IANA Registrar ID",
|
||||
"identifier" : "1"
|
||||
"identifier" : "%NAME%"
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
{
|
||||
"objectClassName" : "entity",
|
||||
"handle" : "unicoderegistrar",
|
||||
"handle" : "1",
|
||||
"status" : ["active"],
|
||||
"roles" : ["registrar"],
|
||||
"links" :
|
||||
[
|
||||
{
|
||||
"value" : "http://myserver.google.com/entity/unicoderegistrar",
|
||||
"value" : "http://myserver.google.com/entity/1",
|
||||
"rel" : "self",
|
||||
"href" : "http://myserver.google.com/entity/unicoderegistrar",
|
||||
"href" : "http://myserver.google.com/entity/1",
|
||||
"type" : "application/rdap+json"
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"eventAction": "registration",
|
||||
"eventActor": "unicoderegistrar",
|
||||
"eventActor": "1",
|
||||
"eventDate": "1999-01-01T00:00:00.000Z"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -51,11 +51,16 @@ public final class FullFieldsTestEntityHelper {
|
|||
|
||||
public static Registrar makeRegistrar(
|
||||
String clientId, String registrarName, Registrar.State state) {
|
||||
return makeRegistrar(clientId, registrarName, state, 1L);
|
||||
}
|
||||
|
||||
public static Registrar makeRegistrar(
|
||||
String clientId, String registrarName, Registrar.State state, Long ianaIdentifier) {
|
||||
Registrar registrar = new Registrar.Builder()
|
||||
.setClientIdentifier(clientId)
|
||||
.setRegistrarName(registrarName)
|
||||
.setType(Registrar.Type.REAL)
|
||||
.setIanaIdentifier(1L)
|
||||
.setIanaIdentifier(ianaIdentifier)
|
||||
.setState(state)
|
||||
.setInternationalizedAddress(new RegistrarAddress.Builder()
|
||||
.setStreet(ImmutableList.of("123 Example Boulevard <script>"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue