Exemplo n.º 1
0
 public static void SetObserver(IExecutionObserver observer)
 {
     _observer = observer;
     #if DEBUG
     ExecutionObserverDebugger.Test(_observer);
     #endif
 }
Exemplo n.º 2
0
        public SpecificationEngine(ISystem system, ISpecRunner runner, IExecutionObserver observer)
        {
            _system = system;
            _runner = runner;

            _executionQueue = new ConsumingQueue(request =>
            {
                if (request.IsCancelled)
                {
                    return;
                }

                _warmup.Wait(30.Seconds());

                observer.SpecStarted(request);
                var results = _runner.Execute(request, _executionQueue);

                if (!request.IsCancelled && results != null)
                {
                    // TODO -- combine the two things here?
                    request.SpecExecutionFinished(results);
                    observer.SpecFinished(request);
                }
            });

            _warmup = _system.Warmup().ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    _runner.MarkAsInvalid(t.Exception);
                }
            });
        }
Exemplo n.º 3
0
        public SpecificationEngine(ISystem system, ISpecRunner runner, IExecutionObserver observer)
        {
            _system = system;
            _runner = runner;

            _executionQueue = new ConsumingQueue(request =>
            {
                if (request.IsCancelled)
                {
                    return;
                }

                _warmup.Wait(30.Seconds());

                observer.SpecStarted(request);
                var results = _runner.Execute(request, _executionQueue );

                if (!request.IsCancelled && results != null)
                {
                    // TODO -- combine the two things here?
                    request.SpecExecutionFinished(results);
                    observer.SpecFinished(request);
                }
            });

            _warmup = _system.Warmup().ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    _runner.MarkAsInvalid(t.Exception);
                }
            });
        }
Exemplo n.º 4
0
        public SpecificationEngine(ISystem system, ISpecRunner runner, IExecutionObserver observer)
        {
            if (system == null)
            {
                throw new ArgumentNullException(nameof(system));
            }
            if (runner == null)
            {
                throw new ArgumentNullException(nameof(runner));
            }
            if (observer == null)
            {
                throw new ArgumentNullException(nameof(observer));
            }


            _system = system;
            _runner = runner;

            _executionQueue = new ConsumingQueue(request =>
            {
                if (request.IsCancelled)
                {
                    return;
                }

                _warmup.Wait(30.Seconds());

                var results = _runner.Execute(request, _executionQueue);

                if (!request.IsCancelled && (results != null))
                {
                    // TODO -- combine the two things here?
                    request.SpecExecutionFinished(results);
                    observer.SpecFinished(request);
                }
            });

            var warmup = _system.Warmup();

            if (warmup == null)
            {
                throw new InvalidOperationException($"{system} cannot return a null value from {nameof(ISystem.Warmup)}()");
            }


            if (warmup.Status == TaskStatus.WaitingForActivation)
            {
                warmup.Start();
            }

            _warmup = warmup.ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    _runner.MarkAsInvalid(t.Exception);
                }
            });
        }
Exemplo n.º 5
0
        public SpecRunner(IExecutionMode mode, ISystem system, IExecutionObserver observer)
        {
            _mode     = mode;
            _system   = system;
            _observer = observer;

            Status = SpecRunnerStatus.Valid;
        }
Exemplo n.º 6
0
        public SpecRunner(IExecutionMode mode, ISystem system, IExecutionObserver observer)
        {
            _mode = mode;
            _system = system;
            _observer = observer;

            Status = SpecRunnerStatus.Valid;
        }
 public ResumeAfterWorkflowExecutor(
     Execution <TContext> execution,
     TContext context,
     INodesResolver <TContext> nodes,
     IActivityFactory factory,
     IExecutionObserver observer,
     IActivityOutputProvider outputProvider)
     : base(execution, context, nodes, factory, observer)
 {
     m_OutputProvider = outputProvider;
 }
Exemplo n.º 8
0
 public Workflow(
     string name,
     IWorkflowPersister <TContext> persister,
     IActivityFactory activityFactory     = null,
     IExecutionObserver executionObserver = null)
     : this(
         persister,
         activityFactory,
         executionObserver)
 {
     Name = name ?? throw new ArgumentNullException(nameof(name));
 }
Exemplo n.º 9
0
 protected WorkflowExecutorBase(
     Execution <TContext> execution,
     TContext context,
     INodesResolver <TContext> nodes,
     IActivityFactory factory,
     IExecutionObserver observer)
 {
     m_ExecutionObserver = observer ?? new NullExecutionObserver();
     m_Context           = context;
     Factory             = factory;
     m_Execution         = execution;
     m_Nodes             = nodes;
 }
 protected WorkflowExecutorBase(
     Execution execution,
     TContext context,
     Workflow <TContext> workflow,
     IActivityFactory factory,
     IExecutionObserver observer)
 {
     m_ExecutionObserver = observer ?? new NullExecutionObserver();
     m_Context           = context;
     Factory             = factory;
     m_Execution         = execution;
     _workflow           = workflow;
     _workflowTypeName   = _workflow.GetType().Name;
 }
Exemplo n.º 11
0
 public WorkflowExecutor(
     Execution execution,
     TContext context,
     Workflow <TContext> workflow,
     IActivityFactory factory,
     IExecutionObserver observer)
     : base(
         execution,
         context,
         workflow,
         factory,
         observer)
 {
 }
