Search in sources :

Example 11 with RangerServiceList

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);
}
Also used : ArrayList(java.util.ArrayList) SearchFilter(org.apache.ranger.plugin.util.SearchFilter) RangerServiceList(org.apache.ranger.view.RangerServiceList) RangerService(org.apache.ranger.plugin.model.RangerService) Test(org.junit.Test)

Aggregations

RangerServiceList (org.apache.ranger.view.RangerServiceList)11 SearchFilter (org.apache.ranger.plugin.util.SearchFilter)8 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)6 RangerService (org.apache.ranger.plugin.model.RangerService)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 VXString (org.apache.ranger.view.VXString)3 UserSessionBase (org.apache.ranger.common.UserSessionBase)2 VXUser (org.apache.ranger.view.VXUser)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 XXPortalUser (org.apache.ranger.entity.XXPortalUser)1 PList (org.apache.ranger.plugin.store.PList)1 RangerPerfTracer (org.apache.ranger.plugin.util.RangerPerfTracer)1 RangerSecurityContext (org.apache.ranger.security.context.RangerSecurityContext)1