Ejemplo n.º 1
0
        public void RegisterWorkflow <TWorkflow>()
            where TWorkflow : IWorkflow, new()
        {
            TWorkflow wf = new TWorkflow();

            _registry.RegisterWorkflow(wf);
        }
Ejemplo n.º 2
0
        public void RegisterWorkflow <TWorkflow>()
            where TWorkflow : IWorkflow
        {
            TWorkflow wf = ActivatorUtilities.CreateInstance <TWorkflow>(_serviceProvider);

            _registry.RegisterWorkflow(wf);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 5
0
        public WorkflowDefinition LoadDefinition(string json)
        {
            var source = JsonConvert.DeserializeObject <DefinitionSourceV1>(json);
            var def    = Convert(source);

            _registry.RegisterWorkflow(def);
            return(def);
        }
Ejemplo n.º 6
0
        public WorkflowDefinition LoadDefinition(string source, Func <string, DefinitionSourceV1> deserializer)
        {
            var sourceObj = deserializer(source);
            var def       = Convert(sourceObj);

            _registry.RegisterWorkflow(def);
            return(def);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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>);
        }
Ejemplo n.º 9
0
        public void LoadDefinition(Definition source)
        {
            var def = Convert(source);

            _registry.RegisterWorkflow(def);
        }