[gatein-issues] [JBoss JIRA] (GTNPORTAL-3495) Membership Pagination don't work

Marek Posolda (JIRA) issues at jboss.org
Mon Jun 2 11:41:19 EDT 2014


    [ https://issues.jboss.org/browse/GTNPORTAL-3495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972526#comment-12972526 ] 

Marek Posolda commented on GTNPORTAL-3495:
------------------------------------------

Few comments about this:
1) Your test is not correct as it always read just page1 (memberships.load(0, 5);), so it return it always same results for both call, hence it's not surprising that results are duplicated. I've changed the code of the method "testMembership" like this:

{code}
  @Test
  public void testMembership() throws Exception {

    ExoContainer container = PortalContainer.getInstance();
    OrganizationService service = (OrganizationService) container.getComponentInstance(OrganizationService.class);
    MembershipHandler handler = service.getMembershipHandler();
    Group group = service.getGroupHandler().findGroupById("/test/developers");
    ListAccess<Membership> memberships = handler.findAllMembershipsByGroup(group);

    Set<String> identities = new HashSet<String>();

    int counter = 0;
    int pageNumber = 0;
    while (counter < memberships.getSize()) {
      int remaining = memberships.getSize() - counter;
      int currentPageCount = Math.min(remaining, 5);
      Membership[] membershipsPage = memberships.load(counter, currentPageCount);
      counter += currentPageCount;
      for (Membership membership : membershipsPage) {
        identities.add(membership.getUserName());                 
      }
      System.out.println("Loaded page: " + ++pageNumber + " with " + currentPageCount + " records.");
    }

    System.out.println("All loaded members: " + identities);
    // Assert same count, so no identities has been filtered
    assertEquals(identities.size(), memberships.getSize());
  }
{code}
And now there are 11 memberships in LDAP and all those are properly read in 3 pages (page1 has 5 items, page2 has 5 items and last page just remaining 1 item) and displayed.

2) Parameter "skipPaginationInMembershipQuery" already has default value "true" as you can see here: https://github.com/gatein/gatein-portal/blob/master/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml#L319 . I don't think that it should be removed because for DB-only setup, it can be used to improve performance as with non-mixed (DB only) setup, it's safe to use paginated query in IDM. Unfortunately for mixed DB+LDAP setup, pagination can't be safely used due to reasons, which Bolek already mentioned by email.

> Membership Pagination don't work
> --------------------------------
>
>                 Key: GTNPORTAL-3495
>                 URL: https://issues.jboss.org/browse/GTNPORTAL-3495
>             Project: GateIn Portal
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.5.9.Final
>            Reporter: Boubaker Khanfir
>            Assignee: Marek Posolda
>         Attachments: plidm-ldap-membership-pagination.zip
>
>
> I attach a new unit test for a bug that I met in PL IDM 1.4.4.
> Test case description:
> 1/ add about 10 users in an LDAP group
> 2/ use SearchCriteria to paginate on the Members of this group
> => Problem: pagination doesn't work
> Why does it fails:
> Because in this method "org.picketlink.idm.impl.store.ldap.LDAPIdentityStoreImpl.resolveRelationships(IdentityStoreInvocationContext, IdentityObject, IdentityObjectRelationshipType, boolean, boolean, String, IdentityObjectSearchCriteria)" the attribute "IdentityObjectSearchCriteria" isn't used for pagination.
> To workaround this bug I had to use (skipPaginationInMembershipQuery=true). If the UI is buggy without this parameter to "true", I think it has to be *by default "true" in Config class* and may be even delete this option to not use pagination in Membership at all.



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the gatein-issues mailing list