use of org.apache.ranger.plugin.util.SearchFilter in project ranger by apache.
the class TestServiceDBStore method test18getPaginatedServiceDefs.
@Test
public void test18getPaginatedServiceDefs() throws Exception {
SearchFilter filter = new SearchFilter();
filter.setParam(SearchFilter.POLICY_NAME, "policyName");
filter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
List<RangerServiceDef> serviceDefsList = new ArrayList<RangerServiceDef>();
RangerServiceDef serviceDef = rangerServiceDef();
serviceDefsList.add(serviceDef);
RangerServiceDefList serviceDefList = new RangerServiceDefList();
serviceDefList.setPageSize(0);
serviceDefList.setResultSize(1);
serviceDefList.setSortBy("asc");
serviceDefList.setSortType("1");
serviceDefList.setStartIndex(0);
serviceDefList.setTotalCount(10);
serviceDefList.setServiceDefs(serviceDefsList);
Mockito.when(serviceDefService.searchRangerServiceDefs(filter)).thenReturn(serviceDefList);
PList<RangerServiceDef> dbServiceDefList = serviceDBStore.getPaginatedServiceDefs(filter);
Assert.assertNotNull(dbServiceDefList);
Assert.assertEquals(dbServiceDefList.getList(), serviceDefList.getServiceDefs());
Mockito.verify(serviceDefService).searchRangerServiceDefs(filter);
}
use of org.apache.ranger.plugin.util.SearchFilter 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.plugin.util.SearchFilter 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);
}
use of org.apache.ranger.plugin.util.SearchFilter in project ranger by apache.
the class TestServiceDBStore method test17getServiceDefs.
@Test
public void test17getServiceDefs() throws Exception {
SearchFilter filter = new SearchFilter();
filter.setParam(SearchFilter.POLICY_NAME, "policyName");
filter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
List<RangerServiceDef> serviceDefsList = new ArrayList<RangerServiceDef>();
RangerServiceDef serviceDef = rangerServiceDef();
serviceDefsList.add(serviceDef);
RangerServiceDefList serviceDefList = new RangerServiceDefList();
serviceDefList.setPageSize(0);
serviceDefList.setResultSize(1);
serviceDefList.setSortBy("asc");
serviceDefList.setSortType("1");
serviceDefList.setStartIndex(0);
serviceDefList.setTotalCount(10);
serviceDefList.setServiceDefs(serviceDefsList);
Mockito.when(serviceDefService.searchRangerServiceDefs(filter)).thenReturn(serviceDefList);
List<RangerServiceDef> dbServiceDef = serviceDBStore.getServiceDefs(filter);
Assert.assertNotNull(dbServiceDef);
Assert.assertEquals(dbServiceDef, serviceDefsList);
Assert.assertEquals(dbServiceDef.get(0), serviceDefsList.get(0));
Mockito.verify(serviceDefService).searchRangerServiceDefs(filter);
}
use of org.apache.ranger.plugin.util.SearchFilter in project ranger by apache.
the class TestServiceDBStore method test24getServices.
@Test
public void test24getServices() throws Exception {
SearchFilter filter = new SearchFilter();
filter.setParam(SearchFilter.POLICY_NAME, "policyName");
filter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
List<RangerService> serviceList = new ArrayList<RangerService>();
RangerService rangerService = rangerService();
serviceList.add(rangerService);
RangerServiceList serviceListObj = new RangerServiceList();
serviceListObj.setPageSize(0);
serviceListObj.setResultSize(1);
serviceListObj.setSortBy("asc");
serviceListObj.setSortType("1");
serviceListObj.setStartIndex(0);
serviceListObj.setTotalCount(10);
serviceListObj.setServices(serviceList);
Mockito.when(svcService.searchRangerServices(filter)).thenReturn(serviceListObj);
List<RangerService> dbRangerService = serviceDBStore.getServices(filter);
Assert.assertNotNull(dbRangerService);
Assert.assertEquals(dbRangerService, serviceList);
Mockito.verify(svcService).searchRangerServices(filter);
}
Aggregations