public void SetUp() { ErrorLog.Clear(); var logger = LogManager.GetLogger("Test"); logger.Info("This is an info message."); }
public StoreQuery GenerateQuery() { ErrorLog.Clear(); Validate(); if (ValidationResults.Any()) { return(null); } var subQueries = new List <StoreQuery>(); try { for (int i = 1; i < SubQueryList.Count; i++) { var q = SubQueryList[i]; var gen = _engine.GenerateQuery(q); subQueries.Add(gen); } var result = _engine.GenerateQuery(MainQuery, StoreParameters); result.Query.SubQueries = subQueries.ToDictionary(s => s.Name, s => s.Query); return(result); } catch (Exception exc) { ErrorLog.AppendLine($"Cannot generate query: {exc.Message}"); return(null); } }
public async void RemoveJobs(string jenkinsHost) { ErrorLog.Clear(); foreach (Repository rep in Repos) { IReadOnlyList <Branch> branches = await GHClient.Repository.Branch.GetAll(rep.Id); foreach (Branch branch in branches) { string[] branchParts = branch.Name.Split('_'); if (branchParts[0] == "VB") { continue; } string pureBranchName; if (branchParts.Length == 2) { pureBranchName = branchParts[1]; } else { pureBranchName = branchParts[0]; } string reqUrl = string.Format("{0}/job/{1}_{2}/doDelete", jenkinsHost, rep.Name, pureBranchName); try { Post(reqUrl, ""); } catch (Exception e) { ErrorLog.Add(reqUrl + ": " + e.Message + System.Environment.NewLine); } } } MessageBox.Show("Ready"); }
/// <summary> /// 清理数据文件 /// </summary> internal void ClearData() { ExcelData.Clear(); JsonData.Clear(); TemplateData.Clear(); MultipleJsonData.Clear(); MultipleTemplateData.Clear(); ErrorLog.Clear(); }
public async void CreateJobs(string jenkinsHost) { XmlDocument doc = new XmlDocument(); doc.Load("config.xml"); XmlNode projectUrlNode = doc.DocumentElement.SelectSingleNode(@"/project/properties/com.coravy.hudson.plugins.github.GithubProjectProperty/projectUrl"); XmlNode gitRepoUrlNode = doc.DocumentElement.SelectSingleNode(@"/project/scm/userRemoteConfigs/hudson.plugins.git.UserRemoteConfig/url"); XmlNode whiteListedBranches = doc.DocumentElement.SelectSingleNode(@"/project/triggers/org.jenkinsci.plugins.ghprb.GhprbTrigger/whiteListTargetBranches/org.jenkinsci.plugins.ghprb.GhprbBranch/branch"); ErrorLog.Clear(); foreach (Repository rep in Repos) { IReadOnlyList <Branch> branches = await GHClient.Repository.Branch.GetAll(rep.Id); foreach (Branch branch in branches) { string[] branchParts = branch.Name.Split('_'); if (branchParts[0] == "VB") { continue; } string pureBranchName; if (branchParts.Length == 2) { pureBranchName = branchParts[1]; } else { pureBranchName = branchParts[0]; } string repoUrl = string.Format(@"https://github.com/{0}/{1}", OrgName, rep.Name); projectUrlNode.InnerText = repoUrl; gitRepoUrlNode.InnerText = repoUrl + ".git"; whiteListedBranches.InnerText = string.Format("^.*{0}.*", pureBranchName); pureBranchName = pureBranchName.Replace("+", "%2b"); string reqUrl = jenkinsHost + "/createItem?name=" + string.Format("{0}_{1}", rep.Name, pureBranchName); try { Post(reqUrl, doc.OuterXml); } catch (Exception e) { ErrorLog.Add(e.Message + ": " + System.Environment.NewLine); } } } MessageBox.Show("Ready"); }
public void SetUp() { ErrorLog.Clear(); var logger = LogManager.GetLogger("Test"); _exception = new ArgumentException { Source = "SetUp" }; try { new Thrower().Throw(_exception); } catch (Exception ex) { logger.ErrorException("This is an error message.", ex); } }
public void Clear() { Log = ""; ErrorLog.Clear(); }