Revise RDAP domain action tests to check results more completely

Also fixed a bug discovered as a result of the more complete testing!

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171156304
This commit is contained in:
mountford 2017-10-05 08:27:35 -07:00 committed by jianglai
parent 373e174deb
commit 07e5536988
18 changed files with 1920 additions and 279 deletions

View file

@ -210,8 +210,10 @@ public class RdapDomainSearchAction extends RdapActionBase {
}
// Query the domains directly, rather than the foreign keys, because then we have an index on
// TLD if we need it.
int numFetched = 0;
for (DomainResource domain :
query.limit(RESULT_SET_SIZE_SCALING_FACTOR * rdapResultSetMaxSize)) {
numFetched++;
if (EppResourceUtils.isActive(domain, now)) {
if (domainList.size() >= rdapResultSetMaxSize) {
return makeSearchResults(
@ -220,7 +222,13 @@ public class RdapDomainSearchAction extends RdapActionBase {
domainList.add(domain);
}
}
return makeSearchResults(domainList, now);
return makeSearchResults(
domainList,
((numFetched == RESULT_SET_SIZE_SCALING_FACTOR * rdapResultSetMaxSize)
&& (domainList.size() < rdapResultSetMaxSize))
? IncompletenessWarningType.MIGHT_BE_INCOMPLETE
: IncompletenessWarningType.NONE,
now);
}
}