public bool SetDefaultAlmConfig(GingerCoreNET.ALMLib.ALMIntegration.eALMType AlmType) { //set default on the solution foreach (GingerCoreNET.ALMLib.ALMConfig alm in WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.DefaultAlm).ToList()) { alm.DefaultAlm = false; } GingerCoreNET.ALMLib.ALMConfig almConfig = GetCurrentAlmConfig(AlmType); almConfig.DefaultAlm = true; //set default on almcore foreach (GingerCoreNET.ALMLib.ALMConfig alm in ALMCore.AlmConfigs.Where(x => x.DefaultAlm).ToList()) { alm.DefaultAlm = false; } GingerCoreNET.ALMLib.ALMConfig DefaultAlm = ALMCore.AlmConfigs.FirstOrDefault(x => x.AlmType == AlmType); if (DefaultAlm == null) { DefaultAlm = new GingerCoreNET.ALMLib.ALMConfig(); DefaultAlm.AlmType = AlmType; ALMCore.AlmConfigs.Add(DefaultAlm); } DefaultAlm.DefaultAlm = true; return(true); }
public override void SetALMConfigurations(string ALMServerUrl, bool UseRest, string ALMUserName, string ALMPassword, string ALMDomain, string ALMProject, string ALMProjectKey, GingerCoreNET.ALMLib.ALMIntegration.eALMType almType, string ALMConfigPackageFolderPath, GingerCoreNET.ALMLib.ALMIntegration.eTestingALMType testingALMType = GingerCoreNET.ALMLib.ALMIntegration.eTestingALMType.None) { GingerCoreNET.ALMLib.ALMConfig AlmConfig = ALMCore.AlmConfigs.FirstOrDefault(x => x.AlmType == almType); GingerCoreNET.ALMLib.ALMUserConfig CurrentAlmUserConfigurations = amdocs.ginger.GingerCoreNET.WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almType); //if not exist add otherwise update if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfigs.Add(AlmConfig); } AlmConfig.ALMServerURL = GetServerValueFromDict(GetDynamicServerConfigAndSetPaths()); AlmConfig.UseRest = UseRest; AlmConfig.ALMUserName = CurrentAlmUserConfigurations.ALMUserName; AlmConfig.ALMPassword = CurrentAlmUserConfigurations.ALMPassword; AlmConfig.ALMDomain = ALMDomain; AlmConfig.ALMProjectName = ALMProject; AlmConfig.ALMProjectKey = ALMProjectKey; AlmConfig.AlmType = almType; AlmConfig.ALMConfigPackageFolderPath = ALMConfigPackageFolderPath; AlmConfig.JiraTestingALM = testingALMType; }
public void UpdateALMType(GingerCoreNET.ALMLib.ALMIntegration.eALMType AlmType) { GingerCoreNET.ALMLib.ALMConfig CurrentAlmConfigurations = GetCurrentAlmConfig(AlmType); ALMCore.DefaultAlmConfig = CurrentAlmConfigurations; switch (AlmType) { case GingerCoreNET.ALMLib.ALMIntegration.eALMType.QC: if (!CurrentAlmConfigurations.UseRest) { AlmCore = new QCCore(); AlmRepo = new QCRepository(); } else { AlmCore = new QCRestAPICore(); AlmRepo = new QCRestAPIRepository(); } break; case GingerCoreNET.ALMLib.ALMIntegration.eALMType.RQM: AlmCore = new RQMCore(); AlmRepo = new RQMRepository(); break; case GingerCoreNET.ALMLib.ALMIntegration.eALMType.RALLY: AlmCore = new RallyCore(); AlmRepo = new RallyRepository(); break; case GingerCoreNET.ALMLib.ALMIntegration.eALMType.Jira: AlmCore = new JiraCore(); AlmRepo = new JIRA_Repository(AlmCore); break; case GingerCoreNET.ALMLib.ALMIntegration.eALMType.Qtest: AlmCore = new QtestCore(); AlmRepo = new QtestRepository(); break; case GingerCoreNET.ALMLib.ALMIntegration.eALMType.Octane: if (!(AlmCore is OctaneCore && AlmRepo is OctaneRepository)) { AlmCore = new OctaneCore(); AlmRepo = new OctaneRepository(AlmCore); } break; case GingerCoreNET.ALMLib.ALMIntegration.eALMType.ZephyrEnterprise: AlmCore = new ZephyrEntCore(); AlmRepo = new ZephyrEnt_Repository(AlmCore); break; } AlmCore.GetCurrentAlmConfig(); SetALMCoreConfigurations(AlmType); }
public virtual void SetALMConfigurations(string ALMServerUrl, bool UseRest, string ALMUserName, string ALMPassword, string ALMDomain, string ALMProject, string ALMProjectKey, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType almType, string ALMConfigPackageFolderPath, bool UseToken, GingerCoreNET.ALMLib.ALMIntegrationEnums.eTestingALMType jiraTestingALM = GingerCoreNET.ALMLib.ALMIntegrationEnums.eTestingALMType.None) { GingerCoreNET.ALMLib.ALMConfig AlmConfig = ALMCore.AlmConfigs.FirstOrDefault(x => x.AlmType == almType); if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfigs.Add(AlmConfig); } GingerCoreNET.ALMLib.ALMUserConfig CurrentAlmUserConfigurations = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almType); if (CurrentAlmUserConfigurations == null) { CurrentAlmUserConfigurations = new GingerCoreNET.ALMLib.ALMUserConfig(); CurrentAlmUserConfigurations.AlmType = almType; WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(CurrentAlmUserConfigurations); } if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfigs.Add(AlmConfig); } if (CurrentAlmUserConfigurations.ALMServerURL != null) { AlmConfig.ALMServerURL = CurrentAlmUserConfigurations.ALMServerURL; } else { AlmConfig.ALMServerURL = ALMServerUrl; } AlmConfig.UseRest = UseRest; AlmConfig.ALMUserName = CurrentAlmUserConfigurations.ALMUserName; AlmConfig.ALMPassword = CurrentAlmUserConfigurations.ALMPassword; AlmConfig.UseToken = UseToken; AlmConfig.ALMDomain = ALMDomain; AlmConfig.ALMProjectName = ALMProject; AlmConfig.ALMProjectKey = ALMProjectKey; AlmConfig.AlmType = almType; AlmConfig.JiraTestingALM = jiraTestingALM; if (CurrentAlmUserConfigurations.ALMConfigPackageFolderPath != null) { AlmConfig.ALMConfigPackageFolderPath = CurrentAlmUserConfigurations.ALMConfigPackageFolderPath; } else { if (!String.IsNullOrEmpty(ALMConfigPackageFolderPath)) { AlmConfig.ALMConfigPackageFolderPath = ALMConfigPackageFolderPath; } } if (!string.IsNullOrEmpty(AlmConfig.ALMConfigPackageFolderPath)) { AlmConfig.ALMConfigPackageFolderPath = WorkSpace.Instance.SolutionRepository.ConvertFullPathToBeRelative(AlmConfig.ALMConfigPackageFolderPath); } }
public void OpenALMItemsFieldsPage() { GingerCoreNET.ALMLib.ALMConfig AlmConfig = GetDefaultAlmConfig(); if (AlmRepo == null) { UpdateALMType(AlmConfig.AlmType); } AlmRepo.OpenALMItemsFieldsPage(); }
private void OpenDefectForSelectedSuggestions_Click(object sender, RoutedEventArgs e) { //if selected ALM is QC And UseRest=False return GingerCoreNET.ALMLib.ALMConfig almConfig = ALMIntegration.Instance.GetCurrentAlmConfig(((ALMDefectProfile)DefectProfiles_cbx.SelectedItem).AlmType); if (!almConfig.UseRest && almConfig.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.QC) { Reporter.ToUser(eUserMsgKey.ALMDefectsUserInOtaAPI, ""); return; } if ((WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList != null) && (WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Count > 0) && (WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.ToOpenDefectFlag == true && (x.ALMDefectID == null || x.ALMDefectID == string.Empty)).ToList().Count > 0)) { if (Reporter.ToUser(eUserMsgKey.AskALMDefectsOpening, WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.ToOpenDefectFlag == true && (x.ALMDefectID == null || x.ALMDefectID == string.Empty)).ToList().Count) == Amdocs.Ginger.Common.eUserMsgSelection.Yes) { Mouse.OverrideCursor = Cursors.Wait; Dictionary <Guid, Dictionary <string, string> > defectsForOpening = new Dictionary <Guid, Dictionary <string, string> >(); foreach (DefectSuggestion defectSuggestion in WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.ToOpenDefectFlag == true && (x.ALMDefectID == null || x.ALMDefectID == string.Empty)).ToList()) { Dictionary <string, string> currentALMDefectFieldsValues = new Dictionary <string, string>(); try { currentALMDefectFieldsValues = ((ALMDefectProfile)DefectProfiles_cbx.SelectedItem).ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) || z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&") : x.SelectedValue = string.Empty) .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.Description : w.Value) .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value) .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value); } catch (Exception ex) { currentALMDefectFieldsValues.Add("Summary", defectSuggestion.Summary); currentALMDefectFieldsValues.Add("description", defectSuggestion.ErrorDetails != null ? defectSuggestion.ErrorDetails : "There is no error description"); } defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues); } var defectFields = ((ALMDefectProfile)DefectProfiles_cbx.SelectedItem).ALMDefectProfileFields.ToList(); //Update alm type to open defect ALMIntegration.Instance.UpdateALMType(((ALMDefectProfile)DefectProfiles_cbx.SelectedItem).AlmType); Dictionary <Guid, string> defectsOpeningResults = ALMIntegration.Instance.CreateNewALMDefects(defectsForOpening, defectFields); if ((defectsOpeningResults != null) && (defectsOpeningResults.Count > 0)) { foreach (KeyValuePair <Guid, string> defectOpeningResult in defectsOpeningResults) { if ((defectOpeningResult.Value != null) && (defectOpeningResult.Value != "0")) { WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.DefectSuggestionGuid == defectOpeningResult.Key).ToList().ForEach(z => { z.ALMDefectID = defectOpeningResult.Value; z.IsOpenDefectFlagEnabled = false; z.ToOpenDefectFlag = false; }); } } grdDefectSuggestions.DataSourceList = WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList; Mouse.OverrideCursor = null; Reporter.ToUser(eUserMsgKey.ALMDefectsWereOpened, defectsOpeningResults.Where(x => x.Value != null && x.Value != string.Empty && x.Value != "0").ToList().Count); } Mouse.OverrideCursor = null; } } }
public void SetALMCoreConfigurations(GingerCoreNET.ALMLib.ALMIntegration.eALMType almType) { GingerCoreNET.ALMLib.ALMConfig CurrentAlmConfigurations = GetCurrentAlmConfig(almType); ALMCore.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper(); if (CurrentAlmConfigurations != null) { AlmCore.SetALMConfigurations(CurrentAlmConfigurations.ALMServerURL, CurrentAlmConfigurations.UseRest, CurrentAlmConfigurations.ALMUserName, CurrentAlmConfigurations.ALMPassword, CurrentAlmConfigurations.ALMDomain, CurrentAlmConfigurations.ALMProjectName, CurrentAlmConfigurations.ALMProjectKey, CurrentAlmConfigurations.AlmType, CurrentAlmConfigurations.ALMConfigPackageFolderPath); } }
public GingerCoreNET.ALMLib.ALMConfig GetDefaultAlmConfig() { GingerCoreNET.ALMLib.ALMConfig AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.DefaultAlm).FirstOrDefault(); if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfig.DefaultAlm = true; WorkSpace.Instance.Solution.ALMConfigs.Add(AlmConfig); } return(AlmConfig); }
private void CurrentProfilePickerCbx_SelectionChanged(object sender, SelectionChangedEventArgs e) { runSetActionAutomatedALMDefects.SelectedDefectsProfileID = ((ALMDefectProfile)CurrentProfilePickerCbx.SelectedItem).ID; //if selected ALM is QC And UseRest=False return GingerCoreNET.ALMLib.ALMConfig almConfig = ALMIntegration.Instance.GetCurrentAlmConfig(((ALMDefectProfile)CurrentProfilePickerCbx.SelectedItem).AlmType); if (!almConfig.UseRest && almConfig.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.QC) { Reporter.ToUser(eUserMsgKey.ALMDefectsUserInOtaAPI, ""); return; } }
public static GingerCoreNET.ALMLib.ALMConfig GetCurrentAlmConfig(GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType almType) { GingerCoreNET.ALMLib.ALMConfig AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.FirstOrDefault(x => x.AlmType == almType); if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfig.AlmType = almType; WorkSpace.Instance.Solution.ALMConfigs.Add(AlmConfig); } return(AlmConfig); }
public GingerCoreNET.ALMLib.ALMConfig GetCurrentAlmConfig() { GingerCoreNET.ALMLib.ALMConfig AlmConfig = null; if (this.GetType() == typeof(GingerCore.ALM.QCCore)) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.QC).FirstOrDefault(); } if (this.GetType() == typeof(GingerCore.ALM.QCRestAPICore)) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.QC).FirstOrDefault(); } if (this.GetType() == typeof(GingerCore.ALM.RQMCore)) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.RQM).FirstOrDefault(); } if (this.GetType() == typeof(GingerCore.ALM.JiraCore)) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.Jira).FirstOrDefault(); } if (this.GetType() == typeof(GingerCore.ALM.QtestCore)) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.Qtest).FirstOrDefault(); } if (this.GetType() == typeof(GingerCore.ALM.OctaneCore)) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.Octane).FirstOrDefault(); } if (this.GetType() == typeof(GingerCore.ALM.RallyCore)) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.RALLY).FirstOrDefault(); } if (AlmConfig != null) { GingerCoreNET.ALMLib.ALMUserConfig AlmUserConfig = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == AlmConfig.AlmType); if (AlmUserConfig == null) { AlmUserConfig = new GingerCoreNET.ALMLib.ALMUserConfig(); AlmUserConfig.AlmType = AlmConfig.AlmType; WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(AlmUserConfig); } AlmConfig.ALMUserName = AlmUserConfig.ALMUserName; AlmConfig.ALMPassword = AlmUserConfig.ALMPassword; } else { AlmConfig = AlmConfigs.FirstOrDefault(); } DefaultAlmConfig = AlmConfig; return(AlmConfig); }
public GingerCoreNET.ALMLib.ALMConfig GetCurrentAlmConfig(bool isOperationAlmType = false) { GingerCoreNET.ALMLib.ALMConfig AlmConfig = null; if (isOperationAlmType) { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.AlmType == this.ALMType).FirstOrDefault(); } else { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.DefaultAlm).FirstOrDefault(); } if (AlmConfig != null) { GingerCoreNET.ALMLib.ALMUserConfig AlmUserConfig = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == AlmConfig.AlmType); if (AlmUserConfig == null) { AlmUserConfig = new GingerCoreNET.ALMLib.ALMUserConfig(); AlmUserConfig.AlmType = AlmConfig.AlmType; WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(AlmUserConfig); } if (AlmUserConfig.ALMServerURL != null) { AlmConfig.ALMServerURL = AlmUserConfig.ALMServerURL; } if (AlmUserConfig.ALMConfigPackageFolderPath != null) { AlmConfig.ALMConfigPackageFolderPath = AlmUserConfig.ALMConfigPackageFolderPath; } if (!string.IsNullOrEmpty(AlmConfig.ALMConfigPackageFolderPath)) { AlmConfig.ALMConfigPackageFolderPath = WorkSpace.Instance.SolutionRepository.ConvertFullPathToBeRelative(AlmConfig.ALMConfigPackageFolderPath); } AlmConfig.ALMUserName = AlmUserConfig.ALMUserName; AlmConfig.ALMPassword = AlmUserConfig.ALMPassword; } else { AlmConfig = AlmConfigs.FirstOrDefault(); } DefaultAlmConfig = AlmConfig; return(AlmConfig); }
public virtual void SetALMConfigurations(string ALMServerUrl, bool UseRest, string ALMUserName, string ALMPassword, string ALMDomain, string ALMProject, string ALMProjectKey, GingerCoreNET.ALMLib.ALMIntegration.eALMType almType, string ALMConfigPackageFolderPath) { GingerCoreNET.ALMLib.ALMConfig AlmConfig = ALMCore.AlmConfigs.FirstOrDefault(x => x.AlmType == almType); if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfigs.Add(AlmConfig); } GingerCoreNET.ALMLib.ALMUserConfig CurrentAlmUserConfigurations = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almType); if (CurrentAlmUserConfigurations == null) { CurrentAlmUserConfigurations = new GingerCoreNET.ALMLib.ALMUserConfig(); CurrentAlmUserConfigurations.AlmType = almType; WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(CurrentAlmUserConfigurations); } if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfigs.Add(AlmConfig); } AlmConfig.ALMServerURL = ALMServerUrl; AlmConfig.UseRest = UseRest; AlmConfig.ALMUserName = CurrentAlmUserConfigurations.ALMUserName; AlmConfig.ALMPassword = CurrentAlmUserConfigurations.ALMPassword; AlmConfig.ALMDomain = ALMDomain; AlmConfig.ALMProjectName = ALMProject; AlmConfig.ALMProjectKey = ALMProjectKey; AlmConfig.AlmType = almType; if (!String.IsNullOrEmpty(ALMConfigPackageFolderPath)) { AlmConfig.ALMConfigPackageFolderPath = ALMConfigPackageFolderPath; } }
private void xSetFieldsBtn_Click(object sender, RoutedEventArgs e) { GingerCoreNET.ALMLib.ALMConfig AlmConfig = null; if (xALMTypeCbx.ComboBoxSelectedValue.ToString().Equals(RunSetActionPublishToQC.AlmTypeDefault)) { AlmConfig = ALMIntegration.Instance.GetDefaultAlmConfig(); } else { AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.Where(alm => alm.AlmType.ToString().Equals(xALMTypeCbx.ComboBoxSelectedValue.ToString())).FirstOrDefault(); } if (AlmConfig is null) { ALMConnectionPage almConnPage = new ALMConnectionPage(eALMConnectType.Auto, true); almConnPage.ShowAsWindow(); if (ALMIntegration.Instance.TestALMProjectConn(eALMConnectType.Auto)) { return; } } else { try { ALMIntegration.Instance.UpdateALMType(AlmConfig.AlmType, true); ObservableList <ExternalItemFieldBase> almItemFields = ALMIntegration.Instance.GetALMItemFieldsREST(true, ALM_Common.DataContracts.ResourceType.ALL, null); ObservableList <ExternalItemFieldBase> operationItemFields = new ObservableList <ExternalItemFieldBase>(); foreach (ExternalItemFieldBase field in mPublishToALMConfig.AlmFields) { operationItemFields.Add(field); } foreach (ExternalItemFieldBase field in operationItemFields) { mPublishToALMConfig.AlmFields.Remove(field); } if (almItemFields is not null) { almItemFields = ALMIntegration.Instance.AlmCore.RefreshALMItemFields(operationItemFields, almItemFields); } else { Reporter.ToUser(eUserMsgKey.ALMOperationFailed, "Failed get ALM items fields"); return; } ALMIntegration.Instance.OpenALMItemsFieldsPage(eALMConfigType.Operation, AlmConfig.AlmType, almItemFields); operationItemFields = ALMIntegration.Instance.GetUpdatedFields(almItemFields, false); foreach (ExternalItemFieldBase field in operationItemFields) { mPublishToALMConfig.AlmFields.Add(field); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Error occurred while Fetching Fields", ex); } finally { ALMIntegration.Instance.UpdateALMType(ALMCore.GetDefaultAlmConfig().AlmType); } } }