public async Task BPMN_FinishEmptyActivity_ShouldFinishEmptyActivity() { var processModelId = "test_consumer_api_emptyactivity"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); // Give the ProcessEngine time to reach the EmptyActivity await Task.Delay(1000); var emptyActivities = await this .fixture .ProcessEngineClient .GetSuspendedEmptyActivitiesForCorrelation(processInstance.CorrelationId); Assert.NotEmpty(emptyActivities); var emptyActivityToBeFinished = emptyActivities.ElementAt(0); await this .fixture .ProcessEngineClient .FinishEmptyActivity( processInstance.ProcessInstanceId, processInstance.CorrelationId, emptyActivityToBeFinished.FlowNodeInstanceId ); }
public async Task BPMN_FinishManualTask_ShouldFinishManualTask() { var processModelId = "test_consumer_api_manualtask"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); // Give the ProcessEngine time to reach the ManualTask await Task.Delay(1000); var manualTasks = await this .fixture .ProcessEngineClient .GetSuspendedManualTasksForCorrelation(processInstance.CorrelationId); Assert.NotEmpty(manualTasks); var manualTaskToBeFinished = manualTasks.ElementAt(0); await this .fixture .ProcessEngineClient .FinishManualTask( processInstance.ProcessInstanceId, processInstance.CorrelationId, manualTaskToBeFinished.FlowNodeInstanceId ); }
public async Task BPMN_GetResultForProcessModelInCorrelation_ShouldGetResultOfStaticProcess() { var processModelId = "test_consumer_api_correlation_result"; var endEventId = "EndEvent_Success"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnEndEventReached; var processStartResponsePayload = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType, endEventId); var correlationResults = await this .fixture .ProcessEngineClient .GetResultForProcessModelInCorrelation <TestResult>(processStartResponsePayload.CorrelationId, processModelId); var expectedCorrelationResult = new CorrelationResult <TestResult> { TokenPayload = new TestResult() { scriptOutput = "hello world" }, CorrelationId = processStartResponsePayload.CorrelationId, EndEventId = endEventId }; var actualCorrelationResult = new List <CorrelationResult <TestResult> >(correlationResults.CorrelationResults).FirstOrDefault(); Assert.NotNull(actualCorrelationResult); Assert.Equal(expectedCorrelationResult.CorrelationId, actualCorrelationResult.CorrelationId); Assert.Equal(expectedCorrelationResult.EndEventId, actualCorrelationResult.EndEventId); Assert.Equal(expectedCorrelationResult.TokenPayload.scriptOutput, actualCorrelationResult.TokenPayload.scriptOutput); }
public async Task BPMN_TriggerMessageEvent_ShouldContinueProcessWithMessageIntermediateCatchEvent() { var processModelId = "test_consumer_api_message_event"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processStartResponsePayload = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); await Task.Delay(5000); var messageName = "test_message_event"; await this.fixture.ProcessEngineClient.TriggerMessageEvent(messageName); await Task.Delay(5000); var processResult = await this .fixture .ProcessEngineClient .GetResultForProcessModelInCorrelation <object>(processStartResponsePayload.CorrelationId, processModelId); Assert.NotEmpty(processResult.CorrelationResults); }
public async Task BPMN_GetSuspendedEventsForProcessModel_ShouldFetchEventsOfRunningProcess() { var processModelId = "test_consumer_api_message_event"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processStartResponsePayload = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); await Task.Delay(1000); var events = await this .fixture .ProcessEngineClient .GetSuspendedEventsForProcessModel(processModelId); Assert.NotEmpty(events); var fetchedEvent = events.ElementAt(0); var expectedMessageName = "test_message_event"; Assert.Equal(fetchedEvent.EventName, expectedMessageName); }
public void StartProcessInstance_ProcessModelNotFound_ShouldThrowException() { var payload = new ProcessStartRequest <object>(); Assert.ThrowsAsync <Exception>(async() => await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>("Test", "Test", payload)); }
public void StartProcessInstance_EmptyParameters_ShouldThrowException() { var payload = new ProcessStartRequest <object>(); Assert.ThrowsAsync <ArgumentNullException>(async() => await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>("", "Test", payload)); }
public async Task BPMN_StartProcessInstance_ShouldCreateAndFinishProcess() { var processModelId = "test_start_process"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnEndEventReached; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType, "EndEvent_1"); }
public async Task <ProcessStartResponse <TResponsePayload> > StartProcessInstance <TResponsePayload>( string processModelId, string startEventId, StartCallbackType startCallbackType = StartCallbackType.CallbackOnProcessInstanceCreated, string endEventId = "") where TResponsePayload : new() { var request = new ProcessStartRequest <object>(); return(await this.StartProcessInstance <object, TResponsePayload>(processModelId, startEventId, request, startCallbackType, endEventId)); }
public async Task BPMN_StartProcessInstance_ShouldCreateCorrelationIdIfNoneProvided() { var processModelId = "test_start_process"; var payload = new ProcessStartRequest <object>(); var processStartResponsePayload = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload); Assert.NotEmpty(processStartResponsePayload.CorrelationId); }
public async Task BPMN_StartProcessInstance_ShouldCreateProcessWithDistinctCorrelationId() { var processModelId = "test_start_process"; var correlationId = "CorrelationId_1"; var payload = new ProcessStartRequest <object>(correlationId, ""); var processStartResponsePayload = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload); Assert.Equal(processStartResponsePayload.CorrelationId, correlationId); }
public async Task BPMN_GetProcessInstancesForClientIdentity_ShouldGetProcessInstances() { var processModelId = "test_consumer_api_correlation_result"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); var processInstances = await this .fixture .ProcessEngineClient .GetProcessInstancesForClientIdentity(); Assert.NotNull(processInstances.ProcessInstances); }
public async Task BPMN_GetSuspendedManualTasksForClientIdentity_ShouldFetchManualTaskList() { var processModelId = "test_consumer_api_manualtask"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); // Give the ProcessEngine time to reach the ManualTask await Task.Delay(2000); var manualTasks = await this.fixture.ProcessEngineClient.GetSuspendedManualTasksForClientIdentity(); Assert.NotEmpty(manualTasks); }
public async Task BPMN_GetSuspendedEmptyActivitiesForProcessInstance_ShouldFetchEmptyActivityList() { var processModelId = "test_consumer_api_emptyactivity"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); // Give the ProcessEngine time to reach the EmptyActivity await Task.Delay(1000); var emptyActivities = await this .fixture .ProcessEngineClient .GetSuspendedEmptyActivitiesForProcessInstance(processInstance.ProcessInstanceId); Assert.NotEmpty(emptyActivities); }
public async Task BPMN_GetSuspendedUserTasksForProcessModelInCorrelation_ShouldFetchUserTaskList() { var processModelId = "test_consumer_api_usertask"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); // Give the ProcessEngine time to reach the UserTask await Task.Delay(1000); var userTasks = await this .fixture .ProcessEngineClient .GetSuspendedUserTasksForProcessModelInCorrelation(processModelId, processInstance.CorrelationId); Assert.NotEmpty(userTasks); }
public async Task BPMN_FinishUserTask_ShouldFinishUserTask() { var processModelId = "test_consumer_api_usertask"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceCreated; var processInstance = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); // Give the ProcessEngine time to reach the UserTask await Task.Delay(5000); var userTasks = await this .fixture .ProcessEngineClient .GetSuspendedUserTasksForCorrelation(processInstance.CorrelationId); Assert.NotEmpty(userTasks); var userTaskToBeFinished = userTasks.ElementAt(0); var userTaskResult = new UserTaskResult() { FormFields = new Dictionary <string, object>() }; userTaskResult.FormFields.Add("my_test_key", "my_test_value"); await this .fixture .ProcessEngineClient .FinishUserTask( processInstance.ProcessInstanceId, processInstance.CorrelationId, userTaskToBeFinished.FlowNodeInstanceId, userTaskResult ); }
public async Task <ProcessStartResponse <TResponsePayload> > StartProcessInstance <TRequestPayload, TResponsePayload>( string processModelId, string startEventId, ProcessStartRequest <TRequestPayload> request, StartCallbackType startCallbackType = StartCallbackType.CallbackOnProcessInstanceCreated, string endEventId = "" ) where TRequestPayload : new() where TResponsePayload : new() { var noEndEventIdProvided = startCallbackType == StartCallbackType.CallbackOnEndEventReached && String.IsNullOrEmpty(endEventId); if (noEndEventIdProvided) { throw new ArgumentNullException(nameof(endEventId), "Must provide an EndEventId, when using callback type 'CallbackOnEndEventReached'!"); } var payload = new ProcessStartRequestPayload <TRequestPayload>(); payload.CallerId = request.ParentProcessInstanceId; payload.CorrelationId = request.CorrelationId; payload.InputValues = request.Payload; var url = this.BuildStartProcessInstanceUrl(processModelId, startEventId, endEventId, startCallbackType); var response = await this.HttpFacade.SendRequestAndExpectResult <ProcessStartRequestPayload <TRequestPayload>, ProcessStartResponsePayload>(HttpMethod.Post, url, payload); var parsedResponse = new ProcessStartResponse <TResponsePayload>( response.ProcessInstanceId, response.CorrelationId, response.EndEventId, (TResponsePayload)response.TokenPayload ); return(parsedResponse); }
public async Task BPMN_GetProcessModelByProcessInstanceId_ShouldGetProcessModel() { var processModelId = "test_consumer_api_correlation_result"; var payload = new ProcessStartRequest <object>(); var callbackType = StartCallbackType.CallbackOnProcessInstanceFinished; var processStartResponsePayload = await this .fixture .ProcessEngineClient .StartProcessInstance <object, object>(processModelId, "StartEvent_1", payload, callbackType); Assert.NotNull(processStartResponsePayload); var processModel = await this .fixture .ProcessEngineClient .GetProcessModelByProcessInstanceId(processStartResponsePayload.ProcessInstanceId); Assert.NotNull(processModel); Assert.Equal(processModelId, processModel.ID); Assert.Equal("StartEvent_1", processModel.StartEvents[0].Id); Assert.Equal("EndEvent_Success", processModel.EndEvents[0].Id); }