コード例 #1
0
 private void StartupBrowserCommunicationTimeoutMonitor()
 {
     if (_browserCommunicationTimeoutMonitor == null)
     {
         _browserCommunicationTimeoutMonitor = new BrowserCommunicationTimeoutMonitor(_eventPublisher, new TimerWrapper(3000), TimeSpan.FromMinutes(5));
         _eventSubscriptionManager.AddListener(_browserCommunicationTimeoutMonitor);
     }
 }
コード例 #2
0
        public static IEventSubscriptionManager AddListener <T>(this IEventSubscriptionManager eventAggregator, Action <T> listener)
        {
            var delegateListener = new DelegateListener <T>(listener);

            eventAggregator.AddListener(delegateListener);
            return(eventAggregator);
        }
コード例 #3
0
        internal WebServerOnlyRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebServer webServer,
            Uri testHtmlPageUrl,
            string xapPath)
        {
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _webServer = webServer;
            _testHtmlPageUrl = testHtmlPageUrl;
            _xapPath = xapPath;

            _testResultAggregator = new TestResultAggregator(logger, eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);
            _continuousRunnerThread = new Thread(() =>
            {
                string line;
                do
                {
                    line = Console.ReadLine();
                } while (line.ToLower(CultureInfo.CurrentCulture) != "exit");
                //string line;
                //while ((line = System.Console.ReadLine())
                //        .ToLower(CultureInfo.CurrentCulture) != "exit")
                //{
                //    ;
                //}
            });
        }
コード例 #4
0
        internal WebServerOnlyRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebServer webServer,
            Uri testHtmlPageUrl,
            string xapPath)
        {
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _webServer       = webServer;
            _testHtmlPageUrl = testHtmlPageUrl;
            _xapPath         = xapPath;

            _testResultAggregator = new TestResultAggregator(logger, eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);
            _continuousRunnerThread = new Thread(() =>
            {
                string line;
                do
                {
                    line = Console.ReadLine();
                } while (line.ToLower(CultureInfo.CurrentCulture) != "exit");
                //string line;
                //while ((line = System.Console.ReadLine())
                //        .ToLower(CultureInfo.CurrentCulture) != "exit")
                //{
                //    ;
                //}
            });
        }
コード例 #5
0
        public StatLightRunnerFactory(ILogger logger, IEventSubscriptionManager eventSubscriptionManager, IEventPublisher eventPublisher)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _eventPublisher           = eventPublisher;

            var debugListener = new ConsoleDebugListener(logger);

            _eventSubscriptionManager.AddListener(debugListener);

            var ea = eventSubscriptionManager as EventAggregator;

            if (ea != null)
            {
                ea.IgnoreTracingEvent <InitializationOfUnitTestHarnessClientEvent>();
                ea.IgnoreTracingEvent <TestExecutionClassCompletedClientEvent>();
                ea.IgnoreTracingEvent <TestExecutionClassBeginClientEvent>();
                ea.IgnoreTracingEvent <SignalTestCompleteClientEvent>();
            }

            SetupExtensions(_eventSubscriptionManager);
        }
コード例 #6
0
 private void StartupBrowserCommunicationTimeoutMonitor()
 {
     if (_browserCommunicationTimeoutMonitor == null)
     {
         _browserCommunicationTimeoutMonitor = new BrowserCommunicationTimeoutMonitor(_logger, _eventPublisher, new TimerWrapper(3000), Settings.Default.MaxWaitTimeAllowedBeforeCommunicationErrorSent);
         _eventSubscriptionManager.AddListener(_browserCommunicationTimeoutMonitor);
     }
 }
コード例 #7
0
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                var ea = (new EventAggregatorFactory(TestLogger)).Create();

                _eventSubscriptionManager = ea;
                _eventPublisher           = ea;
                _eventSubscriptionManager.AddListener(new MultiListener());
            }
コード例 #8
0
        private void Start()
        {
            _testResultAggregator = new TestResultAggregator(_logger, _eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);

            _logger.Information("{1}{1}Starting Test Run: {0}{1}{1}"
                                .FormatWith(DateTime.Now, Environment.NewLine));
            _startOfRun = DateTime.Now;
            _webBrowser.Start();
            IsCurrentlyRunningTest = true;
        }
コード例 #9
0
        internal OnetimeRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebServer webServer,
            List <IWebBrowser> webBrowsers,
            string xapPath,
            IDialogMonitorRunner dialogMonitorRunner)
        {
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _webServer           = webServer;
            _webBrowsers         = webBrowsers;
            _xapPath             = xapPath;
            _dialogMonitorRunner = dialogMonitorRunner;

            _testResultAggregator = new TestResultAggregator(logger, eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);
            _eventSubscriptionManager.AddListener(this);
        }
