private void zExecuteStep() { zOnStepBegin(new StepEventArgs(CurrentStep)); IStepExecutor stepExecutor = m_StepExecutorProvider.GetStepExecutor(CurrentStep); stepExecutor.LoadScope(CurrentStep, m_Context); StepResult result = stepExecutor.ExecuteStep(); if (result == StepResult.Failed) { switch (CurrentStep.FailureScope) { case StepFailureScope.Step: //Do nothing break; case StepFailureScope.Iteration: m_Context.ExecutionStack.SkipIteration(); break; case StepFailureScope.Group: m_Context.ExecutionStack.BreakBranch(); break; case StepFailureScope.Sequence: m_ExecutionState = ExecutionState.Fail; break; } } zOnStepComplete(new StepCompleteEventArgs(CurrentStep, result)); }
public WorkflowExecutorFixture() { Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); ServiceProvider = A.Fake <IServiceProvider>(); ScopeProvider = A.Fake <IScopeProvider>(); Registry = A.Fake <IWorkflowRegistry>(); ResultProcesser = A.Fake <IExecutionResultProcessor>(); EventHub = A.Fake <ILifeCycleEventPublisher>(); CancellationProcessor = A.Fake <ICancellationProcessor>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); MiddlewareRunner = A.Fake <IWorkflowMiddlewareRunner>(); StepExecutor = A.Fake <IStepExecutor>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); var stepExecutionScope = A.Fake <IServiceScope>(); A.CallTo(() => ScopeProvider.CreateScope(A <IStepExecutionContext> ._)).Returns(stepExecutionScope); A.CallTo(() => stepExecutionScope.ServiceProvider).Returns(ServiceProvider); var scope = A.Fake <IServiceScope>(); var scopeFactory = A.Fake <IServiceScopeFactory>(); A.CallTo(() => ServiceProvider.GetService(typeof(IServiceScopeFactory))).Returns(scopeFactory); A.CallTo(() => scopeFactory.CreateScope()).Returns(scope); A.CallTo(() => scope.ServiceProvider).Returns(ServiceProvider); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); A.CallTo(() => DateTimeProvider.UtcNow).Returns(DateTime.UtcNow); A .CallTo(() => ServiceProvider.GetService(typeof(IWorkflowMiddlewareRunner))) .Returns(MiddlewareRunner); A .CallTo(() => ServiceProvider.GetService(typeof(IStepExecutor))) .Returns(StepExecutor); A.CallTo(() => MiddlewareRunner .RunPostMiddleware(A <WorkflowInstance> ._, A <WorkflowDefinition> ._)) .Returns(Task.CompletedTask); A.CallTo(() => MiddlewareRunner .RunExecuteMiddleware(A <WorkflowInstance> ._, A <WorkflowDefinition> ._)) .Returns(Task.CompletedTask); A.CallTo(() => StepExecutor.ExecuteStep(A <IStepExecutionContext> ._, A <IStepBody> ._)) .ReturnsLazily(call => call.Arguments[1].As <IStepBody>().RunAsync( call.Arguments[0].As <IStepExecutionContext>())); //config logging var loggerFactory = new LoggerFactory(); //loggerFactory.AddConsole(LogLevel.Debug); Subject = new WorkflowExecutor(Registry, ServiceProvider, ScopeProvider, DateTimeProvider, ResultProcesser, EventHub, CancellationProcessor, Options, loggerFactory); }
public ExecutionOrchestrator(IReflectionWrapper reflectionWrapper, IAssemblyLoader assemblyLoader, object classInstanceManager, IHookExecutor hookExecutor, IStepExecutor stepExecutor) { _reflectionWrapper = reflectionWrapper; _assemblyLoader = assemblyLoader; _classInstanceManager = classInstanceManager; _hookExecutor = hookExecutor; _stepExecutor = stepExecutor; }
public WorkflowExecutor(IWorkflowRegistry registry, IServiceProvider serviceProvider, IScopeProvider scopeProvider, IDateTimeProvider datetimeProvider, IExecutionResultProcessor executionResultProcessor, ILifeCycleEventPublisher publisher, ICancellationProcessor cancellationProcessor, WorkflowOptions options, IWorkflowMiddlewareRunner middlewareRunner, IStepExecutor stepExecutor, ILoggerFactory loggerFactory) { _serviceProvider = serviceProvider; _scopeProvider = scopeProvider; _registry = registry; _datetimeProvider = datetimeProvider; _publisher = publisher; _cancellationProcessor = cancellationProcessor; _options = options; _logger = loggerFactory.CreateLogger <WorkflowExecutor>(); _executionResultProcessor = executionResultProcessor; _middlewareRunner = middlewareRunner; _stepExecutor = stepExecutor; }
internal Workflow( TRequest request, IStepExecutor executor, IErrorHandler <TRequest, TStepOrdinal> defaultErrorHandler, IInterceptor <TRequest, TStepOrdinal> defaultInterceptor) { if (executor == null) { throw new ArgumentNullException("executor"); } _executor = executor; _defaultErrorHandler = defaultErrorHandler; _defaultInterceptor = defaultInterceptor; _request = request; }
public void AcceptVisitor(IStepExecutor executor) { executor.Line(this); }
public void AcceptVisitor(IStepExecutor executor) { executor.Composite(this); }
public void AcceptVisitor(IStepExecutor executor) { _innerFixture.Context = executor.CurrentContext; _inner.AcceptVisitor(executor); }