public bool OnDefectStateChange(WorkitemStateChangeResult stateChangeResult) { logger.Log(LogMessage.SeverityType.Debug, stateChangeResult.ToString()); var bugId = int.Parse(stateChangeResult.ExternalId); var bugzillaClient = bugzillaClientFactory.CreateNew(configuration.Url); bugzillaClient.Login(configuration.UserName, configuration.Password, true, configuration.IgnoreCert); // We do not need to push changes to Defects that have been processed as we could break their state. if(SkipCloseActions(bugId, bugzillaClient)) { logger.Log(LogMessage.SeverityType.Info, string.Format("Defect {0} has already been processed, check CloseFieldId and CloseReassignValue.", bugId)); return true; } if (configuration.OnStateChangeAccept && !bugzillaClient.AcceptBug(bugId , configuration.OnCreateResolveValue)) { logger.Log(LogMessage.SeverityType.Error, string.Format("Failed to accept bug {0}.", bugId)); } if (!string.IsNullOrEmpty(configuration.OnStateChangeFieldName)) { if (!bugzillaClient.UpdateBug(bugId, configuration.OnStateChangeFieldName, configuration.OnStateChangeFieldValue)) { logger.Log(LogMessage.SeverityType.Error, string.Format("Failed to set {0} to {1}.", configuration.OnStateChangeFieldName, configuration.OnStateChangeFieldValue)); } } if (!string.IsNullOrEmpty(configuration.OnStateChangeReassignValue)) { if (!bugzillaClient.ReassignBug(bugId, configuration.OnStateChangeReassignValue)) { logger.Log(LogMessage.SeverityType.Error, string.Format("Failed to reassign bug to {0}.", configuration.OnStateChangeReassignValue)); } } ResolveBugIfRequired(configuration.OnStateChangeResolveValue, bugId, bugzillaClient); bugzillaClient.Logout(); return true; }
public void OnDefectStateChange(WorkitemStateChangeResult stateChangeResult) { logger.Log(LogMessage.SeverityType.Debug, stateChangeResult.ToString()); query.UpdateStatesToClosed(stateChangeResult.ExternalId); }