use of org.apache.ranger.view.VXStringList in project ranger by apache.
the class TestXUserREST method test104deleteUsersByUserNameListGetListNull.
@Test
public void test104deleteUsersByUserNameListGetListNull() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = "false";
Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
VXStringList vxStringList = createVXStringList();
vxStringList.setVXStrings(null);
xUserRest.deleteUsersByUserName(request, vxStringList);
Mockito.verify(request).getParameter("forceDelete");
}
use of org.apache.ranger.view.VXStringList in project ranger by apache.
the class TestXUserREST method test108deleteGroupsByGroupNameNull.
@Test
public void test108deleteGroupsByGroupNameNull() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = null;
boolean forceDelete = true;
Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
VXString testVXString = new VXString();
testVXString.setValue("testVXGroup");
VXGroup testVXGroup = createVXGroup();
VXStringList vxStringList = createVXStringListGroup();
Mockito.when(xGroupService.getGroupByGroupName(testVXString.getValue())).thenReturn(testVXGroup);
forceDelete = false;
Mockito.doNothing().when(xUserMgr).deleteXGroup(testVXGroup.getId(), forceDelete);
xUserRest.deleteGroupsByGroupName(request, vxStringList);
Mockito.verify(xUserMgr).deleteXGroup(testVXGroup.getId(), forceDelete);
Mockito.verify(xGroupService).getGroupByGroupName(testVXString.getValue());
Mockito.verify(request).getParameter("forceDelete");
}
use of org.apache.ranger.view.VXStringList in project ranger by apache.
the class TestXUserREST method test102deleteUsersByUserNameSetValueNull.
@Test
public void test102deleteUsersByUserNameSetValueNull() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = "false";
boolean forceDelete = true;
Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
VXString testVXString = new VXString();
testVXString.setValue("User1");
VXUser testVXUser = createVXUser();
VXStringList vxStringList = createVXStringList();
Mockito.when(xUserService.getXUserByUserName(testVXString.getValue())).thenReturn(testVXUser);
forceDelete = false;
Mockito.doNothing().when(xUserMgr).deleteXUser(testVXUser.getId(), forceDelete);
xUserRest.deleteUsersByUserName(request, vxStringList);
Mockito.verify(xUserMgr).deleteXUser(testVXUser.getId(), forceDelete);
Mockito.verify(xUserService).getXUserByUserName(testVXString.getValue());
Mockito.verify(request).getParameter("forceDelete");
}
use of org.apache.ranger.view.VXStringList in project ranger by apache.
the class TestXUserREST method test96setUserRolesByName.
@Test
public void test96setUserRolesByName() {
VXStringList testVXStringList = createVXStringList();
Mockito.when(xUserMgr.setUserRolesByName("Admin", testVXStringList.getVXStrings())).thenReturn(testVXStringList);
VXStringList retVXStringList = xUserRest.setUserRolesByName("Admin", testVXStringList);
Mockito.verify(xUserMgr).setUserRolesByName("Admin", testVXStringList.getVXStrings());
assertNotNull(retVXStringList);
assertEquals(testVXStringList.getTotalCount(), retVXStringList.getTotalCount());
assertEquals(testVXStringList.getClass(), retVXStringList.getClass());
}
use of org.apache.ranger.view.VXStringList in project ranger by apache.
the class TestXUserREST method createVXStringListGroup.
private VXStringList createVXStringListGroup() {
VXStringList testVXStringList = new VXStringList();
VXString testVXString = new VXString();
testVXString.setValue("testVXGroup");
List<VXString> testVXStrings = new ArrayList<VXString>();
testVXStrings.add(testVXString);
testVXStringList.setVXStrings(testVXStrings);
testVXStringList.setResultSize(1);
testVXStringList.setPageSize(1);
testVXStringList.setSortBy("Id");
testVXStringList.setStartIndex(1);
testVXStringList.setTotalCount(1);
return testVXStringList;
}
Aggregations