Beispiel #1
0
        public void ReturnExecutorTestReplay()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver1, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver2, process);

            //退件到初始活动
            process = WfRuntime.GetProcessByProcessID(process.ID);
            WfReturnExecutor returnExec = new WfReturnExecutor(process.CurrentActivity, process.Activities[0]);

            returnExec.Execute();

            Assert.IsTrue(process.CurrentActivity.CreatorInstanceID != "");
            Assert.IsTrue(ProcessTestHelper.ExistsActivityUserTasks(process.CurrentActivity.ID, TaskStatus.Ban));

            process = WfRuntime.GetProcessByProcessID(process.ID);
            IWfActivity act = process.Activities.FindActivityByDescriptorKey(process.CurrentActivity.Descriptor.AssociatedActivityKey);

            Assert.AreEqual(act.Assignees.Count, process.CurrentActivity.Assignees.Count);

            Assert.AreEqual(process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity.AssociatedActivityKey, act.Descriptor.ToTransitions[0].ToActivity.Key);
            Assert.IsTrue(process.Activities.FindActivityByDescriptorKey(process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity.Key).Assignees.Count > 0);
        }
Beispiel #2
0
        public void ReturnExecutorTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver1, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver2, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.requestor, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            WfReturnExecutor returnExec = new WfReturnExecutor(process.CurrentActivity, process.Activities[1]);

            returnExec.Execute();

            process = WfRuntime.GetProcessByProcessID(process.ID);
            Assert.IsTrue(process.CurrentActivity.CreatorInstanceID != "");
            Assert.AreEqual(process.ElapsedActivities[process.ElapsedActivities.Count - 1].ID, process.CurrentActivity.CreatorInstanceID);

            WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities();

            Assert.AreEqual(6, coll.Count);
            Assert.IsTrue(ProcessTestHelper.ExistsActivityUserTasks(process.CurrentActivity.ID, TaskStatus.Ban));
        }
Beispiel #3
0
        public void MainStreamActivitiesWithConditionActivityPassed()
        {
            IWfProcessDescriptor desp = WfProcessTestCommon.CreateProcessDescriptor();

            desp.InitialActivity.Resources.Add(new WfUserResourceDescriptor((IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object));

            IWfActivityDescriptor actDesp = desp.Activities[1];

            AddActivitiesDespToSameActivityDesp(actDesp, 2);
            ToTransitionsDescriptorCollection transDespColl = actDesp.ToTransitions;

            SetTransitionCondition(transDespColl[0], false, 1);
            SetTransitionCondition(transDespColl[1], true, 3);

            WfProcessStartupParams startupParams = WfProcessTestCommon.GetInstanceOfWfProcessStartupParams(desp);

            IWfProcess process = WfRuntime.StartWorkflow(startupParams);

            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver1, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver2, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.requestor, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            Assert.AreEqual(3, process.ElapsedActivities.Count);

            WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities();

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

            Assert.AreEqual(transDespColl[1].ToActivity.Key, coll[2].Activity.Key, "此处为动态添加的活动");
        }
Beispiel #4
0
        public void ReturnTestWithBranchActivity()
        {
            IWfProcessDescriptor desp = WfProcessTestCommon.CreateProcessDescriptor();

            desp.InitialActivity.Resources.Add(new WfUserResourceDescriptor((IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object));

            GetProcDespWithBranchActivities(desp.Activities[1], 2);

            WfProcessStartupParams startupParams = WfProcessTestCommon.GetInstanceOfWfProcessStartupParams(desp);
            IWfProcess             process       = WfRuntime.StartWorkflow(startupParams);

            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver1, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver2, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            Assert.AreEqual(2, process.ElapsedActivities.Count);
            WfRuntime.ProcessContext.ActivityChangingContext.CreatorInstanceID = process.CurrentActivity.ID;
            process.CurrentActivity.CopyMainStreamActivities(process.Activities[1], null, WfControlOperationType.Return); //退件
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.requestor, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);

            Assert.IsTrue(process.CurrentActivity.CreatorInstanceID.IsNotEmpty());
            Assert.AreEqual(process.ElapsedActivities[2].ID, process.CurrentActivity.CreatorInstanceID);

            Assert.AreEqual(10, process.Activities.Count);
        }
Beispiel #5
0
        public void MainStreamActivitiesWithReturn()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver1, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver2, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.requestor, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            int i = process.Activities.Count;

            Assert.AreEqual(6, i);
            Assert.AreEqual(6, process.Descriptor.Activities.Count);
            WfRuntime.ProcessContext.ActivityChangingContext.CreatorInstanceID = process.CurrentActivity.ID;
            process.CurrentActivity.CopyMainStreamActivities(process.Activities[1], null, WfControlOperationType.Return);

            int j = process.Activities.Count;

            Assert.AreEqual(9, j);
            Assert.AreEqual(9, process.Descriptor.Activities.Count);

            //此时还在当前节点,如果流转,也是流转到process.Activities[1]中
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.requestor, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            Assert.IsTrue(process.CurrentActivity.CreatorInstanceID.IsNotEmpty());
            Assert.AreEqual(process.ElapsedActivities[process.ElapsedActivities.Count - 1].ID, process.CurrentActivity.CreatorInstanceID);

            WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities();

            Assert.AreEqual(6, coll.Count);
        }