public void SingleCount() { // Multi | Single // S -> Process -> Sync -> Process -> End List <GraphNode> nodes = new List <GraphNode>(); nodes.Add(TestHelpers.BuildGraphNode(0, "in", inputPlugin3.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(1, "pro")); nodes.Add(TestHelpers.BuildGraphNode(2, "sync", SyncNode.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(3, "pro")); nodes.Add(TestHelpers.BuildGraphNode(4, "end")); List <NodeLinkInfo> links = new List <NodeLinkInfo>(); links.Add(TestHelpers.MatchSlots(nodes[0], nodes[1], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[1], nodes[2], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[2], nodes[3], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[3], nodes[4], 0, 0)); PipelineState.UpdateActiveGraph(nodes.ToArray(), links.ToArray()); PipelineExecutor[] executor = PipelineState.BuildPipesTestOnly(); SpecialNodeData data = PipelineState.SpecialNodeDataTestOnly; Assert.AreEqual(2, data.SyncInformation.NodeGroups.Count); Assert.AreEqual(3, data.SyncInformation.NodeGroups[0].pipes.Length); Assert.AreEqual(3, data.SyncInformation.NodeGroups[0].RequiredPipes); Assert.IsTrue(data.SyncInformation.NodeGroups[0].Input); Assert.AreEqual(1, data.SyncInformation.NodeGroups[1].pipes.Length); Assert.AreEqual(1, data.SyncInformation.NodeGroups[1].RequiredPipes); Assert.AreEqual(1, data.SyncInformation.SyncNodes[0].TriggeredPipelines.Length); Assert.AreEqual(3, data.SyncInformation.SyncNodes[0].ParallelismTestOnly); Assert.IsFalse(data.SyncInformation.NodeGroups[1].Input); }
public void MultiToSingle() { // Multi | Single // S -> Process -> Sync -> Process -> End List <DependentNode> nodes = new List <DependentNode>(); DependentNode start = new DependentNode(0, "start"), sync = new DependentNode(1, SyncNode.TypeName), pro1 = new DependentNode(2, "pro"), pro2 = new DependentNode(3, "pro"), end = new DependentNode(4, "end"); nodes.Add(start); nodes.Add(pro1); nodes.Add(sync); nodes.Add(pro2); nodes.Add(end); TestHelpers.MatchSlots(start, pro1, 0, 0); TestHelpers.MatchSlots(pro1, sync, 0, 0); TestHelpers.MatchSlots(sync, pro2, 0, 0); TestHelpers.MatchSlots(pro2, end, 0, 0); DataStore staticData = new DataStore(true); SpecialNodeData data = SpecialNodeSearch.CheckForSpecialNodes(TestHelpers.ConvertToDictionary(nodes), staticData); Assert.AreEqual(1, data.SyncInformation.SyncNodes.Length); Assert.AreEqual(0, data.SyncInformation.NodeGroups[0].Dependents.Length); Assert.AreEqual(1, data.SyncInformation.NodeGroups[1].CalledBy); }
public void OverrideOutput() { List <GraphNode> nodes = new List <GraphNode>(); nodes.Add(TestHelpers.BuildGraphNode(0, "input")); nodes.Add(TestHelpers.BuildGraphNode(1, "process")); nodes.Add(TestHelpers.BuildGraphNode(2, "output", output.TypeName, "Override")); List <NodeLinkInfo> links = new List <NodeLinkInfo>(); links.Add(TestHelpers.MatchSlots(nodes[0], nodes[1], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[1], nodes[2], 0, 0)); DataStore staticStore = new DataStore(true), standardData = new DataStore(0, ""); List <DependentNode> dependents = TestHelpers.ConvertToDependentNodes(nodes); Dictionary <int, DependentNode> dependentNodes = TestHelpers.ConvertToDictionary(dependents); SpecialNodeData special = SpecialNodeSearch.CheckForSpecialNodes(dependentNodes, staticStore); PipelineExecutor pipeline = new PipelineExecutor(dependentNodes, staticStore, 0, special); TaskRunner runner = new TaskRunner(output, dependents[2], standardData, staticStore, pipeline, 0); Task task = runner.getTask(); task.Start(); task.Wait(); Assert.AreEqual("Override", output.OutputDir); }
public void NoSync() { // Multi // S -> Process -> Process -> End List <DependentNode> nodes = new List <DependentNode>(); DependentNode start = new DependentNode(0, "start"), pro1 = new DependentNode(2, "pro"), pro2 = new DependentNode(3, "pro"), end = new DependentNode(4, "end"); nodes.Add(start); nodes.Add(pro1); nodes.Add(pro2); nodes.Add(end); TestHelpers.MatchSlots(start, pro1, 0, 0); TestHelpers.MatchSlots(pro1, pro2, 0, 0); TestHelpers.MatchSlots(pro2, end, 0, 0); DataStore staticData = new DataStore(true); SpecialNodeData data = SpecialNodeSearch.CheckForSpecialNodes(TestHelpers.ConvertToDictionary(nodes), staticData); Assert.AreEqual(0, data.SyncInformation.SyncNodes.Length, "There should not be any sync blocks in this test"); Assert.AreEqual(null, data.SyncInformation.NodeGroups); }
public void ManyToMore() { // Multi | Many // S -> Process -> Sync -> Process -> End // Input ----ᴧ List <GraphNode> nodes = new List <GraphNode>(); nodes.Add(TestHelpers.BuildGraphNode(0, "input", inputPlugin.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(1, "process")); nodes.Add(TestHelpers.BuildGraphNode(2, "sync", SyncNode.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(3, "input", inputPlugin2.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(4, "process")); nodes.Add(TestHelpers.BuildGraphNode(5, "output")); List <NodeLinkInfo> links = new List <NodeLinkInfo>(); links.Add(TestHelpers.MatchSlots(nodes[0], nodes[1], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[1], nodes[2], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[2], nodes[4], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[3], nodes[4], 0, 1)); links.Add(TestHelpers.MatchSlots(nodes[4], nodes[5], 0, 0)); PipelineState.UpdateActiveGraph(nodes.ToArray(), links.ToArray()); PipelineExecutor[] results = PipelineState.BuildPipesTestOnly(); Assert.AreEqual(DataSize + (DataSize * 2), results.Length); SpecialNodeData nodeData = PipelineState.SpecialNodeDataTestOnly; Assert.AreEqual(1, nodeData.SyncInformation.SyncNodes.Length); Assert.AreEqual(inputPlugin2.InputDataQuantity(""), nodeData.SyncInformation.SyncNodes[0].TriggeredPipelines.Length); }
public void ManyToManyWithInput() { // Multi | Multi // ᴧ------------------v // S -> Process -> Sync -> Process -> End // Input ----ᴧ List <GraphNode> nodes = new List <GraphNode>(); nodes.Add(TestHelpers.BuildGraphNode(0, "input", inputPlugin.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(1, "process")); nodes.Add(TestHelpers.BuildGraphNode(2, "sync", SyncNode.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(3, "input", inputPlugin2.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(4, "process")); nodes.Add(TestHelpers.BuildGraphNode(5, "output")); List <NodeLinkInfo> links = new List <NodeLinkInfo>(); links.Add(TestHelpers.MatchSlots(nodes[0], nodes[1], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[1], nodes[2], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[1], nodes[4], 0, 2)); links.Add(TestHelpers.MatchSlots(nodes[2], nodes[4], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[3], nodes[4], 0, 1)); links.Add(TestHelpers.MatchSlots(nodes[4], nodes[5], 0, 0)); PipelineState.UpdateActiveGraph(nodes.ToArray(), links.ToArray()); Assert.Throws <PipelineException>(() => PipelineState.BuildPipesTestOnly()); SpecialNodeData nodeData = PipelineState.SpecialNodeDataTestOnly; Assert.AreEqual(1, nodeData.SyncInformation.SyncNodes.Length); }
public void MultiToSingleToMulti() { // Multi | Single | Multi // S -> Process -> Sync -> Process -> Sync -> Process -> End // v-------------------------------------ᴧ List <DependentNode> nodes = new List <DependentNode>(); DependentNode start = new DependentNode(0, "start"), sync = new DependentNode(1, SyncNode.TypeName), sync2 = new DependentNode(6, SyncNode.TypeName), pro1 = new DependentNode(2, "pro"), pro2 = new DependentNode(3, "pro"), pro3 = new DependentNode(5, "pro"), end = new DependentNode(4, "end"); nodes.Add(start); nodes.Add(pro1); nodes.Add(sync); nodes.Add(sync2); nodes.Add(pro2); nodes.Add(pro3); nodes.Add(end); TestHelpers.MatchSlots(start, pro1, 0, 0); TestHelpers.MatchSlots(pro1, sync, 0, 0); TestHelpers.MatchSlots(pro1, pro3, 1, 1); TestHelpers.MatchSlots(sync, pro2, 0, 0); TestHelpers.MatchSlots(pro2, sync2, 0, 0); TestHelpers.MatchSlots(sync2, pro3, 0, 0); TestHelpers.MatchSlots(pro3, end, 0, 0); DataStore staticData = new DataStore(true); SpecialNodeData data = SpecialNodeSearch.CheckForSpecialNodes(TestHelpers.ConvertToDictionary(nodes), staticData); Assert.AreEqual(2, data.SyncInformation.SyncNodes.Length); Assert.AreEqual(3, data.SyncInformation.NodeGroups.Count); Assert.AreEqual(sync.Id, data.SyncInformation.NodeGroups[1].CalledBy); Assert.AreEqual(sync2.Id, data.SyncInformation.NodeGroups[2].CalledBy); Assert.IsTrue(data.SyncInformation.NodeGroups[0].Dependents.Contains(pro3.Id)); }
public void ManyToSingleToMany() { // Many | Single | Many // S -> Process -> Sync -> Process -> Sync -> Process -> End // v-------------------------------------ᴧ List <GraphNode> nodes = new List <GraphNode>(); nodes.Add(TestHelpers.BuildGraphNode(0, "input", inputPlugin.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(1, "process")); nodes.Add(TestHelpers.BuildGraphNode(2, "sync", SyncNode.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(3, "process")); nodes.Add(TestHelpers.BuildGraphNode(4, "sync", SyncNode.TypeName)); nodes.Add(TestHelpers.BuildGraphNode(5, "process")); nodes.Add(TestHelpers.BuildGraphNode(6, "output")); List <NodeLinkInfo> links = new List <NodeLinkInfo>(); links.Add(TestHelpers.MatchSlots(nodes[0], nodes[1], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[1], nodes[2], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[1], nodes[5], 1, 1)); links.Add(TestHelpers.MatchSlots(nodes[2], nodes[3], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[3], nodes[4], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[4], nodes[5], 0, 0)); links.Add(TestHelpers.MatchSlots(nodes[5], nodes[6], 0, 0)); PipelineState.UpdateActiveGraph(nodes.ToArray(), links.ToArray()); PipelineExecutor[] results = PipelineState.BuildPipesTestOnly(); Assert.AreEqual(DataSize + 1, results.Length); SpecialNodeData nodeData = PipelineState.SpecialNodeDataTestOnly; Assert.AreEqual(2, nodeData.SyncInformation.SyncNodes.Length); Assert.AreEqual(3, nodeData.SyncInformation.NodeGroups.Count); Assert.AreSame(nodeData.SyncInformation.NodeGroups[0].pipes, nodeData.SyncInformation.SyncNodes[1].TriggeredPipelines); }