예제 #1
0
        public static SortedDictionary <string, bool> GetActionDefs(IXConnection ixConn, List <string> jsTexts, string package)
        {
            String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/" + package + "/Action definitions";

            if (package.Equals(""))
            {
                parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/_global/Action definitions";
            }
            List <Sord> sordActionDefInfo = RepoUtils.FindChildren(parentId, ixConn, true);
            SortedDictionary <string, bool> dicActionDefs = new SortedDictionary <string, bool>();

            foreach (Sord s in sordActionDefInfo)
            {
                string   actionDef = s.name;
                string[] rf        = actionDef.Split('.');
                actionDef = rf[rf.Length - 1];
                actionDef = "actions." + actionDef;

                if (!dicActionDefs.ContainsKey(actionDef))
                {
                    bool match = Unittests.Match(ixConn, actionDef, package, jsTexts);
                    dicActionDefs.Add(actionDef, match);
                }
            }
            ;
            return(dicActionDefs);
        }
예제 #2
0
        public static SortedDictionary <string, bool> GetRules(IXConnection ixConn, List <string> jsTexts, string package)
        {
            String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/" + package + "/ELOas Base/Direct";

            if (package.Equals(""))
            {
                parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/ELOas Base/Direct";
            }

            List <Sord> sordRuleInfo = RepoUtils.FindChildren(parentId, ixConn, true);
            SortedDictionary <string, bool> dicRules = new SortedDictionary <string, bool>();

            foreach (Sord s in sordRuleInfo)
            {
                string   objId    = s.id + "";
                EditInfo editInfo = ixConn.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO);
                if (editInfo.document.docs.Length > 0)
                {
                    DocVersion dv          = editInfo.document.docs[0];
                    string     url         = dv.url;
                    Stream     inputStream = ixConn.Download(url, 0, -1);
                    string     xmlText     = new StreamReader(inputStream, Encoding.UTF8).ReadToEnd();

                    try
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(xmlText);
                        string rulesetname = "";
                        foreach (XmlNode nameNode in doc.SelectNodes("ruleset/base/name"))
                        {
                            foreach (XmlNode subNode in nameNode.ChildNodes)
                            {
                                switch (subNode.Name)
                                {
                                case "#text":
                                    rulesetname = subNode.InnerText;
                                    break;
                                }
                            }
                        }
                        if (!dicRules.ContainsKey(rulesetname))
                        {
                            bool match = Unittests.Match(ixConn, rulesetname, package, jsTexts);
                            dicRules.Add(rulesetname, match);
                        }
                    }
                    catch (XmlException e)
                    {
                        Debug.WriteLine("Exception: {0}", e.Message);
                    }
                }
            }
            ;
            return(dicRules);
        }
예제 #3
0
        public static SortedDictionary <string, bool> GetRFs(IXConnection ixConn, List <string> jsTexts, string package)
        {
            String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/" + package + "/IndexServer Scripting Base";

            if (package.Equals(""))
            {
                parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/IndexServer Scripting Base/_ALL/business_solutions";
            }
            List <Sord> sordRFInfo = RepoUtils.FindChildren(parentId, ixConn, true);
            SortedDictionary <string, bool> dicRFs = new SortedDictionary <string, bool>();

            foreach (Sord s in sordRFInfo)
            {
                string   objId    = s.id + "";
                EditInfo editInfo = ixConn.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO);
                if (editInfo.document.docs.Length > 0)
                {
                    DocVersion dv          = editInfo.document.docs[0];
                    string     url         = dv.url;
                    Stream     inputStream = ixConn.Download(url, 0, -1);
                    string     jsText      = new StreamReader(inputStream, Encoding.UTF8).ReadToEnd();
                    string[]   jsLines     = jsText.Split('\n');
                    foreach (string line in jsLines)
                    {
                        if (line.Contains("function RF_"))
                        {
                            string[] rf      = line.Split();
                            string   rfName  = rf[1];
                            string[] rfNames = rfName.Split('(');
                            rfName = rfNames[0];
                            if (!rfName.Equals("*"))
                            {
                                if (!dicRFs.ContainsKey(rfName))
                                {
                                    bool match = Unittests.Match(ixConn, rfName, package, jsTexts);
                                    dicRFs.Add(rfName, match);
                                }
                            }
                        }
                    }
                }
            }
            ;
            return(dicRFs);
        }