use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test41deleteTagResourceMap.
@Test
public void test41deleteTagResourceMap() {
RangerTagResourceMap oldTagResourceMap = new RangerTagResourceMap();
oldTagResourceMap.setId(id);
try {
Mockito.when(validator.preDeleteTagResourceMap(id)).thenReturn(oldTagResourceMap);
} catch (Exception e) {
}
try {
Mockito.doNothing().when(tagStore).deleteTagResourceMap(id);
} catch (Exception e) {
}
tagREST.deleteTagResourceMap(id);
Assert.assertNotNull(oldTagResourceMap.getId());
try {
Mockito.verify(validator).preDeleteTagResourceMap(id);
} catch (Exception e) {
}
try {
Mockito.verify(tagStore).deleteTagResourceMap(id);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test44getTagResourceMap.
@Test
public void test44getTagResourceMap() {
RangerTagResourceMap oldTagResourceMap = new RangerTagResourceMap();
oldTagResourceMap.setId(id);
oldTagResourceMap.setGuid(gId);
try {
Mockito.when(tagStore.getTagResourceMap(id)).thenReturn(oldTagResourceMap);
} catch (Exception e) {
}
RangerTagResourceMap rangerTagResourceMap = tagREST.getTagResourceMap(id);
Assert.assertNotNull(rangerTagResourceMap.getId());
Assert.assertEquals(rangerTagResourceMap.getId(), oldTagResourceMap.getId());
Assert.assertEquals(rangerTagResourceMap.getGuid(), oldTagResourceMap.getGuid());
try {
Mockito.verify(tagStore).getTagResourceMap(id);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test48deleteServiceResourceByGuid.
@Test
public void test48deleteServiceResourceByGuid() {
RangerServiceResource oldRSR = new RangerServiceResource();
oldRSR.setId(id);
oldRSR.setGuid(gId);
List<RangerTagResourceMap> tagResourceMaps = new ArrayList<RangerTagResourceMap>();
RangerTagResourceMap rangerTagResourceMap = new RangerTagResourceMap();
rangerTagResourceMap.setId(id);
rangerTagResourceMap.setTagId(id);
tagResourceMaps.add(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 test45getTagResourceMapByGuid.
@Test
public void test45getTagResourceMapByGuid() {
RangerTagResourceMap oldTagResourceMap = new RangerTagResourceMap();
oldTagResourceMap.setId(id);
oldTagResourceMap.setGuid(gId);
try {
Mockito.when(tagStore.getTagResourceMapByGuid(gId)).thenReturn(oldTagResourceMap);
} catch (Exception e) {
}
RangerTagResourceMap rangerTagResourceMap = tagREST.getTagResourceMapByGuid(gId);
Assert.assertNotNull(rangerTagResourceMap.getId());
Assert.assertEquals(rangerTagResourceMap.getId(), oldTagResourceMap.getId());
Assert.assertEquals(rangerTagResourceMap.getGuid(), oldTagResourceMap.getGuid());
try {
Mockito.verify(tagStore).getTagResourceMapByGuid(gId);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagResourceMap in project ranger by apache.
the class TestTagREST method test47getAllTagResourceMaps.
@Test
public void test47getAllTagResourceMaps() {
List<RangerTagResourceMap> ret = new ArrayList<RangerTagResourceMap>();
RangerTagResourceMap rangerTagResourceMap = new RangerTagResourceMap();
rangerTagResourceMap.setId(id);
rangerTagResourceMap.setTagId(id);
ret.add(rangerTagResourceMap);
try {
Mockito.when(tagStore.getTagResourceMaps((SearchFilter) Mockito.any())).thenReturn(ret);
} catch (Exception e) {
}
List<RangerTagResourceMap> result = tagREST.getAllTagResourceMaps();
Assert.assertNotNull(result.get(0).getId());
Assert.assertEquals(result.get(0).getId(), ret.get(0).getId());
Assert.assertEquals(result.get(0).getTagId(), ret.get(0).getTagId());
try {
Mockito.verify(tagStore).getTagResourceMaps((SearchFilter) Mockito.any());
} catch (Exception e) {
}
}
Aggregations