Ejemplo n.º 1
0
        public void FaultBookmark_Human()
        {
            _process = this.CreateProcess(SequenceWorkflowParser.GetActivitySettings());
            TestHelper.SetProcessId(_process, Guid.NewGuid());
            var instance = WorkflowBuilder.CreateInstance(_process, new SequenceWorkflowParser());

            instance.Run();
            Thread.Sleep(1000);
            //节点1执行人规则解析错误
            this.AssertWorkflowInstance(instance, 1, 1);

            var bookmark = instance.GetBookmarks()[0].Name;

            //错误书签
            Assert.IsTrue(bookmark.Contains("Error#"));

            //直接重试后仍错误
            instance.ResumeBookmark(bookmark, null);
            Thread.Sleep(1000);
            this.AssertWorkflowInstance(instance, 1, 2);
            //同一个位置再次错误书签相同
            Assert.AreEqual(bookmark, instance.GetBookmarks()[0].Name);

            //修复后重试
            (SequenceWorkflowParser.First.Helper as GetUsers).Scripts[0] = "originator";
            instance.ResumeBookmark(bookmark, null);
            Thread.Sleep(1000);
            //重试成功,生成人工任务和正常书签
            this.AssertWorkflowInstance(instance, 1, 2);
            Assert.AreNotEqual(bookmark, instance.GetBookmarks()[0].Name);
            Assert.IsFalse(instance.GetBookmarks()[0].Name.Contains("Error#"));
        }
Ejemplo n.º 2
0
        public void Human()
        {
            _process = this.CreateProcess(SequenceWorkflowParser.GetActivitySettings());
            TestHelper.SetProcessId(_process, Guid.NewGuid());
            var instance = WorkflowBuilder.CreateInstance(_process, new SequenceWorkflowParser(false));

            instance.Run();
            Thread.Sleep(1000);
            Assert.AreEqual(1, _humanCount);
            this.AssertWorkflowInstance(instance, 1, 0);
        }
Ejemplo n.º 3
0
        public void Server()
        {
            _process = this.CreateProcess(SequenceWorkflowParser.GetActivitySettings());
            TestHelper.SetProcessId(_process, Guid.NewGuid());
            var instance = WorkflowBuilder.CreateInstance(_process, new SequenceWorkflowParser(false));

            //先跳转到自动节点
            this.UpdateCurrentNode(instance, 4);
            instance.Run();
            Thread.Sleep(1000);
            Assert.AreEqual(1, _serverCount);
        }
Ejemplo n.º 4
0
 public void FaultResumption()
 {
     _process = this.CreateProcess(SequenceWorkflowParser.GetActivitySettings());
     TestHelper.SetProcessId(_process, Guid.NewGuid());
     TestHelper.ChangeProcessStatus(_process, ProcessStatus.Running);
     //验证调度器串行调度逻辑
     TestHelper.Resume(DependencyResolver.Resolve <Scheduler>(), new List <long>()
     {
         1, 2, 3
     }.OrderBy(o => o));
     //并行活动内的调度项的异常不互相影响,前2个都可以被执行,在第三个调度项执行时停止
     Assert.AreEqual(2, _resumCount);
 }
Ejemplo n.º 5
0
        public void FaultBookmark_SubProcess()
        {
            _process = this.CreateProcess(SequenceWorkflowParser.GetActivitySettings());
            TestHelper.SetProcessId(_process, Guid.NewGuid());
            var instance = WorkflowBuilder.CreateInstance(_process, new SequenceWorkflowParser());

            //跳转到子流程-节点2
            this.UpdateCurrentNode(instance, 2);
            instance.Run();
            Thread.Sleep(1000);
            this.AssertWorkflowInstance(instance, 1, 0);
            //此时有一个子流程节点实例
            Assert.AreEqual(1, _subProcessCount);

            var bookmark = instance.GetBookmarks()[0].Name;

            //子流程结束后恢复子流程活动
            instance.ResumeBookmark(bookmark, null);
            Thread.Sleep(1000);
            //发生了错误
            this.AssertWorkflowInstance(instance, 1, 1);
            //书签复用
            Assert.AreEqual(bookmark, instance.GetBookmarks()[0].Name);
            //错误重试,应从callback处恢复
            instance.ResumeBookmark(bookmark, null);
            Thread.Sleep(1000);
            //始终只能有一个书签
            this.AssertWorkflowInstance(instance, 1, 2);
            //重试不能重新创建子流程节点实例
            Assert.AreEqual(1, _subProcessCount);

            //修复后重试
            SequenceWorkflowParser.Second.FinishRule["error"] = "true";
            instance.ResumeBookmark(bookmark, null);
            Thread.Sleep(1000);
            this.AssertWorkflowInstance(instance, 0, 2);
        }