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); }
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); }
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); }
public static void ShowReportMatchUnittest(KonfigurationIx ixConf) { try { IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "Show Report Match Unittest", "1.0"); IXConnection ixConn = connFact.Create(ixConf.user, ixConf.pwd, null, null); List <string> jsTexts = RepoUtils.LoadTextDocs("ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/_global/Unit Tests", ixConn); SortedDictionary <string, bool> dicRFs = RegisterFunctions.GetRFs(ixConn, jsTexts, ixConf.package); SortedDictionary <string, bool> dicASDirectRules = ASDirectRules.GetRules(ixConn, jsTexts, ixConf.package); SortedDictionary <string, bool> dicActionDefs = ActionDefinitions.GetActionDefs(ixConn, jsTexts, ixConf.package); string htmlDoc = Http.CreateHtmlReport(dicRFs, dicASDirectRules, dicActionDefs); string reportUrl = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ReportElo"; if (!Directory.Exists(reportUrl)) { Directory.CreateDirectory(reportUrl); } File.WriteAllText(Path.Combine(reportUrl, "Report.html"), htmlDoc); reportUrl = reportUrl + "\\Report.html"; Http.OpenUrl(reportUrl); } catch (byps.BException e) { if (e.Source != null) { MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("byps.BException message: {0}", e.Message); } } catch (System.Net.WebException e) { if (e.Source != null) { MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk); Debug.WriteLine("System.Net.WebException message: {0}", e.Message); } } }
public static List <string> LoadTextDocs(String parentId, IXConnection ixConn) { List <Sord> sordRFInfo = RepoUtils.FindChildren(parentId, ixConn, true); List <string> docTexts = new List <string>(); 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 docText = new StreamReader(inputStream, Encoding.UTF8).ReadToEnd(); docTexts.Add(docText); } } ; return(docTexts); }
static Dictionary <string, string> GetUnittestApp(IXConnection ixConn) { String parentId = "ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/development/ELOapps/ClientInfos"; List <Sord> sordELOappsClientInfo = RepoUtils.FindChildren(parentId, ixConn, false); string configApp = ""; string configId = ""; foreach (Sord s in sordELOappsClientInfo) { string objId = s.id + ""; EditInfo editInfo = ixConn.Ix.checkoutDoc(objId, null, EditInfoC.mbSordDoc, LockC.NO); DocVersion dv = editInfo.document.docs[0]; string url = dv.url; Stream inputStream = ixConn.Download(url, 0, -1); string jsonString = new StreamReader(inputStream, Encoding.UTF8).ReadToEnd(); jsonString = jsonString.Replace("namespace", "namespace1"); JsonConfig config = JsonConfig.ReadToObject(jsonString); string webId = config.web.id; if (webId != null) { if (webId.Contains("UnitTests")) { configApp = config.web.namespace1 + "." + config.web.id; configId = config.id; } } } ; Dictionary <string, string> dicApp = new Dictionary <string, string>(); dicApp.Add("configApp", configApp); dicApp.Add("configId", configId); return(dicApp); }