Search in sources :

Example 21 with VXGroup

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");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) VXString(org.apache.ranger.view.VXString) VXStringList(org.apache.ranger.view.VXStringList) VXString(org.apache.ranger.view.VXString) VXGroup(org.apache.ranger.view.VXGroup) Test(org.junit.Test)

Example 22 with VXGroup

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);
}
Also used : VXGroup(org.apache.ranger.view.VXGroup) Test(org.junit.Test)

Example 23 with VXGroup

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");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) VXString(org.apache.ranger.view.VXString) VXStringList(org.apache.ranger.view.VXStringList) VXString(org.apache.ranger.view.VXString) VXGroup(org.apache.ranger.view.VXGroup) Test(org.junit.Test)

Example 24 with VXGroup

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);
}
Also used : VXGroup(org.apache.ranger.view.VXGroup) Test(org.junit.Test)

Example 25 with VXGroup

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");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) VXString(org.apache.ranger.view.VXString) VXStringList(org.apache.ranger.view.VXStringList) VXString(org.apache.ranger.view.VXString) VXGroup(org.apache.ranger.view.VXGroup) Test(org.junit.Test)

Aggregations

VXGroup (org.apache.ranger.view.VXGroup)32 Test (org.junit.Test)26 VXString (org.apache.ranger.view.VXString)10 HttpServletRequest (javax.servlet.http.HttpServletRequest)9 XXGroup (org.apache.ranger.entity.XXGroup)7 ArrayList (java.util.ArrayList)5 XXGroupDao (org.apache.ranger.db.XXGroupDao)5 VXStringList (org.apache.ranger.view.VXStringList)4 HashMap (java.util.HashMap)3 VXGroupUser (org.apache.ranger.view.VXGroupUser)3 VXUser (org.apache.ranger.view.VXUser)3 XXGroupUserDao (org.apache.ranger.db.XXGroupUserDao)2 VXGroupList (org.apache.ranger.view.VXGroupList)2 VXGroupUserList (org.apache.ranger.view.VXGroupUserList)2 Date (java.util.Date)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 SearchCriteria (org.apache.ranger.common.SearchCriteria)1 UserSessionBase (org.apache.ranger.common.UserSessionBase)1 XXAuditMapDao (org.apache.ranger.db.XXAuditMapDao)1