use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestXUserREST method test53createXAuditMap.
@Test
public void test53createXAuditMap() {
VXAuditMap testvXAuditMap = createVXAuditMapObj();
Mockito.when(xUserMgr.createXAuditMap(testvXAuditMap)).thenReturn(testvXAuditMap);
VXResource testVxResource = createVXResource();
Mockito.when(xResourceService.readResource(testvXAuditMap.getResourceId())).thenReturn(testVxResource);
VXAuditMap retvXAuditMap = xUserRest.createXAuditMap(testvXAuditMap);
assertEquals(testvXAuditMap.getId(), retvXAuditMap.getId());
assertEquals(testvXAuditMap.getClass(), retvXAuditMap.getClass());
assertNotNull(retvXAuditMap);
Mockito.verify(xUserMgr).createXAuditMap(testvXAuditMap);
Mockito.verify(xResourceService).readResource(testvXAuditMap.getResourceId());
}
use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestXUserREST method test52getXAuditMap.
@Test
public void test52getXAuditMap() {
VXAuditMap testvXAuditMap = createVXAuditMapObj();
Mockito.when(xUserMgr.getXAuditMap(id)).thenReturn(testvXAuditMap);
VXResource testVxResource = createVXResource();
Mockito.when(xResourceService.readResource(testvXAuditMap.getResourceId())).thenReturn(testVxResource);
VXAuditMap retVXAuditMap = xUserRest.getXAuditMap(id);
assertEquals(testvXAuditMap.getId(), retVXAuditMap.getId());
assertEquals(testvXAuditMap.getClass(), retVXAuditMap.getClass());
assertNotNull(retVXAuditMap);
Mockito.verify(xUserMgr).getXAuditMap(id);
Mockito.verify(xResourceService).readResource(testvXAuditMap.getResourceId());
}
use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestXUserREST method test56updateXAuditMap.
@Test
public void test56updateXAuditMap() {
VXAuditMap testvXAuditMap = createVXAuditMapObj();
testvXAuditMap.setResourceId(id);
Mockito.when(xUserMgr.updateXAuditMap(testvXAuditMap)).thenReturn(testvXAuditMap);
VXResource testVxResource = createVXResource();
Mockito.when(xResourceService.readResource(testvXAuditMap.getResourceId())).thenReturn(testVxResource);
VXAuditMap retvXAuditMap = xUserRest.updateXAuditMap(testvXAuditMap);
assertEquals(testvXAuditMap.getId(), retvXAuditMap.getId());
assertEquals(testvXAuditMap.getClass(), retvXAuditMap.getClass());
assertNotNull(retvXAuditMap);
Mockito.verify(xUserMgr).updateXAuditMap(testvXAuditMap);
Mockito.verify(xResourceService).readResource(testvXAuditMap.getResourceId());
}
use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestXUserREST method createVXResource.
private VXResource createVXResource() {
VXResource testVXResource = new VXResource();
testVXResource.setAssetId(id);
testVXResource.setAssetName("AdminAsset");
testVXResource.setAssetType(1);
testVXResource.setCreateDate(new Date());
testVXResource.setOwner("Admin");
testVXResource.setUpdateDate(new Date());
testVXResource.setUpdatedBy("Admin");
testVXResource.setParentId(id);
testVXResource.setName("User");
return testVXResource;
}
use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestRangerBizUtil method testHasPermission_isAdmin.
@Test
public void testHasPermission_isAdmin() {
VXResource vXResource = new VXResource();
vXResource.setName(resourceName);
vXResource.setAssetId(id);
UserSessionBase currentUserSession = ContextUtil.getCurrentUserSession();
currentUserSession.setUserAdmin(true);
VXResponse resp = rangerBizUtil.hasPermission(vXResource, AppConstants.XA_PERM_TYPE_UNKNOWN);
Assert.assertNotNull(resp);
Assert.assertEquals(VXResponse.STATUS_SUCCESS, resp.getStatusCode());
}
Aggregations