mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged mward/5.2.n-repo-1583-groupmem (5.2.1) to 5.2.N (5.2.1)
134379 mward: REPO-1583: added tests for sorting git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@134402 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -586,6 +586,51 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
|||||||
{
|
{
|
||||||
getGroupsByPersonId(personAlice.getId(), getPaging(-1, null), null, HttpServletResponse.SC_BAD_REQUEST);
|
getGroupsByPersonId(personAlice.getId(), getPaging(-1, null), null, HttpServletResponse.SC_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// orderBy=sortColumn should be the same to orderBy=sortColumn ASC
|
||||||
|
{
|
||||||
|
// paging
|
||||||
|
Paging paging = getPaging(0, Integer.MAX_VALUE);
|
||||||
|
|
||||||
|
Map<String, String> otherParams = new HashMap<>();
|
||||||
|
|
||||||
|
// Default order.
|
||||||
|
addOrderBy(otherParams, org.alfresco.rest.api.Groups.PARAM_DISPLAY_NAME, null);
|
||||||
|
|
||||||
|
ListResponse<Group> resp = getGroupsByPersonId(personAlice.getId(), paging, otherParams);
|
||||||
|
List<Group> groups = resp.getList();
|
||||||
|
assertTrue("groups order not valid", groups.indexOf(groupA) < groups.indexOf(groupB));
|
||||||
|
|
||||||
|
// Ascending order.
|
||||||
|
addOrderBy(otherParams, org.alfresco.rest.api.Groups.PARAM_DISPLAY_NAME, true);
|
||||||
|
ListResponse<Group> respOrderAsc = getGroupsByPersonId(personAlice.getId(), paging, otherParams);
|
||||||
|
checkList(respOrderAsc.getList(), resp.getPaging(), resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort by id.
|
||||||
|
{
|
||||||
|
// paging
|
||||||
|
Paging paging = getPaging(0, Integer.MAX_VALUE);
|
||||||
|
|
||||||
|
Map<String, String> otherParams = new HashMap<>();
|
||||||
|
addOrderBy(otherParams, org.alfresco.rest.api.Groups.PARAM_ID, false);
|
||||||
|
|
||||||
|
// list sites
|
||||||
|
ListResponse<Group> resp = getGroupsByPersonId(personAlice.getId(), paging, otherParams);
|
||||||
|
|
||||||
|
List<Group> groups = resp.getList();
|
||||||
|
assertTrue("groups order not valid", groups.indexOf(groupB) < groups.indexOf(groupA));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Multiple sort fields not allowed.
|
||||||
|
{
|
||||||
|
// paging
|
||||||
|
Paging paging = getPaging(0, Integer.MAX_VALUE);
|
||||||
|
Map<String, String> otherParams = new HashMap<>();
|
||||||
|
otherParams.put("orderBy", org.alfresco.rest.api.Groups.PARAM_ID + " ASC," + org.alfresco.rest.api.Groups.PARAM_DISPLAY_NAME + " ASC");
|
||||||
|
|
||||||
|
getGroupsByPersonId(personAlice.getId(), paging, otherParams, HttpServletResponse.SC_BAD_REQUEST);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testGetGroupMembersByGroupId() throws Exception
|
private void testGetGroupMembersByGroupId() throws Exception
|
||||||
|
Reference in New Issue
Block a user