@Test public void testToRangerService(){ Map<String, String> map = new HashMap<String, String>(); RangerService expectedRangerService = new RangerService(); expectedRangerService.setId(1L); expectedRangerService.setName("hive"); expectedRangerService.setDescription("hive Description"); map.put("config", "hiveConfig"); VXAsset vXAsset = new VXAsset(); vXAsset.setId(1L); vXAsset.setCreateDate(new Date()); vXAsset.setUpdateDate(new Date()); vXAsset.setOwner("ranger"); vXAsset.setUpdatedBy("rangerAdmin"); vXAsset.setAssetType(5); vXAsset.setName("hive"); vXAsset.setDescription("hive Description"); vXAsset.setActiveStatus(1); vXAsset.setConfig("{config : hiveConfig}"); Mockito.when(jsonUtil.jsonToMap("{config : hiveConfig}")).thenReturn(map); RangerService actualRangerService = serviceUtil.toRangerService(vXAsset); Assert.assertNotNull(actualRangerService); Assert.assertEquals(actualRangerService.getId(), expectedRangerService.getId()); Assert.assertEquals(actualRangerService.getName(), expectedRangerService.getName()); Assert.assertEquals(actualRangerService.getDescription(), expectedRangerService.getDescription()); Assert.assertTrue(actualRangerService.getIsEnabled()); }
public RangerService toRangerService(VXAsset asset) { if(asset == null) { return null; } RangerService ret = new RangerService(); dataObjectToRangerObject(asset, ret); ret.setType(toServiceType(asset.getAssetType())); ret.setName(asset.getName()); ret.setDescription(asset.getDescription()); ret.setIsEnabled(asset.getActiveStatus() == RangerCommonEnums.STATUS_ENABLED); ret.setConfigs(jsonUtil.jsonToMap(asset.getConfig())); return ret; }
ServiceUtil { public RangerService toRangerService(VXAsset asset) { if(asset == null) { return null; } RangerService ret = new RangerService(); dataObjectToRangerObject(asset, ret); ret.setType(toServiceType(asset.getAssetType())); ret.setName(asset.getName()); ret.setDescription(asset.getDescription()); ret.setIsEnabled(asset.getActiveStatus() == RangerCommonEnums.STATUS_ENABLED); ret.setConfigs(jsonUtil.jsonToMap(asset.getConfig())); return ret; } }
ServiceUtil { public RangerService toRangerService(VXAsset asset) { if(asset == null) { return null; } RangerService ret = new RangerService(); dataObjectToRangerObject(asset, ret); ret.setType(toServiceType(asset.getAssetType())); ret.setName(asset.getName()); ret.setDescription(asset.getDescription()); ret.setIsEnabled(asset.getActiveStatus() == RangerCommonEnums.STATUS_ENABLED); ret.setConfigs(jsonUtil.jsonToMap(asset.getConfig())); return ret; }  }
ServiceUtil { public RangerService toRangerService(VXAsset asset) { if(asset == null) { return null; } RangerService ret = new RangerService(); dataObjectToRangerObject(asset, ret); ret.setType(toServiceType(asset.getAssetType())); ret.setName(asset.getName()); ret.setDescription(asset.getDescription()); ret.setIsEnabled(asset.getActiveStatus() == RangerCommonEnums.STATUS_ENABLED); ret.setConfigs(jsonUtil.jsonToMap(asset.getConfig())); return ret; }  RangerService getServiceByName(@PathParam("name") String name); RangerService toRangerService(VXAsset asset); VXAsset toVXAsset(RangerService service); VXRepository toVXRepository(RangerService service); RangerPolicy toRangerPolicy(VXResource resource, RangerService service); VXResource toVXResource(RangerPolicy policy, RangerService service); VXAsset publicObjecttoVXAsset(VXRepository vXRepository); VXRepository vXAssetToPublicObject(VXAsset asset); static String toAccessType(int permType); SearchCriteria getMappedSearchParams(HttpServletRequest request,
			SearchCriteria searchCriteria); VXRepositoryList rangerServiceListToPublicObjectList(List<RangerService> serviceList); VXPolicy toVXPolicy(RangerPolicy policy, RangerService service); List<VXPermMap> getVXPermMapList(RangerPolicy policy); List<VXPermObj> mapPermMapToPermObj(List<VXPermMap> permMapList); RangerPolicy toRangerPolicy(VXPolicy vXPolicy, RangerService service ); VXPolicyList rangerPolicyListToPublic(List<RangerPolicy> rangerPolicyList,SearchFilter filter); GrantRevokeRequest toGrantRevokeRequest(VXPolicy vXPolicy); boolean isValidateHttpsAuthentication( String serviceName, HttpServletRequest request); boolean isValidService(String serviceName, HttpServletRequest request); List<RangerPolicy> getMatchingPoliciesForResource(HttpServletRequest request,
			List<RangerPolicy> policyLists); }
ServiceUtil { public RangerService toRangerService(VXAsset asset) { if(asset == null) { return null; } RangerService ret = new RangerService(); dataObjectToRangerObject(asset, ret); ret.setType(toServiceType(asset.getAssetType())); ret.setName(asset.getName()); ret.setDescription(asset.getDescription()); ret.setIsEnabled(asset.getActiveStatus() == RangerCommonEnums.STATUS_ENABLED); ret.setConfigs(jsonUtil.jsonToMap(asset.getConfig())); return ret; }  RangerService getServiceByName(@PathParam("name") String name); RangerService toRangerService(VXAsset asset); VXAsset toVXAsset(RangerService service); VXRepository toVXRepository(RangerService service); RangerPolicy toRangerPolicy(VXResource resource, RangerService service); VXResource toVXResource(RangerPolicy policy, RangerService service); VXAsset publicObjecttoVXAsset(VXRepository vXRepository); VXRepository vXAssetToPublicObject(VXAsset asset); static String toAccessType(int permType); SearchCriteria getMappedSearchParams(HttpServletRequest request,
			SearchCriteria searchCriteria); VXRepositoryList rangerServiceListToPublicObjectList(List<RangerService> serviceList); VXPolicy toVXPolicy(RangerPolicy policy, RangerService service); List<VXPermMap> getVXPermMapList(RangerPolicy policy); List<VXPermObj> mapPermMapToPermObj(List<VXPermMap> permMapList); RangerPolicy toRangerPolicy(VXPolicy vXPolicy, RangerService service ); VXPolicyList rangerPolicyListToPublic(List<RangerPolicy> rangerPolicyList,SearchFilter filter); GrantRevokeRequest toGrantRevokeRequest(VXPolicy vXPolicy); boolean isValidateHttpsAuthentication( String serviceName, HttpServletRequest request); boolean isValidService(String serviceName, HttpServletRequest request); List<RangerPolicy> getMatchingPoliciesForResource(HttpServletRequest request,
			List<RangerPolicy> policyLists);  }