use of org.apache.ranger.view.VXGroup in project ranger by apache.
the class TestXUserREST method createVXGroup.
private VXGroup createVXGroup() {
VXGroup testVXGroup = new VXGroup();
testVXGroup.setName("testVXGroup");
testVXGroup.setCreateDate(new Date());
testVXGroup.setUpdateDate(new Date());
testVXGroup.setUpdatedBy("Admin");
testVXGroup.setOwner("Admin");
testVXGroup.setId(id);
testVXGroup.setGroupType(1);
testVXGroup.setCredStoreId(1L);
testVXGroup.setGroupSource(1);
testVXGroup.setIsVisible(1);
return testVXGroup;
}
use of org.apache.ranger.view.VXGroup 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.VXGroup in project ranger by apache.
the class TestXUserREST method test2secureGetXGroup.
@Test
public void test2secureGetXGroup() {
VXGroup compareTestVXGroup = createVXGroup();
Mockito.when(xUserMgr.getXGroup(id)).thenReturn(compareTestVXGroup);
VXGroup retVxGroup = xUserRest.secureGetXGroup(id);
assertNotNull(retVxGroup);
assertEquals(compareTestVXGroup.getId(), retVxGroup.getId());
assertEquals(compareTestVXGroup.getName(), retVxGroup.getName());
Mockito.verify(xUserMgr).getXGroup(id);
}
use of org.apache.ranger.view.VXGroup in project ranger by apache.
the class TestXUserREST method test68deleteXGroupByGroupNameNull.
@Test
public void test68deleteXGroupByGroupNameNull() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = null;
boolean forceDelete = true;
Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
VXGroup testVXGroup = createVXGroup();
Mockito.when(xGroupService.getGroupByGroupName(testVXGroup.getName())).thenReturn(testVXGroup);
forceDelete = false;
Mockito.doNothing().when(xUserMgr).deleteXGroup(testVXGroup.getId(), forceDelete);
xUserRest.deleteXGroupByGroupName(testVXGroup.getName(), request);
Mockito.verify(xUserMgr).deleteXGroup(testVXGroup.getId(), forceDelete);
Mockito.verify(xGroupService).getGroupByGroupName(testVXGroup.getName());
Mockito.verify(request).getParameter("forceDelete");
}
use of org.apache.ranger.view.VXGroup in project ranger by apache.
the class TestXUserREST method test63getXGroupByGroupName.
@Test
public void test63getXGroupByGroupName() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
VXGroup compareTestVXGroup = createVXGroup();
Mockito.when(xGroupService.getGroupByGroupName(compareTestVXGroup.getName())).thenReturn(compareTestVXGroup);
VXGroup retVxGroup = xUserRest.getXGroupByGroupName(request, compareTestVXGroup.getName());
assertNotNull(retVxGroup);
assertEquals(compareTestVXGroup.getClass(), compareTestVXGroup.getClass());
assertEquals(compareTestVXGroup.getId(), compareTestVXGroup.getId());
Mockito.verify(xGroupService).getGroupByGroupName(compareTestVXGroup.getName());
}
Aggregations