// // Validates the Jira ticket if needed // bool ValidateJiraTicket(string jiraId) { // If we have no ticker, we're fine if (string.IsNullOrEmpty(jiraId) == true) { return(true); } // Get our credentials string serverName = Names.Url[(int)Names.Type.Jira]; Simple credentials = Credentials.Create(serverName, m_logger) as Simple; if (credentials == null) { m_logger.Log("Unable to create credentials for '{0}'", serverName); throw new FileNotFoundException(@"Unable to find the credentials for " + serverName); } // Split out ticket IDs so we validate them all string[] jiras = jiraId.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (jiras == null || jiras.Length == 0) { jiras = new string[] { jiraId } } ; // Validate the ticker foreach (string thisTicket in jiras) { string ticketToCheck = thisTicket.Trim(); bool tickerValid = RB_Tools.Shared.Targets.Jira.ValidateJiraTicker(credentials, ticketToCheck).Result; if (tickerValid == false) { string message = string.Format("Unable to find ticket '{0}' on {1}", jiraId, serverName); m_logger.Log(message); throw new InvalidOperationException(message); } } // We're done return(true); } // // Requests a new review // object RequestReview(ReviewRequestProperties thisRequest) { if (thisRequest.ReviewProperties.ReviewLevel == RB_Tools.Shared.Review.Properties.Level.FullReview) { // Get our credentials string serverName = Names.Url[(int)Names.Type.Reviewboard]; Simple credentials = Credentials.Create(serverName, m_logger) as Simple; if (credentials == null) { m_logger.Log("Unable to create credentials for '{0}'", serverName); throw new FileNotFoundException(@"Unable to find the credentials for " + serverName); } // Request the review m_logger.Log("Requesting review"); Reviewboard.ReviewRequestResult result = Reviewboard.RequestReview( thisRequest.WorkingCopy, credentials.Server, credentials.User, credentials.Password, thisRequest.ReviewProperties, m_logger); // Save the result m_logger.Log("Review request finished"); return(result); } else { // Save the result m_logger.Log("Review request skipped as a review is not being carried out"); return(new Reviewboard.ReviewRequestResult(null, null, thisRequest.ReviewProperties)); } }