public Task <IDisposable> Run(RunTargets targets) { Func <bool, bool> filter = p => !_skipEventsFromBackend || !p; var clusters = targets.VisibilityPublisher.GetClustersSequence() .Where(p => filter(p.FromBackend)) .Subscribe(payload => targets.BackendNotifier.Cluster(payload)); var sources = targets.VisibilityPublisher.GetSourcesSequence() .Where(p => filter(p.FromBackend)) .Subscribe(payload => targets.BackendNotifier.Source(payload)); var users = targets.VisibilityPublisher.GetUsersSequence() .Where(p => filter(p.FromBackend)) .Subscribe(payload => targets.BackendNotifier.User(payload)); var clusterSources = targets.VisibilityPublisher.GetClusterSourcesSequence() .Where(p => filter(p.FromBackend)) .Subscribe(payload => targets.BackendNotifier.ClusterSource(payload)); var clusterUsers = targets.VisibilityPublisher.GetClusterUsersSequence() .Where(p => filter(p.FromBackend)) .Subscribe(payload => targets.BackendNotifier.ClusterUser(payload)); return(Task.FromResult((IDisposable) new CompositeDisposable(clusters, sources, users, clusterSources, clusterUsers))); }
public async Task <IDisposable> Run(ValueOrError <User> user, RunTargets targets) { if (user.Value.Tokens.Count() > 1) { return(Disposable.Empty); } var name = user.Value.Name; Func <Task <IEnumerable <Source> > > getUserSources = async() => await targets.VisibilityPersistor.GetUserSources(name); var frontend = targets.ErrorsInbox != null ? targets.ErrorsInbox.GetErrorsStream() : Observable.Empty <ErrorPayload>(); var backend = targets.BackendErrorsInbox != null ? targets.BackendErrorsInbox.GetErrorsStream() : Observable.Empty <ErrorPayload>(); var errors = from e in frontend.Merge(backend) from sources in getUserSources() from a in sources where e.SourceId == a.SourceId select e; return(errors.Subscribe(payload => targets.FrontendNotifier.Error(name, payload))); }
public async Task <IDisposable> Run(ValueOrError <User> user, RunTargets targets) { var name = user.Value.Name; //Initial recap var initialRecap = await InitialRecap(name, targets.VisibilityPersistor, targets.ErrorsBacklogReader, (a, r) => new { Sources = a, Recap = r }); var rs = from r in initialRecap.ToSingleton().ToObservable() select new { Sources = r.Sources, Additions = r.Sources, Removals = Enumerable.Empty <Source>() }; //Deltas var clusterSources = from p in targets.VisibilityPublisher.GetClusterSourcesSequence() let sources = p.Target.Primary.Sources let deltas = p.Target.Secondary.ToSingleton() let target = p.Target.Secondary.SourceId from u in p.Target.Primary.Users where u.Name == name select new { Sources = sources, Additions = p.Type == DeltaType.Added ? deltas : Enumerable.Empty <Source>(), Removals = p.Type == DeltaType.Removed ? deltas : Enumerable.Empty <Source>() }; var userSources = from p in targets.VisibilityPublisher.GetClusterUsersSequence() let sources = p.Target.Primary.Sources where p.Target.Secondary.Name == name select new { Sources = sources, Additions = p.Type == DeltaType.Added ? sources : Enumerable.Empty <Source>(), Removals = p.Type == DeltaType.Removed ? sources : Enumerable.Empty <Source>() }; var mergedSources = clusterSources.Merge(userSources); //Stream return(rs.Concat(mergedSources).Subscribe(async payload => { var recap = await targets.ErrorsBacklogReader.GetSourcesRecap(payload.Sources); if (!recap.HasValue) { return; } targets.FrontendNotifier.Recap(name, recap.Value); targets.FrontendNotifier.UserSources(name, payload.Additions, payload.Removals); })); }
public ITestResult Execute(CancellationToken cancellationToken) { // todo: implement cancellation if (!RunTargets.Any()) { throw new InvalidOperationException("No run targets were specified!"); } var xTestResult = new TestResult(); OutputHandler.ExecutionStart(); foreach (var xConfig in GetRunConfigurations()) { OutputHandler.RunConfigurationStart(xConfig); foreach (var xKernelAssembly in KernelsAssembliesToRun) { var xKernelName = Path.GetFileNameWithoutExtension(xKernelAssembly); var xKernelTestResult = new KernelTestResult(xKernelName, xConfig); var xWorkingDirectory = Path.Combine(WorkingDirectoryBase, xKernelName); if (Directory.Exists(xWorkingDirectory)) { Directory.Delete(xWorkingDirectory, true); } Directory.CreateDirectory(xWorkingDirectory); try { xKernelTestResult.Result = ExecuteKernel( xKernelAssembly, xWorkingDirectory, xConfig, xKernelTestResult); } catch (Exception e) { OutputHandler.UnhandledException(e); } xKernelTestResult.TestLog = mTestResultOutputHandler.TestLog; xTestResult.AddKernelTestResult(xKernelTestResult); } OutputHandler.RunConfigurationEnd(xConfig); } OutputHandler.ExecutionEnd(); var xPassedTestsCount = xTestResult.KernelTestResults.Count(r => r.Result); var xFailedTestsCount = xTestResult.KernelTestResults.Count(r => !r.Result); OutputHandler.LogMessage($"Done executing: {xPassedTestsCount} test(s) passed, {xFailedTestsCount} test(s) failed."); return(xTestResult); }
public bool Execute() { if (OutputHandler == null) { throw new InvalidOperationException("No OutputHandler set!"); } if (RunTargets.Count == 0) { RunTargets.AddRange((RunTargetEnum[])Enum.GetValues(typeof(RunTargetEnum))); } OutputHandler.ExecutionStart(); try { var xResult = true; foreach (var xConfig in GetRunConfigurations()) { OutputHandler.RunConfigurationStart(xConfig); try { foreach (var xAssemblyFile in mKernelsToRun) { mBaseWorkingDirectory = Path.Combine(Path.GetDirectoryName(typeof(Engine).Assembly.Location), "WorkingDirectory"); if (Directory.Exists(mBaseWorkingDirectory)) { Directory.Delete(mBaseWorkingDirectory, true); } Directory.CreateDirectory(mBaseWorkingDirectory); xResult &= ExecuteKernel(xAssemblyFile, xConfig); } } catch (Exception e) { OutputHandler.UnhandledException(e); } finally { OutputHandler.RunConfigurationEnd(xConfig); } } return(xResult); } catch (Exception E) { OutputHandler.UnhandledException(E); return(false); } finally { OutputHandler.ExecutionEnd(); } // todo: now report summary //DoLog("NotImplemented, summary?"); }
public bool Execute() { if (OutputHandler == null) { throw new InvalidOperationException("No OutputHandler set!"); } if (!RunTargets.Any()) { throw new InvalidOperationException("No run targets were specified!"); } OutputHandler.ExecutionStart(); try { var xResult = true; foreach (var xConfig in GetRunConfigurations()) { OutputHandler.RunConfigurationStart(xConfig); try { foreach (var xKernelType in KernelsToRun) { var xAssemblyPath = xKernelType.Assembly.Location; var xWorkingDirectory = Path.Combine( WorkingDirectoryBase, Path.GetFileNameWithoutExtension(xAssemblyPath)); if (Directory.Exists(xWorkingDirectory)) { Directory.Delete(xWorkingDirectory, true); } Directory.CreateDirectory(xWorkingDirectory); xResult &= ExecuteKernel(xAssemblyPath, xWorkingDirectory, xConfig); } } catch (Exception e) { if (!mKernelResultSet) { OutputHandler.SetKernelTestResult(false, e.ToString()); mKernelResult = false; xResult = false; } OutputHandler.UnhandledException(e); } finally { OutputHandler.RunConfigurationEnd(xConfig); } } return(xResult); } catch (Exception E) { OutputHandler.UnhandledException(E); return(false); } finally { OutputHandler.ExecutionEnd(); } // todo: now report summary //DoLog("NotImplemented, summary?"); }
public async Task <IDisposable> Run(RunTargets targets) { return(targets.ErrorsInbox.GetErrorsStream().Subscribe(payload => targets.BackendNotifier.Error(payload))); }