private StandardUserDetailsService getUserDetailsTestService(CoreContext ctx, boolean imEnabled) { User u = new User() { @Override public boolean hasPermission(PermissionName permission) { return true; } }; u.setUserName(USER_NAME); u.setUniqueId(); AddressBookEntry abe = new AddressBookEntry(); abe.setImId(USER_IM_ID); u.setAddressBookEntry(abe); u.setSettings(TestHelper.loadSettings("commserver/user-settings.xml")); u.setSettingTypedValue("im/im-account", imEnabled); AcdContext acdContext = createMock(AcdContext.class); StandardUserDetailsService uds = new StandardUserDetailsService(); uds.setCoreContext(ctx); uds.setAcdContext(acdContext); ctx.loadUserByUserNameOrAlias(USER_IM_ID); expectLastCall().andReturn(null); ctx.loadUserByConfiguredImId(USER_IM_ID); expectLastCall().andReturn(u); acdContext.getUsersWithAgents(); expectLastCall().andReturn(Collections.emptyList()); replay(ctx, acdContext); return uds; }
private ConfigGenerator createConfigGenerator() { ConfigGenerator cg = new ConfigGenerator(); DomainManager domainManager = TestUtil.getMockDomainManager(); EasyMock.replay(domainManager); AuthRules authRules = new AuthRules(); authRules.setDomainManager(domainManager); cg.setAuthRules(authRules); MappingRules mappingRules = new MappingRules(); mappingRules.setDomainManager(domainManager); cg.setMappingRules(mappingRules); FallbackRules fallbackRules = new FallbackRules(); fallbackRules.setDomainManager(domainManager); cg.setFallbackRules(fallbackRules); ForwardingRules forwardingRules = new ForwardingRules(); cg.setForwardingRules(forwardingRules); forwardingRules.setVelocityEngine(TestHelper.getVelocityEngine()); SbcManager sbcManager = createNiceMock(SbcManager.class); replay(sbcManager); forwardingRules.setSbcManager(sbcManager); SipxProxyService proxyService = new SipxProxyService(); proxyService.setModelDir("sipxproxy"); proxyService.setModelName("sipxproxy.xml"); proxyService.setModelFilesContext(TestHelper.getModelFilesContext()); proxyService.setBeanName(SipxProxyService.BEAN_ID); proxyService.setSipPort("9901"); proxyService.setDomainManager(domainManager); SipxService statusService = new SipxStatusService(); statusService.setBeanName(SipxStatusService.BEAN_ID); statusService.setModelFilesContext(TestHelper.getModelFilesContext()); statusService.setSettings(TestHelper.loadSettings("sipxstatus/sipxstatus.xml")); Setting statusConfigSettings = statusService.getSettings().getSetting("status-config"); statusConfigSettings.getSetting("SIP_STATUS_SIP_PORT").setValue("9905"); SipxRegistrarService registrarService = new SipxRegistrarService(); registrarService.setBeanName(SipxRegistrarService.BEAN_ID); registrarService.setRegistrarEventSipPort("9906"); registrarService.setSipPort("9907"); SipxServiceManager sipxServiceManager = TestUtil.getMockSipxServiceManager(true, proxyService, registrarService, statusService); forwardingRules.setSipxServiceManager(sipxServiceManager); return cg; }