Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LivenessCheckingStrategy"/> class.
 /// </summary>
 internal LivenessCheckingStrategy(Configuration configuration, SpecificationEngine specificationEngine,
                                   SchedulingStrategy strategy)
 {
     this.Configuration       = configuration;
     this.SpecificationEngine = specificationEngine;
     this.SchedulingStrategy  = strategy;
 }
Exemplo n.º 2
0
        private SpecificationEngine buildBatchedEngine(string tracingStyle)
        {
            IBatchObserver     batchObserver     = new BatchObserver();
            IExecutionObserver executionObserver = new NulloObserver();

            if ("TeamCity" == tracingStyle)
            {
                batchObserver     = new TeamCityBatchObserver(batchObserver);
                executionObserver = new TeamCityExecutionObserver();
            }

            var executionMode = new BatchExecutionMode(batchObserver);
            var runner        = new SpecRunner(executionMode, _system, _specExpiration);

            var engine = new SpecificationEngine(
                _system, runner, executionObserver);

            _controller = new BatchController(engine, batchObserver);

            _services.Add(engine);

            EventAggregator.Messaging.AddListener(_controller);

            return(engine);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the specification engine.
 /// </summary>
 internal void SetSpecificationEngine(SpecificationEngine specificationEngine)
 {
     if (this.Configuration.IsLivenessCheckingEnabled)
     {
         this.Strategy = new TemperatureCheckingStrategy(this.Configuration, specificationEngine, this.Strategy);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the specification engine.
 /// </summary>
 internal void SetSpecificationEngine(SpecificationEngine specificationEngine)
 {
     if (this.Strategy is TemperatureCheckingStrategy temperatureCheckingStrategy)
     {
         temperatureCheckingStrategy.SetSpecificationEngine(specificationEngine);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the specification engine.
 /// </summary>
 internal void SetSpecificationEngine(SpecificationEngine specificationEngine)
 {
     if (this.SchedulingPolicy is SchedulingPolicy.Systematic &&
         this.Configuration.IsLivenessCheckingEnabled)
     {
         this.Strategy = new TemperatureCheckingStrategy(this.Configuration, specificationEngine,
                                                         this.Strategy as SystematicStrategy);
     }
 }
Exemplo n.º 6
0
        public void Start(EngineMode mode, Project project, MarshalByRefObject remoteListener)
        {
            Project.CurrentProject = project;

            EventAggregator.Start((IRemoteListener)remoteListener);

            _project = project;

            Type systemType = null;

            try
            {
                systemType = _project.DetermineSystemType();
                _system    = Activator.CreateInstance(systemType).As <ISystem>();
                _services.Add(_system);

                var timeZone   = new MachineTimeZoneContext();
                var clock      = new Clock();
                var systemTime = new SystemTime(clock, timeZone);
                _specExpiration = new SpecExpiration(systemTime);

                if (mode == EngineMode.Interactive)
                {
                    _engine = buildUserInterfaceEngine();
                }
                else
                {
                    _engine = buildBatchedEngine(project.TracingStyle);
                }


                _engine.Start(project.StopConditions);
            }
            catch (Exception e)
            {
                var message = new SystemRecycled
                {
                    error   = e.ToString(),
                    success = false,
                };

                if (systemType != null)
                {
                    message.system_name = systemType.AssemblyQualifiedName;
                }

                EventAggregator.SendMessage(message);
            }

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            AppDomain.CurrentDomain.DomainUnload       += CurrentDomainOnDomainUnload;
        }
Exemplo n.º 7
0
        private SpecificationEngine buildUserInterfaceEngine()
        {
            var observer = new UserInterfaceObserver();

            var runner = new SpecRunner(new UserInterfaceExecutionMode(observer), _system, _specExpiration);

            var executionObserver = new UserInterfaceExecutionObserver();
            var engine            = new SpecificationEngine(_system, runner, executionObserver);

            _controller = new EngineController(engine, observer, runner);

            // Super hokey, but we need some way to feed the spec started
            // event up to EngineController
            // TODO -- maybe pull the IExecutionQueue concept from 1-2 back out
            executionObserver.Controller = (EngineController)_controller;


            _services.Add(observer);
            _services.Add(engine);

            EventAggregator.Messaging.AddListener(_controller);

            return(engine);
        }
Exemplo n.º 8
0
 public SpecifiesStatically() : base(new TypeStoreFactory())
 {
     this.engine = new SpecificationEngine(this);
 }
Exemplo n.º 9
0
 protected Specifies() : base(new TypeStoreFactory())
 {
     instanceForCleanUp = this;
     this.engine        = new SpecificationEngine(this);
 }
 /// <summary>
 /// Sets the specification engine.
 /// </summary>
 internal void SetSpecificationEngine(SpecificationEngine specificationEngine)
 {
     this.SpecificationEngine = specificationEngine;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TemperatureCheckingStrategy"/> class.
 /// </summary>
 internal TemperatureCheckingStrategy(Configuration configuration, SpecificationEngine specificationEngine,
                                      SchedulingStrategy strategy)
     : base(configuration, specificationEngine, strategy)
 {
 }
Exemplo n.º 12
0
 public Specifies() : base(new TypeStoreFactory())
 {
     this.engine = new SpecificationEngine(this);
     this.engine.Run();
 }