Exemplo n.º 1
0
        public JiraIssueAggregator(IJiraClient jiraClient)
        {
            ArgumentUtility.CheckNotNull ("jiraClient", jiraClient);

              _jiraClient = jiraClient;
        }
Exemplo n.º 2
0
        private void CheckAndConnectJira()
        {
            if (jira == null)
            {
                try
                {
                    jira = JiraClientFactory.BuildJiraClient(jiraConnectionSettings.JiraUrl, jiraConnectionSettings.JiraUsername, jiraConnectionSettings.JiraPassword);

                    CurrentUser = jira.GetCurrentUser();
                    LoggedIn?.Invoke(this, null);

                    TrackingType trackingType;
                    if (jira.GetType() == typeof(JiraRestClient))
                    {
                        trackingType = jiraConnectionSettings.JiraUrl.Contains(".atlassian.net") ? TrackingType.JiraConnectCloudRest : TrackingType.JiraConnectSelfhostRest;
                    }
                    else
                    {
                        trackingType = jiraConnectionSettings.JiraUrl.Contains(".atlassian.net") ? TrackingType.JiraConnectCloudSoap : TrackingType.JiraConnectSelfhostSoap;
                    }

                    trackUsage.TrackAppUsage(trackingType);

                }
                catch (InvalidCredentialException)
                {
                    throw new MissingJiraConfigException("Required settings to create connection to jira are missing");
                }
                catch (Exception ex)
                {
                    throw new JiraConnectionException("Error creating instance of Jira", ex);
                }
            }
        }
Exemplo n.º 3
0
		public void Connect(IJiraClient client)
		{
			_client = client;
            Fields = _client.GetFields();
		}
Exemplo n.º 4
0
 public void ReConnect(IJiraConnectionSettings newJiraConnectionSettings, IExportSettings newExportSettings)
 {
     exportSettings = newExportSettings;
     jiraConnectionSettings = newJiraConnectionSettings;
     jira = null;
     CheckAndConnectJira();
     Task.Factory.StartNew(UpdateJiraProjectCache);
 }
Exemplo n.º 5
0
        private void CheckAndConnectJira(bool useRestApi = true)
        {
            if (jira == null)
            {
                if (string.IsNullOrWhiteSpace(jiraConnectionSettings.JiraUrl) ||
                    string.IsNullOrWhiteSpace(jiraConnectionSettings.JiraUsername) ||
                    string.IsNullOrWhiteSpace(jiraConnectionSettings.JiraPassword))
                {
                    throw new MissingJiraConfigException("Required settings to create connection to jira are missing");
                }

                try
                {
                    if (useRestApi)
                    {
                        jira = new JiraRestClient(jiraConnectionSettings.JiraUrl.Replace("/secure/Dashboard.jspa", ""), jiraConnectionSettings.JiraUsername, jiraConnectionSettings.JiraPassword);
                    }
                    else
                    {
                        jira = new JiraSoapClient(jiraConnectionSettings.JiraUrl.Replace("/secure/Dashboard.jspa", ""), jiraConnectionSettings.JiraUsername, jiraConnectionSettings.JiraPassword);
                    }

                    CurrentUser = jira.GetCurrentUser();
                }
                catch (Exception ex)
                {
                    jira = null;
                    if (useRestApi)
                    {
                        CheckAndConnectJira(false);
                    }
                    else
                    {
                        throw new JiraConnectionException("Error creating instance of Jira", ex);
                    }
                }
            }
        }
Exemplo n.º 6
0
 public void ReConnect(IJiraConnectionSettings newJiraConnectionSettings, IExportSettings newExportSettings)
 {
     exportSettings = newExportSettings;
     jiraConnectionSettings = newJiraConnectionSettings;
     jira = null;
     CheckAndConnectJira();
     UpdateJiraProjectCache();
 }
Exemplo n.º 7
0
 public HomeController(IJiraClient jiraClient, IReportService reportService, ReportSetup defaultReportSetup)
 {
     _jiraClient = jiraClient;
     _reportService = reportService;
     _defaultReportSetup = defaultReportSetup;
 }
 public void SetUp()
 {
     _jiraClientStub = MockRepository.GenerateStub<IJiraClient>();
       _jiraIssueAggregator = new JiraIssueAggregator (_jiraClientStub);
 }