use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test36searchXGroupGroups.
@SuppressWarnings("unchecked")
@Test
public void test36searchXGroupGroups() {
VXGroupGroupList testvXGroupGroupList = new VXGroupGroupList();
VXGroupGroup testVXGroup = createVXGroupGroup();
List<VXGroupGroup> testVXGroupGroups = new ArrayList<VXGroupGroup>();
testVXGroupGroups.add(testVXGroup);
testvXGroupGroupList.setVXGroupGroups(testVXGroupGroups);
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
SearchCriteria testSearchCriteria = createsearchCriteria();
Mockito.when(searchUtil.extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any())).thenReturn(testSearchCriteria);
Mockito.when(xUserMgr.searchXGroupGroups(testSearchCriteria)).thenReturn(testvXGroupGroupList);
VXGroupGroupList outputvXGroupGroupList = xUserRest.searchXGroupGroups(request);
Mockito.verify(xUserMgr).searchXGroupGroups(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
assertNotNull(outputvXGroupGroupList);
assertEquals(outputvXGroupGroupList.getClass(), testvXGroupGroupList.getClass());
assertEquals(outputvXGroupGroupList.getResultSize(), testvXGroupGroupList.getResultSize());
}
use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test93countXGroupPermission.
@SuppressWarnings("unchecked")
@Test
public void test93countXGroupPermission() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
SearchCriteria testSearchCriteria = createsearchCriteria();
Mockito.when(searchUtil.extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any())).thenReturn(testSearchCriteria);
vXLong.setValue(1);
Mockito.when(xUserMgr.getXGroupPermissionSearchCount(testSearchCriteria)).thenReturn(vXLong);
VXLong testvxLong = xUserRest.countXGroupPermission(request);
Mockito.verify(xUserMgr).getXGroupPermissionSearchCount(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
assertNotNull(testvxLong);
assertEquals(testvxLong.getValue(), vXLong.getValue());
assertEquals(testvxLong.getClass(), vXLong.getClass());
}
use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test31countXGroupUserst.
@SuppressWarnings("unchecked")
@Test
public void test31countXGroupUserst() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
SearchCriteria testSearchCriteria = createsearchCriteria();
Mockito.when(searchUtil.extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any())).thenReturn(testSearchCriteria);
vXLong.setValue(1);
Mockito.when(xUserMgr.getXGroupUserSearchCount(testSearchCriteria)).thenReturn(vXLong);
VXLong testvxLong = xUserRest.countXGroupUsers(request);
Mockito.verify(xUserMgr).getXGroupUserSearchCount(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
assertNotNull(testvxLong);
assertEquals(testvxLong.getValue(), vXLong.getValue());
assertEquals(testvxLong.getClass(), vXLong.getClass());
}
use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test24searchXUsers.
@SuppressWarnings("unchecked")
@Test
public void test24searchXUsers() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
SearchCriteria testSearchCriteria = createsearchCriteria();
Mockito.when(searchUtil.extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any())).thenReturn(testSearchCriteria);
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "name", "User name", null)).thenReturn("");
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "emailAddress", "Email Address", null)).thenReturn("");
Mockito.when(searchUtil.extractInt(request, testSearchCriteria, "userSource", "User Source")).thenReturn(1);
Mockito.when(searchUtil.extractInt(request, testSearchCriteria, "isVisible", "User Visibility")).thenReturn(1);
Mockito.when(searchUtil.extractInt(request, testSearchCriteria, "status", "User Status")).thenReturn(1);
Mockito.when(searchUtil.extractStringList(request, testSearchCriteria, "userRoleList", "User Role List", "userRoleList", null, null)).thenReturn(new ArrayList<String>());
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "userRole", "UserRole", null)).thenReturn("");
List<VXUser> vXUsersList = new ArrayList<VXUser>();
vXUsersList.add(vxUser);
VXUserList testVXUserList = new VXUserList();
testVXUserList.setVXUsers(vXUsersList);
Mockito.when(xUserMgr.searchXUsers(testSearchCriteria)).thenReturn(testVXUserList);
VXUserList gotVXUserList = xUserRest.searchXUsers(request);
Mockito.verify(xUserMgr).searchXUsers(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "name", "User name", null);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "emailAddress", "Email Address", null);
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "userSource", "User Source");
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "isVisible", "User Visibility");
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "status", "User Status");
Mockito.verify(searchUtil).extractStringList(request, testSearchCriteria, "userRoleList", "User Role List", "userRoleList", null, null);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "userRole", "UserRole", null);
assertNotNull(gotVXUserList);
assertEquals(testVXUserList.getTotalCount(), gotVXUserList.getTotalCount());
assertEquals(testVXUserList.getClass(), gotVXUserList.getClass());
}
use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test49countXPermMaps.
@SuppressWarnings("unchecked")
@Test
public void test49countXPermMaps() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
SearchCriteria testSearchCriteria = createsearchCriteria();
Mockito.when(searchUtil.extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any())).thenReturn(testSearchCriteria);
vXLong.setValue(1);
Mockito.when(xUserMgr.getXPermMapSearchCount(testSearchCriteria)).thenReturn(vXLong);
VXLong testvxLong = xUserRest.countXPermMaps(request);
Mockito.verify(xUserMgr).getXPermMapSearchCount(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
assertNotNull(testvxLong);
}
Aggregations