Exemplo n.º 1
0
        /// <summary>
        /// Create a complex pipeline, with a root node and two leaf nodes
        /// </summary>
        public static ProjectDOM.Pipeline CreateTreePipeline()
        {
            // create a pipeline
            var pipeline = new ProjectDOM.Pipeline();

            // create root node and set it as root of the pipeline
            var nodeId = pipeline.AddRootNode("TestFilter2");

            // create leaf nodes
            var node2Id = pipeline.AddNode("TestFilter1");
            var node3Id = pipeline.AddNode("TestFilter1");

            // set leaf node properties
            var nodeProps = pipeline.GetNode(node2Id).GetPropertiesForConfiguration("Root");

            nodeProps.SetValue("Value1", "5");
            nodeProps.SetValue("Value2", "7");

            // set leaf node properties
            nodeProps = pipeline.GetNode(node3Id).GetPropertiesForConfiguration("Root");
            nodeProps.SetValue("Value1", "5");
            nodeProps.SetValue("Value2", "7");

            // set root node properties
            nodeProps = pipeline.GetNode(nodeId).GetPropertiesForConfiguration("Root");
            nodeProps.SetReferenceIds("Value1", node2Id);
            nodeProps.SetReferenceIds("Value2", node3Id);

            return(pipeline);
        }
Exemplo n.º 2
0
        public static Guid AddRootNode(this ProjectDOM.Pipeline pipeline, string className)
        {
            var id = pipeline.AddNode(className);

            pipeline.RootIdentifier = id;

            return(id);
        }
Exemplo n.º 3
0
            private Pipeline(IPipelineViewServices c, ProjectDOM.Pipeline p)
            {
                _Parent      = c;
                _PipelineDom = p;

                ClearCurrentCmd       = new RelayCommand(_ClearCurrentRootNode, arg => this.IsInstanced && !this.IsChildConfiguration);
                SetCurrentEmptyCmd    = new RelayCommand(() => {}, arg => false); // this command is disabled because it only makes sense for child configurations, and root's don'g have per-cfg values
                SetCurrentValueCmd    = new RelayCommand(_SetCurrentRootNode, arg => this.IsEmpty && !this.IsChildConfiguration);
                ViewCurrentPreviewCmd = new RelayCommand(() => { if (Content is Node node)
                                                                 {
                                                                     node.SetAsCurrentResultView();
                                                                 }
                                                         }, arg => IsInstanced);
            }
Exemplo n.º 4
0
        /// <summary>
        /// Create a simple pipeline, with a single node that returns the sum of two values
        /// </summary>
        public static ProjectDOM.Pipeline CreateBasicPipeline()
        {
            // create a pipeline
            var pipeline = new ProjectDOM.Pipeline();

            // create a node and set it as root of the pipeline
            var nodeId = pipeline.AddRootNode("TestFilter1");

            // set node properties for "Root" Configuration
            var nodeProps = pipeline.GetNode(nodeId).GetPropertiesForConfiguration("Root");

            nodeProps.SetValue("Value1", "5");
            nodeProps.SetValue("Value2", "7");

            return(pipeline);
        }
Exemplo n.º 5
0
            public static Pipeline Create(IPipelineViewServices c, ProjectDOM.Pipeline p)
            {
                if (c == null)
                {
                    return(null);
                }
                if (p == null)
                {
                    return(null);
                }

                var pp = new Pipeline(c, p);

                pp.UpdateGraph();

                return(pp);
            }
Exemplo n.º 6
0
        private static Object _Evaluate(ProjectDOM.Pipeline pipeline, string configuration)
        {
            // create a pipeline evaluator

            var srcDir = new PathString(System.Environment.CurrentDirectory);

            var instance = Evaluation.PipelineInstance.CreatePipelineInstance(pipeline, TestFiltersFactory.CreateInstance, null);

            instance.Setup(Evaluation.BuildContext.Create(configuration, srcDir, true));

            // run evaluation

            using (var evaluator = instance.CreateEvaluator())
            {
                // note we're using the secondary evaluator instead of the primary one, to prevent creating the target directory.
                return((int)evaluator.EvaluateRoot().Result);
            }
        }
Exemplo n.º 7
0
        public static ProjectDOM.Pipeline CreateArithmeticPipeline()
        {
            // create a pipeline
            var pipeline = new ProjectDOM.Pipeline();

            var value1Id = pipeline.AddNode("AssignIntegerValue");

            pipeline.GetNode(value1Id).GetPropertiesForConfiguration("Root").SetValue("Value", "5");

            var value2Id = pipeline.AddNode("AssignIntegerValue");

            pipeline.GetNode(value2Id).GetPropertiesForConfiguration("Root").SetValue("Value", "5");

            var rootId = pipeline.AddRootNode("AddIntegerValues");

            pipeline.GetNode(rootId).GetPropertiesForConfiguration("Root").SetReferenceIds("Value1", value1Id);
            pipeline.GetNode(rootId).GetPropertiesForConfiguration("Root").SetReferenceIds("Value2", value2Id);

            return(pipeline);
        }
Exemplo n.º 8
0
        public void AddDifferentNodesOnEachConfiguration()
        {
            // create a pipeline
            var pipeline = new ProjectDOM.Pipeline();

            // create the nodes
            var root         = pipeline.CreateRootNode("TestFilter2");
            var childOnRoot  = pipeline.CreateNode("TestFilter1");
            var childOnDebug = pipeline.CreateNode("TestFilter1");

            root.SetReferences("Root", "Value1", childOnRoot);

            Assert.IsTrue(root.GetReferenceIds("Root", "Value1").Contains(childOnRoot.Identifier));
            Assert.IsTrue(pipeline.GetReferences(root, "Root", "Value1").Contains(childOnRoot));

            root.SetReferences("Root.Debug", "Value1", childOnDebug);

            Assert.IsTrue(root.GetReferenceIds("Root", "Value1").Contains(childOnRoot.Identifier));
            Assert.IsTrue(root.GetReferenceIds("Root.Debug", "Value1").Contains(childOnDebug.Identifier));
            Assert.IsTrue(pipeline.GetReferences(root, "Root.Debug", "Value1").Contains(childOnDebug));
        }
Exemplo n.º 9
0
        public static IEnumerable <ProjectDOM.Node> GetReferences(this ProjectDOM.Pipeline pipeline, ProjectDOM.Node parent, string jointCfg, string propertyName)
        {
            var ids = parent.GetReferenceIds(jointCfg, propertyName);

            return(ids.Select(item => pipeline.GetNode(item)));
        }
Exemplo n.º 10
0
        public static ProjectDOM.Node CreateRootNode(this ProjectDOM.Pipeline pipeline, string className)
        {
            var id = pipeline.AddRootNode(className);

            return(pipeline.GetNode(id));
        }