Search in sources :

Example 11 with VXModuleDef

use of org.apache.ranger.view.VXModuleDef in project ranger by apache.

the class TestXUserMgr method test31createXModuleDefPermission.

// Module permission
@Test
public void test31createXModuleDefPermission() {
    VXModuleDef vXModuleDef = vXModuleDef();
    Mockito.when(xModuleDefService.createResource(vXModuleDef)).thenReturn(vXModuleDef);
    XXModuleDefDao obj = Mockito.mock(XXModuleDefDao.class);
    Mockito.when(daoManager.getXXModuleDef()).thenReturn(obj);
    VXModuleDef dbMuduleDef = xUserMgr.createXModuleDefPermission(vXModuleDef);
    Assert.assertNotNull(dbMuduleDef);
    Assert.assertEquals(dbMuduleDef, vXModuleDef);
    Assert.assertEquals(dbMuduleDef.getId(), vXModuleDef.getId());
    Assert.assertEquals(dbMuduleDef.getOwner(), vXModuleDef.getOwner());
    Assert.assertEquals(dbMuduleDef.getUpdatedBy(), vXModuleDef.getUpdatedBy());
    Assert.assertEquals(dbMuduleDef.getUrl(), vXModuleDef.getUrl());
    Assert.assertEquals(dbMuduleDef.getAddedById(), vXModuleDef.getAddedById());
    Assert.assertEquals(dbMuduleDef.getCreateDate(), vXModuleDef.getCreateDate());
    Assert.assertEquals(dbMuduleDef.getCreateTime(), vXModuleDef.getCreateTime());
    Assert.assertEquals(dbMuduleDef.getUserPermList(), vXModuleDef.getUserPermList());
    Assert.assertEquals(dbMuduleDef.getGroupPermList(), vXModuleDef.getGroupPermList());
    Mockito.verify(xModuleDefService).createResource(vXModuleDef);
}
Also used : VXModuleDef(org.apache.ranger.view.VXModuleDef) XXModuleDefDao(org.apache.ranger.db.XXModuleDefDao) Test(org.junit.Test)

Aggregations

VXModuleDef (org.apache.ranger.view.VXModuleDef)11 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)5 VXGroupPermission (org.apache.ranger.view.VXGroupPermission)4 VXUserPermission (org.apache.ranger.view.VXUserPermission)4 Date (java.util.Date)2 XXModuleDefDao (org.apache.ranger.db.XXModuleDefDao)2 VXModuleDefList (org.apache.ranger.view.VXModuleDefList)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 SearchCriteria (org.apache.ranger.common.SearchCriteria)1 SortField (org.apache.ranger.common.SortField)1 UserSessionBase (org.apache.ranger.common.UserSessionBase)1 XXGroupPermissionDao (org.apache.ranger.db.XXGroupPermissionDao)1 XXGroupUserDao (org.apache.ranger.db.XXGroupUserDao)1 XXUserPermissionDao (org.apache.ranger.db.XXUserPermissionDao)1 XXGroup (org.apache.ranger.entity.XXGroup)1 XXGroupPermission (org.apache.ranger.entity.XXGroupPermission)1 XXModuleDef (org.apache.ranger.entity.XXModuleDef)1