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; }; }
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); }
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; }
private string LogError(WorklistItem worklistItem, Exception exception) { var message = PrepareWorkflowInstanceErrorMessage(worklistItem.InstanceId.Value, worklistItem.ActivityName, exception); Logger.Error(message, exception, OperationContext.LoggingCategory); return message; }
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; }
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))); }
protected internal void SetWorkItemData(WorklistItem worklistItem) { WorkflowData = worklistItem; }