示例#1
0
        public MockFailedWorkflowEngine(WorkflowContext context, WorklistItem worklistItem)
            : base(context)
        {
            ExitStrategy.Quitting = false; // <<==== IMPORTANT! Otherwise the engine "loop" will just quit before it has even started
            _worklistItem = worklistItem;

            FinalStatusOutcomeDeterminedHandler += outcomeStatusId =>
            {
                StatusResult = outcomeStatusId;
                ExitStrategy.Quitting = true;
            };
        }
        public MockNormalWorkflowEngine(WorkflowContext context, WorklistItem worklistItem)
            : base(context)
        {
            ExitStrategy.Quitting = false;
            _worklistItem = worklistItem;

            FinalStatusOutcomeDeterminedHandler += outcomeStatusId =>
            {
                StatusResult = outcomeStatusId;
                ExitStrategy.Quitting = true;
            };
        }
示例#3
0
        public void CanCreateCostLedgerItem()
        {

            workListItem = cloudCostingActivityTestClass.GetWorkListItem();
            cloudCostingActivityTestClass.OnVirtualWork();


            var result = (from wl in db.Cloudcore_CostLedger
                          where wl.InstanceId == workListItem.InstanceId
                          select new
                          {
                              wl.Cost,
                          }).Single();

            Assert.AreEqual(100, result.Cost);
        }
示例#4
0
        public WorklistItem GetWorkListItem()
        {
            var result = (from wl in Database.Cloudcore_VwWorklistEx
                          select new
                          {
                              wl.ActivityId,
                              wl.ActivityGuid,
                              wl.ActivityName,
                              wl.InstanceId
                          }).First();

            var workListItem = new WorklistItem(result.ActivityId, result.ActivityGuid,
                result.ActivityName, 1, 1);
            workListItem.InstanceId = result.InstanceId;
            SetWorkItemData(workListItem);

            return workListItem;
        }
示例#5
0
 private string LogError(WorklistItem worklistItem, Exception exception)
 {
     var message = PrepareWorkflowInstanceErrorMessage(worklistItem.InstanceId.Value, worklistItem.ActivityName,
         exception);
     Logger.Error(message, exception, OperationContext.LoggingCategory);
     return message;
 }
示例#6
0
        private Type DetermineActivityClassType(WorklistItem worklistItem)
        {
            Type activityClassType = null;

            if (worklistItem.ActivityGuid != null)
            {
                var classTypeName = "_" + worklistItem.ActivityGuid.Value.ToString().Replace("-", "_").ToLower();

                if (!ActivityClassTypes.TryGetValue(classTypeName, out activityClassType))
                {
                    throw new UnknownWorkerTaskTypeException(String.Format(@"Unexpected workflow activity type encountered: {0} " +
                                                                           @"for activity guid {1}. (Have you registered all your modules? " +
                                                                           @"Please see ""CloudCore.Deployment.VirtualWorker.Worker.RegisterWorkerModules()"" " +
                                                                           @"for more information.)", classTypeName, worklistItem.ActivityGuid));
                }
            }

            return activityClassType;
        }
示例#7
0
        private BaseActivity PrepareWorkflowItemForExecution(WorklistItem worklistItem)
        {
            if (worklistItem.ActivityGuid != null)
            {
                var activityClassType = DetermineActivityClassType(worklistItem);
                var workerActivity = (BaseActivity)Activator.CreateInstance(activityClassType);
                workerActivity.SetThreadSafeDataAccessObject(OperationContext.ThreadSafeDataAccess);
                workerActivity.SetWorkItemData(worklistItem);
                return workerActivity;
            }

            throw new NullReferenceException(string.Format(@"Preparation of Worklist Activity Type Instance did not "
                                                             + @"contain all required worklist data. Please see Type ""{0}"""
                                                             + "for the required fields.",
                                                           typeof(WorklistItem)));
        }
示例#8
0
 protected internal void SetWorkItemData(WorklistItem worklistItem)
 {
     WorkflowData = worklistItem;
 }