Search in sources :

Example 1 with VXGroupGroupList

use of org.apache.ranger.view.VXGroupGroupList 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 2 with VXGroupGroupList

use of org.apache.ranger.view.VXGroupGroupList 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

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