Exemple #1
0
        public void SimpleProcessPersistTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupSimpleProcessWithAssignee();

            //process.DefaultTaskTitle = "测试保存的流程";

            ProcessTestHelper.OutputExecutionTime(() => WfRuntime.PersistWorkflows(), "保存简单流程");

            try
            {
                IWfProcess loadedProcess = WfRuntime.GetProcessByProcessID(process.ID);

                Assert.AreEqual(process.ID, loadedProcess.ID);
                Assert.AreEqual(process.Status, loadedProcess.Status);
                Assert.AreEqual(DataLoadingType.External, loadedProcess.LoadingType);

                WfTransferParams transferParams = new WfTransferParams(process.Descriptor.CompletedActivity);

                transferParams.Assignees.Add(new WfAssignee((IUser)OguObjectSettings.GetConfig().Objects["approver1"].Object));
                transferParams.Assignees.Add(new WfAssignee((IUser)OguObjectSettings.GetConfig().Objects["approver2"].Object));

                loadedProcess.MoveTo(transferParams);
                WfRuntime.PersistWorkflows();

                Assert.AreEqual(process.ID, loadedProcess.ID);
                Assert.AreEqual(WfProcessStatus.Completed, loadedProcess.Status);
                Assert.AreEqual(DataLoadingType.External, loadedProcess.LoadingType);
            }
            finally
            {
                //WfRuntime.DeleteProcessByProcessID(process.ID);
            }
        }
Exemple #2
0
        public void PersistProcessWithTenantCode()
        {
            IWfProcess process = WfProcessTestCommon.StartupSimpleProcessWithAssignee();

            TenantContext.Current.TenantCode = "1001";
            ProcessTestHelper.OutputExecutionTime(() => WfRuntime.PersistWorkflows(), "保存简单的带TenantCode的流程");
        }
Exemple #3
0
        public void FetchPersistQueueTest()
        {
            WfPersistQueueAdapter.Instance.ClearQueue();
            WfPersistQueueAdapter.Instance.ClearArchivedQueue();

            IWfProcess process = WfProcessTestCommon.StartupSimpleProcessWithAssignee();

            ProcessTestHelper.OutputExecutionTime(() => WfRuntime.PersistWorkflows(), "保存简单流程");

            Assert.AreEqual(0, WfProcessCurrentAssigneeAdapter.Instance.Load(process.ID).Count);
            Assert.AreEqual(0, WfProcessRelativeParamsAdapter.Instance.Load(process.ID).Count);
            Assert.IsNull(WfProcessDimensionAdapter.Instance.Load(process.ID));

            Console.WriteLine(process.ID);

            WfPersistQueue pq = WfPersistQueueAdapter.Instance.FetchQueueItemsAndDoOperation(1).FirstOrDefault();

            Assert.IsTrue(WfProcessCurrentAssigneeAdapter.Instance.Load(pq.ProcessID).Count > 0);
            Assert.AreEqual(process.RelativeParams.Count, WfProcessRelativeParamsAdapter.Instance.Load(pq.ProcessID).Count);

            Assert.IsNull(WfPersistQueueAdapter.Instance.Load(pq.ProcessID));

            WfPersistQueue pqArchieved = WfPersistQueueAdapter.Instance.LoadArchived(pq.ProcessID);

            Assert.IsNotNull(pqArchieved);
            Assert.AreEqual(pq.UpdateTag, pqArchieved.UpdateTag);

            WfProcessDimension pd = WfProcessDimensionAdapter.Instance.Load(pq.ProcessID);

            Assert.IsNotNull(pd);

            Console.WriteLine(pd.Data);
        }
Exemple #4
0
        public void PersistQueueBasicTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupSimpleProcessWithAssignee();

            ProcessTestHelper.OutputExecutionTime(() => WfRuntime.PersistWorkflows(), "保存简单流程");

            WfPersistQueue pq = WfPersistQueue.FromProcess(process);

            Console.WriteLine(pq.ProcessID);

            Assert.AreEqual(0, WfProcessCurrentAssigneeAdapter.Instance.Load(pq.ProcessID).Count);
            Assert.AreEqual(0, WfProcessRelativeParamsAdapter.Instance.Load(pq.ProcessID).Count);
            Assert.IsNull(WfProcessDimensionAdapter.Instance.Load(pq.ProcessID));

            WfPersistQueueAdapter.Instance.DoQueueOperation(pq);

            Assert.IsTrue(WfProcessCurrentAssigneeAdapter.Instance.Load(pq.ProcessID).Count > 0);
            Assert.AreEqual(process.RelativeParams.Count, WfProcessRelativeParamsAdapter.Instance.Load(pq.ProcessID).Count);

            WfProcessDimension pd = WfProcessDimensionAdapter.Instance.Load(pq.ProcessID);

            Assert.IsNotNull(pd);

            Console.WriteLine(pd.Data);
        }
Exemple #5
0
        public void ProcessPersistExecutionTimeTest()
        {
            IWfProcessDescriptor processDesc = WfProcessTestCommon.CreateSimpleProcessDescriptor();

            int totalProcesses = 40;

            //准备流程实例
            List <IWfProcess> processes = ProcessTestHelper.StartupMultiProcesses(processDesc, totalProcesses);

            ProcessTestHelper.OutputExecutionTime(() =>
            {
                WfRuntime.PersistWorkflows();
            },
                                                  string.Format("保存{0}个流程", totalProcesses));
        }