Search in sources :

Example 1 with RangerPolicyConditionDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef 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 RangerPolicyConditionDef

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

the class TestRangerServiceDefServiceBase method test11populateRangerPolicyConditionDefToXXnullValue.

@Test
public void test11populateRangerPolicyConditionDefToXXnullValue() {
    RangerPolicyConditionDef rangerConditionDefvObj = null;
    XXPolicyConditionDef policyConditionDefObj = null;
    XXServiceDef serviceDefObj = null;
    Mockito.when(restErrorUtil.createRESTException("RangerServiceDef cannot be null.", MessageEnums.DATA_NOT_FOUND)).thenThrow(new WebApplicationException());
    thrown.expect(WebApplicationException.class);
    XXPolicyConditionDef dbPolicyConditionDef = rangerServiceDefService.populateRangerPolicyConditionDefToXX(rangerConditionDefvObj, policyConditionDefObj, serviceDefObj, 1);
    Assert.assertNull(dbPolicyConditionDef);
}
Also used : XXServiceDef(org.apache.ranger.entity.XXServiceDef) XXPolicyConditionDef(org.apache.ranger.entity.XXPolicyConditionDef) WebApplicationException(javax.ws.rs.WebApplicationException) RangerPolicyConditionDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef) Test(org.junit.Test)

Example 3 with RangerPolicyConditionDef

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

the class TestRangerServiceDefServiceBase method test12populateXXToRangerPolicyConditionDef.

@Test
public void test12populateXXToRangerPolicyConditionDef() {
    XXPolicyConditionDef policyConditionDefObj = new XXPolicyConditionDef();
    policyConditionDefObj.setAddedByUserId(Id);
    policyConditionDefObj.setCreateTime(new Date());
    policyConditionDefObj.setDefid(Id);
    policyConditionDefObj.setDescription("policy");
    policyConditionDefObj.setId(Id);
    policyConditionDefObj.setName("country");
    policyConditionDefObj.setOrder(0);
    policyConditionDefObj.setUpdatedByUserId(Id);
    policyConditionDefObj.setUpdateTime(new Date());
    RangerPolicyConditionDef dbRangerPolicyConditionDef = rangerServiceDefService.populateXXToRangerPolicyConditionDef(policyConditionDefObj);
    Assert.assertNotNull(dbRangerPolicyConditionDef);
    Assert.assertEquals(dbRangerPolicyConditionDef.getName(), policyConditionDefObj.getName());
    Assert.assertEquals(dbRangerPolicyConditionDef.getDescription(), policyConditionDefObj.getDescription());
    Assert.assertEquals(dbRangerPolicyConditionDef.getEvaluator(), policyConditionDefObj.getEvaluator());
    Assert.assertEquals(dbRangerPolicyConditionDef.getLabel(), policyConditionDefObj.getLabel());
}
Also used : XXPolicyConditionDef(org.apache.ranger.entity.XXPolicyConditionDef) RangerPolicyConditionDef(org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef) Date(java.util.Date) Test(org.junit.Test)

Example 4 with RangerPolicyConditionDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef 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 RangerPolicyConditionDef

use of org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef 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

RangerPolicyConditionDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerPolicyConditionDef)22 RangerServiceDef (org.apache.ranger.plugin.model.RangerServiceDef)10 RangerAccessTypeDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerAccessTypeDef)10 RangerContextEnricherDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerContextEnricherDef)10 RangerEnumDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerEnumDef)10 RangerResourceDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerResourceDef)10 RangerServiceConfigDef (org.apache.ranger.plugin.model.RangerServiceDef.RangerServiceConfigDef)10 ArrayList (java.util.ArrayList)9 Date (java.util.Date)8 XXPolicyConditionDef (org.apache.ranger.entity.XXPolicyConditionDef)5 XXServiceDef (org.apache.ranger.entity.XXServiceDef)4 Test (org.junit.Test)4 RangerPolicyItemCondition (org.apache.ranger.plugin.model.RangerPolicy.RangerPolicyItemCondition)3 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 HashSet (java.util.HashSet)2 XXAccessTypeDefDao (org.apache.ranger.db.XXAccessTypeDefDao)2 XXAccessTypeDefGrantsDao (org.apache.ranger.db.XXAccessTypeDefGrantsDao)2