Search in sources :

Example 1 with VXPolicyExportAudit

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

the class XPolicyExportAuditServiceBase method searchXPolicyExportAudits.

/**
 * @param searchCriteria
 * @return
 */
public VXPolicyExportAuditList searchXPolicyExportAudits(SearchCriteria searchCriteria) {
    VXPolicyExportAuditList returnList = new VXPolicyExportAuditList();
    List<VXPolicyExportAudit> xPolicyExportAuditList = new ArrayList<VXPolicyExportAudit>();
    List<T> resultList = searchResources(searchCriteria, searchFields, sortFields, returnList);
    // Iterate over the result list and create the return list
    for (T gjXPolicyExportAudit : resultList) {
        VXPolicyExportAudit vXPolicyExportAudit = populateViewBean(gjXPolicyExportAudit);
        xPolicyExportAuditList.add(vXPolicyExportAudit);
    }
    returnList.setVXPolicyExportAudits(xPolicyExportAuditList);
    return returnList;
}
Also used : VXPolicyExportAuditList(org.apache.ranger.view.VXPolicyExportAuditList) ArrayList(java.util.ArrayList) VXPolicyExportAudit(org.apache.ranger.view.VXPolicyExportAudit)

Example 2 with VXPolicyExportAudit

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

the class TestAssetREST method testSearchXPolicyExportAudits.

@Test
public void testSearchXPolicyExportAudits() {
    SearchCriteria searchCriteria = new SearchCriteria();
    List<SortField> sortFields = null;
    List<VXPolicyExportAudit> vXPolicyExportAudits = new ArrayList<VXPolicyExportAudit>();
    VXPolicyExportAuditList vXPolicyExportAuditList = new VXPolicyExportAuditList();
    vXPolicyExportAuditList.setVXPolicyExportAudits(vXPolicyExportAudits);
    Mockito.when(searchUtil.extractCommonCriterias(request, sortFields)).thenReturn(searchCriteria);
    Mockito.when(searchUtil.extractString((HttpServletRequest) Mockito.any(), (SearchCriteria) Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn("test");
    Mockito.when(searchUtil.extractInt((HttpServletRequest) Mockito.any(), (SearchCriteria) Mockito.any(), Mockito.anyString(), Mockito.anyString())).thenReturn((Integer) 8);
    Mockito.when(assetMgr.searchXPolicyExportAudits(searchCriteria)).thenReturn(vXPolicyExportAuditList);
    VXPolicyExportAuditList expectedVXPolicyExportAuditList = assetREST.searchXPolicyExportAudits(request);
    Assert.assertEquals(vXPolicyExportAuditList, expectedVXPolicyExportAuditList);
    Mockito.verify(searchUtil).extractCommonCriterias(request, sortFields);
    Mockito.verify(searchUtil, Mockito.times(4)).extractString((HttpServletRequest) Mockito.any(), (SearchCriteria) Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
    Mockito.verify(searchUtil).extractInt((HttpServletRequest) Mockito.any(), (SearchCriteria) Mockito.any(), Mockito.anyString(), Mockito.anyString());
    Mockito.verify(searchUtil, Mockito.times(2)).extractDate((HttpServletRequest) Mockito.any(), (SearchCriteria) Mockito.any(), Mockito.anyString(), Mockito.anyString(), (String) Mockito.isNull());
    Mockito.verify(searchUtil).extractCommonCriterias(request, sortFields);
    Mockito.verify(assetMgr).searchXPolicyExportAudits(searchCriteria);
}
Also used : VXPolicyExportAuditList(org.apache.ranger.view.VXPolicyExportAuditList) ArrayList(java.util.ArrayList) SortField(org.apache.ranger.common.SortField) VXPolicyExportAudit(org.apache.ranger.view.VXPolicyExportAudit) SearchCriteria(org.apache.ranger.common.SearchCriteria) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)2 VXPolicyExportAudit (org.apache.ranger.view.VXPolicyExportAudit)2 VXPolicyExportAuditList (org.apache.ranger.view.VXPolicyExportAuditList)2 SearchCriteria (org.apache.ranger.common.SearchCriteria)1 SortField (org.apache.ranger.common.SortField)1 Test (org.junit.Test)1