/// <summary> /// Get the available statuses for the given JIRA install /// </summary> public IList <RemoteStatus> getStatuses() { JiraSoapServiceService service = getServiceEndPoint(); string token = service.login(_username, _password); return(new List <RemoteStatus>(service.getStatuses(token))); }
public JiraConnection(string url, string userName, string password, Converter <string, string> settings) { Log.Verbose("Creating a new connection"); _rootUrl = url.TrimEnd('\\', '/'); int offset = _rootUrl.LastIndexOf("/rpc/soap/jirasoapservice-v2"); if (offset > 0) { _rootUrl = _rootUrl.Substring(0, offset); } Log.Info("Root Url: {0}", _rootUrl); _settings = settings; _knownUsers = new Dictionary <string, JiraUser>(StringComparer.OrdinalIgnoreCase); _lookupUsers = StringComparer.OrdinalIgnoreCase.Equals(settings("resolveUserNames"), "true"); Log.Info("LookUp Users: {0}", _lookupUsers); LoadUsers(); _statuses = new Dictionary <string, JiraStatus>(StringComparer.Ordinal); _userName = userName; _password = password; Log.Verbose("Creating a new internal Soap Service"); _service = new JiraSoapServiceService(); Log.Verbose("Service Created"); _service.Url = _rootUrl + "/rpc/soap/jirasoapservice-v2"; _service.UseDefaultCredentials = true; if (!String.IsNullOrEmpty(settings("jira:proxyurl"))) { ICredentials proxyAuth = CredentialCache.DefaultCredentials; var proxyuri = new UriBuilder(settings("jira:proxyurl")); if (!String.IsNullOrEmpty(proxyuri.UserName)) { proxyAuth = new NetworkCredential(proxyuri.UserName, proxyuri.Password); proxyuri.Password = proxyuri.UserName = String.Empty; } _service.Proxy = new WebProxy(proxyuri.Uri); _service.Proxy.Credentials = proxyAuth; } _token = null; Log.Verbose("Connecting..."); Connect(); Log.Verbose("Connection Successfull"); _currentUser = GetUser(_userName); Log.Verbose("Getting Statuses"); foreach (RemoteStatus rs in _service.getStatuses(_token)) { _statuses[rs.id] = new JiraStatus(rs); } Log.Verbose("Finished creating a new connection"); }
private void InitializeStatuses() { //TODO Caching. if (_statuses == null) { _statuses = new Dictionary <string, RemoteStatus>(); foreach (RemoteStatus s in _jira.getStatuses(_jiraToken)) { _statuses[s.id] = s; } } }
public override Dictionary <string, string> GetStatesForDefects(List <string> defectIds) { Dictionary <string, string> result = new Dictionary <string, string>(); List <string> failedIds = new List <string>(); Connect(); RemoteStatus[] remoteStatuses = jira.getStatuses(jiraToken); Dictionary <string, string> statusNames = remoteStatuses.ToDictionary(remoteStatus => remoteStatus.id, remoteStatus => remoteStatus.name); foreach (string defectId in defectIds) { try { RemoteIssue issue = jira.getIssue(jiraToken, defectId); if (statusNames.ContainsKey(issue.status)) { result.Add(defectId, statusNames[issue.status]); } } catch { failedIds.Add(defectId); } } Disconnect(); if (failedIds.Count > 0) { MessageBox.Show( "The status of the following Defects could not be retrieved:" + Environment.NewLine + string.Join(",", failedIds.ToArray()), "Synchronize Defect States"); } return(result); }
public JiraConnection(string url, string userName, string password, Converter <string, string> settings) { _rootUrl = url.TrimEnd('\\', '/'); int offset = _rootUrl.LastIndexOf("/rpc/soap/jirasoapservice-v2"); if (offset > 0) { _rootUrl = _rootUrl.Substring(0, offset); } _settings = settings; _knownUsers = new Dictionary <string, JiraUser>(StringComparer.OrdinalIgnoreCase); _lookupUsers = StringComparer.OrdinalIgnoreCase.Equals(settings("resolveUserNames"), "true"); LoadUsers(); _statuses = new Dictionary <string, JiraStatus>(StringComparer.Ordinal); _userName = userName; _password = password; _service = new CSharpTest.Net.SvnJiraIntegration.Jira.JiraSoapServiceService(); _service.Url = _rootUrl + "/rpc/soap/jirasoapservice-v2"; _service.UseDefaultCredentials = true; if (!String.IsNullOrEmpty(settings("jira:proxyurl"))) { System.Net.ICredentials proxyAuth = System.Net.CredentialCache.DefaultCredentials; UriBuilder proxyuri = new UriBuilder(settings("jira:proxyurl")); if (!String.IsNullOrEmpty(proxyuri.UserName)) { proxyAuth = new System.Net.NetworkCredential(proxyuri.UserName, proxyuri.Password); proxyuri.Password = proxyuri.UserName = String.Empty; } _service.Proxy = new System.Net.WebProxy(proxyuri.Uri); _service.Proxy.Credentials = proxyAuth; } _token = null; Connect(); _currentUser = GetUser(_userName); foreach (RemoteStatus rs in _service.getStatuses(_token)) { _statuses[rs.id] = new JiraStatus(rs); } }
public List <JiraNamedEntity> getStatuses() { return(createEntityListFromConstants(service.getStatuses(Token))); }