use of org.apache.ranger.common.SortField in project ranger by apache.
the class TestXUserREST method test86searchXUserPermission.
@SuppressWarnings("unchecked")
@Test
public void test86searchXUserPermission() {
VXUserPermissionList testVXUserPermissionList = new VXUserPermissionList();
testVXUserPermissionList.setTotalCount(1);
testVXUserPermissionList.setStartIndex(1);
VXUserPermission testVXUserPermission = createVXUserPermission();
List<VXUserPermission> testVXUserPermissions = new ArrayList<VXUserPermission>();
testVXUserPermissions.add(testVXUserPermission);
testVXUserPermissionList.setvXModuleDef(testVXUserPermissions);
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, "userPermissionList", "userId", StringUtil.VALIDATION_NAME)).thenReturn("");
Mockito.when(xUserMgr.searchXUserPermission(testSearchCriteria)).thenReturn(testVXUserPermissionList);
VXUserPermissionList outputVXUserPermissionList = xUserRest.searchXUserPermission(request);
assertNotNull(outputVXUserPermissionList);
assertEquals(outputVXUserPermissionList.getStartIndex(), testVXUserPermissionList.getStartIndex());
assertEquals(outputVXUserPermissionList.getTotalCount(), testVXUserPermissionList.getTotalCount());
Mockito.verify(xUserMgr).searchXUserPermission(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, "userPermissionList", "userId", StringUtil.VALIDATION_NAME);
}
use of org.apache.ranger.common.SortField in project ranger by apache.
the class TestXUserREST method test81countXModuleDef.
@SuppressWarnings("unchecked")
@Test
public void test81countXModuleDef() {
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.getXModuleDefSearchCount(testSearchCriteria)).thenReturn(vXLong);
VXLong testvxLong = xUserRest.countXModuleDef(request);
Mockito.verify(xUserMgr).getXModuleDefSearchCount(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.SortField 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.SortField 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.SortField 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());
}
Aggregations