Пример #1
0
        public virtual void testCatchErrorThrownBySignalOfDelegateExpression()
        {
            IVariableMap variables = ESS.FW.Bpm.Engine.Variable.Variables.CreateVariables().PutValue("myDelegate", new ThrowErrorDelegate());
            string       pi        = runtimeService.StartProcessInstanceByKey("testProcess", variables).Id;

            Assert.True((bool)runtimeService.GetVariable(pi, "executed"));
            Assert.IsNull(runtimeService.GetVariable(pi, "signaled"));

            IExecution serviceTask = runtimeService.CreateExecutionQuery(c => c.ProcessInstanceId == pi && c.ActivityId == "serviceTask").First();

            Assert.NotNull(serviceTask);

            runtimeService.SetVariables(pi, ThrowErrorDelegate.throwError());
            runtimeService.Signal(serviceTask.Id);

            Assert.True((bool)runtimeService.GetVariable(pi, "executed"));
            Assert.True((bool)runtimeService.GetVariable(pi, "signaled"));

            ITask userTask = taskService.CreateTaskQuery(c => c.ProcessInstanceId == pi).First();

            Assert.NotNull(userTask);
            Assert.AreEqual("userTaskError", userTask.TaskDefinitionKey);

            taskService.Complete(userTask.Id);
        }
Пример #2
0
        public virtual void testCatchExceptionThrownByExecuteOfAbstractBpmnActivityBehavior()
        {
            string pi = runtimeService.StartProcessInstanceByKey("testProcess", ThrowErrorDelegate.throwException()).Id;

            Assert.True((bool)runtimeService.GetVariable(pi, "executed"));
            Assert.IsNull(runtimeService.GetVariable(pi, "signaled"));

            ITask userTask = taskService.CreateTaskQuery(c => c.ProcessInstanceId == pi).First();

            Assert.NotNull(userTask);
            Assert.AreEqual("userTaskException", userTask.TaskDefinitionKey);

            taskService.Complete(userTask.Id);
        }
Пример #3
0
 public virtual void testCatchExceptionExpressionThrownByFollowUpScopeTask()
 {
     try
     {
         IDictionary <string, object> vars = ThrowErrorDelegate.throwException();
         var id = runtimeService.StartProcessInstanceByKey("testProcess", vars).Id;
         Assert.Fail("should Assert.Fail and not catch the error on the first task");
     }
     catch (ProcessEngineException)
     {
         // happy path
     }
     Assert.IsNull(taskService.CreateTaskQuery().First());
 }
Пример #4
0
        public virtual void testCatchExceptionThrownByExecuteOfDelegateExpression()
        {
            IVariableMap variables = ESS.FW.Bpm.Engine.Variable.Variables.CreateVariables().PutValue("myDelegate", new ThrowErrorDelegate());

            variables.PutAll(ThrowErrorDelegate.throwException() as IDictionary <string, ITypedValue>);
            string pi = runtimeService.StartProcessInstanceByKey("testProcess", variables).Id;

            Assert.True((bool)runtimeService.GetVariable(pi, "executed"));
            Assert.IsNull(runtimeService.GetVariable(pi, "signaled"));

            ITask userTask = taskService.CreateTaskQuery(c => c.ProcessInstanceId == pi).First();

            Assert.NotNull(userTask);
            Assert.AreEqual("userTaskException", userTask.TaskDefinitionKey);

            taskService.Complete(userTask.Id);
        }