use of org.apache.ranger.view.RangerServiceDefList in project ranger by apache.
the class TestPublicAPIsv2 method test3searchServiceDefs.
@Test
public void test3searchServiceDefs() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
List<RangerServiceDef> serviceDefsList = new ArrayList<RangerServiceDef>();
RangerServiceDef serviceDef = rangerServiceDef();
serviceDefsList.add(serviceDef);
RangerServiceDefList serviceDefList = new RangerServiceDefList(serviceDefsList);
Mockito.when(serviceREST.getServiceDefs(request)).thenReturn(serviceDefList);
List<RangerServiceDef> dbRangerServiceDefList = publicAPIsv2.searchServiceDefs(request);
Assert.assertNotNull(dbRangerServiceDefList);
Assert.assertEquals(dbRangerServiceDefList.size(), serviceDefsList.size());
Mockito.verify(serviceREST).getServiceDefs(request);
}
use of org.apache.ranger.view.RangerServiceDefList in project ranger by apache.
the class ServiceDBStore method getServiceDefs.
@Override
public List<RangerServiceDef> getServiceDefs(SearchFilter filter) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("==> ServiceDBStore.getServiceDefs(" + filter + ")");
}
RangerServiceDefList svcDefList = serviceDefService.searchRangerServiceDefs(filter);
predicateUtil.applyFilter(svcDefList.getServiceDefs(), filter);
List<RangerServiceDef> ret = svcDefList.getServiceDefs();
if (LOG.isDebugEnabled()) {
LOG.debug("==> ServiceDBStore.getServiceDefs(" + filter + "): " + ret);
}
return ret;
}
use of org.apache.ranger.view.RangerServiceDefList in project ranger by apache.
the class TestServiceDBStore method test42getMetricByTypeaudits.
@Test
public void test42getMetricByTypeaudits() throws Exception {
String type = "audits";
Date date = new Date();
date.setYear(2018);
Mockito.when(restErrorUtil.parseDate(Mockito.anyString(), Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyString(), Mockito.anyString())).thenReturn(date);
RangerServiceDefList svcDefList = new RangerServiceDefList();
svcDefList.setTotalCount(10l);
Mockito.when(serviceDefService.searchRangerServiceDefs(Mockito.any(SearchFilter.class))).thenReturn(svcDefList);
serviceDBStore.getMetricByType(ServiceDBStore.METRIC_TYPE.getMetricTypeByName(type));
}
use of org.apache.ranger.view.RangerServiceDefList in project ranger by apache.
the class TestServiceDBStore method test47getMetricByTypeDenyconditions.
@Test
public void test47getMetricByTypeDenyconditions() throws Exception {
String type = "denyconditions";
RangerServiceDefList svcDefList = new RangerServiceDefList();
svcDefList.setTotalCount(10l);
Mockito.when(serviceDefService.searchRangerServiceDefs(Mockito.any(SearchFilter.class))).thenReturn(svcDefList);
serviceDBStore.getMetricByType(ServiceDBStore.METRIC_TYPE.getMetricTypeByName(type));
}
use of org.apache.ranger.view.RangerServiceDefList in project ranger by apache.
the class TestRangerServiceDefServiceBase method test21searchRangerServiceDefs.
@Test
public void test21searchRangerServiceDefs() {
setup();
SearchFilter searchFilter = new SearchFilter();
searchFilter.setParam(SearchFilter.POLICY_NAME, "policyName");
searchFilter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
RangerServiceDefList dbRangerServiceDefList = rangerServiceDefService.searchRangerServiceDefs(searchFilter);
Assert.assertNotNull(dbRangerServiceDefList);
}
Aggregations