@Test
public void testToRangerPolicyForResourceTypeTopology(){

        RangerPolicy expectedRangerPolicy = new RangerPolicy();
        expectedRangerPolicy.setId(1L);
        expectedRangerPolicy.setName("hive Policy");
        expectedRangerPolicy.setService("hive");
        expectedRangerPolicy.setDescription("hive policy description");
        Map<String, RangerPolicyResource> expectedMap = new HashMap<String, RangerPolicyResource>();
        List<String> valuesList = new ArrayList<String>();
        valuesList.add("topology");
        VXAuditMap vXAuditMap = new VXAuditMap();
        vXAuditMap.setId(1L);
        vXAuditMap.setOwner("rangerAdmin");
        List<VXAuditMap> vXAuditMapList = new ArrayList<VXAuditMap>();
        vXAuditMapList.add(vXAuditMap);
        RangerPolicyResource rangerPolicyResource = new RangerPolicyResource();
        rangerPolicyResource.setIsExcludes(false);
        rangerPolicyResource.setIsRecursive(false);
        rangerPolicyResource.setValue("topology");
        rangerPolicyResource.setValues(valuesList);
        expectedMap.put("topology", rangerPolicyResource);
        expectedRangerPolicy.setResources(expectedMap);
        RangerService rangerService = new RangerService();
        rangerService.setName("hive");
        VXResource resource = new VXResource();
        resource.setId(1L);
        resource.setTopologies("topology");
        resource.setUpdateDate(new Date());
        resource.setCreateDate(new Date());
        resource.setOwner("rangerAdmin");
        resource.setUpdatedBy("rangerAdmin");
        resource.setPolicyName("hive Policy");
        resource.setDescription("hive policy description");
        resource.setResourceStatus(RangerCommonEnums.STATUS_ENABLED);
        resource.setIsRecursive(1);
        resource.setTableType(1);
        resource.setColumnType(1);
        RangerPolicy actualRangerPolicy = serviceUtil.toRangerPolicy(resource, rangerService);
        Assert.assertNotNull(actualRangerPolicy);
        Assert.assertEquals(expectedRangerPolicy.getId(), actualRangerPolicy.getId());
        Assert.assertEquals(expectedRangerPolicy.getName(), actualRangerPolicy.getName());
        Assert.assertEquals(expectedRangerPolicy.getService(), actualRangerPolicy.getService());
        Assert.assertEquals(expectedRangerPolicy.getDescription(), actualRangerPolicy.getDescription());
        Assert.assertEquals(expectedRangerPolicy.getResources(), actualRangerPolicy.getResources());
}