use of org.apache.ranger.common.db.BaseDao 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");
BaseDao baseDao = Mockito.mock(BaseDao.class);
Mockito.when(daoManager.getDaoForClassName(Mockito.anyString())).thenReturn(baseDao);
RangerServiceDefList dbRangerServiceDefList = rangerServiceDefService.searchRangerServiceDefs(searchFilter);
Assert.assertNotNull(dbRangerServiceDefList);
Mockito.verify(daoManager).getDaoForClassName(Mockito.anyString());
}
use of org.apache.ranger.common.db.BaseDao in project ranger by apache.
the class TestRangerServiceServiceBase method test3searchRangerServices.
@Test
public void test3searchRangerServices() {
SearchFilter searchFilter = new SearchFilter();
searchFilter.setParam(SearchFilter.POLICY_NAME, "policyName");
searchFilter.setParam(SearchFilter.SERVICE_NAME, "serviceName");
BaseDao baseDao = Mockito.mock(BaseDao.class);
Mockito.when(daoManager.getDaoForClassName(Mockito.anyString())).thenReturn(baseDao);
RangerServiceList dbRangerServiceList = rangerServiceService.searchRangerServices(searchFilter);
Assert.assertNotNull(dbRangerServiceList);
Mockito.verify(daoManager).getDaoForClassName(Mockito.anyString());
}
use of org.apache.ranger.common.db.BaseDao in project ranger by apache.
the class TestRangerBizUtil method testGetMObject.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testGetMObject() {
BaseDao baseDao = Mockito.mock(BaseDao.class);
Mockito.when(daoManager.getDaoForClassType(RangerCommonEnums.CLASS_TYPE_USER_PROFILE)).thenReturn(baseDao);
Mockito.when(baseDao.getById(id)).thenReturn(new XXAsset());
XXDBBase mObjChk = rangerBizUtil.getMObject(RangerCommonEnums.CLASS_TYPE_USER_PROFILE, id);
Assert.assertNotNull(mObjChk);
}
use of org.apache.ranger.common.db.BaseDao in project ranger by apache.
the class TestRangerBizUtil method testGetMObject_VXDataObject.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testGetMObject_VXDataObject() {
VXAsset vXDataObject = new VXAsset();
vXDataObject.setId(id);
BaseDao baseDao = Mockito.mock(BaseDao.class);
Mockito.when(daoManager.getDaoForClassType(vXDataObject.getMyClassType())).thenReturn(baseDao);
Mockito.when(baseDao.getById(vXDataObject.getId())).thenReturn(new XXAsset());
XXDBBase xXDBaseChk = rangerBizUtil.getMObject(vXDataObject);
Assert.assertNotNull(xXDBaseChk);
}
Aggregations