use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestRangerBizUtil method testHasPermission_When_disableAccessControl.
@Test
public void testHasPermission_When_disableAccessControl() {
VXResource vXResource = null;
rangerBizUtil.enableResourceAccessControl = false;
VXResponse resp = rangerBizUtil.hasPermission(vXResource, AppConstants.XA_PERM_TYPE_UNKNOWN);
Assert.assertNotNull(resp);
}
use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestAssetREST method testUpdateXResource.
@Test
public void testUpdateXResource() {
VXResource vxResource = vxResource(Id);
RangerPolicy rangerPolicy = rangerPolicy(Id);
RangerService rangerService = rangerService(Id);
Mockito.when(serviceREST.getService(vxResource.getAssetId())).thenReturn(rangerService);
Mockito.when(serviceREST.updatePolicy(rangerPolicy)).thenReturn(rangerPolicy);
Mockito.when(serviceUtil.toRangerPolicy(vxResource, rangerService)).thenReturn(rangerPolicy);
Mockito.when(serviceUtil.toVXResource(rangerPolicy, rangerService)).thenReturn(vxResource);
VXResource actualvxResource = assetREST.updateXResource(vxResource);
Assert.assertNotNull(actualvxResource);
Assert.assertEquals(vxResource, actualvxResource);
Mockito.verify(serviceREST).getService(vxResource.getAssetId());
Mockito.verify(serviceREST).updatePolicy(rangerPolicy);
Mockito.verify(serviceUtil).toRangerPolicy(vxResource, rangerService);
Mockito.verify(serviceUtil).toVXResource(rangerPolicy, rangerService);
}
use of org.apache.ranger.view.VXResource in project ranger by apache.
the class TestAssetREST method testGetXResource.
@Test
public void testGetXResource() {
VXResource expectedvxResource = vxResource(Id);
RangerPolicy rangerPolicy = rangerPolicy(Id);
RangerService rangerService = rangerService(Id);
Mockito.when(serviceREST.getPolicy(Id)).thenReturn(rangerPolicy);
Mockito.when(serviceREST.getServiceByName(rangerPolicy.getService())).thenReturn(rangerService);
Mockito.when(serviceUtil.toVXResource(rangerPolicy, rangerService)).thenReturn(expectedvxResource);
VXResource actualvxResource = assetREST.getXResource(Id);
Assert.assertNotNull(actualvxResource);
Assert.assertEquals(expectedvxResource, actualvxResource);
}
Aggregations