private void BtnRun_Clicked() { if (cancellation != null) { MessageBox.ErrorQuery("Already Running", "Pipeline is already running", "Ok"); return; } runner = new PipelineRunner(_useCase, _pipeline); foreach (var l in additionals) { runner.AdditionalListeners.Add(l); } runner.PipelineExecutionFinishedsuccessfully += Runner_PipelineExecutionFinishedsuccessfully; // clear old results _results.Text = ""; _results.SelectedItem = 0; Task.Run(() => { try { cancellation = new GracefulCancellationTokenSource(); exitCode = runner.Run(activator.RepositoryLocator, this, new FromDataLoadEventListenerToCheckNotifier(this), cancellation.Token); cancellation = null; } catch (Exception ex) { OnNotify(this, new NotifyEventArgs(ProgressEventType.Error, ex.Message, ex)); cancellation = null; } }); }
public void ExportMapDescription() { var payload = InitializePayload(); var inputSetup = GetInputTask(); var pipelineItems = new List <IPipelineTask <DungeonGeneratorPayload> > { inputSetup }; PipelineRunner.Run(pipelineItems, payload); var levelDescription = payload.LevelDescription; var mapDescription = levelDescription.GetMapDescription(); var intMapDescription = GetIntMapDescription(mapDescription); var json = JsonConvert.SerializeObject(intMapDescription, Formatting.Indented, new JsonSerializerSettings() { PreserveReferencesHandling = PreserveReferencesHandling.All, TypeNameHandling = TypeNameHandling.Auto, }); var filename = "exportedMapDescription.json"; File.WriteAllText(filename, json); Debug.Log($"Map description exported to {filename}"); }
public IEnumerable<ContributorCall> GenerateCallGraph(PipelineRunner pipelineRunner) { var bootstrapper = pipelineRunner.Contributors.OfType<KnownStages.IBegin>().Single(); var tree = new DependencyTree<ContributorNotification>( new ContributorNotification(bootstrapper, new Notification(pipelineRunner, null))); foreach (var contrib in pipelineRunner.Contributors.Where(x => x != bootstrapper)) { pipelineRunner.NotificationRegistrations.Clear(); using (pipelineRunner.PipelineLog.Operation(pipelineRunner, "Initializing contributor {0}.".With(contrib.GetType().Name))) contrib.Initialize(pipelineRunner); foreach (var reg in pipelineRunner.NotificationRegistrations.DefaultIfEmpty(new Notification(pipelineRunner, null))) { tree.CreateNode(new ContributorNotification(contrib, reg)); } } foreach (var notificationNode in tree.Nodes) { foreach (var parentNode in GetCompatibleTypes(tree, notificationNode, notificationNode.Value.Notification.AfterTypes)) parentNode.ChildNodes.Add(notificationNode); foreach (var childNode in GetCompatibleTypes(tree, notificationNode, notificationNode.Value.Notification.BeforeTypes)) childNode.ParentNodes.Add(notificationNode); } return tree.GetCallGraph().Select(x => new ContributorCall(x.Value.Contributor, x.Value.Notification.Target, x.Value.Notification.Description)); }
public void InitializePipeline(ISyncModelProvider provider) { if (pipelineAsset == null) { Debug.LogError("Unable start pipeline. Please assign a Pipeline Asset."); return; } beforeInitialize?.Invoke(); if (m_Reflect == null) { m_Reflect = FindObjectOfType <RuntimeReflectBootstrapper>(); } if (m_Reflect == null) { m_Reflect = gameObject.AddComponent <RuntimeReflectBootstrapper>(); } m_PipelineRunner = new PipelineRunner(m_Reflect.Hook); m_PipelineRunner.onException += onException; m_PipelineRunner.CreateProcessors(this, provider); m_PipelineRunner.Initialize(); afterInitialize?.Invoke(); }
public void Run_ReturnValue_WithInitialValues_CallsInternalRunner() { var initialValue = new object(); var runResult = new object(); const string pipelineName = "Pipeline"; var pipeline = new Mock <IPipeline>(); var pipelineRepository = new Mock <IPipelineRepository>(); pipelineRepository.Setup(r => r.Get(pipelineName)).Returns(pipeline.Object); var pipelineContext = new Mock <IPipelineContext>(); var internalPipelineRunner = new Mock <IInternalPipelineRunner>(); internalPipelineRunner .Setup(r => r.Run(pipeline.Object, pipelineContext.Object)) .Returns(runResult) .Callback(() => pipelineContext.Verify(c => c.SetValue(initialValue))); var runner = new PipelineRunner(pipelineName, pipelineRepository.Object, internalPipelineRunner.Object, pipelineContext.Object); var result = runner.Run <object>(initialValue); internalPipelineRunner.Verify(r => r.Run(pipeline.Object, pipelineContext.Object)); result.Should().Be(runResult); }
public void the_pipeline_must_have_been_initialized(Type callGraphGeneratorType) { var pipeline = new PipelineRunner(new InternalDependencyResolver()); Executing(() => pipeline.Run(new InMemoryCommunicationContext())) .ShouldThrow <InvalidOperationException>(); }
public SelectBaseLayout() { _sheerResponse = new SheerResponseWrapper(); var runner = new PipelineRunner(); _contextChecker = new SelectBaseLayoutContextChecker(new PageModeAccess(), runner); _dialogLocator = new SelectBaseLayoutDialogLocator(runner); _dialogResultProcessor = new SelectBaseLayoutDialogResultProcessor(runner); }
public async void PipelineRunner_Does_Not_Execute_When_Processors_Collection_Is_Null() { var pipelineRunner = new PipelineRunner(); var pipeline = new Mock <IPipeline>(); pipeline.Setup(x => x.GetProcessors()).Returns((IEnumerable <IProcessor>)null); await pipelineRunner.RunPipeline(pipeline.Object, string.Empty); }
public void PipelineRunnerResultTest() { PipelineRunner <int> pipeline = new PipelineRunner <int>(); pipeline.Register(new ConcreteStage()) .Register(new ConcreteStageTwo()); Assert.Equal(2, pipeline.Process(1)); }
public void CanRunAPipeline() { Pipeline <int> pipeline = new PipelineRunner <int>(); pipeline.Pipe(new ConcreteStage()) .Pipe(new ConcreteStageTwo()) .Pipe(new ConcreteStage()); pipeline.Process(0); }
public async void PipelineRunner_Uses_Declared_Processors_In_Pipeline() { var pipelineRunner = new PipelineRunner(); var pipeline = new Mock <IPipeline>(); pipeline.Setup(x => x.GetProcessors()).Returns(Enumerable.Empty <IProcessor>()); await pipelineRunner.RunPipeline(pipeline.Object, string.Empty); pipeline.Verify(x => x.GetProcessors(), Times.AtLeastOnce); }
public async void Pipeline_Mechanism_Produces_A_Simple_Check_Before_Returning_A_Result() { PipelineRunner runner = new PipelineRunner(); var arguments = new HelloWorldArguments { Name = " " }; await runner.RunPipeline(new HelloWorldPipelineWithValidation(), arguments); arguments.GetMessages(MessageFilter.Errors).Should().ContainSingle(pipelineMessage => pipelineMessage.Message.Equals(HelloWorldPipelineMessages.NameMustBeProvided)); }
public override void Generate() { Debug.Log("--- Generator started ---"); var stopwatch = new Stopwatch(); stopwatch.Start(); var(pipelineItems, payload) = GetPipelineItemsAndPayload(); PipelineRunner.Run(pipelineItems, payload); Debug.Log($"--- Level generated in {stopwatch.ElapsedMilliseconds / 1000f:F}s ---"); }
public async void Pipeline_Mechanism_Is_Able_To_Produce_A_Simple_Result() { PipelineRunner runner = new PipelineRunner(); var arguments = new HelloWorldArguments() { Name = "Sergey" }; await runner.RunPipeline(new HelloWorldPipeline(), arguments); arguments.Result.Should().Be("Hello, Sergey!", $"we've passed name '{arguments.Name}' to the pipeline, and expect it to be displayed in phrase 'Hello, {arguments.Name}!'"); }
public void Init() { executorProvider = new Mock <ControllerExecutorProvider>(); executor = new Mock <ControllerExecutor>(); controllerProvider = new Mock <ControllerProvider>(); context = new Mock <HttpContextBase>(); routeMatch = new RouteMatch(null, null); prototype = new ControllerPrototype(new object()); runner = new PipelineRunner { ControllerProviders = new[] { new Lazy <ControllerProvider, IComponentOrder>(() => controllerProvider.Object, new FakeOrderMeta()) }, ControllerExecutorProviders = new[] { new Lazy <ControllerExecutorProvider, IComponentOrder>(() => executorProvider.Object, new FakeOrderMeta()) } }; }
static void Main(string[] args) { string RepoCsProj = @"C:\src\CRM.Solutions.Sales\solutions\Sales\Plugins\SalesPlugins.csproj"; if (args.GetLength(0) > 0) { RepoCsProj = args[0]; } log.Info("Parsing Project for Code Recording"); log.Info(new { RepoCsProj }); var piplineRunner = new PipelineRunner(RepoCsProj); piplineRunner.RunPipeLine(); }
protected IPipeline CreatePipeline(params Type[] contributorTypes) { var resolver = new InternalDependencyResolver(); resolver.AddDependency <IPipelineContributor, BootstrapperContributor>(); foreach (var type in contributorTypes) { resolver.AddDependency(typeof(IPipelineContributor), type, DependencyLifetime.Singleton); } var runner = new PipelineRunner(resolver) { PipelineLog = new TraceSourceLogger <PipelineLogSource>() }; runner.Initialize(); return(runner); }
public IEnumerable <ContributorCall> GenerateCallGraph(PipelineRunner pipelineRunner) { var bootstrapper = pipelineRunner.Contributors.OfType <KnownStages.IBegin>().Single(); var nodes = new List <DependencyNodeV2 <ContributorNotification> >(); foreach (var contributor in pipelineRunner.Contributors.Where(x => x != bootstrapper)) { pipelineRunner.NotificationRegistrations.Clear(); using (pipelineRunner.PipelineLog.Operation(pipelineRunner, "Initializing contributor {0}.".With(contributor.GetType().Name))) { contributor.Initialize(pipelineRunner); } foreach (var reg in pipelineRunner.NotificationRegistrations.DefaultIfEmpty(new Notification(pipelineRunner, null))) { nodes.Add(new DependencyNodeV2 <ContributorNotification>(new ContributorNotification(contributor, reg))); } } foreach (var notificationNode in nodes) { foreach (var afterType in notificationNode.Item.Notification.AfterTypes) { var parents = GetCompatibleNodes(nodes, notificationNode, afterType); notificationNode.Dependencies.AddRange(parents); } foreach (var beforeType in notificationNode.Item.Notification.BeforeTypes) { var children = GetCompatibleNodes(nodes, notificationNode, beforeType); foreach (var child in children) { child.Dependencies.Add(notificationNode); } } } var rootItem = new ContributorNotification(bootstrapper, new Notification(pipelineRunner, null)); return(new DependencyGraph <ContributorNotification>(rootItem, nodes).Nodes .Select(n => new ContributorCall(n.Item.Contributor, n.Item.Notification.Target, n.Item.Notification.Description))); }
public IEnumerable<ContributorCall> GenerateCallGraph(PipelineRunner pipelineRunner) { var bootstrapper = pipelineRunner.Contributors.OfType<KnownStages.IBegin>().Single(); var nodes = new List<DependencyNodeV2<ContributorNotification>>(); foreach (var contributor in pipelineRunner.Contributors.Where(x => x != bootstrapper)) { pipelineRunner.NotificationRegistrations.Clear(); using (pipelineRunner.PipelineLog.Operation(pipelineRunner, "Initializing contributor {0}.".With(contributor.GetType().Name))) { contributor.Initialize(pipelineRunner); } foreach (var reg in pipelineRunner.NotificationRegistrations.DefaultIfEmpty(new Notification(pipelineRunner, null))) { nodes.Add(new DependencyNodeV2<ContributorNotification>(new ContributorNotification(contributor, reg))); } } foreach (var notificationNode in nodes) { foreach (var afterType in notificationNode.Item.Notification.AfterTypes) { var parents = GetCompatibleNodes(nodes, notificationNode, afterType); notificationNode.Dependencies.AddRange(parents); } foreach (var beforeType in notificationNode.Item.Notification.BeforeTypes) { var children = GetCompatibleNodes(nodes, notificationNode, beforeType); foreach (var child in children) { child.Dependencies.Add(notificationNode); } } } var rootItem = new ContributorNotification(bootstrapper, new Notification(pipelineRunner, null)); return new DependencyGraph<ContributorNotification>(rootItem, nodes).Nodes .Select(n => new ContributorCall(n.Item.Contributor, n.Item.Notification.Target, n.Item.Notification.Description)); }
public async void PipelineRunner_Executes_Processors_In_The_Collection_In_Exact_Order() { var pipelineRunner = new PipelineRunner(); var executionSequence = new MockSequence(); var mockRepository = new MockRepository(MockBehavior.Strict); var a = mockRepository.Create <IProcessor>(); var b = mockRepository.Create <IProcessor>(); var c = mockRepository.Create <IProcessor>(); a.InSequence(executionSequence).Setup(x => x.Execute(It.IsAny <object>())).Returns(Task.CompletedTask); b.InSequence(executionSequence).Setup(x => x.Execute(It.IsAny <object>())).Returns(Task.CompletedTask); c.InSequence(executionSequence).Setup(x => x.Execute(It.IsAny <object>())).Returns(Task.CompletedTask); var pipeline = new Mock <IPipeline>(); pipeline.Setup(x => x.GetProcessors()).Returns(new [] { a.Object, b.Object, c.Object }); await pipelineRunner.RunPipeline(pipeline.Object, string.Empty); }
/// <summary> /// The run elastic search pipeline. /// </summary> /// <param name="container"> /// The container. /// </param> /// <param name="config"> /// The config. /// </param> /// <param name="cancellationToken"> /// The cancellation token /// </param> public void RunElasticSearchPipeline( IUnityContainer container, IJob config, CancellationToken cancellationToken) { var stopwatch = new Stopwatch(); stopwatch.Start(); var pipelineRunner = new PipelineRunner(container, cancellationToken); pipelineRunner.RunElasticSearchPipeline(config); stopwatch.Stop(); var timeElapsed = stopwatch.Elapsed.ToString(@"hh\:mm\:ss"); var threadText = config.Config.UseMultipleThreads ? "multiple threads" : "single thread"; container.Resolve <ILogger>().Verbose($"Finished in {timeElapsed} using {threadText}"); }
public void Run_Void_NoInitialValues_CallsInternalRunner() { const string pipelineName = "Pipeline"; var pipeline = new Mock <IPipeline>(); var pipelineRepository = new Mock <IPipelineRepository>(); pipelineRepository.Setup(r => r.Get(pipelineName)).Returns(pipeline.Object); var pipelineContext = new Mock <IPipelineContext>(); var internalPipelineRunner = new Mock <IInternalPipelineRunner>(); internalPipelineRunner .Setup(r => r.Run(pipeline.Object, pipelineContext.Object)) .Callback(() => pipelineContext.Verify(c => c.SetValue(null))); var runner = new PipelineRunner(pipelineName, pipelineRepository.Object, internalPipelineRunner.Object, pipelineContext.Object); runner.Run(); internalPipelineRunner.Verify(r => r.Run(pipeline.Object, pipelineContext.Object)); }
public IEnumerable <ContributorCall> GenerateCallGraph(PipelineRunner pipelineRunner) { var bootstrapper = pipelineRunner.Contributors.OfType <KnownStages.IBegin>().Single(); var tree = new DependencyTree <ContributorNotification>( new ContributorNotification(bootstrapper, new Notification(pipelineRunner, null))); foreach (var contrib in pipelineRunner.Contributors.Where(x => x != bootstrapper)) { pipelineRunner.NotificationRegistrations.Clear(); using (pipelineRunner.PipelineLog.Operation(pipelineRunner, "Initializing contributor {0}.".With(contrib.GetType().Name))) contrib.Initialize(pipelineRunner); foreach (var reg in pipelineRunner.NotificationRegistrations.DefaultIfEmpty(new Notification(pipelineRunner, null))) { tree.CreateNode(new ContributorNotification(contrib, reg)); } } foreach (var notificationNode in tree.Nodes) { foreach (var parentNode in GetCompatibleTypes(tree, notificationNode, notificationNode.Value.Notification.AfterTypes)) { parentNode.ChildNodes.Add(notificationNode); } foreach (var childNode in GetCompatibleTypes(tree, notificationNode, notificationNode.Value.Notification.BeforeTypes)) { childNode.ParentNodes.Add(notificationNode); } } return(tree.GetCallGraph().Select(x => new ContributorCall(x.Value.Contributor, x.Value.Notification.Target, x.Value.Notification.Description))); }
public void TestElasticSearchPipelineSingleThreaded() { var sql = @"SELECT CustomerNM ,CustomerID , AliasPatientID , GenderNormDSC ,RaceNormDSC ,MaritalStatusNormDSC FROM CAFEEDW.SharedClinicalUnion.ElasticsearchInputPatient where CustomerID = 4"; var job = new Job { Config = new QueryConfig { ConnectionString = "foo", LocalSaveFolder = Path.GetTempPath(), TopLevelKeyColumn = "AliasPatientID", Url = "http://foo", UploadToElasticSearch = false, EntitiesPerUploadFile = 1 }, Data = new JobData { MyDataSources = new List <DataSource> { new DataSource { Sql = sql } } } }; var mockRepository = new MockRepository(MockBehavior.Strict); var mockDatabusSqlReader = mockRepository.Create <IDatabusSqlReader>(); mockDatabusSqlReader.Setup( service => service.ReadDataFromQueryAsync( It.IsAny <IDataSource>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <ILogger>(), It.IsAny <string>())).ReturnsAsync( new ReadSqlDataResult { ColumnList = new List <ColumnInfo> { new ColumnInfo { Name = "CustomerNM", ElasticSearchType = ElasticSearchTypes.keyword.ToString() }, new ColumnInfo { Name = "CustomerID", ElasticSearchType = ElasticSearchTypes.integer.ToString() }, new ColumnInfo { Name = "AliasPatientID", ElasticSearchType = ElasticSearchTypes.integer.ToString() }, new ColumnInfo { Name = "GenderNormDSC", ElasticSearchType = ElasticSearchTypes.keyword.ToString() }, new ColumnInfo { Name = "RaceNormDSC", ElasticSearchType = ElasticSearchTypes.keyword.ToString() }, new ColumnInfo { Name = "MaritalStatusNormDSC", ElasticSearchType = ElasticSearchTypes.keyword.ToString() } }, Data = new Dictionary <string, List <object[]> > { { "ElasticsearchInputPatient", new List <object[]> { new object[] { "name", 1, 2, "M", "White", "Married" } } } } }); var mockFileUploaderFactory = mockRepository.Create <IElasticSearchUploaderFactory>(); var mockFileUploader = mockRepository.Create <IElasticSearchUploader>(); mockFileUploaderFactory .Setup(service => service.Create(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <List <string> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(mockFileUploader.Object); mockFileUploader.Setup( service => service.SendStreamToHosts( It.IsAny <string>(), It.IsAny <int>(), It.IsAny <Stream>(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(Task.CompletedTask); mockFileUploader .Setup(service => service.StartUploadAsync()) .Returns(Task.CompletedTask); ILogger logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.Debug() .CreateLogger(); using (var progressMonitor = new ProgressMonitor(new TestConsoleProgressLogger())) { using (var cancellationTokenSource = new CancellationTokenSource()) { var container = new UnityContainer(); container.RegisterInstance <IProgressMonitor>(progressMonitor); container.RegisterInstance(mockDatabusSqlReader.Object); container.RegisterInstance(mockFileUploaderFactory.Object); container.RegisterInstance(logger); container.RegisterType <IPipelineExecutorFactory, SingleThreadedPipelineExecutorFactory>(); var pipelineRunner = new PipelineRunner(container, cancellationTokenSource.Token); try { pipelineRunner.RunElasticSearchPipeline(job); } catch (OperationCanceledException e) { Console.WriteLine(e.ToString()); throw; } catch (AggregateException e) { Console.WriteLine(e.Flatten().ToString()); throw; } catch (Exception e) { Console.WriteLine(e); throw; } } } }
public Notification(PipelineRunner runner, Func <ICommunicationContext, PipelineContinuation> action) { _runner = runner; Target = action; }
public void ShutdownPipeline() { m_PipelineRunner?.Shutdown(); m_PipelineRunner = null; }
public void run() { ScrumMaster scrumMaster = new ScrumMaster { FirstName = "Jack-Ryan" }; ProductOwner productOwner = new ProductOwner(); Project project = new SoftwareProject(productOwner, "project 1", "this is project 1"); project.AddBoard(new ScrumBoard()); Sprint sprint1 = new Sprint("Sprint 1", new DateTime(), new DateTime().AddDays(7), scrumMaster); sprint1.addTeamMember(scrumMaster); Forum forum = new Forum(sprint1); scrumMaster.addSprint(sprint1); productOwner.addSprint(sprint1); project.GetBoard().AddSprint(sprint1); //lets start the sprint sprint1.sprintState.start(); BacklogItem backlogItem1 = new BacklogItem(sprint1.backlog, "mn leuke item", 18); backlogItem1.Subscribe(scrumMaster); backlogItem1.assign(scrumMaster); sprint1.backlog.addBacklogItem(backlogItem1); Thread thread = forum.addThread(backlogItem1, "een probleem ivm iets", "bla bla", scrumMaster); thread.addComment(new Comment("klopt", scrumMaster)); sprint1.backlog.addBacklogItem(backlogItem1); backlogItem1.backlogState.doing(); System.Threading.Thread.Sleep(100); backlogItem1.backlogState.done(); System.Threading.Thread.Sleep(100); //should throw error, only going back from done to todo is allowed, not done to doing backlogItem1.backlogState.doing(); thread.addComment(new Comment("backlogitem is gesloten dus men zou geen notificatie moeten krijgen..", scrumMaster)); System.Threading.Thread.Sleep(100); backlogItem1.backlogState.todo(); thread.addComment(new Comment("backlogitem is weer geopend dus men krijgt weer notificatie", scrumMaster)); System.Threading.Thread.Sleep(100); backlogItem1.backlogState.doing(); System.Threading.Thread.Sleep(100); backlogItem1.backlogState.done(); Console.WriteLine(new Report(sprint1).reportAsString()); Console.WriteLine("------------------------------------------------"); // Abstract Factory GitFactory gitFactory = new GitFactory(); ContentManager gitContentManager = new ContentManager(gitFactory); gitContentManager.InitRepo("project1", project); //Get first branch in Repo (which by default after init is master) var currentBranch = gitContentManager.GetRepo().Branches.First(); //git commit gitContentManager.AddCommit(currentBranch, "init commit", ""); Console.WriteLine(""); //git commit gitContentManager.AddCommit(currentBranch, "second Commit", "its okay I guess"); gitContentManager.GetRepo().Branches.First().PrintCommits(); Console.WriteLine(gitContentManager.GetRepo().FindCommit("init commit").ToString()); DevOpsIterator devOps = new DevOpsIterator(); PipelineRunner pipeline = new PipelineRunner(devOps); pipeline.StartPipeline(); }
public void Generate() { var pipelineRunner = new PipelineRunner(); pipelineRunner.Run(PipelineItems, PayloadInitializer.InitializePayload()); }
public PipelineTest() { PipelineIterator iterator = new DevOpsIterator(); pipeline = new PipelineRunner(iterator); }
public Notification(PipelineRunner runner, Func<ICommunicationContext, PipelineContinuation> action) { _runner = runner; Target = action; }