Search in sources :

Example 1 with RangerContextEnricherDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef in project ranger by apache.

the class TestRangerServiceDefService method rangerServiceDef.

private RangerServiceDef rangerServiceDef() {
    List<RangerServiceConfigDef> configs = new ArrayList<RangerServiceConfigDef>();
    List<RangerResourceDef> resources = new ArrayList<RangerResourceDef>();
    List<RangerAccessTypeDef> accessTypes = new ArrayList<RangerAccessTypeDef>();
    List<RangerPolicyConditionDef> policyConditions = new ArrayList<RangerPolicyConditionDef>();
    List<RangerContextEnricherDef> contextEnrichers = new ArrayList<RangerContextEnricherDef>();
    List<RangerEnumDef> enums = new ArrayList<RangerEnumDef>();
    RangerServiceDef rangerServiceDef = new RangerServiceDef();
    rangerServiceDef.setId(Id);
    rangerServiceDef.setImplClass("RangerServiceHdfs");
    rangerServiceDef.setLabel("HDFS Repository");
    rangerServiceDef.setDescription("HDFS Repository");
    rangerServiceDef.setRbKeyDescription(null);
    rangerServiceDef.setUpdatedBy("Admin");
    rangerServiceDef.setUpdateTime(new Date());
    rangerServiceDef.setConfigs(configs);
    rangerServiceDef.setResources(resources);
    rangerServiceDef.setAccessTypes(accessTypes);
    rangerServiceDef.setPolicyConditions(policyConditions);
    rangerServiceDef.setContextEnrichers(contextEnrichers);
    rangerServiceDef.setEnums(enums);
    return rangerServiceDef;
}
Also used : RangerServiceConfigDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerServiceConfigDef) ArrayList(java.util.ArrayList) RangerEnumDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerEnumDef) RangerPolicyConditionDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef) Date(java.util.Date) RangerAccessTypeDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerAccessTypeDef) RangerContextEnricherDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef) RangerServiceDef(org.apache.ranger.plugin.model.RangerServiceDef) RangerResourceDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerResourceDef)

Example 2 with RangerContextEnricherDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef in project ranger by apache.

the class TestRangerServiceDefServiceBase method test15populateXXToRangerContextEnricherDef.

@Test
public void test15populateXXToRangerContextEnricherDef() {
    XXContextEnricherDef contextEnricherDefObj = new XXContextEnricherDef();
    contextEnricherDefObj.setAddedByUserId(Id);
    contextEnricherDefObj.setCreateTime(new Date());
    contextEnricherDefObj.setDefid(Id);
    contextEnricherDefObj.setId(Id);
    contextEnricherDefObj.setName("country-provider");
    contextEnricherDefObj.setEnricherOptions("contextName=COUNTRY;dataFile=/etc/ranger/data/userCountry.properties");
    contextEnricherDefObj.setEnricher("RangerCountryProvider");
    contextEnricherDefObj.setOrder(null);
    contextEnricherDefObj.setUpdatedByUserId(Id);
    contextEnricherDefObj.setUpdateTime(new Date());
    RangerContextEnricherDef dbRangerContextEnricherDef = rangerServiceDefService.populateXXToRangerContextEnricherDef(contextEnricherDefObj);
    Assert.assertNotNull(dbRangerContextEnricherDef);
    Assert.assertEquals(dbRangerContextEnricherDef.getEnricher(), contextEnricherDefObj.getEnricher());
    Assert.assertEquals(dbRangerContextEnricherDef.getName(), contextEnricherDefObj.getName());
}
Also used : RangerContextEnricherDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef) XXContextEnricherDef(org.apache.ranger.entity.XXContextEnricherDef) Date(java.util.Date) Test(org.junit.Test)

Example 3 with RangerContextEnricherDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef in project ranger by apache.

the class TestRangerServiceDefServiceBase method test13populateRangerContextEnricherDefToXX.

