//static HttpClient client = new HttpClient(); public override void Execute(TCAddOnTaskContext context) { //context.ShowMessageBox("Test Execute", "You clicked on a menu item."); RunAsync().Wait(); Console.ReadLine(); context.ShowMessageBox("Test Result", "Successfully Created Issue"); }
public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { IEnumerable <XModule> modules = ((TCFolder)objectToExecuteOn).Search("=>SUBPARTS:XModule").OfType <XModule>(); string engines = string.Empty; foreach (var item in modules) { var engineParam = item.XParams.Where(t => t.Name == "Engine").First(); if (!engines.Contains(engineParam.Value)) { engines += (engineParam.Value + Environment.NewLine); } } taskContext.ShowMessageBox("Used Engines", engines); return(objectToExecuteOn); }
public override void Execute(TCAddOnTaskContext context) { StringBuilder summaryInfo = new StringBuilder(); TCProject project = TCAddOn.ActiveWorkspace.GetTCProject(); List <string> totalTcObjectCount = new List <string>(); totalTcObjectCount.Add(" Requirements: " + project.Search("=>SUBPARTS:Requirement").Count()); totalTcObjectCount.Add(" TestSheet: " + project.Search("=>SUBPARTS:TestSheet").Count()); totalTcObjectCount.Add(" XModule: " + project.Search("=>SUBPARTS:XModule").Count()); totalTcObjectCount.Add(" TestCase: " + project.Search("=>SUBPARTS:TestCase").Count()); totalTcObjectCount.Add(" ExecutionList: " + project.Search("=>SUBPARTS:ExecutionList").Count()); foreach (var item in totalTcObjectCount) { summaryInfo.Append(item + Environment.NewLine); } context.ShowMessageBox($"Summary of {project.DisplayedName}", $"Count of Tosca objects at {DateTime.Now + Environment.NewLine + Environment.NewLine + summaryInfo}"); }
public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { List <TCObject> modules = (objectToExecuteOn as TCFolder).Search("=>SUBPARTS:XModule"); List <string> engineNames = new List <string>(); List <string> moduleNames = new List <string>(); string engineInfo = string.Empty; foreach (XModule module in modules) { IEnumerable <XParam> parms = (module as XModule).XParams; foreach (XParam parm in parms) { if (parm.Name.Equals("Engine")) { if (!engineNames.Contains(parm.Value)) { engineNames.Add(parm.Value); moduleNames.Add(string.Empty); } moduleNames[engineNames.IndexOf(parm.Value)] = moduleNames[engineNames.IndexOf(parm.Value)] + " " + module.Name + Environment.NewLine; break; } } } foreach (string engine in engineNames) { engineInfo = engineInfo + "Engine " + engine + " in Modules: " + Environment.NewLine + moduleNames[engineNames.IndexOf(engine)] + Environment.NewLine; } taskContext.ShowMessageBox("All Engines in Module Folder " + objectToExecuteOn.DisplayedName, engineInfo); return(objectToExecuteOn); }
public override void Execute(TCAddOnTaskContext context) { context.ShowMessageBox("Ribbon", "You clicked my ribbon item"); }
public override TCObject Execute(TCObject requirementSet, TCAddOnTaskContext taskContext) { RequirementSet rs = (RequirementSet)requirementSet; JiraConfig config = rs.GetJiraConfig(); #region Setup if (config == null) { string url = taskContext.GetStringValue("Jira Instance URL: ", false); string jqlValue = taskContext.GetStringValue("JQL Filter for requirements: ", false); config = new JiraConfig { baseURL = url, jqlFilter = jqlValue, fieldMaps = new List <FieldMap>() { new FieldMap { direction = JiraService.Configuration.Direction.jira_to_tosca, jiraJsonPath = "$.fields.summary", toscaField = "Name" } } }; rs.SaveConfig(config); } string username, password; if (CredentialManager.Instance.Credentials.Any(x => x.BaseURL == config.baseURL)) { Credential credential = CredentialManager.Instance.Credentials.First(x => x.BaseURL == config.baseURL); username = credential.Username; password = credential.Password; } else { username = taskContext.GetStringValue("Jira Username", false); password = taskContext.GetStringValue("Jira Password", true); CredentialManager.Instance.StoreOrUpdateCredential(new Credential { BaseURL = config.baseURL, Description = "Created by Jira Config", Username = username, Password = password }); } #endregion var jira = new JiraService.Jira(config.baseURL, username, password); var issueService = jira.GetIssueService(); String startTime = DateTime.Now.ToString("yyyyMMddHHmmss"); string jql = config.jqlFilter; JiraService.Issue.Issue[] issues = null; Task <JiraService.Issue.Issue[]> issueTask = null; try { issueTask = issueService.SearchAsync(jql); while (!issueTask.IsCompleted) { taskContext.ShowStatusInfo($"Gettign issues for JQL: {jql}"); System.Threading.Thread.Sleep(100); } //order the issues so that subtasks are not created before parent tasks issues = issueTask.Result.OrderBy(x => x.fields.project.name).ThenBy(x => x.id).ToArray(); taskContext.ShowStatusInfo("Creating Requirements"); } catch (Exception e) { string err = e.Message; if (e.InnerException != null) { err += "\r\n" + e.InnerException.Message; } taskContext.ShowErrorMessage($"Error synchronising", err); taskContext.ShowStatusInfo($"Error synchronising: {err}"); return(requirementSet); } HashSet <string> updatedItems = new HashSet <string>(); if (issues != null) { foreach (var issue in issues) { var req = CreateOrUpdateRequirement(rs, config, issue); updatedItems.Add(req.UniqueId); } // Prompt status taskContext.ShowMessageBox("Jira Sync", issues.Length.ToString() + " requirements have been synchronised."); } return(null); }
//static HttpClient client = new HttpClient(); public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { taskContext.ShowMessageBox("Attention", "This entry will be run via an AddOnTask"); RunAsync(objectToExecuteOn).Wait(); return(null); }
//static HttpClient client = new HttpClient(); public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { taskContext.ShowMessageBox("Attention", "Executed selected Item"); RunAsync(objectToExecuteOn).Wait(); return(null); }
public override void Execute(TCAddOnTaskContext context) { context.ShowMessageBox("Configuration", "You clicked on Configuration menu item."); }
public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { taskContext.ShowMessageBox("Attention", String.Format("This entyr will be run via an AddOnTask: CWD: {0}", Environment.CurrentDirectory)); (objectToExecuteOn as ExecutionEntry).Run(); return(null); }