mirror of
https://github.com/google/nomulus.git
synced 2025-07-20 01:35:59 +02:00
Add next page navigation for RDAP entity searches
A couple methods were moved to new locations so they are accessible to all types of search queries, not just nameservers like they originally were. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179089014
This commit is contained in:
parent
c8059d4d8a
commit
e619ea1bff
12 changed files with 398 additions and 111 deletions
|
@ -709,34 +709,6 @@ public class RdapNameserverSearchActionTest extends RdapSearchActionTestCase {
|
|||
verifyErrorMetrics();
|
||||
}
|
||||
|
||||
private String getLinkToNext(Object results) {
|
||||
assertThat(results).isInstanceOf(JSONObject.class);
|
||||
Object notices = ((JSONObject) results).get("notices");
|
||||
assertThat(notices).isInstanceOf(JSONArray.class);
|
||||
for (Object notice : (JSONArray) notices) {
|
||||
assertThat(notice).isInstanceOf(JSONObject.class);
|
||||
Object title = ((JSONObject) notice).get("title");
|
||||
assertThat(title).isInstanceOf(String.class);
|
||||
if (!title.equals("Navigation Links")) {
|
||||
continue;
|
||||
}
|
||||
Object links = ((JSONObject) notice).get("links");
|
||||
assertThat(links).isInstanceOf(JSONArray.class);
|
||||
for (Object link : (JSONArray) links) {
|
||||
assertThat(link).isInstanceOf(JSONObject.class);
|
||||
Object rel = ((JSONObject) link).get("rel");
|
||||
assertThat(rel).isInstanceOf(String.class);
|
||||
if (!rel.equals("next")) {
|
||||
continue;
|
||||
}
|
||||
Object href = ((JSONObject) link).get("href");
|
||||
assertThat(href).isInstanceOf(String.class);
|
||||
return (String) href;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks multi-page result set navigation using the cursor.
|
||||
*
|
||||
|
@ -757,7 +729,7 @@ public class RdapNameserverSearchActionTest extends RdapSearchActionTestCase {
|
|||
? generateActualJsonWithName(queryString, cursor)
|
||||
: generateActualJsonWithIp(queryString, cursor);
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
String linkToNext = getLinkToNext(results);
|
||||
String linkToNext = RdapTestHelper.getLinkToNext(results);
|
||||
if (i == expectedPageCount - 1) {
|
||||
assertThat(linkToNext).isNull();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue