Bari.Core.Model.Loader.YamlModelLoaderBase.LoadYaml C# (CSharp) Method

LoadYaml() protected method

Process an already loaded YamlDocument and returns the loaded suite model.
protected LoadYaml ( YamlDocument yaml ) : Suite
yaml YamlDotNet.RepresentationModel.YamlDocument The yaml document to process.
return Suite
        protected Suite LoadYaml(YamlDocument yaml)
        {
            Contract.Requires(yaml != null);
            Contract.Requires(yaml.RootNode != null);
            Contract.Ensures(Contract.Result<Suite>() != null);

            log.Debug("Processing YAML document...");

            foreach (var pluginUri in LoadPlugins(yaml.RootNode))
                pluginLoader.Load(pluginUri);

            var goals = LoadGoals(yaml.RootNode);
            var defaultGoal = LoadDefaultGoal(goals, yaml.RootNode) ?? Suite.DebugGoal;
            var suite = suiteFactory.CreateSuite(new HashSet<Goal>(goals.Values), defaultGoal);

            parser.SetActiveGoal(suite.ActiveGoal);

            suite.Name = parser.GetScalarValue(yaml.RootNode, "suite", "Error reading the name of the suite");
            suite.Version = ParseVersion(parser.GetOptionalScalarValue(yaml.RootNode, "version", null));
            suite.Copyright = parser.GetOptionalScalarValue(yaml.RootNode, "copyright", null);

            LoadParameters(suite, suite, yaml.RootNode);

            foreach (KeyValuePair<string, YamlNode> item in parser.EnumerateNamedNodesOf(yaml.RootNode, "modules"))
            {
                var module = suite.GetModule(item.Key);

                if (item.Value != null)
                    LoadModule(module, item.Value);
            }

            foreach (KeyValuePair<string, YamlNode> item in parser.EnumerateNamedNodesOf(yaml.RootNode, "products"))
            {
                var product = suite.GetProduct(item.Key);

                if (item.Value != null)
                    LoadProduct(suite, product, item.Value);
            }

            LoadSourceSetIgnoreLists(suite.SourceSetIgnoreLists, yaml.RootNode);

            validator.Validate(suite);

            log.Debug("Finished processing YAML document.");
            return suite;
        }