use of org.apache.ranger.entity.XXServiceDef in project ranger by apache.
the class TestRangerServiceDefServiceBase method test3populateRangerServiceConfigDefToXX.
@Test
public void test3populateRangerServiceConfigDefToXX() {
RangerServiceConfigDef serviceConfigDefObj = new RangerServiceConfigDef();
XXServiceConfigDef configDefObj = new XXServiceConfigDef();
XXServiceDef serviceDefObj = new XXServiceDef();
Mockito.when((XXServiceConfigDef) rangerAuditFields.populateAuditFields(configDefObj, serviceDefObj)).thenReturn(configDefObj);
XXServiceConfigDef dbServiceConfigDef = rangerServiceDefService.populateRangerServiceConfigDefToXX(serviceConfigDefObj, configDefObj, serviceDefObj, 1);
Assert.assertNotNull(dbServiceConfigDef);
}
use of org.apache.ranger.entity.XXServiceDef in project ranger by apache.
the class TestRangerServiceDefServiceBase method test2MapEntityToViewBean.
@Test
public void test2MapEntityToViewBean() {
RangerServiceDef rangerServiceDef = rangerServiceDef();
XXServiceDef serviceDef = serviceDef();
RangerServiceDef dbRangerServiceDef = rangerServiceDefService.mapEntityToViewBean(rangerServiceDef, serviceDef);
Assert.assertNotNull(dbRangerServiceDef);
Assert.assertEquals(dbRangerServiceDef, rangerServiceDef);
Assert.assertEquals(dbRangerServiceDef.getDescription(), rangerServiceDef.getDescription());
Assert.assertEquals(dbRangerServiceDef.getGuid(), rangerServiceDef.getGuid());
Assert.assertEquals(dbRangerServiceDef.getName(), rangerServiceDef.getName());
Assert.assertEquals(dbRangerServiceDef.getId(), rangerServiceDef.getId());
Assert.assertEquals(dbRangerServiceDef.getVersion(), rangerServiceDef.getVersion());
}
use of org.apache.ranger.entity.XXServiceDef 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);
}
use of org.apache.ranger.entity.XXServiceDef in project ranger by apache.
the class TestRangerServiceDefServiceBase method test5populateRangerResourceDefToXX.
@Test
public void test5populateRangerResourceDefToXX() {
RangerResourceDef rangerResourceDefObj = new RangerResourceDef();
rangerResourceDefObj.setDescription("HDFS Repository");
rangerResourceDefObj.setExcludesSupported(false);
rangerResourceDefObj.setLabel("HDFS Repository");
rangerResourceDefObj.setName("HDFs");
XXResourceDef resourceDefObj = new XXResourceDef();
resourceDefObj.setAddedByUserId(Id);
resourceDefObj.setCreateTime(new Date());
resourceDefObj.setDefid(Id);
resourceDefObj.setDescription("HDFS Repository");
resourceDefObj.setId(Id);
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((XXResourceDef) rangerAuditFields.populateAuditFields(resourceDefObj, serviceDefObj)).thenReturn(resourceDefObj);
XXResourceDef dbResourceDef = rangerServiceDefService.populateRangerResourceDefToXX(rangerResourceDefObj, resourceDefObj, serviceDefObj, 1);
Assert.assertNotNull(dbResourceDef);
Assert.assertEquals(dbResourceDef, resourceDefObj);
Assert.assertEquals(dbResourceDef.getId(), resourceDefObj.getId());
Assert.assertEquals(dbResourceDef.getLabel(), resourceDefObj.getLabel());
Assert.assertEquals(dbResourceDef.getName(), resourceDefObj.getName());
Assert.assertEquals(dbResourceDef.getDescription(), resourceDefObj.getDescription());
}
use of org.apache.ranger.entity.XXServiceDef in project ranger by apache.
the class TestRangerServiceDefServiceBase method test16populateRangerEnumDefToXX.
@Test
public void test16populateRangerEnumDefToXX() {
RangerEnumDef rangerEnumDefObj = new RangerEnumDef();
rangerEnumDefObj.setName("authnType");
rangerEnumDefObj.setDefaultIndex(0);
XXEnumDef enumDefObj = new XXEnumDef();
enumDefObj.setAddedByUserId(Id);
enumDefObj.setCreateTime(new Date());
enumDefObj.setDefaultindex(0);
enumDefObj.setDefid(Id);
enumDefObj.setId(Id);
enumDefObj.setName("authnType");
enumDefObj.setUpdatedByUserId(Id);
enumDefObj.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((XXEnumDef) rangerAuditFields.populateAuditFields(enumDefObj, serviceDefObj)).thenReturn(enumDefObj);
XXEnumDef dbEnumDef = rangerServiceDefService.populateRangerEnumDefToXX(rangerEnumDefObj, enumDefObj, serviceDefObj, 1);
Assert.assertNotNull(dbEnumDef);
Assert.assertEquals(dbEnumDef, enumDefObj);
Assert.assertEquals(dbEnumDef.getName(), enumDefObj.getName());
Assert.assertEquals(dbEnumDef.getDefid(), enumDefObj.getDefid());
Assert.assertEquals(dbEnumDef.getId(), enumDefObj.getId());
Assert.assertEquals(dbEnumDef.getCreateTime(), enumDefObj.getCreateTime());
}
Aggregations