Search in sources :

Example 41 with RangerServiceResource

use of org.apache.ranger.plugin.model.RangerServiceResource in project ranger by apache.

the class TestHbaseResourceMapper method testHbaseDottedTable.

@Test
public void testHbaseDottedTable() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    entAttribs.put(ENTITY_ATTRIBUTE_QUALIFIED_NAME, DOTTED_TABLE_QUALIFIED_NAME);
    RangerAtlasEntity entity = getHbaseTableEntity(entAttribs);
    RangerServiceResource resource = resourceMapper.buildResource(entity);
    assertTableResource(resource, true);
}
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 42 with RangerServiceResource

use of org.apache.ranger.plugin.model.RangerServiceResource in project ranger by apache.

the class TestHbaseResourceMapper method testHbaseDottedColumnFamily.

@Test
public void testHbaseDottedColumnFamily() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    entAttribs.put(ENTITY_ATTRIBUTE_QUALIFIED_NAME, DOTTED_COLUMN_FAMILY_QUALIFIED_NAME);
    RangerAtlasEntity entity = getHbaseColumnFamilyEntity(entAttribs);
    RangerServiceResource resource = resourceMapper.buildResource(entity);
    assertColumnFamilyResource(resource, true);
}
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 43 with RangerServiceResource

use of org.apache.ranger.plugin.model.RangerServiceResource in project ranger by apache.

the class TestHbaseResourceMapper method testHbaseColumn.

@Test
public void testHbaseColumn() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    entAttribs.put(ENTITY_ATTRIBUTE_QUALIFIED_NAME, COLUMN_QUALIFIED_NAME);
    RangerAtlasEntity entity = getHbaseColumnEntity(entAttribs);
    RangerServiceResource resource = resourceMapper.buildResource(entity);
    assertColumnResource(resource, false);
}
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 44 with RangerServiceResource

use of org.apache.ranger.plugin.model.RangerServiceResource in project ranger by apache.

the class TestHbaseResourceMapper method testHbaseTable.

@Test
public void testHbaseTable() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    entAttribs.put(ENTITY_ATTRIBUTE_QUALIFIED_NAME, TABLE_QUALIFIED_NAME);
    RangerAtlasEntity entity = getHbaseTableEntity(entAttribs);
    RangerServiceResource resource = resourceMapper.buildResource(entity);
    assertTableResource(resource, false);
}
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 45 with RangerServiceResource

use of org.apache.ranger.plugin.model.RangerServiceResource in project ranger by apache.

the class TestHbaseResourceMapper method testHbaseResourceFromMissingAttribs.

@Test
public void testHbaseResourceFromMissingAttribs() throws Exception {
    Map<String, Object> entAttribs = new HashMap<String, Object>();
    RangerAtlasEntity entity = getHbaseTableEntity(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

RangerServiceResource (org.apache.ranger.plugin.model.RangerServiceResource)65 Test (org.junit.Test)42 HashMap (java.util.HashMap)37 RangerAtlasEntity (org.apache.ranger.tagsync.source.atlasrest.RangerAtlasEntity)30 WebApplicationException (javax.ws.rs.WebApplicationException)17 ExpectedException (org.junit.rules.ExpectedException)14 ArrayList (java.util.ArrayList)10 RangerTagResourceMap (org.apache.ranger.plugin.model.RangerTagResourceMap)7 RangerPolicyResource (org.apache.ranger.plugin.model.RangerPolicy.RangerPolicyResource)5 Predicate (org.apache.commons.collections.Predicate)4 XXServiceResource (org.apache.ranger.entity.XXServiceResource)4 RangerTag (org.apache.ranger.plugin.model.RangerTag)4 Map (java.util.Map)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 RangerTagDef (org.apache.ranger.plugin.model.RangerTagDef)3 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)3 PUT (javax.ws.rs.PUT)2 RangerPolicy (org.apache.ranger.plugin.model.RangerPolicy)2 RangerServiceResourceSignature (org.apache.ranger.plugin.store.RangerServiceResourceSignature)2