use of org.apache.ranger.view.VXGroup in project ranger by apache.
the class TestXUserREST method test107GroupsByGroupNameNull.
@Test
public void test107GroupsByGroupNameNull() {
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("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 test1getXGroup.
@Test
public void test1getXGroup() {
VXGroup compareTestVXGroup = createVXGroup();
Mockito.when(xUserMgr.getXGroup(id)).thenReturn(compareTestVXGroup);
VXGroup retVxGroup = xUserRest.getXGroup(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 test106deleteGroupsByGroupName.
// //////////////////////////////
@Test
public void test106deleteGroupsByGroupName() {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String TestforceDeleteStr = "true";
boolean forceDelete = false;
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 = true;
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 test4secureCreateXGroup.
@Test
public void test4secureCreateXGroup() {
VXGroup compareTestVXGroup = createVXGroup();
Mockito.when(xUserMgr.createXGroup(compareTestVXGroup)).thenReturn(compareTestVXGroup);
VXGroup retVxGroup = xUserRest.secureCreateXGroup(compareTestVXGroup);
assertNotNull(retVxGroup);
assertEquals(compareTestVXGroup.getId(), retVxGroup.getId());
assertEquals(compareTestVXGroup.getName(), retVxGroup.getName());
Mockito.verify(xUserMgr).createXGroup(compareTestVXGroup);
}
use of org.apache.ranger.view.VXGroup in project ranger by apache.
the class TestXUserREST method test109deleteGroupsByGroupNameSetValueNull.
@Test
public void test109deleteGroupsByGroupNameSetValueNull() {
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("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");
}
Aggregations