Пример #1
0
        public void RegisterWorkflow <TWorkflow>()
            where TWorkflow : IWorkflow, new()
        {
            TWorkflow wf = new TWorkflow();

            _registry.RegisterWorkflow(wf);
        }
Пример #2
0
        public void RegisterWorkflow <TWorkflow>()
            where TWorkflow : IWorkflow
        {
            TWorkflow wf = ActivatorUtilities.CreateInstance <TWorkflow>(_serviceProvider);

            _registry.RegisterWorkflow(wf);
        }
Пример #3
0
        public void EventSubscribe()
        {
            //arrange
            var def = new EventSubscribeTestWorkflow();

            Registry.RegisterWorkflow(def);

            var instance = new WorkflowInstance();

            instance.WorkflowDefinitionId = def.Id;
            instance.Version       = def.Version;
            instance.Status        = WorkflowStatus.Runnable;
            instance.NextExecution = 0;
            instance.Id            = "001";

            var executionPointer = new ExecutionPointer()
            {
                Active = true,
                StepId = 1
            };

            instance.ExecutionPointers.Add(executionPointer);

            //act
            Subject.Execute(instance, Options);

            //assert
            executionPointer.EventName.Should().Be("MyEvent");
            executionPointer.EventKey.Should().Be("0");
            executionPointer.Active.Should().Be(false);
        }
Пример #4
0
 protected override async Task ExecuteAsync(CancellationToken stoppingToken)
 {
     // throw new System.NotImplementedException();
     _workflowRegistry.RegisterWorkflow(new WorkflowDefinition()
     {
         Id    = "test",
         Steps = new List <WorkFlowStep>()
         {
             new WorkFlowStep()
             {
                 Id       = "No1",
                 StepType = typeof(FirstStepAsync)
             },
             new WorkFlowStep()
             {
                 Id       = "No2",
                 StepType = typeof(SecondStepAsync)
             },
             new WorkFlowStep()
             {
                 Id       = "No3",
                 StepType = typeof(ThirdStepAsync)
             }
         }
     });
     Parallel.For(0, 5, async(i, state) => await _workflowController.StartWorkflowAsync("test", new { TaskId = i }));
     await _workHost.StartAsync(stoppingToken);
 }
        public WorkflowDefinition LoadDefinition(string json)
        {
            var source = JsonConvert.DeserializeObject <DefinitionSourceV1>(json);
            var def    = Convert(source);

            _registry.RegisterWorkflow(def);
            return(def);
        }
Пример #6
0
        public WorkflowDefinition LoadDefinition(string source, Func <string, DefinitionSourceV1> deserializer)
        {
            var sourceObj = deserializer(source);
            var def       = Convert(sourceObj);

            _registry.RegisterWorkflow(def);
            return(def);
        }
Пример #7
0
        public void RegisterDefintion()
        {
            _subject.LoadDefinition("{\"Id\": \"HelloWorld\", \"Version\": 1, \"Steps\": []}");

            A.CallTo(() => _registry.RegisterWorkflow(A <WorkflowDefinition> .That.Matches(x => x.Id == "HelloWorld"))).MustHaveHappened();
            A.CallTo(() => _registry.RegisterWorkflow(A <WorkflowDefinition> .That.Matches(x => x.Version == 1))).MustHaveHappened();
            A.CallTo(() => _registry.RegisterWorkflow(A <WorkflowDefinition> .That.Matches(x => x.DataType == typeof(object)))).MustHaveHappened();
        }
Пример #8
0
        public void RegisterWorkflow(Type type)
        {
            var workflow = _iocManager.Resolve(type);

            if (!(workflow is IAbpWorkflow))
            {
                throw new AbpException("RegistType must implement from AbpWorkflow!");
            }
            _workflowRegistry.RegisterWorkflow(workflow as IWorkflow <WorkflowParamDictionary>);
        }
Пример #9
0
        public void LoadDefinition(Definition source)
        {
            var def = Convert(source);

            _registry.RegisterWorkflow(def);
        }