コード例 #10
0
        public StatLightRunnerFactory(ILogger logger, IEventSubscriptionManager eventSubscriptionManager, IEventPublisher eventPublisher)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _eventPublisher = eventPublisher;

            var debugListener = new ConsoleDebugListener(logger);
            _eventSubscriptionManager.AddListener(debugListener);

            SetupExtensions(_eventSubscriptionManager);
        }
コード例 #11
0
        public override TestReport Run()
        {
            _eventSubscriptionManager.AddListener(_teamCityTestResultHandler);

            _teamCityTestResultHandler.PublishStart();

            var testReport = base.Run();

            _teamCityTestResultHandler.PublishStop();

            _eventSubscriptionManager.RemoveListener(_teamCityTestResultHandler);
            return(testReport);
        }
コード例 #12
0
        private void SetupExtensions(IEventSubscriptionManager eventSubscriptionManager)
        {
            try
            {
                var path = GetFullPath("Extensions");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                using (var directoryCatalog = new DirectoryCatalog(path))
                    using (var compositionContainer = new CompositionContainer(directoryCatalog))
                    {
                        var extensions = compositionContainer.GetExports <ITestingReportEvents>().ToList();
                        if (extensions.Any())
                        {
                            _logger.Debug("********** Extensions **********");
                            foreach (var lazyExtension in extensions)
                            {
                                var extensionInstance = lazyExtension.Value;
                                _logger.Debug("* Adding - {0}".FormatWith(extensionInstance.GetType().FullName));
                                eventSubscriptionManager.AddListener(extensionInstance);
                            }
                            _logger.Debug("********************************");
                        }
                    }
            }
            catch (ReflectionTypeLoadException rfex)
            {
                string loaderExceptionMessages = "";
                foreach (var t in rfex.LoaderExceptions)
                {
                    loaderExceptionMessages += "   -  ";
                    loaderExceptionMessages += t.Message;
                    loaderExceptionMessages += Environment.NewLine;
                }

                string msg = @"
********************* ReflectionTypeLoadException *********************
***** Begin Loader Exception Messages *****
{0}
***** End Loader Exception Messages *****
".FormatWith(loaderExceptionMessages);

                _logger.Error(msg);
            }
            catch (Exception e)
            {
                _logger.Error("Failed to initialize extension. Error:{0}{1}".FormatWith(Environment.NewLine, e.ToString()));
            }
        }
コード例 #13
0
        public StatLightRunnerFactory(ILogger logger, IEventSubscriptionManager eventSubscriptionManager, IEventPublisher eventPublisher)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _eventPublisher           = eventPublisher;

            var debugListener = new ConsoleDebugListener(logger);

            _eventSubscriptionManager.AddListener(debugListener);

            SetupExtensions(_eventSubscriptionManager);
        }
コード例 #14
0
        public static IDisposable AddListenerAction <T>(this IEventSubscriptionManager eventAggregator, Action <T, IEventAggregator> listener)
        {
            if (eventAggregator == null)
            {
                throw new ArgumentNullException(nameof(eventAggregator));
            }
            if (listener == null)
            {
                throw new ArgumentNullException(nameof(listener));
            }

            var delegateListener = new DelegateListener <T>(listener, eventAggregator);

            eventAggregator.AddListener(delegateListener);

            return(delegateListener);
        }
コード例 #15
0
        public static TinyIoCContainer ResolveAndAddToEventAggregator <T>(this TinyIoCContainer ioc) where T : class
        {
            if (ioc == null)
            {
                throw new ArgumentNullException("ioc");
            }

            if (_eventSubscriptionManager == null)
            {
                _eventSubscriptionManager = ioc.Resolve <IEventSubscriptionManager>();
            }

            var listener = ioc.Resolve <T>();

            _eventSubscriptionManager.AddListener(listener);
            return(ioc);
        }
コード例 #16
0
        public void AddExtensionsToEventAggregator()
        {
            var extensions = GetExtensions().ToList();

            if (!extensions.Any())
            {
                return;
            }

            _logger.Debug("********** Extensions **********");
            foreach (var extensionInstance in extensions)
            {
                _logger.Debug("* Adding - {0}".FormatWith(extensionInstance.GetType().FullName));
                _eventSubscriptionManager.AddListener(extensionInstance);
            }
            _logger.Debug("********************************");
        }
コード例 #17
0
        public StatLightRunnerFactory(ILogger logger, IEventSubscriptionManager eventSubscriptionManager, IEventPublisher eventPublisher)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _eventPublisher = eventPublisher;

            var debugListener = new ConsoleDebugListener(logger);
            _eventSubscriptionManager.AddListener(debugListener);

            var ea = eventSubscriptionManager as EventAggregator;
            if (ea != null)
            {
                ea.IgnoreTracingEvent<InitializationOfUnitTestHarnessClientEvent>();
                ea.IgnoreTracingEvent<TestExecutionClassCompletedClientEvent>();
                ea.IgnoreTracingEvent<TestExecutionClassBeginClientEvent>();
                ea.IgnoreTracingEvent<SignalTestCompleteClientEvent>();
            }

            SetupExtensions(_eventSubscriptionManager);
        }
