use of org.apache.ranger.view.RangerServiceList 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);
}
use of org.apache.ranger.view.RangerServiceList in project ranger by apache.
the class TestPublicAPIsv2 method test11searchServices.
@Test
public void test11searchServices() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
List<RangerService> servicesList = new ArrayList<RangerService>();
RangerService service = rangerService();
servicesList.add(service);
RangerServiceList serviceList = new RangerServiceList(servicesList);
Mockito.when(serviceREST.getServices(request)).thenReturn(serviceList);
List<RangerService> dbRangerServiceList = publicAPIsv2.searchServices(request);
Assert.assertNotNull(dbRangerServiceList);
Assert.assertEquals(dbRangerServiceList.size(), servicesList.size());
Mockito.verify(serviceREST).getServices(request);
}
use of org.apache.ranger.view.RangerServiceList in project ranger by apache.
the class TestServiceREST method test31getServices.
@Test
public void test31getServices() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
SearchFilter filter = new SearchFilter();
filter.setParam(SearchFilter.POLICY_NAME, "policyName");
filter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
RangerServiceList dbRangerService = serviceREST.getServices(request);
Assert.assertNull(dbRangerService);
}
Aggregations