public void DontTimeout() { const int configureTimeoutSeconds = 3; const int serverWaitSeconds = 2; MappedFieldList fieldList = new MappedFieldList { new MappedField { Target = REQUEST_TIMEOUT_KEY, MapType = MapType.Value, Source = serverWaitSeconds.ToString() } }; WebhookWorkflowTransitionAction action = new WebhookWorkflowTransitionAction { ServiceEndpointId = "1", RequestFieldMap = fieldList }; EventActionWebhookResponseHandler handler = new EventActionWebhookResponseHandler(new HttpEndpointCommunicator(new EmptyHttpEndpointCommunicationLogger(), configureTimeoutSeconds)) { Endpoints = this.Endpoints }; EventResult result = handler.Handle(null, action, new Application(), new PageList(), this.getApplicationAccessFn); Assert.IsTrue(result.Processed); }
public void UpdateApplication() { Application application = new Application(); application.ApplicationData.Add("Field1", string.Empty); application.ApplicationData.Add("Field2", string.Empty); MappedFieldList fieldList = new MappedFieldList { new MappedField { Target = "Field1", MapType = MapType.Content, Source = "Foo" }, new MappedField { Target = "Field2", MapType = MapType.Content, Source = "Baz" } }; WebhookWorkflowTransitionAction action = new WebhookWorkflowTransitionAction { ServiceEndpointId = "1", ResponseFieldMap = fieldList }; EventActionWebhookResponseHandler handler = new EventActionWebhookResponseHandler(new HttpEndpointCommunicator(new EmptyHttpEndpointCommunicationLogger())) { Endpoints = this.Endpoints }; EventResult result = handler.Handle(null, action, application, new PageList(), this.getApplicationAccessFn); Assert.AreEqual("Bar", result.UpdatedApplication.ApplicationData["Field1"]); Assert.AreEqual("Qux", result.UpdatedApplication.ApplicationData["Field2"]); }
public void StatusCodeNotOk() { MappedFieldList fieldList = new MappedFieldList { new MappedField { Target = REQUEST_HTTP_STATUS_CODE_KEY, MapType = MapType.Value, Source = ((int)HttpStatusCode.InternalServerError).ToString() } }; WebhookWorkflowTransitionAction action = new WebhookWorkflowTransitionAction { ServiceEndpointId = "1", RequestFieldMap = fieldList }; EventActionWebhookResponseHandler handler = new EventActionWebhookResponseHandler(new HttpEndpointCommunicator(new EmptyHttpEndpointCommunicationLogger())) { Endpoints = this.Endpoints }; EventResult result = handler.Handle(null, action, new Application(), new PageList(), this.getApplicationAccessFn); Assert.IsFalse(result.Processed); }
public void StatusCodeOk() { MappedFieldList fieldList = new MappedFieldList(); WebhookWorkflowTransitionAction action = new WebhookWorkflowTransitionAction { ServiceEndpointId = "1", RequestFieldMap = fieldList }; EventActionWebhookResponseHandler handler = new EventActionWebhookResponseHandler(new HttpEndpointCommunicator(new EmptyHttpEndpointCommunicationLogger())) { Endpoints = this.Endpoints }; EventResult result = handler.Handle(null, action, new Application(), new PageList(), this.getApplicationAccessFn); Assert.IsTrue(result.Processed); }
public void RequestFieldMap() { MappedFieldList fieldList = new MappedFieldList { new MappedField { Target = "Field1", MapType = MapType.Value, Source = "Value1" }, new MappedField { Target = "Field2", MapType = MapType.Value, Source = "Value2" } }; WebhookWorkflowTransitionAction action = new WebhookWorkflowTransitionAction { ServiceEndpointId = "1", RequestFieldMap = fieldList }; EventActionWebhookResponseHandler handler = new EventActionWebhookResponseHandler(new HttpEndpointCommunicator(new EmptyHttpEndpointCommunicationLogger())) { Endpoints = this.Endpoints }; EventResult result = handler.Handle(null, action, new Application(), new PageList(), this.getApplicationAccessFn); Assert.IsTrue(result.Processed); }