private void StartupBrowserCommunicationTimeoutMonitor() { if (_browserCommunicationTimeoutMonitor == null) { _browserCommunicationTimeoutMonitor = new BrowserCommunicationTimeoutMonitor(_eventPublisher, new TimerWrapper(3000), TimeSpan.FromMinutes(5)); _eventSubscriptionManager.AddListener(_browserCommunicationTimeoutMonitor); } }
public static IEventSubscriptionManager AddListener <T>(this IEventSubscriptionManager eventAggregator, Action <T> listener) { var delegateListener = new DelegateListener <T>(listener); eventAggregator.AddListener(delegateListener); return(eventAggregator); }
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") //{ // ; //} }); }
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); }
private void StartupBrowserCommunicationTimeoutMonitor() { if (_browserCommunicationTimeoutMonitor == null) { _browserCommunicationTimeoutMonitor = new BrowserCommunicationTimeoutMonitor(_logger, _eventPublisher, new TimerWrapper(3000), Settings.Default.MaxWaitTimeAllowedBeforeCommunicationErrorSent); _eventSubscriptionManager.AddListener(_browserCommunicationTimeoutMonitor); } }
protected override void Before_all_tests() { base.Before_all_tests(); var ea = (new EventAggregatorFactory(TestLogger)).Create(); _eventSubscriptionManager = ea; _eventPublisher = ea; _eventSubscriptionManager.AddListener(new MultiListener()); }
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; }
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); }
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); }
public override TestReport Run() { _eventSubscriptionManager.AddListener(_teamCityTestResultHandler); _teamCityTestResultHandler.PublishStart(); var testReport = base.Run(); _teamCityTestResultHandler.PublishStop(); _eventSubscriptionManager.RemoveListener(_teamCityTestResultHandler); return(testReport); }
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())); } }
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); }
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); }
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); }
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("********************************"); }
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); }
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(); }
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(); } }); }
public void AddHandlerInScopeThatWillRemoveInstanceWhenGarbageCollected(IEventSubscriptionManager eventSubscriptionManager, bool? holdStrongReference = false) { var someMessageHandler = new SomeMessageHandler(); eventSubscriptionManager.AddListener(someMessageHandler, holdStrongReference); }
private void AddHandlerInScopeThatWillRemoveInstanceWhenGarbageCollected(IEventSubscriptionManager eventSubscriptionManager, bool?holdStrongReference = false) { var someMessageHandler = new SomeMessageHandler(); eventSubscriptionManager.AddListener(someMessageHandler, holdStrongReference); }
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())); } }
public static IEventSubscriptionManager AddListener(this IEventSubscriptionManager eventAggregator, Action listener, Predicate <object> filter) { return(eventAggregator.AddListener(listener, filter)); }