use of org.apache.ranger.view.VXPermMap in project ranger by apache.
the class TestXUserREST method test38getXPermMapVXResourceNull.
@Test
public void test38getXPermMapVXResourceNull() throws Exception {
VXPermMap permMap = testcreateXPermMap();
Mockito.when(xUserMgr.getXPermMap(id)).thenReturn(permMap);
Mockito.when(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any())).thenThrow(new WebApplicationException());
thrown.expect(WebApplicationException.class);
VXPermMap retVxGroup = xUserRest.getXPermMap(id);
Mockito.verify(xUserMgr).getXPermMap(id);
Mockito.verify(xResourceService).readResource(null);
Mockito.verify(restErrorUtil).createRESTException(Mockito.anyString(), (MessageEnums) Mockito.any());
assertEquals(permMap.getId(), retVxGroup.getId());
assertEquals(permMap.getClass(), retVxGroup.getClass());
assertNotNull(retVxGroup);
}
use of org.apache.ranger.view.VXPermMap in project ranger by apache.
the class TestXUserREST method test44updateXPermMap.
@Test
public void test44updateXPermMap() {
VXPermMap permMap = testcreateXPermMap();
VXResource testVxResource = new VXResource();
Mockito.when(xResourceService.readResource(id)).thenReturn(testVxResource);
Mockito.when(xUserMgr.updateXPermMap(permMap)).thenReturn(permMap);
VXPermMap retVxGroup = xUserRest.updateXPermMap(permMap);
assertEquals(permMap.getId(), retVxGroup.getId());
assertEquals(permMap.getClass(), retVxGroup.getClass());
assertNotNull(retVxGroup);
Mockito.verify(xUserMgr).updateXPermMap(permMap);
Mockito.verify(xResourceService).readResource(permMap.getResourceId());
}
use of org.apache.ranger.view.VXPermMap in project ranger by apache.
the class TestXUserREST method test43createXPermMapNullVXResource.
@Test
public void test43createXPermMapNullVXResource() {
VXPermMap permMap = testcreateXPermMap();
permMap.setResourceId(null);
Mockito.when(xUserMgr.createXPermMap(permMap)).thenReturn(permMap);
VXResource testVxResource = new VXResource();
Mockito.when(xResourceService.readResource(permMap.getResourceId())).thenReturn(testVxResource);
VXPermMap retVxGroup = xUserRest.createXPermMap(permMap);
assertEquals(permMap.getId(), retVxGroup.getId());
assertEquals(permMap.getClass(), retVxGroup.getClass());
assertNotNull(retVxGroup);
Mockito.verify(xUserMgr).createXPermMap(permMap);
Mockito.verify(xResourceService).readResource(permMap.getResourceId());
}
use of org.apache.ranger.view.VXPermMap in project ranger by apache.
the class TestXUserREST method test39getXPermMapNotNull.
@Test
public void test39getXPermMapNotNull() throws Exception {
VXPermMap permMap = testcreateXPermMap();
Mockito.when(xUserMgr.getXPermMap(id)).thenReturn(permMap);
VXResource testVxResource = new VXResource();
Mockito.when(xResourceService.readResource(id)).thenReturn(testVxResource);
VXPermMap retVxGroup = xUserRest.getXPermMap(id);
assertEquals(permMap.getId(), retVxGroup.getId());
assertEquals(permMap.getClass(), retVxGroup.getClass());
assertNotNull(retVxGroup);
Mockito.verify(xUserMgr).getXPermMap(id);
Mockito.verify(xResourceService).readResource(id);
}
use of org.apache.ranger.view.VXPermMap in project ranger by apache.
the class TestXUserREST method test40getXPermMapNull.
@Test
public void test40getXPermMapNull() {
Mockito.when(xUserMgr.getXPermMap(id)).thenReturn(null);
VXPermMap retVxGroup = xUserRest.getXPermMap(id);
assertNull(retVxGroup);
Mockito.verify(xUserMgr).getXPermMap(id);
}
Aggregations