Search in sources :

Example 6 with XXGroupDao

use of org.apache.ranger.db.XXGroupDao in project ranger by apache.

the class TestXUserMgr method test20ModifyGroupsVisibilitySetEmpty.

@Test
public void test20ModifyGroupsVisibilitySetEmpty() {
    XXGroupDao xxGroupDao = Mockito.mock(XXGroupDao.class);
    VXGroup vXGroup = new VXGroup();
    vXGroup.setId(userId);
    vXGroup.setDescription("group test");
    vXGroup.setName("grouptest");
    XXGroup xxGroup = new XXGroup();
    HashMap<Long, Integer> groupVisibilityMap = new HashMap<Long, Integer>();
    groupVisibilityMap.put(userId, emptyValue);
    Mockito.when(daoManager.getXXGroup()).thenReturn(xxGroupDao);
    Mockito.when(xxGroupDao.getById(vXGroup.getId())).thenReturn(xxGroup);
    Mockito.when(xGroupService.populateViewBean(xxGroup)).thenReturn(vXGroup);
    Mockito.when(xGroupService.updateResource(vXGroup)).thenReturn(vXGroup);
    xUserMgr.modifyGroupsVisibility(groupVisibilityMap);
    Assert.assertEquals(emptyValue, vXGroup.getIsVisible());
    Assert.assertEquals(userId, vXGroup.getId());
    Mockito.verify(daoManager).getXXGroup();
    Mockito.verify(xGroupService).populateViewBean(xxGroup);
    Mockito.verify(xGroupService).updateResource(vXGroup);
}
Also used : XXGroup(org.apache.ranger.entity.XXGroup) HashMap(java.util.HashMap) VXGroup(org.apache.ranger.view.VXGroup) XXGroupDao(org.apache.ranger.db.XXGroupDao) Test(org.junit.Test)

Aggregations

XXGroupDao (org.apache.ranger.db.XXGroupDao)6 XXGroup (org.apache.ranger.entity.XXGroup)6 VXGroup (org.apache.ranger.view.VXGroup)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)3 XXGroupUserDao (org.apache.ranger.db.XXGroupUserDao)3 ArrayList (java.util.ArrayList)2 XXAuditMapDao (org.apache.ranger.db.XXAuditMapDao)2 XXGroupGroupDao (org.apache.ranger.db.XXGroupGroupDao)2 XXGroupPermissionDao (org.apache.ranger.db.XXGroupPermissionDao)2 XXPermMapDao (org.apache.ranger.db.XXPermMapDao)2 XXPolicyDao (org.apache.ranger.db.XXPolicyDao)2 XXGroupGroup (org.apache.ranger.entity.XXGroupGroup)2 XXGroupPermission (org.apache.ranger.entity.XXGroupPermission)2 XXPolicy (org.apache.ranger.entity.XXPolicy)2 SearchCriteria (org.apache.ranger.common.SearchCriteria)1 XXResourceDao (org.apache.ranger.db.XXResourceDao)1 XXUserDao (org.apache.ranger.db.XXUserDao)1 XXGroupUser (org.apache.ranger.entity.XXGroupUser)1 XXModuleDef (org.apache.ranger.entity.XXModuleDef)1