Search in sources :

Example 16 with VXGroup

use of org.apache.ranger.view.VXGroup in project ranger by apache.

the class XGroupService method populateViewBean.

@Override
public VXGroup populateViewBean(XXGroup xGroup) {
    VXGroup vObj = super.populateViewBean(xGroup);
    vObj.setIsVisible(xGroup.getIsVisible());
    return vObj;
}
Also used : VXGroup(org.apache.ranger.view.VXGroup)

Example 17 with VXGroup

use of org.apache.ranger.view.VXGroup in project ranger by apache.

the class XGroupServiceBase method searchXGroups.

/**
 * @param searchCriteria
 * @return
 */
public VXGroupList searchXGroups(SearchCriteria searchCriteria) {
    VXGroupList returnList = new VXGroupList();
    List<VXGroup> xGroupList = new ArrayList<VXGroup>();
    List<T> resultList = searchResources(searchCriteria, searchFields, sortFields, returnList);
    // Iterate over the result list and create the return list
    for (T gjXGroup : resultList) {
        VXGroup vXGroup = populateViewBean(gjXGroup);
        xGroupList.add(vXGroup);
    }
    returnList.setVXGroups(xGroupList);
    return returnList;
}
Also used : VXGroupList(org.apache.ranger.view.VXGroupList) ArrayList(java.util.ArrayList) VXGroup(org.apache.ranger.view.VXGroup)

Example 18 with VXGroup

use of org.apache.ranger.view.VXGroup in project ranger by apache.

the class XGroupService method readResourceWithOutLogin.

public VXGroup readResourceWithOutLogin(Long id) {
    XXGroup resource = getDao().getById(id);
    if (resource == null) {
        // Returns code 400 with DATA_NOT_FOUND as the error message
        throw restErrorUtil.createRESTException(getResourceName() + " not found", MessageEnums.DATA_NOT_FOUND, id, null, "preRead: " + id + " not found.");
    }
    VXGroup view = populateViewBean(resource);
    if (view != null) {
        view.setGroupSource(resource.getGroupSource());
    }
    return view;
}
Also used : XXGroup(org.apache.ranger.entity.XXGroup) VXGroup(org.apache.ranger.view.VXGroup)

Example 19 with VXGroup

use of org.apache.ranger.view.VXGroup in project ranger by apache.

the class TestXUserREST method test5updateXGroup.

@Test
public void test5updateXGroup() {
    VXGroup compareTestVXGroup = createVXGroup();
    Mockito.when(xUserMgr.updateXGroup(compareTestVXGroup)).thenReturn(compareTestVXGroup);
    VXGroup retVxGroup = xUserRest.updateXGroup(compareTestVXGroup);
    assertNotNull(retVxGroup);
    assertEquals(compareTestVXGroup.getId(), retVxGroup.getId());
    assertEquals(compareTestVXGroup.getName(), retVxGroup.getName());
    Mockito.verify(xUserMgr).updateXGroup(compareTestVXGroup);
}
Also used : VXGroup(org.apache.ranger.view.VXGroup) Test(org.junit.Test)

Example 20 with VXGroup

use of org.apache.ranger.view.VXGroup in project ranger by apache.

the class TestXUserREST method test70deleteXGroupAndXUser.

@Test
public void test70deleteXGroupAndXUser() {
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    VXGroup testVXGroup = createVXGroup();
    VXUser testVXuser = createVXUser();
    Mockito.doNothing().when(xUserMgr).deleteXGroupAndXUser(testVXGroup.getName(), testVXuser.getName());
    xUserRest.deleteXGroupAndXUser(testVXGroup.getName(), testVXuser.getName(), request);
    Mockito.verify(xUserMgr).deleteXGroupAndXUser(testVXGroup.getName(), testVXuser.getName());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) VXUser(org.apache.ranger.view.VXUser) 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