Search in sources :

Example 1 with VXGroupList

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

the class TestXUserMgr method test22GetXUserGroups.

@Test
public void test22GetXUserGroups() {
    VXGroupList dbVXGroupList = xUserMgr.getXUserGroups(userId);
    Assert.assertNotNull(dbVXGroupList);
}
Also used : VXGroupList(org.apache.ranger.view.VXGroupList) Test(org.junit.Test)

Example 2 with VXGroupList

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

the class TestXUserREST method test71getXUserGroups.

@Test
public void test71getXUserGroups() {
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    VXGroupList groupList = createxGroupList();
    Mockito.when(xUserMgr.getXUserGroups(id)).thenReturn(groupList);
    VXGroupList retVxGroupList = xUserRest.getXUserGroups(request, id);
    assertNotNull(retVxGroupList);
    assertEquals(groupList.getClass(), retVxGroupList.getClass());
    assertEquals(groupList.getResultSize(), retVxGroupList.getResultSize());
    Mockito.verify(xUserMgr).getXUserGroups(id);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) VXGroupList(org.apache.ranger.view.VXGroupList) Test(org.junit.Test)

Example 3 with VXGroupList

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

the class TestXUserREST method createxGroupList.

private VXGroupList createxGroupList() {
    VXGroupList testVXGroupList = new VXGroupList();
    VXGroup VXGroup1 = createVXGroup();
    List<VXGroup> vXGroups = new ArrayList<VXGroup>();
    vXGroups.add(VXGroup1);
    testVXGroupList.setVXGroups(vXGroups);
    testVXGroupList.setStartIndex(0);
    testVXGroupList.setTotalCount(1);
    return testVXGroupList;
}
Also used : VXGroupList(org.apache.ranger.view.VXGroupList) ArrayList(java.util.ArrayList) VXGroup(org.apache.ranger.view.VXGroup)

Example 4 with VXGroupList

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

the class TestServiceDBStore method test41getMetricByTypeusergroup.

@Test
public void test41getMetricByTypeusergroup() throws Exception {
    VXGroupList vxGroupList = new VXGroupList();
    vxGroupList.setTotalCount(4l);
    vxGroupList.setPageSize(1);
    String type = "usergroup";
    VXUserList vXUserList = new VXUserList();
    vXUserList.setTotalCount(4l);
    Mockito.when(xUserMgr.searchXGroups(Mockito.any(SearchCriteria.class))).thenReturn(vxGroupList);
    Mockito.when(xUserMgr.searchXUsers(Mockito.any(SearchCriteria.class))).thenReturn(vXUserList);
    serviceDBStore.getMetricByType(ServiceDBStore.METRIC_TYPE.getMetricTypeByName(type));
}
Also used : VXGroupList(org.apache.ranger.view.VXGroupList) VXString(org.apache.ranger.view.VXString) VXUserList(org.apache.ranger.view.VXUserList) SearchCriteria(org.apache.ranger.common.SearchCriteria) Test(org.junit.Test)

Example 5 with VXGroupList

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

Aggregations

VXGroupList (org.apache.ranger.view.VXGroupList)14 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)9 SearchCriteria (org.apache.ranger.common.SearchCriteria)7 VXGroup (org.apache.ranger.view.VXGroup)7 VXString (org.apache.ranger.view.VXString)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 VXUser (org.apache.ranger.view.VXUser)3 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 Date (java.util.Date)2 XXModuleDefDao (org.apache.ranger.db.XXModuleDefDao)2 XXPortalUser (org.apache.ranger.entity.XXPortalUser)2 VXLong (org.apache.ranger.view.VXLong)2 VXMetricUserGroupCount (org.apache.ranger.view.VXMetricUserGroupCount)2 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 HashMap (java.util.HashMap)1