Search in sources :

Example 1 with VXGroupGroup

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

the class TestXUserREST method test32getXGroupGroup.

@Test
public void test32getXGroupGroup() {
    VXGroupGroup compareTestVXGroup = createVXGroupGroup();
    Mockito.when(xUserMgr.getXGroupGroup(id)).thenReturn(compareTestVXGroup);
    VXGroupGroup retVxGroup = xUserRest.getXGroupGroup(id);
    assertNotNull(retVxGroup);
    assertEquals(compareTestVXGroup.getClass(), retVxGroup.getClass());
    assertEquals(compareTestVXGroup.getId(), retVxGroup.getId());
    Mockito.verify(xUserMgr).getXGroupGroup(id);
}
Also used : VXGroupGroup(org.apache.ranger.view.VXGroupGroup) Test(org.junit.Test)

Example 2 with VXGroupGroup

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

the class TestXUserREST method createVXGroupGroup.

private VXGroupGroup createVXGroupGroup() {
    VXGroupGroup testVXGroupGroup = new VXGroupGroup();
    testVXGroupGroup.setName("testGroup");
    testVXGroupGroup.setCreateDate(new Date());
    testVXGroupGroup.setUpdateDate(new Date());
    testVXGroupGroup.setUpdatedBy("Admin");
    testVXGroupGroup.setOwner("Admin");
    testVXGroupGroup.setId(id);
    testVXGroupGroup.setParentGroupId(id);
    return testVXGroupGroup;
}
Also used : VXGroupGroup(org.apache.ranger.view.VXGroupGroup) Date(java.util.Date)

Example 3 with VXGroupGroup

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

the class TestXUserREST method test34updateXGroupGroup.

@Test
public void test34updateXGroupGroup() {
    VXGroupGroup compareTestVXGroup = createVXGroupGroup();
    Mockito.when(xUserMgr.updateXGroupGroup(compareTestVXGroup)).thenReturn(compareTestVXGroup);
    VXGroupGroup retVxGroup = xUserRest.updateXGroupGroup(compareTestVXGroup);
    assertNotNull(retVxGroup);
    assertEquals(compareTestVXGroup.getClass(), retVxGroup.getClass());
    assertEquals(compareTestVXGroup.getId(), retVxGroup.getId());
    Mockito.verify(xUserMgr).updateXGroupGroup(compareTestVXGroup);
}
Also used : VXGroupGroup(org.apache.ranger.view.VXGroupGroup) Test(org.junit.Test)

Example 4 with VXGroupGroup

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

the class TestXUserREST method test36searchXGroupGroups.

@SuppressWarnings("unchecked")
@Test
public void test36searchXGroupGroups() {
    VXGroupGroupList testvXGroupGroupList = new VXGroupGroupList();
    VXGroupGroup testVXGroup = createVXGroupGroup();
    List<VXGroupGroup> testVXGroupGroups = new ArrayList<VXGroupGroup>();
    testVXGroupGroups.add(testVXGroup);
    testvXGroupGroupList.setVXGroupGroups(testVXGroupGroups);
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    SearchCriteria testSearchCriteria = createsearchCriteria();
    Mockito.when(searchUtil.extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any())).thenReturn(testSearchCriteria);
    Mockito.when(xUserMgr.searchXGroupGroups(testSearchCriteria)).thenReturn(testvXGroupGroupList);
    VXGroupGroupList outputvXGroupGroupList = xUserRest.searchXGroupGroups(request);
    Mockito.verify(xUserMgr).searchXGroupGroups(testSearchCriteria);
    Mockito.verify(searchUtil).extractCommonCriterias((HttpServletRequest) Mockito.any(), (List<SortField>) Mockito.any());
    assertNotNull(outputvXGroupGroupList);
    assertEquals(outputvXGroupGroupList.getClass(), testvXGroupGroupList.getClass());
    assertEquals(outputvXGroupGroupList.getResultSize(), testvXGroupGroupList.getResultSize());
}
Also used : VXGroupGroupList(org.apache.ranger.view.VXGroupGroupList) HttpServletRequest(javax.servlet.http.HttpServletRequest) ArrayList(java.util.ArrayList) VXGroupGroup(org.apache.ranger.view.VXGroupGroup) SortField(org.apache.ranger.common.SortField) SearchCriteria(org.apache.ranger.common.SearchCriteria) Test(org.junit.Test)

Example 5 with VXGroupGroup

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

the class XGroupGroupServiceBase method searchXGroupGroups.

/**
 * @param searchCriteria
 * @return
 */
public VXGroupGroupList searchXGroupGroups(SearchCriteria searchCriteria) {
    VXGroupGroupList returnList = new VXGroupGroupList();
    List<VXGroupGroup> xGroupGroupList = new ArrayList<VXGroupGroup>();
    List<T> resultList = searchResources(searchCriteria, searchFields, sortFields, returnList);
    // Iterate over the result list and create the return list
    for (T gjXGroupGroup : resultList) {
        V vXGroupGroup = populateViewBean(gjXGroupGroup);
        xGroupGroupList.add(vXGroupGroup);
    }
    returnList.setVXGroupGroups(xGroupGroupList);
    return returnList;
}
Also used : VXGroupGroupList(org.apache.ranger.view.VXGroupGroupList) ArrayList(java.util.ArrayList) VXGroupGroup(org.apache.ranger.view.VXGroupGroup)

Aggregations

VXGroupGroup (org.apache.ranger.view.VXGroupGroup)6 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 VXGroupGroupList (org.apache.ranger.view.VXGroupGroupList)2 Date (java.util.Date)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 SearchCriteria (org.apache.ranger.common.SearchCriteria)1 SortField (org.apache.ranger.common.SortField)1