Search in sources :

Example 11 with RangerAtlasEntity

use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.

the class TestHiveResourceMapper method getHiveDbEntity.

private RangerAtlasEntity getHiveDbEntity(Map<String, Object> entAttribs) throws Exception {
    RangerAtlasEntity entity = Mockito.mock(RangerAtlasEntity.class);
    Mockito.when(entity.getTypeName()).thenReturn(AtlasHiveResourceMapper.ENTITY_TYPE_HIVE_DB);
    Mockito.when(entity.getAttributes()).thenReturn(entAttribs);
    return entity;
}
Also used : RangerAtlasEntity(org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity)

Example 12 with RangerAtlasEntity

use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.

the class TestHiveResourceMapper method getHiveColumnEntity.

private RangerAtlasEntity getHiveColumnEntity(Map<String, Object> entAttribs) throws Exception {
    RangerAtlasEntity entity = Mockito.mock(RangerAtlasEntity.class);
    Mockito.when(entity.getTypeName()).thenReturn(AtlasHiveResourceMapper.ENTITY_TYPE_HIVE_COLUMN);
    Mockito.when(entity.getAttributes()).thenReturn(entAttribs);
    return entity;
}
Also used : RangerAtlasEntity(org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity)

Example 13 with RangerAtlasEntity

use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.

the class TestHiveResourceMapper method testHiveResourceFromMissingAttribs.

@Test
public void testHiveResourceFromMissingAttribs() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    RangerAtlasEntity entity = getHiveDbEntity(entAttribs);
    try {
        RangerServiceResource resource = resourceMapper.buildResource(entity);
        Assert.fail("expected exception. Found " + resource);
    } catch (Exception excp) {
    // ignore
    }
}
Also used : RangerAtlasEntity(org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity) HashMap(java.util.HashMap) RangerServiceResource(org.apache.ranger.plugin.model.RangerServiceResource) Test(org.junit.Test)

Example 14 with RangerAtlasEntity

use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.

the class TestKafkaResourceMapper method testKafkaResourceFromQualifiedName.

@Test
public void testKafkaResourceFromQualifiedName() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    entAttribs.put(AtlasKafkaResourceMapper.ENTITY_ATTRIBUTE_QUALIFIED_NAME, QUALIFIED_NAME);
    RangerAtlasEntity entity = getKafkaTopicEntity(entAttribs);
    RangerServiceResource resource = resourceMapper.buildResource(entity);
    assertServiceResource(resource);
}
Also used : RangerAtlasEntity(org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity) HashMap(java.util.HashMap) RangerServiceResource(org.apache.ranger.plugin.model.RangerServiceResource) Test(org.junit.Test)

Example 15 with RangerAtlasEntity

use of org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity in project ranger by apache.

the class TestKafkaResourceMapper method testKafkaResourceFromOnlyTopic.

@Test
public void testKafkaResourceFromOnlyTopic() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    entAttribs.put(AtlasKafkaResourceMapper.ENTITY_ATTRIBUTE_QUALIFIED_NAME, TOPIC);
    RangerAtlasEntity entity = getKafkaTopicEntity(entAttribs);
    try {
        RangerServiceResource resource = resourceMapper.buildResource(entity);
        Assert.fail("expected exception. Found " + resource);
    } catch (Exception excp) {
    // ignore
    }
}
Also used : RangerAtlasEntity(org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity) HashMap(java.util.HashMap) RangerServiceResource(org.apache.ranger.plugin.model.RangerServiceResource) Test(org.junit.Test)

Aggregations

RangerAtlasEntity (org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity)40 RangerServiceResource (org.apache.ranger.plugin.model.RangerServiceResource)30 HashMap (java.util.HashMap)29 Test (org.junit.Test)28 ServiceTags (org.apache.ranger.plugin.util.ServiceTags)3 RangerTagDef (org.apache.ranger.plugin.model.RangerTagDef)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 RangerTag (org.apache.ranger.plugin.model.RangerTag)1 RangerTagAttributeDef (org.apache.ranger.plugin.model.RangerTagDef.RangerTagAttributeDef)1 RangerAtlasEntityWithTags (org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntityWithTags)1