use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test30searchXGroupUsers.
@SuppressWarnings("unchecked")
@Test
public void test30searchXGroupUsers() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
SearchCriteria testSearchCriteria = createsearchCriteria();
Mockito.when(searchUtil.extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any())).thenReturn(testSearchCriteria);
VXGroupUserList testVXGroupUserList = new VXGroupUserList();
VXGroupUser vXGroupUser = createVXGroupUser();
List<VXGroupUser> vXGroupUsers = new ArrayList<VXGroupUser>();
vXGroupUsers.add(vXGroupUser);
testVXGroupUserList.setVXGroupUsers(vXGroupUsers);
Mockito.when(xUserMgr.searchXGroupUsers(testSearchCriteria)).thenReturn(testVXGroupUserList);
VXGroupUserList outputvXGroupList = xUserRest.searchXGroupUsers(request);
Mockito.verify(xUserMgr).searchXGroupUsers(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
assertNotNull(outputvXGroupList);
assertEquals(outputvXGroupList.getClass(), testVXGroupUserList.getClass());
assertEquals(outputvXGroupList.getResultSize(), testVXGroupUserList.getResultSize());
}
use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test61countXAuditMaps.
@SuppressWarnings("unchecked")
@Test
public void test61countXAuditMaps() {
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.getXAuditMapSearchCount(testSearchCriteria)).thenReturn(vXLong);
VXLong testvxLong = xUserRest.countXAuditMaps(request);
Mockito.verify(xUserMgr).getXAuditMapSearchCount(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
assertEquals(testvxLong.getClass(), vXLong.getClass());
assertEquals(testvxLong.getValue(), vXLong.getValue());
assertNotNull(testvxLong);
}
use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test87countXUserPermission.
@SuppressWarnings("unchecked")
@Test
public void test87countXUserPermission() {
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.getXUserPermissionSearchCount(testSearchCriteria)).thenReturn(vXLong);
VXLong testvxLong = xUserRest.countXUserPermission(request);
Mockito.verify(xUserMgr).getXUserPermissionSearchCount(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 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);
}
use of org.apache.ranger.common.SearchCriteria in project ranger by apache.
the class TestXUserREST method test12countXGroups.
@SuppressWarnings("unchecked")
@Test
public void test12countXGroups() {
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.getXGroupSearchCount(testSearchCriteria)).thenReturn(vXLong);
VXLong testvxLong = xUserRest.countXGroups(request);
Mockito.verify(xUserMgr).getXGroupSearchCount(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