@Test
public void test13populateRangerContextEnricherDefToXX() {
    RangerContextEnricherDef rangerContextEnricherDefObj = new RangerContextEnricherDef();
    rangerContextEnricherDefObj.setName("country-provider");
    rangerContextEnricherDefObj.setEnricher("RangerCountryProvider");
    XXContextEnricherDef contextEnricherDefObj = new XXContextEnricherDef();
    contextEnricherDefObj.setAddedByUserId(Id);
    contextEnricherDefObj.setCreateTime(new Date());
    contextEnricherDefObj.setDefid(Id);
    contextEnricherDefObj.setId(Id);
    contextEnricherDefObj.setName("country-provider");
    contextEnricherDefObj.setEnricherOptions("contextName=COUNTRY;dataFile=/etc/ranger/data/userCountry.properties");
    contextEnricherDefObj.setEnricher("RangerCountryProvider");
    contextEnricherDefObj.setOrder(null);
    contextEnricherDefObj.setUpdatedByUserId(Id);
    contextEnricherDefObj.setUpdateTime(new Date());
    XXServiceDef serviceDefObj = new XXServiceDef();
    serviceDefObj.setAddedByUserId(Id);
    serviceDefObj.setCreateTime(new Date());
    serviceDefObj.setDescription("HDFS Repository");
    serviceDefObj.setGuid("1427365526516_835_0");
    serviceDefObj.setId(Id);
    Mockito.when((XXContextEnricherDef) rangerAuditFields.populateAuditFields(contextEnricherDefObj, serviceDefObj)).thenReturn(contextEnricherDefObj);
    XXContextEnricherDef dbContextEnricherDef = rangerServiceDefService.populateRangerContextEnricherDefToXX(rangerContextEnricherDefObj, contextEnricherDefObj, serviceDefObj, 1);
    Assert.assertNotNull(dbContextEnricherDef);
    Assert.assertEquals(dbContextEnricherDef.getEnricher(), contextEnricherDefObj.getEnricher());
    Assert.assertEquals(dbContextEnricherDef.getEnricherOptions(), contextEnricherDefObj.getEnricherOptions());
    Assert.assertEquals(dbContextEnricherDef.getName(), contextEnricherDefObj.getName());
    Assert.assertEquals(dbContextEnricherDef.getCreateTime(), contextEnricherDefObj.getCreateTime());
    Assert.assertEquals(dbContextEnricherDef.getId(), contextEnricherDefObj.getId());
    Assert.assertEquals(dbContextEnricherDef.getOrder(), contextEnricherDefObj.getOrder());
    Assert.assertEquals(dbContextEnricherDef.getUpdatedByUserId(), contextEnricherDefObj.getUpdatedByUserId());
    Assert.assertEquals(dbContextEnricherDef.getUpdateTime(), contextEnricherDefObj.getUpdateTime());
}
Also used : XXServiceDef(org.apache.ranger.entity.XXServiceDef) RangerContextEnricherDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef) XXContextEnricherDef(org.apache.ranger.entity.XXContextEnricherDef) Date(java.util.Date) Test(org.junit.Test)

Example 4 with RangerContextEnricherDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef in project ranger by apache.

the class TestAssetREST method rangerServiceDef.

private RangerServiceDef rangerServiceDef() {
    List<RangerServiceConfigDef> configs = new ArrayList<RangerServiceConfigDef>();
    List<RangerResourceDef> resources = new ArrayList<RangerResourceDef>();
    List<RangerAccessTypeDef> accessTypes = new ArrayList<RangerAccessTypeDef>();
    List<RangerPolicyConditionDef> policyConditions = new ArrayList<RangerPolicyConditionDef>();
    List<RangerContextEnricherDef> contextEnrichers = new ArrayList<RangerContextEnricherDef>();
    List<RangerEnumDef> enums = new ArrayList<RangerEnumDef>();
    RangerServiceDef rangerServiceDef = new RangerServiceDef();
    rangerServiceDef.setId(Id);
    rangerServiceDef.setImplClass("RangerServiceHdfs");
    rangerServiceDef.setLabel("HDFS Repository");
    rangerServiceDef.setDescription("HDFS Repository");
    rangerServiceDef.setRbKeyDescription(null);
    rangerServiceDef.setUpdatedBy("Admin");
    rangerServiceDef.setUpdateTime(new Date());
    rangerServiceDef.setConfigs(configs);
    rangerServiceDef.setResources(resources);
    rangerServiceDef.setAccessTypes(accessTypes);
    rangerServiceDef.setPolicyConditions(policyConditions);
    rangerServiceDef.setContextEnrichers(contextEnrichers);
    rangerServiceDef.setEnums(enums);
    return rangerServiceDef;
}
Also used : RangerServiceConfigDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerServiceConfigDef) ArrayList(java.util.ArrayList) RangerEnumDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerEnumDef) RangerPolicyConditionDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef) Date(java.util.Date) RangerAccessTypeDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerAccessTypeDef) RangerContextEnricherDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef) RangerServiceDef(org.apache.ranger.plugin.model.RangerServiceDef) RangerResourceDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerResourceDef)

