Пример #1
0
        public Dictionary <Guid, string> CreateNewALMDefects(Dictionary <Guid, Dictionary <string, string> > defectsForOpening, List <ExternalItemFieldBase> defectsFields)
        {
            Dictionary <Guid, string> defectsOpeningResults = new Dictionary <Guid, string>();
            List <JiraIssueExport>    defectsToExport       = new List <JiraIssueExport>();
            List <string>             screenshots           = new List <string>();

            foreach (KeyValuePair <Guid, Dictionary <string, string> > defectForOpening in defectsForOpening)
            {
                string summaryValue = defectForOpening.Value.ContainsKey("Summary") ? defectForOpening.Value["Summary"] : string.Empty;
                if (!string.IsNullOrEmpty(summaryValue))
                {
                    string defectId = CheckIfDefectExist(summaryValue);
                    if (!string.IsNullOrEmpty(defectId))
                    {
                        defectsOpeningResults.Add(defectForOpening.Key, defectId);
                        continue;
                    }
                    else
                    {
                        string paths = defectForOpening.Value.ContainsKey("screenshots") ? defectForOpening.Value["screenshots"] : string.Empty;
                        screenshots.Add(paths);
                    }
                }
                //if no then add into list to open new defect
                defectsToExport.Add(this.CreateDefectData(defectForOpening, defectsFields));
            }

            if (defectsToExport.Count > 0)
            {
                var exportedDefects = jiraRepObj.ExportJiraIssues(ALMCore.DefaultAlmConfig.ALMUserName, ALMCore.DefaultAlmConfig.ALMPassword, ALMCore.DefaultAlmConfig.ALMServerURL, defectsToExport);
                if (exportedDefects.Count > 0)
                {
                    for (var a = 0; a < exportedDefects.Count; a++)
                    {
                        if (exportedDefects[a].DataResult != null)
                        {
                            AttachScreenshotsToDefects(screenshots[a], exportedDefects[a].DataResult.key);
                            defectsOpeningResults.Add(defectsForOpening.ElementAt(a).Key, exportedDefects[a].DataResult.key);
                        }
                        else
                        {
                            Reporter.ToLog(eLogLevel.ERROR, "Failed to create to defect -" + exportedDefects[a].AuthenticationResponseObj.ErrorDesc);
                        }
                    }
                }
            }
            return(defectsOpeningResults);
        }
Пример #2
0
        public Dictionary <Guid, string> CreateNewALMDefects(Dictionary <Guid, Dictionary <string, string> > defectsForOpening, List <ExternalItemFieldBase> defectsFields)
        {
            Dictionary <Guid, string> defectsOpeningResults = new Dictionary <Guid, string>();
            List <JiraIssueExport>    defectsToExport       = new List <JiraIssueExport>();

            foreach (KeyValuePair <Guid, Dictionary <string, string> > defectForOpening in defectsForOpening)
            {
                defectsToExport.Add(this.CreateDefectData(defectForOpening, defectsFields));
            }
            var exportedDefects = jiraRepObj.ExportJiraIssues(ALMCore.AlmConfig.ALMUserName, ALMCore.AlmConfig.ALMPassword, ALMCore.AlmConfig.ALMServerURL, defectsToExport);

            for (var a = 0; a < exportedDefects.Count; a++)
            {
                if (defectsForOpening.Count > a)
                {
                    defectsOpeningResults.Add(defectsForOpening.ElementAt(a).Key, exportedDefects[a].DataResult.key);
                }
            }
            return(defectsOpeningResults);
        }