Search in sources :

Example 1 with BaseDao

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());
}
Also used : BaseDao(org.apache.ranger.common.db.BaseDao) SearchFilter(org.apache.ranger.plugin.util.SearchFilter) RangerServiceDefList(org.apache.ranger.view.RangerServiceDefList) Test(org.junit.Test)

Example 2 with BaseDao

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());
}
Also used : BaseDao(org.apache.ranger.common.db.BaseDao) SearchFilter(org.apache.ranger.plugin.util.SearchFilter) RangerServiceList(org.apache.ranger.view.RangerServiceList) Test(org.junit.Test)

Example 3 with BaseDao

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);
}
Also used : BaseDao(org.apache.ranger.common.db.BaseDao) XXAsset(org.apache.ranger.entity.XXAsset) XXDBBase(org.apache.ranger.entity.XXDBBase) Test(org.junit.Test)

Example 4 with BaseDao

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);
}
Also used : VXAsset(org.apache.ranger.view.VXAsset) BaseDao(org.apache.ranger.common.db.BaseDao) XXAsset(org.apache.ranger.entity.XXAsset) XXDBBase(org.apache.ranger.entity.XXDBBase) Test(org.junit.Test)

Aggregations

BaseDao (org.apache.ranger.common.db.BaseDao)4 Test (org.junit.Test)4 XXAsset (org.apache.ranger.entity.XXAsset)2 XXDBBase (org.apache.ranger.entity.XXDBBase)2 SearchFilter (org.apache.ranger.plugin.util.SearchFilter)2 RangerServiceDefList (org.apache.ranger.view.RangerServiceDefList)1 RangerServiceList (org.apache.ranger.view.RangerServiceList)1 VXAsset (org.apache.ranger.view.VXAsset)1