Exemplo n.º 12
0
 public WorkflowExecutor(
     Execution <TContext> execution,
     TContext context,
     INodesResolver <TContext> nodes,
     IActivityFactory factory,
     IExecutionObserver observer)
     : base(
         execution,
         context,
         nodes,
         factory,
         observer)
 {
 }
Exemplo n.º 13
0
 public Workflow(
     IWorkflowPersister <TContext> persister,
     IActivityFactory activityFactory     = null,
     IExecutionObserver executionObserver = null)
 {
     m_ExecutionObserver = executionObserver;
     m_ActivityFactory   = activityFactory ?? this;
     m_Persister         = persister;
     m_Start             = new GraphNode <TContext>("start");
     m_End  = new GraphNode <TContext>("end");
     m_Fail = new GraphNode <TContext>("fail");
     RegisterNode(m_Start);
     RegisterNode(m_End);
     RegisterNode(m_Fail);
 }
Exemplo n.º 14
0
 public ResumeAfterWorkflowExecutor(
     Execution execution,
     TContext context,
     Workflow <TContext> workflow,
     IActivityFactory factory,
     IExecutionObserver observer,
     IActivityOutputProvider outputProvider)
     : base(
         execution,
         context,
         workflow,
         factory,
         observer)
 {
     m_OutputProvider = outputProvider;
 }
Exemplo n.º 15
0
 public ResumeFromWorkflowExecutor(
     Execution <TContext> execution,
     TContext context,
     INodesResolver <TContext> nodes,
     IActivityFactory factory,
     IExecutionObserver observer,
     object input)
     : base(
         execution,
         context,
         nodes,
         factory,
         observer)
 {
     m_Input = input;
 }
 public ResumeFromWorkflowExecutor(
     Execution execution,
     TContext context,
     Workflow <TContext> workflow,
     IActivityFactory factory,
     IExecutionObserver observer,
     object input)
     : base(
         execution,
         context,
         workflow,
         factory,
         observer)
 {
     m_Input = input;
 }
Exemplo n.º 17
0
 public ResumeWorkflowExecutor(
     Execution <TContext> execution,
     TContext context,
     INodesResolver <TContext> nodes,
     IActivityFactory factory,
     IExecutionObserver observer,
     ActivityExecution resumingActivityExecution,
     object closure)
     : base(
         execution,
         context,
         nodes,
         factory,
         observer)
 {
     m_ResumingActivityExecution = resumingActivityExecution;
     m_Closure = closure;
 }
Exemplo n.º 18
0
 public ResumeWorkflowExecutor(
     Execution execution,
     TContext context,
     Workflow <TContext> workflow,
     IActivityFactory factory,
     IExecutionObserver observer,
     ActivityExecution resumingActivityExecution,
     object closure)
     : base(
         execution,
         context,
         workflow,
         factory,
         observer)
 {
     m_ResumingActivityExecution = resumingActivityExecution;
     m_Closure = closure;
 }
Exemplo n.º 19
0
        private void buildExecutionQueue(SpecRunner runner, IExecutionObserver executionObserver)
        {
            _queue = new ConsumingQueue(request =>
            {
                if (request.IsCancelled)
                {
                    return;
                }

                var results = runner.Execute(request, _queue);

                if (!request.IsCancelled && results != null)
                {
                    // TODO -- combine the two things here?
                    request.SpecExecutionFinished(results);
                    executionObserver.SpecFinished(request);
                }
            });

            _queue.Start();
        }
Exemplo n.º 20
0
 internal void SetExecutionObserver(IExecutionObserver observer)
 {
     _methodSetExecutionObserver?.Invoke(observer);
 }
Exemplo n.º 21
0
 internal void SetExecutionObserver(IExecutionObserver observer)
 {
     _methodInfos[nameof(ExecutionObserverProxy.SetObserver)]
     ?.Invoke(null, new object[] { observer });
 }
Exemplo n.º 22
0
        private static SpecRunner buildRunner(RunInput input, List <Specification> specs, RunningSystem running, out IExecutionObserver executionObserver)
        {
            IBatchObserver batchObserver = new NulloBatchObservor();

            executionObserver = new NulloObserver();
            switch (input.TracingFlag)
            {
            case TracingStyle.verbose:
                batchObserver = new ConsoleBatchObserver(specs.Count);
                // TODO -- awesome if you could get smarter w/ the console output here
                break;

            case TracingStyle.teamcity:
                batchObserver     = new TeamCityBatchObserver();
                executionObserver = new TeamCityExecutionObserver();
                break;

            case TracingStyle.appveyor:
                batchObserver = new AppVeyorBatchObserver();
                break;
            }

            return(new SpecRunner(new BatchExecutionMode(batchObserver), running.System, executionObserver));
        }
 public StepthroughExecution(SpecExecutionRequest request, StopConditions stopConditions, IUserInterfaceObserver observer, IExecutionObserver executionObserver) : base(request, stopConditions, new InstrumentedLogger(observer))
 {
     _observer          = observer;
     _executionObserver = executionObserver;
 }
Exemplo n.º 24
0
 public static void Test(IExecutionObserver observer)
 {
     // To observe the observer's condition during execution,
     // can place a breakpoint below
 }
Exemplo n.º 25
0
 public StepthroughExecution(SpecExecutionRequest request, StopConditions stopConditions, IUserInterfaceObserver observer, IExecutionObserver executionObserver) : base(request, stopConditions, new InstrumentedLogger(observer))
 {
     _observer = observer;
     _executionObserver = executionObserver;
 }
 public static void SetObserver(IExecutionObserver observer)
 {
     _observer = observer;
 }