[gatein-issues] [JBoss JIRA] (GTNPORTAL-3583) Picketlink IDM implementation does not implement GroupHandler#addChild() correctly

Tuyen Nguyen The (JIRA) issues at jboss.org
Wed Apr 8 02:48:19 EDT 2015


     [ https://issues.jboss.org/browse/GTNPORTAL-3583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tuyen Nguyen The updated GTNPORTAL-3583:
----------------------------------------
              Status: Pull Request Sent  (was: Open)
    Git Pull Request: https://github.com/gatein/gatein-portal/pull/935


> Picketlink IDM implementation does not implement GroupHandler#addChild() correctly
> ----------------------------------------------------------------------------------
>
>                 Key: GTNPORTAL-3583
>                 URL: https://issues.jboss.org/browse/GTNPORTAL-3583
>             Project: GateIn Portal
>          Issue Type: Bug
>            Reporter: Tuyen Nguyen The
>            Assignee: Tuyen Nguyen The
>
> Api doc of GroupHandler#addChild() tell that an exception is thrown if the method fail to persist the new group or *there is already one child group with the same group name in the database* or any registered listener fail to handle the event.
> But the IDM implementation does not throw exception when add new groupChild same name with existing one, it will update attribute of existing one to be the same new one. 
> And This test case is failure:
> {code}
>     @Test
>     public void testAddDuplicateGroup() throws Exception {
>         /* Create a parent group with name is: GroupParent */
>         String parentName = "testDuplicateGroup_GroupParent";
>         Group groupParent = groupHandler_.createGroupInstance();
>         groupParent.setGroupName(parentName);
>         groupParent.setDescription("This is description");
>         groupHandler_.addChild(null, groupParent, true);
>         groupParent = groupHandler_.findGroupById(groupParent.getId());
>         /* Create a child group with name: Group1 */
>         Group groupChild1 = groupHandler_.createGroupInstance();
>         groupChild1.setGroupName("testAddDuplicateGroup");
>         groupChild1.setLabel("Group1 Label");
>         groupHandler_.addChild(groupParent, groupChild1, true);
>         assertEquals(groupHandler_.findGroupById(groupChild1.getId()).getLabel(), "Group1 Label");
>         try {
>             //. Add new group with same name
>             Group groupChild2 = groupHandler_.createGroupInstance();
>             groupChild2.setGroupName("testAddDuplicateGroup");
>             groupChild2.setLabel("Group2 Label");
>             groupHandler_.addChild(groupParent, groupChild2, true);
>             fail("Exception should be thrown because group child is existing");
>         } catch (Exception ex) {
>         }
>         assertEquals(groupHandler_.findGroupById(groupChild1.getId()).getLabel(), "Group1 Label");
>     }
> {code}
> We should update IDM implementation of this method to align with the API doc.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the gatein-issues mailing list