예제 #1
0
        public void BranchProcessRunTimeTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupSimpleProcessWithAssignee();

            IWfActivityDescriptor nextActivityDesp = process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity;
            WfTransferParams      tp = ProcessTestHelper.GetInstanceOfWfTransferParams(nextActivityDesp, OguObject.requestor);

            tp.BranchTransferParams.Add(new WfBranchProcessTransferParams(
                                            ProcessTestHelper.CreateConsignTemplate(WfBranchProcessExecuteSequence.Parallel, WfBranchProcessBlockingType.WaitAllBranchProcessesComplete)));

            for (int i = 0; i < 20; i++)
            {
                IUser obj  = (IUser)OguObjectSettings.GetConfig().Objects["approver1"].Object;
                IUser obj2 = (IUser)OguObjectSettings.GetConfig().Objects["approver2"].Object;

                tp.BranchTransferParams[0].BranchParams.Add(obj, obj2);
            }
            int branchProcessNum = tp.BranchTransferParams[0].BranchParams.Count;

            ProcessTestHelper.OutputExecutionTime(() => process.MoveTo(tp), "流转并启动子流程");
            ProcessTestHelper.OutputExecutionTime(() => WfRuntime.PersistWorkflows(), "保存流程状态");
            ProcessTestHelper.OutputExecutionTime(() => WfRuntime.GetProcessByProcessID(process.ID), "重新加载主流程");
        }
예제 #2
0
        public void MainStreamActivitiesWithConsignActivity()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            //会签
            string currentActivityID     = process.CurrentActivity.ID;
            WfActivityDescriptor actDesp = AddActivity(process);

            WfTransferParams tp   = new WfTransferParams(actDesp);
            IUser            user = (IUser)OguObjectSettings.GetConfig().Objects[OguObject.requestor.ToString()].Object;

            tp.Assignees.Add(user);

            tp.BranchTransferParams.Add(new WfBranchProcessTransferParams(
                                            ProcessTestHelper.CreateConsignTemplate(WfBranchProcessExecuteSequence.Parallel, WfBranchProcessBlockingType.WaitAllBranchProcessesComplete),
                                            new IUser[] { (IUser)OguObjectSettings.GetConfig().Objects["approver1"].Object,
                                                          (IUser)OguObjectSettings.GetConfig().Objects["approver2"].Object }));

            process.MoveTo(tp);

            WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities();

            Assert.AreEqual(process.Activities.Count - 1, coll.Count);
        }