public void SetUp() { _kayakoApiRequest = new Mock <IKayakoApiRequest>(); _coreController = new CoreController(_kayakoApiRequest.Object); _getTestData = new TestData("Test"); }
public CoreProxy(ICoreController controller, IModelUpdater modelUpdater) { m_controller = controller; ModelUpdater = modelUpdater; m_controller.StartStateChecking(HandleKeepaliveStateResponse); modelUpdater.Start(); }
/// <summary> /// Initializes a new instance of the KayakoRestApi.KayakoService class. /// </summary> /// <param name="apiKey">Api Key.</param> /// <param name="secretKey">Secret Api Key.</param> /// <param name="apiUrl">URL of Kayako REST Api</param> /// <param name="requestType">Determines how the request URL is formed</param> public KayakoClient(string apiKey, string secretKey, string apiUrl, IWebProxy proxy, ApiRequestType requestType) { _coreController = new CoreController(apiKey, secretKey, apiUrl, proxy, requestType); _customFields = new CustomFieldController(apiKey, secretKey, apiUrl, proxy, requestType); _departments = new DepartmentController(apiKey, secretKey, apiUrl, proxy, requestType); _knowledgebase = new KnowledgebaseController(apiKey, secretKey, apiUrl, proxy, requestType); _news = new NewsController(apiKey, secretKey, apiUrl, proxy, requestType); _staff = new StaffController(apiKey, secretKey, apiUrl, proxy, requestType); _tickets = new TicketController(apiKey, secretKey, apiUrl, proxy, requestType); _troubleshooter = new TroubleshooterController(apiKey, secretKey, apiUrl, proxy, requestType); _users = new UserController(apiKey, secretKey, apiUrl, proxy, requestType); }
protected ModelUpdaterTestBase() { var coreControllerMock = new Mock <ICoreController>(); CoreController = coreControllerMock.Object; CoreLink = new DummyModelResponseCoreLink(); ModelDiffApplier = new DummyModelDiffApplier(); m_modelUpdater = SetupModelUpdater(); }
public async Task ConnectToCoreAsync(ICoreConnectionParams connectionParams) { EndPoint endPoint = connectionParams.EndPoint; if (CoreProxy != null) { Log.Error("Cannot connect to core, there is still a core proxy present"); throw new InvalidOperationException( "There is still a core proxy present"); } if (connectionParams.IsCoreLocal) { if (m_process == null) { await m_charmdRunner.StartIfNotRunningAndWaitAsync( Path.Combine(connectionParams.CoreProcessParams.WorkingDirectory, CharmdRelativePath), CharmdStartWaitMs); // TODO(HonzaS): Move this elsewhere when we have finer local process control. Log.Info("Starting a local core process"); m_process = m_coreProcessFactory.Create(connectionParams.CoreProcessParams); } endPoint = m_process.EndPoint; } if (endPoint == null) { Log.Error("Endpoint not set up, cannot connect to core"); throw new InvalidOperationException("Endpoint not set"); } m_isCoreLocal = connectionParams.IsCoreLocal; Log.Info("Connecting to Core running at {hostname:l}:{port}", endPoint.Hostname, endPoint.Port); ICoreLink coreLink = m_coreLinkFactory.Create(endPoint); // TODO(HonzaS): Check if the endpoint exists (handshake), await the response. // TODO(HonzaS): Move these inside the factory method. ICoreController coreController = m_coreControllerFactory.Create(coreLink); IModelUpdater modelUpdater = m_modelUpdaterFactory.Create(coreLink, coreController); CoreProxy = m_coreProxyFactory.Create(coreController, modelUpdater); RegisterCoreEvents(); }
public override IEnumerable <ModelValidationResult> Validate(object container) { if (container == null) { yield break; } ICoreController controller = this.ControllerContext.Controller as ICoreController; var action = Convert.ToString(this.ControllerContext.RouteData.Values["action"]); List <Tuple <string, ExpressionOperator, object> > list = new List <Tuple <string, ExpressionOperator, object> >(); list.Add(new Tuple <string, ExpressionOperator, object>(Metadata.PropertyName, ExpressionOperator.Equal, Metadata.Model)); if (attribute.DependOnProperty != null) { foreach (var dependOnProperty in attribute.DependOnProperty) { PropertyInfo property = container.GetType().GetProperty(dependOnProperty); if (property != null) { list.Add(new Tuple <string, ExpressionOperator, object>(dependOnProperty, ExpressionOperator.Equal, property.GetValue(container, null))); } } } if (action == "Update") { PropertyInfo property = container.GetType().GetProperty("ID"); list.Add(new Tuple <string, ExpressionOperator, object>(property.Name, ExpressionOperator.NotEqual, property.GetValue(container, null))); } if (action == "Add" || action == "Update") { if (controller.CoreRepository.Exists(list)) { yield return(new ModelValidationResult() { Message = GetMessage() }); } } yield break; }
public ModelUpdater(ICoreLink coreLink, ICoreController coreController, IModelDiffApplier modelDiffApplier) { m_coreLink = coreLink; m_coreController = coreController; m_modelDiffApplier = modelDiffApplier; }
/// <summary> /// Initializes a new instance of the KayakoRestApi.KayakoService class. /// </summary> /// <param name="apiKey">Api Key.</param> /// <param name="secretKey">Secret Api Key.</param> /// <param name="apiUrl">URL of Kayako REST Api</param> public KayakoClient(string apiKey, string secretKey, string apiUrl) { _coreController = new CoreController(apiKey, secretKey, apiUrl, null); _customFields = new CustomFieldController(apiKey, secretKey, apiUrl, null); _departments = new DepartmentController(apiKey, secretKey, apiUrl, null); _knowledgebase = new KnowledgebaseController(apiKey, secretKey, apiUrl, null); _news = new NewsController(apiKey, secretKey, apiUrl, null); _staff = new StaffController(apiKey, secretKey, apiUrl, null); _tickets = new TicketController(apiKey, secretKey, apiUrl, null); _troubleshooter = new TroubleshooterController(apiKey, secretKey, apiUrl, null); _users = new UserController(apiKey, secretKey, apiUrl, null); }
public void SetUp() { _kayakoApiRequest = new Mock<IKayakoApiRequest>(); _coreController = new CoreController(_kayakoApiRequest.Object); _getTestData = new TestData("Test"); }
public ICoreProxy Create(ICoreController controller, IModelUpdater modelUpdater) { return(InjectProperties(new CoreProxy(controller, modelUpdater))); }
public IModelUpdater Create(ICoreLink coreLink, ICoreController coreController) { //return InjectProperties(new ModelUpdater(coreLink, coreController, m_modelDiffApplier)); return(InjectProperties(new LockingModelUpdater(coreLink, coreController, m_modelDiffApplier))); }