コード例 #18
0
        internal ContinuousTestRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebBrowser webBrowser,
            ClientTestRunConfiguration clientTestRunConfiguration,
            string xapPath)
        {
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _eventPublisher           = eventPublisher;
            _webBrowser = webBrowser;
            _clientTestRunConfiguration = clientTestRunConfiguration;
            _xapPath = xapPath;

            _eventSubscriptionManager.AddListener(this);

            _logger.Debug("ContinuousTestRunner.ctor()");

            Start();
        }
コード例 #19
0
        internal ContinuousConsoleRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebServer webServer,
            IEnumerable <IWebBrowser> webBrowsers,
            IDialogMonitorRunner dialogMonitorRunner,
            ICurrentStatLightConfiguration currentStatLightConfiguration)
        {
            eventSubscriptionManager.AddListener(this);
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _eventPublisher           = eventPublisher;
            _webServer                     = webServer;
            _webBrowsers                   = webBrowsers;
            _dialogMonitorRunner           = dialogMonitorRunner;
            _currentStatLightConfiguration = currentStatLightConfiguration;
            Func <string, string> getFullXapPath = path => new FileInfo(path).FullName;
            var xapFiles = currentStatLightConfiguration.Select(x => getFullXapPath(x.Server.XapToTestPath));

            _statLightConfigurations    = currentStatLightConfiguration.ToDictionary(x => getFullXapPath(x.Server.XapToTestPath), x => x);
            _xapFileBuildChangedMonitor = new XapFileBuildChangedMonitor(eventPublisher, xapFiles);
            xapFiles.Each(e => _initialXaps.Add(new XapFileBuildChangedServerEvent(e)));
            _currentFilterString = currentStatLightConfiguration.First().Client.TagFilter;
            QueueInitialXaps();

            _runnerTask = new Thread(() =>
            {
                TryRun();

                while (!ShouldExitFromInput())
                {
                    TryRun();
                }
            });
        }
コード例 #20
0
		public void AddHandlerInScopeThatWillRemoveInstanceWhenGarbageCollected(IEventSubscriptionManager eventSubscriptionManager, bool? holdStrongReference = false)
		{
			var someMessageHandler = new SomeMessageHandler();
			eventSubscriptionManager.AddListener(someMessageHandler, holdStrongReference);
		}
コード例 #21
0
        private void AddHandlerInScopeThatWillRemoveInstanceWhenGarbageCollected(IEventSubscriptionManager eventSubscriptionManager, bool?holdStrongReference = false)
        {
            var someMessageHandler = new SomeMessageHandler();

            eventSubscriptionManager.AddListener(someMessageHandler, holdStrongReference);
        }
コード例 #22
0
        private void SetupExtensions(IEventSubscriptionManager eventSubscriptionManager)
        {
            try
            {
                var path = GetFullPath("Extensions");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                using (var directoryCatalog = new DirectoryCatalog(path))
                using (var compositionContainer = new CompositionContainer(directoryCatalog))
                {

                    var extensions = compositionContainer.GetExports<ITestingReportEvents>().ToList();
                    if (extensions.Any())
                    {
                        _logger.Debug("********** Extensions **********");
                        foreach (var lazyExtension in extensions)
                        {
                            var extensionInstance = lazyExtension.Value;
                            _logger.Debug("* Adding - {0}".FormatWith(extensionInstance.GetType().FullName));
                            eventSubscriptionManager.AddListener(extensionInstance);
                        }
                        _logger.Debug("********************************");
                    }
                }
            }
            catch (ReflectionTypeLoadException rfex)
            {
                string loaderExceptionMessages = "";
                foreach (var t in rfex.LoaderExceptions)
                {
                    loaderExceptionMessages += "   -  ";
                    loaderExceptionMessages += t.Message;
                    loaderExceptionMessages += Environment.NewLine;
                }

                string msg = @"
            ********************* ReflectionTypeLoadException *********************
            ***** Begin Loader Exception Messages *****
            {0}
            ***** End Loader Exception Messages *****
            ".FormatWith(loaderExceptionMessages);

                _logger.Error(msg);
            }
            catch (Exception e)
            {
                _logger.Error("Failed to initialize extension. Error:{0}{1}".FormatWith(Environment.NewLine, e.ToString()));
            }
        }
コード例 #23
0
 public static IEventSubscriptionManager AddListener(this IEventSubscriptionManager eventAggregator, Action listener, Predicate <object> filter)
 {
     return(eventAggregator.AddListener(listener, filter));
 }