Example 5 with RangerContextEnricherDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef in project ranger by apache.

the class TestPublicAPIsv2 method rangerServiceDef.

private RangerServiceDef rangerServiceDef() {
    List<RangerServiceConfigDef> configs = new ArrayList<RangerServiceConfigDef>();
    List<RangerResourceDef> resources = new ArrayList<RangerResourceDef>();
    List<RangerAccessTypeDef> accessTypes = new ArrayList<RangerAccessTypeDef>();
    List<RangerPolicyConditionDef> policyConditions = new ArrayList<RangerPolicyConditionDef>();
    List<RangerContextEnricherDef> contextEnrichers = new ArrayList<RangerContextEnricherDef>();
    List<RangerEnumDef> enums = new ArrayList<RangerEnumDef>();
    RangerServiceDef rangerServiceDef = new RangerServiceDef();
    rangerServiceDef.setId(Id);
    rangerServiceDef.setName("RangerServiceHdfs");
    rangerServiceDef.setImplClass("RangerServiceHdfs");
    rangerServiceDef.setLabel("HDFS Repository");
    rangerServiceDef.setDescription("HDFS Repository");
    rangerServiceDef.setRbKeyDescription(null);
    rangerServiceDef.setUpdatedBy("Admin");
    rangerServiceDef.setUpdateTime(new Date());
    rangerServiceDef.setConfigs(configs);
    rangerServiceDef.setResources(resources);
    rangerServiceDef.setAccessTypes(accessTypes);
    rangerServiceDef.setPolicyConditions(policyConditions);
    rangerServiceDef.setContextEnrichers(contextEnrichers);
    rangerServiceDef.setEnums(enums);
    return rangerServiceDef;
}
Also used : RangerServiceConfigDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerServiceConfigDef) ArrayList(java.util.ArrayList) RangerEnumDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerEnumDef) RangerPolicyConditionDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef) Date(java.util.Date) RangerAccessTypeDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerAccessTypeDef) RangerContextEnricherDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef) RangerServiceDef(org.apache.ranger.plugin.model.RangerServiceDef) RangerResourceDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerResourceDef)

Aggregations

RangerContextEnricherDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef)15 RangerAccessTypeDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerAccessTypeDef)10 RangerEnumDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerEnumDef)10 RangerPolicyConditionDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef)10 RangerResourceDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerResourceDef)10 RangerServiceConfigDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerServiceConfigDef)10 Date (java.util.Date)9 RangerServiceDef (org.apache.ranger.plugin.model.RangerServiceDef)9 ArrayList (java.util.ArrayList)8 XXContextEnricherDef (org.apache.ranger.entity.XXContextEnricherDef)5 XXServiceDef (org.apache.ranger.entity.XXServiceDef)4 RangerDataMaskDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerDataMaskDef)3 RangerDataMaskTypeDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerDataMaskTypeDef)3 RangerRowFilterDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerRowFilterDef)3 VXString (org.apache.ranger.view.VXString)3 XXAccessTypeDefDao (org.apache.ranger.db.XXAccessTypeDefDao)2 XXAccessTypeDefGrantsDao (org.apache.ranger.db.XXAccessTypeDefGrantsDao)2 XXContextEnricherDefDao (org.apache.ranger.db.XXContextEnricherDefDao)2 XXDataMaskTypeDefDao (org.apache.ranger.db.XXDataMaskTypeDefDao)2 XXEnumDefDao (org.apache.ranger.db.XXEnumDefDao)2