use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.
the class TestKafkaResourceMapper method testKafkaResourceFromOnlyClusterName.
@Test
public void testKafkaResourceFromOnlyClusterName() throws Exception {
Map<String, Object> entAttribs = new HashMap<String, Object>();
entAttribs.put(AtlasKafkaResourceMapper.ENTITY_ATTRIBUTE_QUALIFIED_NAME, CLUSTER_NAME);
RangerAtlasEntity entity = getKafkaTopicEntity(entAttribs);
try {
RangerServiceResource resource = resourceMapper.buildResource(entity);
Assert.fail("expected exception. Found " + resource);
} catch (Exception excp) {
// ignore
}
}
use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.
the class AtlasNotificationMapper method buildServiceTagsForEntityDeleteNotification.
@SuppressWarnings("unchecked")
private static ServiceTags buildServiceTagsForEntityDeleteNotification(RangerAtlasEntityWithTags entityWithTags) {
final ServiceTags ret;
RangerAtlasEntity entity = entityWithTags.getEntity();
String guid = entity.getGuid();
if (StringUtils.isNotBlank(guid)) {
ret = new ServiceTags();
RangerServiceResource serviceResource = new RangerServiceResource();
serviceResource.setGuid(guid);
ret.getServiceResources().add(serviceResource);
} else {
ret = buildServiceTags(entityWithTags, null);
if (ret != null) {
// tag-definitions should NOT be deleted as part of service-resource delete
ret.setTagDefinitions(MapUtils.EMPTY_MAP);
// Ranger deletes tags associated with deleted service-resource
ret.setTags(MapUtils.EMPTY_MAP);
}
}
if (ret != null) {
ret.setOp(ServiceTags.OP_DELETE);
}
return ret;
}
use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.
the class TestHbaseResourceMapper method getHbaseColumnEntity.
private RangerAtlasEntity getHbaseColumnEntity(Map<String, Object> entAttribs) throws Exception {
RangerAtlasEntity entity = Mockito.mock(RangerAtlasEntity.class);
Mockito.when(entity.getTypeName()).thenReturn(AtlasHbaseResourceMapper.ENTITY_TYPE_HBASE_COLUMN);
Mockito.when(entity.getAttributes()).thenReturn(entAttribs);
return entity;
}
use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.
the class TestHbaseResourceMapper method getHbaseTableEntity.
private RangerAtlasEntity getHbaseTableEntity(Map<String, Object> entAttribs) throws Exception {
RangerAtlasEntity entity = Mockito.mock(RangerAtlasEntity.class);
Mockito.when(entity.getTypeName()).thenReturn(AtlasHbaseResourceMapper.ENTITY_TYPE_HBASE_TABLE);
Mockito.when(entity.getAttributes()).thenReturn(entAttribs);
return entity;
}
use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.
the class TestHbaseResourceMapper method testHbaseDottedColumn.
@Test
public void testHbaseDottedColumn() throws Exception {
Map<String, Object> entAttribs = new HashMap<String, Object>();
entAttribs.put(ENTITY_ATTRIBUTE_QUALIFIED_NAME, DOTTED_COLUMN_QUALIFIED_NAME);
RangerAtlasEntity entity = getHbaseColumnEntity(entAttribs);
RangerServiceResource resource = resourceMapper.buildResource(entity);
assertColumnResource(resource, true);
}
Aggregations