Search in sources :

Example 41 with ListResponse

use of org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse in project alfresco-remote-api by Alfresco.

the class GroupsTest method testGetGroupsWithInclude.

private void testGetGroupsWithInclude() throws Exception {
    // paging
    int maxItems = 2;
    Paging paging = getPaging(0, maxItems);
    Map<String, String> otherParams = new HashMap<>();
    // Validate that by default optionally fields aren't returned.
    {
        // list sites
        ListResponse<Group> resp = getGroups(paging, null);
        // check results
        assertNotNull(resp);
        assertNotNull(resp.getList());
        assertFalse(resp.getList().isEmpty());
        assertEquals(maxItems, resp.getList().size());
        resp.getList().forEach(group -> validateGroupDefaultFields(group));
    }
    // Check include parent ids.
    {
        otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_PARENT_IDS);
        // list sites
        ListResponse<Group> resp = getGroups(paging, otherParams);
        // check results
        assertEquals(maxItems, resp.getList().size());
        resp.getList().forEach(group -> {
            assertNotNull(group);
            assertNotNull(group.getParentIds());
        });
    }
    // Check include zones.
    {
        otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_ZONES);
        // list sites
        ListResponse<Group> resp = getGroups(paging, otherParams);
        // check results
        assertEquals(maxItems, resp.getList().size());
        resp.getList().forEach(group -> {
            assertNotNull(group);
            assertNotNull(group.getZones());
        });
    }
}
Also used : AuthorityDAOImpl(org.alfresco.repo.security.authority.AuthorityDAOImpl) java.util(java.util) PublicApiException(org.alfresco.rest.api.tests.client.PublicApiException) GroupMember(org.alfresco.rest.api.tests.client.data.GroupMember) AuthorityService(org.alfresco.service.cmr.security.AuthorityService) Mock(org.mockito.Mock) Paging(org.alfresco.rest.api.tests.client.PublicApiClient.Paging) Groups(org.alfresco.rest.api.tests.client.PublicApiClient.Groups) RequestContext(org.alfresco.rest.api.tests.client.RequestContext) PermissionService(org.alfresco.service.cmr.security.PermissionService) GUID(org.alfresco.util.GUID) After(org.junit.After) ListResponse(org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse) AuthorityType(org.alfresco.service.cmr.security.AuthorityType) LuceneTests(org.alfresco.util.testing.category.LuceneTests) Before(org.junit.Before) SortColumn(org.alfresco.rest.framework.resource.parameters.SortColumn) HttpServletResponse(javax.servlet.http.HttpServletResponse) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) PublicApiClient(org.alfresco.rest.api.tests.client.PublicApiClient) Category(org.junit.experimental.categories.Category) AbstractSingleNetworkSiteTest(org.alfresco.rest.AbstractSingleNetworkSiteTest) Group(org.alfresco.rest.api.tests.client.data.Group) AuthenticationUtil(org.alfresco.repo.security.authentication.AuthenticationUtil) Person(org.alfresco.rest.api.tests.client.data.Person) ResultSetRow(org.alfresco.service.cmr.search.ResultSetRow) Assert(org.junit.Assert) ListResponse(org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse) Paging(org.alfresco.rest.api.tests.client.PublicApiClient.Paging)

Aggregations

ListResponse (org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse)41 ArrayList (java.util.ArrayList)30 RequestContext (org.alfresco.rest.api.tests.client.RequestContext)22 JSONObject (org.json.simple.JSONObject)21 Test (org.junit.Test)21 PublicApiException (org.alfresco.rest.api.tests.client.PublicApiException)20 ExpectedPaging (org.alfresco.rest.api.tests.client.PublicApiClient.ExpectedPaging)19 JSONArray (org.json.simple.JSONArray)19 Paging (org.alfresco.rest.api.tests.client.PublicApiClient.Paging)18 List (java.util.List)13 TestSite (org.alfresco.rest.api.tests.RepoService.TestSite)10 TenantRunAsWork (org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork)8 TestNetwork (org.alfresco.rest.api.tests.RepoService.TestNetwork)8 TestPerson (org.alfresco.rest.api.tests.RepoService.TestPerson)8 HashMap (java.util.HashMap)6 Map (java.util.Map)6 Sites (org.alfresco.rest.api.tests.client.PublicApiClient.Sites)6 People (org.alfresco.rest.api.tests.client.PublicApiClient.People)5 NodeRef (org.alfresco.service.cmr.repository.NodeRef)5 ParseException (java.text.ParseException)4