public override bool ConnectALMServer(ALMIntegration.eALMConnectType almConnectType) { try { if (almConnectType == ALMIntegration.eALMConnectType.SettingsPage || almConnectType == ALMIntegration.eALMConnectType.Manual) { HandleSSO(); } Reporter.ToLog(eLogLevel.DEBUG, "Connecting to Octane server"); if (ALMIntegration.Instance.AlmCore.ConnectALMServer()) { return(true); } else { Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, "Bad credentials"); return(false); } } catch (Exception e) { if (almConnectType == ALMIntegration.eALMConnectType.Manual) { Reporter.ToUser(eUserMsgKey.QcConnectFailure, e.Message); //TODO: Fix message } else if (almConnectType == ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, e.Message); } Reporter.ToLog(eLogLevel.WARN, "Error connecting to Octane server", e); return(false); } }
public override bool ConnectALMServer(ALMIntegration.eALMConnectType userMsgStyle) { bool isConnectSucc = false; Reporter.ToLog(eLogLevel.DEBUG, "Connecting to Rally server"); try { isConnectSucc = ALMIntegration.Instance.AlmCore.ConnectALMServer(); } catch (Exception e) { Reporter.ToLog(eLogLevel.ERROR, "Error connecting to Rally server", e); } if (!isConnectSucc) { Reporter.ToLog(eLogLevel.WARN, "Could not connect to Rally server"); if (userMsgStyle == ALMIntegration.eALMConnectType.Manual) { Reporter.ToUser(eUserMsgKey.ALMConnectFailure); } else if (userMsgStyle == ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings); } } return(isConnectSucc); }
public ALMConnectionPage(ALMIntegration.eALMConnectType almConnectStyle, bool isConnWin = false) { CurrentAlmConfigurations = ALMIntegration.Instance.GetDefaultAlmConfig(); CurrentAlmUserConfigurations = ALMIntegration.Instance.GetCurrentAlmUserConfig(CurrentAlmConfigurations.AlmType); ALMIntegration.Instance.UpdateALMType(CurrentAlmConfigurations.AlmType); InitializeComponent(); this.isConnWin = isConnWin; this.almConectStyle = almConnectStyle; Bind(); if (!WorkSpace.Instance.BetaFeatures.Rally) { RallyRadioButton.Visibility = Visibility.Hidden; if (CurrentAlmConfigurations.AlmType == GingerCoreNET.ALMLib.ALMIntegration.eALMType.RALLY) { CurrentAlmConfigurations.AlmType = GingerCoreNET.ALMLib.ALMIntegration.eALMType.QC; } } if (almConnectStyle != ALMIntegration.eALMConnectType.Silence) { if (GetProjectsDetails()) { ConnectProjectButton.Content = "Save Project Mapping"; ConnectProject(); } } StyleRadioButtons(); SetControls(); ChangeALMType(); }
public override bool ConnectALMServer(ALMIntegration.eALMConnectType userMsgStyle) { try { Reporter.ToLog(eAppReporterLogLevel.INFO, "Connecting to QC server"); if(ALMIntegration.Instance.AlmCore.ConnectALMServer()) return true; else { if (userMsgStyle == ALMIntegration.eALMConnectType.Manual) Reporter.ToUser(eUserMsgKeys.QcConnectFailureRestAPI); else if (userMsgStyle == ALMIntegration.eALMConnectType.Auto) Reporter.ToUser(eUserMsgKeys.ALMConnectFailureWithCurrSettings); Reporter.ToLog(eAppReporterLogLevel.ERROR, "Error connecting to QC server"); return false; } } catch (Exception e) { if (userMsgStyle == ALMIntegration.eALMConnectType.Manual) Reporter.ToUser(eUserMsgKeys.QcConnectFailureRestAPI, e.Message); else if (userMsgStyle == ALMIntegration.eALMConnectType.Auto) Reporter.ToUser(eUserMsgKeys.ALMConnectFailureWithCurrSettings, e.Message); Reporter.ToLog(eAppReporterLogLevel.ERROR, "Error connecting to QC server", e); return false; } }
private void RefreshDomainList(ALMIntegration.eALMConnectType userMsgStyle) { List <string> Domains = ALMIntegration.Instance.GetALMDomains(userMsgStyle); string currDomain = App.UserProfile.Solution.ALMDomain; DomainComboBox.Items.Clear(); foreach (string domain in Domains) { DomainComboBox.Items.Add(domain); } if (DomainComboBox.Items.Count > 0) { if (string.IsNullOrEmpty(currDomain) == false) { if (DomainComboBox.Items.Contains(currDomain)) { App.UserProfile.Solution.ALMDomain = currDomain; DomainComboBox.SelectedIndex = DomainComboBox.Items.IndexOf(App.UserProfile.Solution.ALMDomain); } } if (DomainComboBox.SelectedIndex == -1) { DomainComboBox.SelectedIndex = 0; } } }
private void RefreshDomainList(ALMIntegration.eALMConnectType userMsgStyle) { List <string> Domains = ALMIntegration.Instance.GetALMDomains(userMsgStyle); string currDomain = CurrentAlmConfigurations.ALMDomain; DomainComboBox.Items.Clear(); foreach (string domain in Domains) { DomainComboBox.Items.Add(domain); } if (DomainComboBox.Items.Count > 0) { //sort DomainComboBox.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("", System.ComponentModel.ListSortDirection.Descending)); if (string.IsNullOrEmpty(currDomain) == false) { if (DomainComboBox.Items.Contains(currDomain)) { CurrentAlmConfigurations.ALMDomain = currDomain; DomainComboBox.SelectedIndex = DomainComboBox.Items.IndexOf(CurrentAlmConfigurations.ALMDomain); } } if (DomainComboBox.SelectedIndex == -1) { DomainComboBox.SelectedIndex = 0; } } }
private void GetProjectsDetails_Clicked(object sender, RoutedEventArgs e) { almConectStyle = ALMIntegration.eALMConnectType.Manual; GetProjectsDetails(); isProjectMappingCorrect = false; SetControls(); }
public override bool ConnectALMServer(ALMIntegration.eALMConnectType userMsgStyle) { try { Reporter.ToLog(eLogLevel.DEBUG, "Connecting to QTest server"); if (ALMIntegration.Instance.AlmCore.ConnectALMServer()) { return(true); } else { Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, "Bad credentials"); return(false); } } catch (Exception e) { if (userMsgStyle == ALMIntegration.eALMConnectType.Manual) { Reporter.ToUser(eUserMsgKey.QcConnectFailure, e.Message); } else if (userMsgStyle == ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, e.Message); } Reporter.ToLog(eLogLevel.WARN, "Error connecting to QTest server", e); return(false); } }
public ALMConnectionPage(ALMIntegration.eALMConnectType almConnectStyle, bool isConnWin = false) { InitializeComponent(); this.isConnWin = isConnWin; this.almConectStyle = almConnectStyle; App.ObjFieldBinding(ServerURLTextBox, TextBox.TextProperty, ALMIntegration.Instance.AlmConfigurations, nameof(ALMIntegration.Instance.AlmConfigurations.ALMServerURL)); App.ObjFieldBinding(RestAPICheckBox, CheckBox.IsCheckedProperty, ALMIntegration.Instance.AlmConfigurations, nameof(ALMIntegration.Instance.AlmConfigurations.UseRest)); App.ObjFieldBinding(UserNameTextBox, TextBox.TextProperty, ALMIntegration.Instance.AlmConfigurations, nameof(ALMIntegration.Instance.AlmConfigurations.ALMUserName)); App.ObjFieldBinding(DomainComboBox, ComboBox.SelectedValueProperty, ALMIntegration.Instance.AlmConfigurations, nameof(ALMIntegration.Instance.AlmConfigurations.ALMDomain)); App.ObjFieldBinding(ProjectComboBox, ComboBox.SelectedValueProperty, ALMIntegration.Instance.AlmConfigurations, nameof(ALMIntegration.Instance.AlmConfigurations.ALMProjectName)); PasswordTextBox.Password = ALMIntegration.Instance.ALMPassword(); //can't do regular binding with PasswordTextBox control for security reasons if (!WorkSpace.Instance.BetaFeatures.Rally) { RallyRadioButton.Visibility = Visibility.Hidden; if (App.UserProfile.Solution.AlmType == ALMIntegration.eALMType.RALLY) { App.UserProfile.Solution.AlmType = ALMIntegration.eALMType.QC; } } if (!WorkSpace.Instance.BetaFeatures.RestAPI) { RestAPICheckBox.Visibility = Visibility.Hidden; App.UserProfile.Solution.UseRest = false; RestAPICheckBox.IsChecked = false; RestAPICheckBox.IsEnabled = false; } if (almConnectStyle != ALMIntegration.eALMConnectType.Silence) { if (GetProjectsDetails()) { ConnectProject(); } } else { RefreshALMSolutionSettings(); } SetControls(); StyleRadioButtons(); }
public override bool ConnectALMServer(ALMIntegration.eALMConnectType userMsgStyle) { try { Reporter.ToLog(eLogLevel.INFO, "Connecting to QC server"); return(ALMIntegration.Instance.AlmCore.ConnectALMServer()); } catch (Exception e) { if (userMsgStyle == ALMIntegration.eALMConnectType.Manual) { Reporter.ToUser(eUserMsgKeys.QcConnectFailure, e.Message); } else if (userMsgStyle == ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKeys.ALMConnectFailureWithCurrSettings, e.Message); } Reporter.ToLog(eLogLevel.ERROR, "Error connecting to QC server", e); return(false); } }
private void GetProjectsDetails_Clicked(object sender, RoutedEventArgs e) { almConectStyle = ALMIntegration.eALMConnectType.Manual; GetProjectsDetails(); }
public abstract bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null);
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } bool exportRes; string res = string.Empty; Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); exportRes = ((RallyCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToRally(businessFlow, WorkSpace.UserProfile.Solution.ExternalItemsFields, ref res); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto && almConectStyle != ALMIntegration.eALMConnectType.Silence) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } } else { if (almConectStyle != ALMIntegration.eALMConnectType.Silence) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } } Reporter.HideStatusMessage(); return(exportRes); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Silence, string parentObjectId = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } QtestTestSuite matchingTS = null; Amdocs.Ginger.Common.eUserMsgSelection userSelec = Amdocs.Ginger.Common.eUserMsgSelection.None; //check if the businessFlow already mapped to QC Test Set if (!String.IsNullOrEmpty(businessFlow.ExternalID)) { matchingTS = ((QtestCore)ALMIntegration.Instance.AlmCore).GetQtestTestSuite(businessFlow.ExternalID); if (matchingTS != null) { //ask user if want to continue userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.Name); if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTS = null; } } } //check if all of the business flow activities groups already exported to QC and export the ones which not foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { //check if the ActivitiesGroup already mapped to Qtest Test Case matchingTC = null; if (!String.IsNullOrEmpty(ag.ExternalID)) { matchingTC = ((QtestCore)ALMIntegration.Instance.AlmCore).GetQtestTest((long)Convert.ToInt32(ag.ExternalID)); if (matchingTC != null) { //ask user if want to continue Amdocs.Ginger.Common.eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC.TestName); if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTC = null; } else { parentObjectId = matchingTC.TestID; } } } //if user selected No and want to create new testplans to selected folder path if (matchingTC == null && String.IsNullOrEmpty(parentObjectId)) { //get the QC Test Plan path to upload the activities group to parentObjectId = SelectALMTestPlanPath(); if (String.IsNullOrEmpty(parentObjectId)) { //no path to upload to return(false); } } ExportActivitiesGroupToALM(ag, parentObjectId); } if (matchingTS == null && string.IsNullOrEmpty(parentObjectId)) { if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder); } } //upload the business flow Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); string res = string.Empty; //TODO : need to update to retrieve only Test Set Item Fields -->DONE ObservableList <ExternalItemFieldBase> testSetFields = WorkSpace.Instance.Solution.ExternalItemsFields; // ALMIntegration.Instance.RefreshALMItemFields(testSetFields, true, null); // Arvind to merge it from here var filterTestSetFields = testSetFields.Where(tc => tc.ItemType == eQCItemType.TestSet.ToString()).ToList(); bool exportRes = ((QtestCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, parentObjectId, new ObservableList <ExternalItemFieldBase> (filterTestSetFields), ref res); Reporter.HideStatusMessage(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else { if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } } return(false); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (App.UserProfile.Solution.ExternalItemsFields.Where(x => x.ItemType == "TestCase").ToList().Count == 0) { Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "Current solution have no pre-difined values for RQM's mandatory fieds. Please configure before doing export. ('ALM'-'ALM Items Fields Configuration')"); return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } bool exportRes = false; string res = string.Empty; Reporter.ToGingerHelper(eGingerHelperMsgKey.ExportItemToALM, null, businessFlow.Name); exportRes = ((RQMCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToRQM(businessFlow, App.UserProfile.Solution.ExternalItemsFields, ref res); if (exportRes) { if (performSaveAfterExport) { Reporter.ToGingerHelper(eGingerHelperMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto && almConectStyle != ALMIntegration.eALMConnectType.Silence) { Reporter.ToUser(eUserMsgKeys.ExportItemToALMSucceed); } } else { Reporter.ToUser(eUserMsgKeys.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } Reporter.CloseGingerHelper(); return(exportRes); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { throw new NotImplementedException(); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { bool result = false; string responseStr = string.Empty; if (businessFlow != null) { if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return false; } else { ObservableList<ExternalItemFieldBase> allFields = new ObservableList<ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); var testCaseFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_CASE.ToString()) && (a.ToUpdate || a.Mandatory)); var testSetFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_SET.ToString()) && (a.ToUpdate || a.Mandatory)); var testExecutionFields = allFields.Where(a => a.ItemType == "TEST_EXECUTION" && (a.ToUpdate || a.Mandatory)); Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); bool exportRes = false; switch (ALMCore.DefaultAlmConfig.JiraTestingALM) { case GingerCoreNET.ALMLib.ALMIntegration.eTestingALMType.Xray: exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr); break; case GingerCoreNET.ALMLib.ALMIntegration.eTestingALMType.Zephyr: JiraZephyrTreeItem zephyrExportPath = SelectZephyrExportPath(); if (zephyrExportPath == null) { return true; } if (zephyrExportPath is JiraZephyrVersionTreeItem) { exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr, ((JiraZephyrVersionTreeItem)zephyrExportPath).VersionId.ToString(), string.Empty); } else if (zephyrExportPath is JiraZephyrCycleTreeItem) { exportRes = ((JiraCore)this.AlmCore).ExportBfToZephyr(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr, ((JiraZephyrCycleTreeItem)zephyrExportPath).VersionId.ToString(), ((JiraZephyrCycleTreeItem)zephyrExportPath).Id.ToString()); } break; default: exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr); break; } if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); return true; } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, responseStr); } Reporter.HideStatusMessage(); } return result; }
public override bool ConnectALMServer(ALMIntegration.eALMConnectType userMsgStyle) { throw new NotImplementedException(); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Silence, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } TestSet matchingTS = null; Amdocs.Ginger.Common.eUserMsgSelection userSelec = Amdocs.Ginger.Common.eUserMsgSelection.None; //check if the businessFlow already mapped to QC Test Set if (String.IsNullOrEmpty(businessFlow.ExternalID) == false) { matchingTS = ((QCCore)ALMIntegration.Instance.AlmCore).GetQCTestSet(businessFlow.ExternalID); if (matchingTS != null) { //ask user if want to continue userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.TestSetFolder.Path + "\\" + matchingTS.Name); if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTS = null; } } } //check if all of the business flow activities groups already exported to QC and export the ones which not foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { if (string.IsNullOrEmpty(ag.ExternalID) == true || ((QCCore)ALMIntegration.Instance.AlmCore).GetQCTest(ag.ExternalID) == null) { if (testPlanUploadPath == null) { testPlanUploadPath = SelectALMTestPlanPath(); } if (string.IsNullOrEmpty(testPlanUploadPath) == false) { ExportActivitiesGroupToALM(ag, testPlanUploadPath); } } } if (matchingTS == null && string.IsNullOrEmpty(testLabUploadPath)) { if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder); } //get the QC Test Plan path to upload the activities group to testLabUploadPath = SelectALMTestLabPath(); if (String.IsNullOrEmpty(testLabUploadPath)) { //no path to upload to return(false); } } //upload the business flow Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); string res = string.Empty; //TODO : need to update to retrieve only Test Set Item Fields -->DONE ObservableList <ExternalItemFieldBase> testSetFields = WorkSpace.UserProfile.Solution.ExternalItemsFields; ALMIntegration.Instance.RefreshALMItemFields(testSetFields, true, null); for (int indx = testSetFields.Count - 1; indx >= 0; indx--) { if (testSetFields[indx].ItemType != eQCItemType.TestSet.ToString()) { testSetFields.RemoveAt(indx); } } bool exportRes = ((QCCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, testLabUploadPath, testSetFields, ref res); Reporter.HideStatusMessage(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } //} return(false); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Silence, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } TestSet matchingTS = null; Amdocs.Ginger.Common.eUserMsgSelection userSelec = Amdocs.Ginger.Common.eUserMsgSelection.None; //check if the businessFlow already mapped to QC Test Set if (String.IsNullOrEmpty(businessFlow.ExternalID) == false) { matchingTS = ((QCCore)ALMIntegration.Instance.AlmCore).GetQCTestSet(businessFlow.ExternalID); if (matchingTS != null) { //ask user if want to continue userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.TestSetFolder.Path + "\\" + matchingTS.Name); if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTS = null; } } } //check if all of the business flow activities groups already exported to QC and export the ones which not foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { //check if the ActivitiesGroup already mapped to QC Test Case matchingTC = null; if (String.IsNullOrEmpty(ag.ExternalID) == false) { matchingTC = ((QCCore)ALMIntegration.Instance.AlmCore).GetQCTest(ag.ExternalID); if (matchingTC != null) { //ask user if want to continue Amdocs.Ginger.Common.eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC["TS_SUBJECT"].Path + "\\" + matchingTC.Name); if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTC = null; } else { testPlanUploadPath = matchingTC["TS_SUBJECT"].Path; } } } //if user selected No and want to create new testplans to selected folder path if (matchingTC == null && String.IsNullOrEmpty(testPlanUploadPath)) { //get the QC Test Plan path to upload the activities group to testPlanUploadPath = SelectALMTestPlanPath(); if (String.IsNullOrEmpty(testPlanUploadPath)) { //no path to upload to return(false); } //create upload path if checked to create separete folder if (QCTestPlanFolderTreeItem.IsCreateBusinessFlowFolder) { //create folder with BF name try { if (QCConnect.CreateFolder(testPlanUploadPath, businessFlow.Name)) { testPlanUploadPath += "\\" + businessFlow.Name; } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to get create folder for Test Plan", ex); } } } ExportActivitiesGroupToALM(ag, testPlanUploadPath); } if (matchingTS == null && string.IsNullOrEmpty(testLabUploadPath)) { if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder); } //get the QC Test Plan path to upload the activities group to testLabUploadPath = SelectALMTestLabPath(); if (String.IsNullOrEmpty(testLabUploadPath)) { //no path to upload to return(false); } } //upload the business flow Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); string res = string.Empty; //TODO : need to update to retrieve only Test Set Item Fields -->DONE ObservableList <ExternalItemFieldBase> testSetFields = WorkSpace.Instance.Solution.ExternalItemsFields; ALMIntegration.Instance.RefreshALMItemFields(testSetFields, true, null); var filterTestSetFields = testSetFields.Where(tc => tc.ItemType == eQCItemType.TestSet.ToString()).ToList(); bool exportRes = ((QCCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, testLabUploadPath, new ObservableList <ExternalItemFieldBase> (filterTestSetFields), ref res); Reporter.HideStatusMessage(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } //} return(false); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { bool result = false; string responseStr = string.Empty; if (businessFlow != null) { if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } else { ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); var testCaseFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_CASE.ToString()) && (a.ToUpdate || a.Mandatory)); var testSetFields = allFields.Where(a => a.ItemType == (ResourceType.TEST_SET.ToString()) && (a.ToUpdate || a.Mandatory)); var testExecutionFields = allFields.Where(a => a.ItemType == "TEST_EXECUTION" && (a.ToUpdate || a.Mandatory)); var exportRes = ((JiraCore)this.AlmCore).ExportBfToAlm(businessFlow, testCaseFields, testSetFields, testExecutionFields, ref responseStr); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, responseStr); } } } return(result); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } QCRestClient.QCTestSet matchingTS = null; Amdocs.Ginger.Common.eUserMsgSelection userSelec = Amdocs.Ginger.Common.eUserMsgSelection.None; //check if the businessFlow already mapped to QC Test Set if (String.IsNullOrEmpty(businessFlow.ExternalID) == false) { matchingTS = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).GetQCTestSet(businessFlow.ExternalID); if (matchingTS != null) { //ask user if want to continute userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.Name); if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTS = null; } } } //check if all of the business flow activities groups already exported to QC and export the ones which not foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { // matchingTC = null; //check if the ActivitiesGroup already mapped to QC Test Case if (String.IsNullOrEmpty(ag.ExternalID) == false) { matchingTC = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).GetQCTest(ag.ExternalID); if (matchingTC != null) { //ask user if want to continute Amdocs.Ginger.Common.eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC.Name); if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTC = null; } else { if (String.IsNullOrEmpty(testPlanUploadPath)) { //testPlanUploadPath = ""; string parentId = matchingTC.ElementsField["parent-id"].ToString(); //need to test as the function changed in the library QCTestFolder testPlanFolder = QCRestAPIConnect.QcRestClient.GetTestPlanFolderDetails(parentId); string revrsePath = testPlanFolder.Name + "/"; string testPlanRootFolderId = QCRestAPIConnect.QcRestClient.GetTestPlanRootFolder().Id; while (testPlanFolder.Id != testPlanRootFolderId) { testPlanFolder = QCRestAPIConnect.QcRestClient.GetTestPlanFolderDetails(testPlanFolder.ParentId); revrsePath = revrsePath + testPlanFolder.Name + "/"; } revrsePath = revrsePath.Substring(0, revrsePath.Length - 1); string[] str = revrsePath.Split('/'); Array.Reverse(str); testPlanUploadPath = string.Join("\\", str); } } } } //if user selected No and want to create new testplans to selected folder path if (matchingTC == null && String.IsNullOrEmpty(testPlanUploadPath)) { //get the QC Test Plan path to upload the activities group to testPlanUploadPath = SelectALMTestPlanPath(); if (String.IsNullOrEmpty(testPlanUploadPath)) { //no path to upload to return(false); } //create upload path if checked to create separete folder if (QCTestPlanFolderTreeItem.IsCreateBusinessFlowFolder) { try { string newFolderId = QCRestAPIConnect.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString(); QCItem newFolder = new QCItem(); newFolder.Fields.Add("name", businessFlow.Name); newFolder.Fields.Add("parent-id", QCRestAPIConnect.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString()); ALMResponseData responseData = QCRestAPIConnect.CreateNewEntity(ResourceType.TEST_FOLDERS, newFolder); newFolderId = responseData.IdCreated; testPlanUploadPath = testPlanUploadPath + "\\" + businessFlow.Name; } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to get create folder for Test Plan with REST API", ex); } } } ExportActivitiesGroupToALM(ag, testPlanUploadPath, false, businessFlow); } if (matchingTS == null && string.IsNullOrEmpty(testLabUploadPath)) { if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder); } //get the QC Test Plan path to upload the activities group to testLabUploadPath = SelectALMTestLabPath(); if (String.IsNullOrEmpty(testLabUploadPath)) { //no path to upload to return(false); } } //upload the business flow Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); string res = string.Empty; ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); ObservableList <ExternalItemFieldBase> testSetFieldsFields = CleanUnrelvantFields(allFields, ResourceType.TEST_SET); ObservableList <ExternalItemFieldBase> testInstanceFields = CleanUnrelvantFields(allFields, ResourceType.TEST_CYCLE); bool exportRes = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, testLabUploadPath, testSetFieldsFields, testInstanceFields, ref res); Reporter.HideStatusMessage(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } return(false); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } List <BaseResponseItem> matchingTS = null; Amdocs.Ginger.Common.eUserMsgSelection userSelec = Amdocs.Ginger.Common.eUserMsgSelection.None; //check if the businessFlow already mapped to Zephyr ent. Test Set if (!String.IsNullOrEmpty(businessFlow.ExternalID)) { matchingTS = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetZephyrEntPhaseById(Convert.ToInt32(businessFlow.ExternalID2)); if (matchingTS != null && matchingTS.Count > 0) { //ask user if want to continute userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS[0].TryGetItem("name").ToString()); if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTS = null; } } } //check if all of the business flow activities groups already exported to zephyr and export the ones which not foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { matchingTC = null; //check if the ActivitiesGroup already mapped to zephyr Test Case if (!String.IsNullOrEmpty(ag.ExternalID)) { matchingTC = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetZephyrEntTest(ag.ExternalID2); if (matchingTC != null && matchingTC.Count > 0) { //ask user if want to continue Amdocs.Ginger.Common.eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC[0].TryGetItem("name").ToString()); if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelect == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTC = null; } else { if (String.IsNullOrEmpty(testPlanUploadPath)) { testPlanUploadPath = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).GetRepositoryTreeIdByTestcaseId(Convert.ToInt32(ag.ExternalID)).ToString(); } } } } //if user selected No and want to create new testplans to selected folder path if (matchingTC == null && String.IsNullOrEmpty(testPlanUploadPath)) { //get the zephyr Test repository path to upload the activities group to testPlanUploadPath = SelectALMTestPlanPath(); if (String.IsNullOrEmpty(testPlanUploadPath)) { //no path to upload to return(false); } //create upload path if checked to create separete folder if (TestRepositoryFolderTreeItem.IsCreateBusinessFlowFolder) { try { TreeNode treeNode = ((ZephyrEntCore)ALMIntegration.Instance.AlmCore).CreateTreeNode(); testPlanUploadPath = treeNode.id.ToString(); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to get create folder for Test Repository with Zephyr Ent.", ex); } } } ExportActivitiesGroupToALM(ag, testPlanUploadPath, false, businessFlow); } if (matchingTS == null && string.IsNullOrEmpty(testLabUploadPath)) { if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder); } //get the zephyr Test Planning path to upload the activities group to string uploadData = SelectALMTestLabPath(); if (String.IsNullOrEmpty(uploadData)) { //no path to upload to return(false); } string[] getTypeAndId = uploadData.Split('#'); testLabUploadPath = getTypeAndId[1]; bfEntityType = getTypeAndId[0]; moduleParentId = getTypeAndId[2] == null ? string.Empty : getTypeAndId[2]; folderCycleId = getTypeAndId[3]; } //upload the business flow Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); string res = string.Empty; ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); Dictionary <string, string> testSetFieldsFields = CleanUnrelvantFields(allFields, EntityName.cycle); Dictionary <string, string> testInstanceFields = CleanUnrelvantFields(allFields, EntityName.testcase); bool exportRes = ExportBusinessFlowToTestPlanning(businessFlow, matchingTS, testLabUploadPath, testSetFieldsFields, testInstanceFields, ref res); Reporter.HideStatusMessage(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else { if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } } return(exportRes); }
public abstract bool ConnectALMServer(ALMIntegration.eALMConnectType userMsgStyle);
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) { return(false); } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return(false); } QCTestSet matchingTS = null; Amdocs.Ginger.Common.eUserMsgSelection userSelec; //TO DO MaheshK : check if the businessFlow already mapped to Octane Test Suite if (!String.IsNullOrEmpty(businessFlow.ExternalID)) { matchingTS = ((OctaneCore)ALMIntegration.Instance.AlmCore).GetTestSuiteById(businessFlow.ExternalID); if (matchingTS != null) { //ask user if want to continute userSelec = Reporter.ToUser(eUserMsgKey.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.Name); if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.No) { matchingTS = null; testPlanUploadPath = SelectALMTestPlanPath(); if (String.IsNullOrEmpty(testPlanUploadPath)) { //no path to upload to return(false); } //create upload path if checked to create separete folder if (QCTestPlanFolderTreeItem.IsCreateBusinessFlowFolder) { try { string folderId = octaneCore.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString(); folderId = octaneCore.CreateApplicationModule(businessFlow.Name, businessFlow.Description, folderId); testPlanUploadPath = folderId; } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to get create folder for Test Plan with Octane REST API", ex); } } else { testPlanUploadPath = octaneCore.GetLastTestPlanIdFromPath(testPlanUploadPath).ToString(); } } else { if (String.IsNullOrEmpty(testPlanUploadPath)) { testPlanUploadPath = matchingTS.ParentId; } } } } testLabUploadPath = testPlanUploadPath; bool performSave = false; //just to check if new TC needs to be created or update has to be done if (matchingTS == null) { matchingTC = null; } else { matchingTC = new QCTestCase(); } //check if all of the business flow activities groups already exported to Octane and export the ones which not foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { ExportActivitiesGroupToALM(ag, testPlanUploadPath, performSave, businessFlow); } //upload the business flow Reporter.ToStatus(eStatusMsgKey.ExportItemToALM, null, businessFlow.Name); string res = string.Empty; ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.Instance.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); ObservableList <ExternalItemFieldBase> testSetFieldsFields = CleanUnrelvantFields(allFields, "Test Suite"); bool exportRes = ((OctaneCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlow(businessFlow, matchingTS, testLabUploadPath, testSetFieldsFields, null, ref res); Reporter.HideStatusMessage(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed); } return(true); } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) { Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } return(false); }
public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, ALMIntegration.eALMConnectType almConectStyle = ALMIntegration.eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null) { if (businessFlow == null) return false; if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "The " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " do not include " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " which supposed to be mapped to ALM Test Cases, please add at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup) + " before doing export."); return false; } QCRestClient.QCTestSet matchingTS = null; MessageBoxResult userSelec = MessageBoxResult.None; //check if the businessFlow already mapped to QC Test Set if (String.IsNullOrEmpty(businessFlow.ExternalID) == false) { matchingTS = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).GetQCTestSet(businessFlow.ExternalID); if (matchingTS != null) { //ask user if want to continute userSelec = Reporter.ToUser(eUserMsgKeys.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.Name); if (userSelec == MessageBoxResult.Cancel) return false; else if (userSelec == MessageBoxResult.No) matchingTS = null; } } //check if all of the business flow activities groups already exported to QC and export the ones which not foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { if (string.IsNullOrEmpty(ag.ExternalID) == true || ((QCRestAPICore)ALMIntegration.Instance.AlmCore).GetQCTest(ag.ExternalID) == null) { if (testPlanUploadPath == null) testPlanUploadPath = SelectALMTestPlanPath(); if (string.IsNullOrEmpty(testPlanUploadPath) == false) ExportActivitiesGroupToALM(ag, testPlanUploadPath); else return false; } else ExportActivitiesGroupToALM(ag, testPlanUploadPath); } if (matchingTS == null && string.IsNullOrEmpty(testLabUploadPath)) { if (userSelec == MessageBoxResult.No) Reporter.ToUser(eUserMsgKeys.ExportQCNewTestSetSelectDiffFolder); //get the QC Test Plan path to upload the activities group to testLabUploadPath = SelectALMTestLabPath(); if (String.IsNullOrEmpty(testLabUploadPath)) { //no path to upload to return false; } } //upload the business flow Reporter.ToGingerHelper(eGingerHelperMsgKey.ExportItemToALM, null, businessFlow.Name); string res = string.Empty; ObservableList<ExternalItemFieldBase> allFields = new ObservableList<ExternalItemFieldBase>(App.UserProfile.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); ObservableList<ExternalItemFieldBase> testSetFieldsFields = CleanUnrelvantFields(allFields, ResourceType.TEST_SET); ObservableList<ExternalItemFieldBase> testInstanceFields = CleanUnrelvantFields(allFields, ResourceType.TEST_CYCLE); bool exportRes = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, testLabUploadPath, testSetFieldsFields, testInstanceFields, ref res); Reporter.CloseGingerHelper(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToGingerHelper(eGingerHelperMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.CloseGingerHelper(); } if (almConectStyle != ALMIntegration.eALMConnectType.Auto) Reporter.ToUser(eUserMsgKeys.ExportItemToALMSucceed); return true; } else if (almConectStyle != ALMIntegration.eALMConnectType.Auto) Reporter.ToUser(eUserMsgKeys.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); return false; }