use of org.apache.ranger.common.SortField 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.SortField 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.SortField 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.SortField 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());
}
use of org.apache.ranger.common.SortField in project ranger by apache.
the class TestXUserREST method test74getAuthSessions.
@SuppressWarnings("unchecked")
@Test
public void test74getAuthSessions() {
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.extractLong(request, testSearchCriteria, "id", "Auth Session Id")).thenReturn(1L);
Mockito.when(searchUtil.extractLong(request, testSearchCriteria, "userId", "User Id")).thenReturn(1L);
Mockito.when(searchUtil.extractInt(request, testSearchCriteria, "authStatus", "Auth Status")).thenReturn(1);
Mockito.when(searchUtil.extractInt(request, testSearchCriteria, "deviceType", "Device Type")).thenReturn(1);
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "firstName", "User First Name", StringUtil.VALIDATION_NAME)).thenReturn("");
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "lastName", "User Last Name", StringUtil.VALIDATION_NAME)).thenReturn("");
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "requestUserAgent", "User Agent", StringUtil.VALIDATION_TEXT)).thenReturn("");
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "requestIP", "Request IP Address", StringUtil.VALIDATION_IP_ADDRESS)).thenReturn("");
Mockito.when(searchUtil.extractString(request, testSearchCriteria, "loginId", "Login ID", StringUtil.VALIDATION_TEXT)).thenReturn("");
VXAuthSessionList testVXAuthSessionList = new VXAuthSessionList();
testVXAuthSessionList.setTotalCount(1);
testVXAuthSessionList.setStartIndex(1);
VXAuthSession testVXAuthSession = createVXAuthSession();
List<VXAuthSession> testvXAuthSessions = new ArrayList<VXAuthSession>();
testvXAuthSessions.add(testVXAuthSession);
testVXAuthSessionList.setVXAuthSessions(testvXAuthSessions);
Mockito.when(sessionMgr.searchAuthSessions(testSearchCriteria)).thenReturn(testVXAuthSessionList);
VXAuthSessionList outputvXGroupList = xUserRest.getAuthSessions(request);
Mockito.verify(sessionMgr).searchAuthSessions(testSearchCriteria);
Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
Mockito.verify(searchUtil).extractLong(request, testSearchCriteria, "id", "Auth Session Id");
Mockito.verify(searchUtil).extractLong(request, testSearchCriteria, "userId", "User Id");
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "authStatus", "Auth Status");
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "authType", "Login Type");
Mockito.verify(searchUtil).extractInt(request, testSearchCriteria, "deviceType", "Device Type");
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "firstName", "User First Name", StringUtil.VALIDATION_NAME);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "lastName", "User Last Name", StringUtil.VALIDATION_NAME);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "requestUserAgent", "User Agent", StringUtil.VALIDATION_TEXT);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "requestIP", "Request IP Address", StringUtil.VALIDATION_IP_ADDRESS);
Mockito.verify(searchUtil).extractString(request, testSearchCriteria, "loginId", "Login ID", StringUtil.VALIDATION_TEXT);
Mockito.verify(searchUtil).extractDate(request, testSearchCriteria, "startDate", "Start Date", null);
Mockito.verify(searchUtil).extractDate(request, testSearchCriteria, "endDate", "End Date", null);
assertNotNull(outputvXGroupList);
assertEquals(outputvXGroupList.getStartIndex(), testVXAuthSessionList.getStartIndex());
assertEquals(outputvXGroupList.getTotalCount(), testVXAuthSessionList.getTotalCount());
}
Aggregations