use of org.apache.ranger.view.VXGroupPermissionList in project ranger by apache.
the class XGroupPermissionServiceBase method searchXGroupPermission.
/**
* @param searchCriteria
* @return
*/
public VXGroupPermissionList searchXGroupPermission(SearchCriteria searchCriteria) {
VXGroupPermissionList returnList = new VXGroupPermissionList();
List<VXGroupPermission> vXGroupPermissions = new ArrayList<VXGroupPermission>();
List<T> resultList = searchResources(searchCriteria, searchFields, sortFields, returnList);
// Iterate over the result list and create the return list
for (T gjXUser : resultList) {
VXGroupPermission vXGroupPermission = populateViewBean(gjXUser);
vXGroupPermissions.add(vXGroupPermission);
}
returnList.setvXGroupPermission(vXGroupPermissions);
return returnList;
}
use of org.apache.ranger.view.VXGroupPermissionList in project ranger by apache.
the class TestXUserREST method test92searchXGroupPermission.
@SuppressWarnings("unchecked")
@Test
public void test92searchXGroupPermission() {
VXGroupPermissionList testVXGroupPermissionList = new VXGroupPermissionList();
testVXGroupPermissionList.setTotalCount(1);
VXGroupPermission testVXGroupPermission = createVXGroupPermission();
List<VXGroupPermission> testVXGroupPermissions = new ArrayList<VXGroupPermission>();
testVXGroupPermissions.add(testVXGroupPermission);
testVXGroupPermissionList.setvXGroupPermission(testVXGroupPermissions);
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, "id", "id", StringUtil.VALIDATION_NAME)).thenReturn("");
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "groupPermissionList", "groupId", StringUtil.VALIDATION_NAME)).thenReturn("");
Mockito.when(xUserMgr.searchXGroupPermission(testSearchCriteria)).thenReturn(testVXGroupPermissionList);
VXGroupPermissionList outputVXGroupPermissionList = xUserRest.searchXGroupPermission(request);
assertNotNull(outputVXGroupPermissionList);
assertEquals(outputVXGroupPermissionList.getClass(), testVXGroupPermissionList.getClass());
assertEquals(outputVXGroupPermissionList.getTotalCount(), testVXGroupPermissionList.getTotalCount());
Mockito.verify(xUserMgr).searchXGroupPermission(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "id", "id", StringUtil.VALIDATION_NAME);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "groupPermissionList", "groupId", StringUtil.VALIDATION_NAME);
}
Aggregations