mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 12:08:36 +02:00
RDAP: Implement entity name search
Adds the ability to search for entities (contacts and registrars) by name. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130305930
This commit is contained in:
parent
64abebec82
commit
160266f37a
8 changed files with 368 additions and 66 deletions
|
@ -85,6 +85,13 @@ public class RdapEntitySearchActionTest {
|
|||
ImmutableList.of("123 Blinky St", "Blinkyland"),
|
||||
clock.nowUtc());
|
||||
|
||||
makeAndPersistContactResource(
|
||||
"blindly",
|
||||
"Blindly",
|
||||
"blindly@b.tld",
|
||||
ImmutableList.of("123 Blindly St", "Blindlyland"),
|
||||
clock.nowUtc());
|
||||
|
||||
// deleted
|
||||
persistResource(
|
||||
makeContactResource("clyde", "Clyde (愚図た)", "clyde@c.tld")
|
||||
|
@ -188,7 +195,15 @@ public class RdapEntitySearchActionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSuffix_rejected() throws Exception {
|
||||
public void testNameMatch_suffixRejected() throws Exception {
|
||||
assertThat(generateActualJsonWithFullName("exam*ple"))
|
||||
.isEqualTo(
|
||||
generateExpectedJson("Suffix not allowed after wildcard", "rdap_error_422.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(422);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleMatch_suffixRejected() throws Exception {
|
||||
assertThat(generateActualJsonWithHandle("exam*ple"))
|
||||
.isEqualTo(
|
||||
generateExpectedJson("Suffix not allowed after wildcard", "rdap_error_422.json"));
|
||||
|
@ -212,11 +227,51 @@ public class RdapEntitySearchActionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatch_notImplemented() throws Exception {
|
||||
assertThat(generateActualJsonWithFullName("hello"))
|
||||
public void testNameMatch_contactFound() throws Exception {
|
||||
assertThat(generateActualJsonWithFullName("Blinky (赤ベイ)"))
|
||||
.isEqualTo(
|
||||
generateExpectedJson("Entity name search not implemented", "rdap_error_501.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(501);
|
||||
generateExpectedJsonForEntity(
|
||||
"2-ROID",
|
||||
"Blinky (赤ベイ)",
|
||||
"blinky@b.tld",
|
||||
"\"123 Blinky St\", \"Blinkyland\"",
|
||||
"rdap_contact.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatch_contactWildcardFound() throws Exception {
|
||||
assertThat(generateActualJsonWithFullName("Blinky*"))
|
||||
.isEqualTo(
|
||||
generateExpectedJsonForEntity(
|
||||
"2-ROID",
|
||||
"Blinky (赤ベイ)",
|
||||
"blinky@b.tld",
|
||||
"\"123 Blinky St\", \"Blinkyland\"",
|
||||
"rdap_contact.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatch_contactWildcardFoundBoth() throws Exception {
|
||||
assertThat(generateActualJsonWithFullName("Blin*"))
|
||||
.isEqualTo(generateExpectedJson("rdap_multiple_contacts2.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatch_deletedContactNotFound() throws Exception {
|
||||
generateActualJsonWithFullName("Cl*");
|
||||
assertThat(response.getStatus()).isEqualTo(404);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatch_registrarFound() throws Exception {
|
||||
assertThat(generateActualJsonWithFullName("Yes Virginia <script>"))
|
||||
.isEqualTo(
|
||||
generateExpectedJsonForEntity(
|
||||
"2-Registrar", "Yes Virginia <script>", null, null, "rdap_registrar.json"));
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -253,6 +308,12 @@ public class RdapEntitySearchActionTest {
|
|||
assertThat(response.getStatus()).isEqualTo(404);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatch_testAndInactiveRegistrars_notFound() throws Exception {
|
||||
generateActualJsonWithHandle("No Way");
|
||||
assertThat(response.getStatus()).isEqualTo(404);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleMatch_2rstar_found() throws Exception {
|
||||
assertThat(generateActualJsonWithHandle("2-R*"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue