Skip to content

Commit

Permalink
[cfid-144] scim queries now producing results
Browse files Browse the repository at this point in the history
There was a bug tickled by the /Groups changes that caused a multi-page
list to be empty on the second iteration.  Fixed in the paging list
implementation.

[Fixes #36825399] [cfid-144] scim query fails when over 200 users and no pagination parameters

Change-Id: I92d108be9e34cffeab47cd401b27910e73452c2d
  • Loading branch information
dsyer committed Oct 1, 2012
1 parent 3ca228e commit ba2a8cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Expand Up @@ -70,7 +70,7 @@ public E get(int index) {
if (index >= size) {
throw new ArrayIndexOutOfBoundsException(index);
}
if (current == null || index - start >= pageSize) {
if (current == null || index - start >= pageSize || index < start) {
current = parameterJdbcTemplate.query(getLimitSql(sql, index, pageSize), args, mapper);
start = index;
}
Expand Down
Expand Up @@ -83,6 +83,13 @@ public void testIterationOverPages() throws Exception {
names.add(name);
}
assertEquals(5, names.size());
names = new HashSet<String>();
for (Map<String, Object> map : list) {
String name = (String) map.get("name");
assertNotNull(name);
names.add(name);
}
assertEquals(5, names.size());
}

@Test
Expand Down
Expand Up @@ -15,6 +15,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -301,6 +302,7 @@ public void findUsers() throws Exception {
Map<String, Object> results = response.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue("There should be more than zero users", (Integer) results.get("totalResults") > 0);
assertTrue("There should be some resources", ((Collection<?>) results.get("resources")).size() > 0);
}

@Test
Expand Down

0 comments on commit ba2a8cd

Please sign in to comment.