use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class RangerTagResourceMapService method postUpdate.
@Override
public RangerTagResourceMap postUpdate(XXTagResourceMap tagResMap) {
RangerTagResourceMap ret = super.postUpdate(tagResMap);
daoMgr.getXXServiceVersionInfo().updateServiceVersionInfoForServiceResourceUpdate(tagResMap.getResourceId(), tagResMap.getUpdateTime());
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test43deleteTagResourceMap.
@Test
public void test43deleteTagResourceMap() {
RangerTagResourceMap oldTagResourceMap = new RangerTagResourceMap();
oldTagResourceMap.setId(id);
try {
Mockito.when(validator.preDeleteTagResourceMap(tagGuid, resourceGuid)).thenReturn(oldTagResourceMap);
} catch (Exception e) {
}
try {
Mockito.doNothing().when(tagStore).deleteTagResourceMap(oldTagResourceMap.getId());
} catch (Exception e) {
}
tagREST.deleteTagResourceMap(tagGuid, resourceGuid);
try {
Mockito.verify(validator).preDeleteTagResourceMap(tagGuid, resourceGuid);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test61deleteServiceResourceByGuid.
@Test
public void test61deleteServiceResourceByGuid() {
RangerServiceResource oldRSR = new RangerServiceResource();
oldRSR.setId(id);
oldRSR.setGuid(gId);
List<RangerTagResourceMap> tagResourceMaps = new ArrayList<RangerTagResourceMap>();
try {
Mockito.when(validator.preDeleteServiceResourceByGuid(gId, true)).thenReturn(oldRSR);
} catch (Exception e) {
}
try {
Mockito.when(tagStore.getTagResourceMapsForResourceGuid(oldRSR.getGuid())).thenReturn(tagResourceMaps);
} catch (Exception e) {
}
tagREST.deleteServiceResourceByGuid(gId, true);
try {
Mockito.verify(validator).preDeleteServiceResourceByGuid(gId, true);
} catch (Exception e) {
}
try {
Mockito.verify(tagStore).getTagResourceMapsForResourceGuid(oldRSR.getGuid());
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test46getTagResourceMap.
@Test
public void test46getTagResourceMap() {
RangerTagResourceMap oldTagResourceMap = new RangerTagResourceMap();
oldTagResourceMap.setId(id);
oldTagResourceMap.setTagId(id);
try {
Mockito.when(tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid)).thenReturn(oldTagResourceMap);
} catch (Exception e) {
}
RangerTagResourceMap rangerTagResourceMap = tagREST.getTagResourceMap(tagGuid, resourceGuid);
Assert.assertNotNull(rangerTagResourceMap.getId());
Assert.assertEquals(rangerTagResourceMap.getId(), oldTagResourceMap.getId());
Assert.assertEquals(rangerTagResourceMap.getTagId(), oldTagResourceMap.getTagId());
try {
Mockito.verify(tagStore).getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test39createTagResourceMap.
@Test
public void test39createTagResourceMap() {
RangerTagResourceMap oldTagResourceMap = new RangerTagResourceMap();
try {
Mockito.when(tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid)).thenReturn(oldTagResourceMap);
} catch (Exception e) {
}
Mockito.when(restErrorUtil.createRESTException(Mockito.anyInt(), Mockito.anyString(), Mockito.anyBoolean())).thenThrow(new WebApplicationException());
thrown.expect(WebApplicationException.class);
tagREST.createTagResourceMap(tagGuid, resourceGuid, false);
try {
Mockito.verify(tagStore).getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid);
} catch (Exception e) {
}
Mockito.verify(restErrorUtil).createRESTException(Mockito.anyInt(), Mockito.anyString(), Mockito.anyBoolean());
}
Aggregations