@Test public void test5getPopulatedViewObject() { XXPortalUserDao xPortalUserDao = Mockito.mock(XXPortalUserDao.class); XXServiceConfigDefDao xServiceConfigDefDao = Mockito .mock(XXServiceConfigDefDao.class); XXResourceDefDao xResourceDefDao = Mockito.mock(XXResourceDefDao.class); XXAccessTypeDefDao xAccessTypeDefDao = Mockito .mock(XXAccessTypeDefDao.class); XXPolicyConditionDefDao xPolicyConditionDefDao = Mockito .mock(XXPolicyConditionDefDao.class); XXContextEnricherDefDao xContextEnricherDefDao = Mockito .mock(XXContextEnricherDefDao.class); XXEnumDefDao xEnumDefDao = Mockito.mock(XXEnumDefDao.class); XXEnumElementDefDao xEnumElementDefDao = Mockito .mock(XXEnumElementDefDao.class); XXServiceDef serviceDef = serviceDef(); String name = "fdfdfds"; XXPortalUser tUser = new XXPortalUser(); tUser.setAddedByUserId(Id); tUser.setCreateTime(new Date()); tUser.setEmailAddress("test@gmail.com"); tUser.setFirstName(name); tUser.setId(Id); tUser.setLastName(name); List<XXServiceConfigDef> serviceConfigDefList = new ArrayList<XXServiceConfigDef>(); XXServiceConfigDef serviceConfigDefObj = new XXServiceConfigDef(); serviceConfigDefObj.setAddedByUserId(Id); serviceConfigDefObj.setCreateTime(new Date()); serviceConfigDefObj.setDefaultvalue("simple"); serviceConfigDefObj.setDescription("service config"); serviceConfigDefObj.setId(Id); serviceConfigDefObj.setIsMandatory(true); serviceConfigDefObj.setName(name); serviceConfigDefObj.setLabel("username"); serviceConfigDefObj.setRbkeydescription(null); serviceConfigDefObj.setRbkeylabel(null); serviceConfigDefObj.setRbKeyValidationMessage(null); serviceConfigDefObj.setType("password"); serviceConfigDefList.add(serviceConfigDefObj); List<XXResourceDef> resDefList = new ArrayList<XXResourceDef>(); XXResourceDef resourceDef = new XXResourceDef(); resourceDef.setAddedByUserId(Id); resourceDef.setCreateTime(new Date()); resourceDef.setDefid(Id); resourceDef.setDescription("test"); resourceDef.setId(Id); resDefList.add(resourceDef); List<XXPolicyItem> xPolicyItemList = new ArrayList<XXPolicyItem>(); XXPolicyItem xPolicyItem = new XXPolicyItem(); xPolicyItem.setDelegateAdmin(false); xPolicyItem.setAddedByUserId(null); xPolicyItem.setCreateTime(new Date()); xPolicyItem.setGUID(null); xPolicyItem.setId(Id); xPolicyItem.setOrder(null); xPolicyItem.setPolicyId(Id); xPolicyItem.setUpdatedByUserId(null); xPolicyItem.setUpdateTime(new Date()); xPolicyItemList.add(xPolicyItem); List<XXPolicyItemAccess> policyItemAccessList = new ArrayList<XXPolicyItemAccess>(); XXPolicyItemAccess policyItemAccess = new XXPolicyItemAccess(); policyItemAccess.setAddedByUserId(Id); policyItemAccess.setCreateTime(new Date()); policyItemAccess.setPolicyitemid(Id); policyItemAccess.setId(Id); policyItemAccess.setOrder(1); policyItemAccess.setUpdatedByUserId(Id); policyItemAccess.setUpdateTime(new Date()); policyItemAccessList.add(policyItemAccess); List<XXPolicyConditionDef> xConditionDefList = new ArrayList<XXPolicyConditionDef>(); XXPolicyConditionDef policyConditionDefObj = new XXPolicyConditionDef(); policyConditionDefObj.setAddedByUserId(Id); policyConditionDefObj.setCreateTime(new Date()); policyConditionDefObj.setDefid(Id); policyConditionDefObj.setDescription("policy conditio"); policyConditionDefObj.setId(Id); policyConditionDefObj.setName(name); policyConditionDefObj.setOrder(1); policyConditionDefObj.setLabel("label"); xConditionDefList.add(policyConditionDefObj); List<XXPolicyItemCondition> policyItemConditionList = new ArrayList<XXPolicyItemCondition>(); XXPolicyItemCondition policyItemCondition = new XXPolicyItemCondition(); policyItemCondition.setAddedByUserId(Id); policyItemCondition.setCreateTime(new Date()); policyItemCondition.setType(1L); policyItemCondition.setId(Id); policyItemCondition.setOrder(1); policyItemCondition.setPolicyItemId(Id); policyItemCondition.setUpdatedByUserId(Id); policyItemCondition.setUpdateTime(new Date()); policyItemConditionList.add(policyItemCondition); List<XXContextEnricherDef> contextEnrichersList = new ArrayList<XXContextEnricherDef>(); XXContextEnricherDef contextEnricherDefObj = new XXContextEnricherDef(); contextEnricherDefObj.setAddedByUserId(Id); contextEnricherDefObj.setCreateTime(new Date()); contextEnricherDefObj.setDefid(Id); contextEnricherDefObj.setEnricher("RangerCountryProvider"); contextEnricherDefObj.setName("country-provider"); contextEnricherDefObj.setId(Id); contextEnricherDefObj.setOrder(0); contextEnricherDefObj.setUpdatedByUserId(Id); contextEnricherDefObj.setUpdateTime(new Date()); contextEnrichersList.add(contextEnricherDefObj); List<XXEnumDef> xEnumList = new ArrayList<XXEnumDef>(); XXEnumDef enumDefObj = new XXEnumDef(); enumDefObj.setAddedByUserId(Id); enumDefObj.setCreateTime(new Date()); enumDefObj.setDefaultindex(null); enumDefObj.setDefid(Id); enumDefObj.setId(Id); enumDefObj.setName(name); enumDefObj.setUpdatedByUserId(Id); enumDefObj.setUpdateTime(new Date()); xEnumList.add(enumDefObj); List<XXEnumElementDef> xElementsList = new ArrayList<XXEnumElementDef>(); XXEnumElementDef enumElementDefObj = new XXEnumElementDef(); enumElementDefObj.setAddedByUserId(Id); enumElementDefObj.setCreateTime(new Date()); enumElementDefObj.setEnumdefid(Id); enumElementDefObj.setId(Id); enumElementDefObj.setLabel("Authentication"); enumElementDefObj.setName("authentication"); enumElementDefObj.setUpdateTime(new Date()); enumElementDefObj.setUpdatedByUserId(Id); enumElementDefObj.setRbkeylabel(null); enumElementDefObj.setOrder(0); xElementsList.add(enumElementDefObj); Mockito.when(daoManager.getXXPortalUser()).thenReturn(xPortalUserDao); Mockito.when(xPortalUserDao.getById(Id)).thenReturn(tUser); Mockito.when(daoManager.getXXServiceConfigDef()).thenReturn( xServiceConfigDefDao); Mockito.when( xServiceConfigDefDao.findByServiceDefId(serviceDef.getId())) .thenReturn(serviceConfigDefList); Mockito.when(daoManager.getXXResourceDef()).thenReturn(xResourceDefDao); Mockito.when(daoManager.getXXAccessTypeDef()).thenReturn( xAccessTypeDefDao); Mockito.when(daoManager.getXXPolicyConditionDef()).thenReturn( xPolicyConditionDefDao); Mockito.when(daoManager.getXXContextEnricherDef()).thenReturn( xContextEnricherDefDao); Mockito.when( xContextEnricherDefDao.findByServiceDefId(serviceDef.getId())) .thenReturn(contextEnrichersList); Mockito.when(daoManager.getXXEnumDef()).thenReturn(xEnumDefDao); Mockito.when(xEnumDefDao.findByServiceDefId(serviceDef.getId())) .thenReturn(xEnumList); Mockito.when(daoManager.getXXEnumElementDef()).thenReturn( xEnumElementDefDao); Mockito.when( xEnumElementDefDao.findByEnumDefId(enumElementDefObj.getId())) .thenReturn(xElementsList); XXDataMaskTypeDefDao xDataMaskTypeDao = Mockito.mock(XXDataMaskTypeDefDao.class); List<XXDataMaskTypeDef> xDataMaskTypeDefs = new ArrayList<XXDataMaskTypeDef>(); Mockito.when(daoManager.getXXDataMaskTypeDef()).thenReturn(xDataMaskTypeDao); Mockito.when(xDataMaskTypeDao.findByServiceDefId(serviceDef.getId())).thenReturn(xDataMaskTypeDefs); RangerServiceDef dbRangerServiceDef = serviceDefService .getPopulatedViewObject(serviceDef); Assert.assertNotNull(dbRangerServiceDef); Mockito.verify(daoManager).getXXServiceConfigDef(); Mockito.verify(daoManager).getXXResourceDef(); Mockito.verify(daoManager).getXXAccessTypeDef(); Mockito.verify(daoManager).getXXPolicyConditionDef(); Mockito.verify(daoManager).getXXContextEnricherDef(); Mockito.verify(daoManager).getXXEnumDef(); }
public RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef) { return this.populateViewBean(xServiceDef); }
RangerServiceDefService extends RangerServiceDefServiceBase<XXServiceDef, RangerServiceDef> { public RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef) { return this.populateViewBean(xServiceDef); } }
RangerServiceDefService extends RangerServiceDefServiceBase<XXServiceDef, RangerServiceDef> { public RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef) { return this.populateViewBean(xServiceDef); } RangerServiceDefService(); }
RangerServiceDefService extends RangerServiceDefServiceBase<XXServiceDef, RangerServiceDef> { public RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef) { return this.populateViewBean(xServiceDef); } RangerServiceDefService(); List<RangerServiceDef> getAllServiceDefs(); RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef); }
RangerServiceDefService extends RangerServiceDefServiceBase<XXServiceDef, RangerServiceDef> { public RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef) { return this.populateViewBean(xServiceDef); } RangerServiceDefService(); List<RangerServiceDef> getAllServiceDefs(); RangerServiceDef getPopulatedViewObject(XXServiceDef xServiceDef);  }