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);
}
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;
}
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);
}
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());
}
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;
}
Aggregations