use of org.apache.ranger.view.RangerPolicyList in project ranger by apache.
the class TestServiceREST method test23getServicePoliciesByName.
@Test
public void test23getServicePoliciesByName() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
RangerPolicy rangerPolicy = rangerPolicy();
List<RangerPolicy> ret = Mockito.mock(List.class);
SearchFilter filter = new SearchFilter();
filter.setParam(SearchFilter.POLICY_NAME, "policyName");
filter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
Mockito.when(searchUtil.getSearchFilter(request, policyService.sortFields)).thenReturn(filter);
Mockito.when(svcStore.getServicePolicies(rangerPolicy.getName(), filter)).thenReturn(ret);
RangerPolicyList dbRangerPolicy = serviceREST.getServicePoliciesByName(rangerPolicy.getName(), request);
Assert.assertNotNull(dbRangerPolicy);
}
use of org.apache.ranger.view.RangerPolicyList in project ranger by apache.
the class TestServiceDBStore method test36getPaginatedServicePolicies.
@Test
public void test36getPaginatedServicePolicies() throws Exception {
String serviceName = "HDFS_1";
RangerPolicyList policyList = new RangerPolicyList();
policyList.setPageSize(0);
SearchFilter filter = new SearchFilter();
filter.setParam(SearchFilter.POLICY_NAME, "policyName");
filter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
PList<RangerPolicy> dbRangerPolicyList = serviceDBStore.getPaginatedServicePolicies(serviceName, filter);
Assert.assertNotNull(dbRangerPolicyList);
}
use of org.apache.ranger.view.RangerPolicyList in project ranger by apache.
the class TestServiceDBStore method test30getPolicies.
@Test
public void test30getPolicies() throws Exception {
SearchFilter filter = new SearchFilter();
filter.setParam(SearchFilter.POLICY_NAME, "policyName");
filter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
List<RangerPolicy> rangerPolicyLists = new ArrayList<RangerPolicy>();
RangerPolicy rangerPolicy = rangerPolicy();
rangerPolicyLists.add(rangerPolicy);
RangerPolicyList policyListObj = new RangerPolicyList();
policyListObj.setPageSize(0);
policyListObj.setResultSize(1);
policyListObj.setSortBy("asc");
policyListObj.setSortType("1");
policyListObj.setStartIndex(0);
policyListObj.setTotalCount(10);
List<RangerPolicy> dbRangerPolicy = serviceDBStore.getPolicies(filter);
Assert.assertNotNull(dbRangerPolicy);
}
Aggregations