use of org.apache.ranger.view.VXGroup in project ranger by apache.
the class TestXUserMgr method test29deleteXGroupAndXUser.
@Test
public void test29deleteXGroupAndXUser() {
setup();
VXUser vxUser = vxUser();
VXGroup vxGroup = new VXGroup();
VXGroupUserList vxGroupUserList = new VXGroupUserList();
String groupName = "Grp2";
String userName = "test";
Mockito.when(xGroupService.getGroupByGroupName(Mockito.anyString())).thenReturn(vxGroup);
Mockito.when(xUserService.getXUserByUserName(Mockito.anyString())).thenReturn(vxUser);
Mockito.when(xGroupUserService.searchXGroupUsers((SearchCriteria) Mockito.any())).thenReturn(vxGroupUserList);
xUserMgr.deleteXGroupAndXUser(groupName, userName);
Mockito.verify(xGroupService).getGroupByGroupName(Mockito.anyString());
Mockito.verify(xUserService).getXUserByUserName(Mockito.anyString());
Mockito.verify(xGroupUserService).searchXGroupUsers((SearchCriteria) Mockito.any());
}
use of org.apache.ranger.view.VXGroup 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);
}
Aggregations