@Test public void testPublicObjecttoVXAsset(){ Date date = new Date(); VXAsset expectedVXAsset = new VXAsset(); expectedVXAsset.setId(1L); expectedVXAsset.setCreateDate(date); expectedVXAsset.setUpdateDate(date); expectedVXAsset.setOwner("rangerAdmin"); expectedVXAsset.setUpdatedBy("rangerAdmin"); expectedVXAsset.setAssetType(3); expectedVXAsset.setActiveStatus(RangerCommonEnums.STATUS_ENABLED); expectedVXAsset.setName("hive"); expectedVXAsset.setDescription("hive description"); expectedVXAsset.setConfig("/myConfig"); VXRepository vXRepository = new VXRepository(); vXRepository.setId(1L); vXRepository.setCreateDate(date); vXRepository.setUpdateDate(date); vXRepository.setOwner("rangerAdmin"); vXRepository.setUpdatedBy("rangerAdmin"); vXRepository.setRepositoryType("hive"); vXRepository.setIsActive(true); vXRepository.setName("hive"); vXRepository.setDescription("hive description"); vXRepository.setConfig("/myConfig"); VXAsset actualVXAsset = serviceUtil.publicObjecttoVXAsset(vXRepository); Assert.assertNotNull(actualVXAsset); Assert.assertEquals(actualVXAsset.getActiveStatus(), expectedVXAsset.getActiveStatus()); Assert.assertEquals(actualVXAsset.getId(), expectedVXAsset.getId()); Assert.assertEquals(actualVXAsset.getName(), expectedVXAsset.getName()); Assert.assertEquals(actualVXAsset.getDescription(), expectedVXAsset.getDescription()); Assert.assertEquals(actualVXAsset.getCreateDate(), expectedVXAsset.getCreateDate()); Assert.assertEquals(actualVXAsset.getOwner(), expectedVXAsset.getOwner()); Assert.assertEquals(actualVXAsset.getAssetType() , expectedVXAsset.getAssetType()); Assert.assertEquals(actualVXAsset.getConfig() , expectedVXAsset.getConfig()); }
public VXAsset publicObjecttoVXAsset(VXRepository vXRepository) { VXAsset ret = new VXAsset(); publicDataObjectTovXDataObject(vXRepository,ret); Integer assetType = toAssetType(vXRepository.getRepositoryType()); ret.setAssetType(assetType == null ? -1 : assetType.intValue()); ret.setName(vXRepository.getName()); ret.setDescription(vXRepository.getDescription()); ret.setActiveStatus(vXRepository.getIsActive() ? RangerCommonEnums.STATUS_ENABLED : RangerCommonEnums.STATUS_DISABLED); ret.setConfig(vXRepository.getConfig()); return ret; }
ServiceUtil { public VXAsset publicObjecttoVXAsset(VXRepository vXRepository) { VXAsset ret = new VXAsset(); publicDataObjectTovXDataObject(vXRepository,ret); Integer assetType = toAssetType(vXRepository.getRepositoryType()); ret.setAssetType(assetType == null ? -1 : assetType.intValue()); ret.setName(vXRepository.getName()); ret.setDescription(vXRepository.getDescription()); ret.setActiveStatus(vXRepository.getIsActive() ? RangerCommonEnums.STATUS_ENABLED : RangerCommonEnums.STATUS_DISABLED); ret.setConfig(vXRepository.getConfig()); return ret; } }
ServiceUtil { public VXAsset publicObjecttoVXAsset(VXRepository vXRepository) { VXAsset ret = new VXAsset(); publicDataObjectTovXDataObject(vXRepository,ret); Integer assetType = toAssetType(vXRepository.getRepositoryType()); ret.setAssetType(assetType == null ? -1 : assetType.intValue()); ret.setName(vXRepository.getName()); ret.setDescription(vXRepository.getDescription()); ret.setActiveStatus(vXRepository.getIsActive() ? RangerCommonEnums.STATUS_ENABLED : RangerCommonEnums.STATUS_DISABLED); ret.setConfig(vXRepository.getConfig()); return ret; }  }
ServiceUtil { public VXAsset publicObjecttoVXAsset(VXRepository vXRepository) { VXAsset ret = new VXAsset(); publicDataObjectTovXDataObject(vXRepository,ret); Integer assetType = toAssetType(vXRepository.getRepositoryType()); ret.setAssetType(assetType == null ? -1 : assetType.intValue()); ret.setName(vXRepository.getName()); ret.setDescription(vXRepository.getDescription()); ret.setActiveStatus(vXRepository.getIsActive() ? RangerCommonEnums.STATUS_ENABLED : RangerCommonEnums.STATUS_DISABLED); ret.setConfig(vXRepository.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 VXAsset publicObjecttoVXAsset(VXRepository vXRepository) { VXAsset ret = new VXAsset(); publicDataObjectTovXDataObject(vXRepository,ret); Integer assetType = toAssetType(vXRepository.getRepositoryType()); ret.setAssetType(assetType == null ? -1 : assetType.intValue()); ret.setName(vXRepository.getName()); ret.setDescription(vXRepository.getDescription()); ret.setActiveStatus(vXRepository.getIsActive() ? RangerCommonEnums.STATUS_ENABLED : RangerCommonEnums.STATUS_DISABLED); ret.setConfig(vXRepository.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);  }