public bool SavePrompt() { //set file size to check for changes string txt = GherkinTextEditor.GetText(); if (fileSize != txt.Length && fileSize != 0) { fileSize = txt.Length; //TODO Reporter.ToUser(eUserMsgKeys.AskIfSureWantToClose); Amdocs.Ginger.Common.MessageBoxResult result = Reporter.ToUser(eUserMsgKeys.GherkinAskToSaveFeatureFile); if (result == Amdocs.Ginger.Common.MessageBoxResult.Yes) { Save(); return(true); } else if (result == Amdocs.Ginger.Common.MessageBoxResult.No) { //Do nothing? this will still create optmized activities and even update BF without saving the feature file... not advised return(true); } else if (result == Amdocs.Ginger.Common.MessageBoxResult.Cancel) { //stop optimize so user can fix unwanted changes. return(false); } } fileSize = txt.Length; return(true); }
private void XDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { MessageInfo messageInfo = (MessageInfo)xDataGrid.SelectedValue; eUserMsgKeys mess = messageInfo.MessageKey; Amdocs.Ginger.Common.MessageBoxResult messageBoxResult = Reporter.ToUser(mess, "%1", "%2", "%3"); MessageBox.Show("You selected: " + messageBoxResult); }
private void DoSearch(object sender, RoutedEventArgs e) { bool isSearched = mWindowExlorerPage.DoSearchControls(); int FoundItemsCount = mWindowExlorerPage.WindowControlsGridView.DataSourceList.Count; if (isSearched) { Amdocs.Ginger.Common.MessageBoxResult resultCloseWindow = Reporter.ToUser(eUserMsgKeys.CloseFilterPage, FoundItemsCount); if (resultCloseWindow == Amdocs.Ginger.Common.MessageBoxResult.Yes) { _GenWin.Close(); } } }
public override Amdocs.Ginger.Common.MessageBoxResult MessageBoxShow(string messageText, string caption, Amdocs.Ginger.Common.MessageBoxButton buttonsType, GingerCoreNET.ReporterLib.MessageBoxImage messageImage, Amdocs.Ginger.Common.MessageBoxResult defualtResault) { Amdocs.Ginger.Common.MessageBoxResult result = defualtResault; // if user just close the window we return the default defined result App.MainWindow.Dispatcher.Invoke(() => { MessageBoxWindow messageBoxWindow = new MessageBoxWindow(messageText, caption, buttonsType, messageImage, defualtResault); messageBoxWindow.ShowDialog(); result = messageBoxWindow.messageBoxResult; }); return(result); }
private void DeleteParams(bool ClearAllParams) { Amdocs.Ginger.Common.MessageBoxResult messageResult = Amdocs.Ginger.Common.MessageBoxResult.No; if (mApplicationModel is ApplicationAPIModel && (((ApplicationAPIModel)mApplicationModel).ContentType == ApplicationAPIUtils.eContentType.XML || ((ApplicationAPIModel)mApplicationModel).ContentType == ApplicationAPIUtils.eContentType.JSon)) { messageResult = Reporter.ToUser(eUserMsgKeys.DeleteNodesFromRequest); } if (messageResult == Amdocs.Ginger.Common.MessageBoxResult.Yes) { if (ClearAllParams) { SyncParamsPendingDeleteWithBodyNodes(new List <AppModelParameter>(ParamsList)); } else { SyncParamsPendingDeleteWithBodyNodes(new List <AppModelParameter>(ModelParametersGrid.Grid.SelectedItems.Cast <AppModelParameter>().ToList())); } } else if (messageResult == Amdocs.Ginger.Common.MessageBoxResult.No) { if (ModelParametersGrid.Grid.Items.Count == 0) { Reporter.ToUser(eUserMsgKeys.NoItemToDelete); return; } if (ClearAllParams && (Reporter.ToUser(eUserMsgKeys.SureWantToDeleteAll)) == Amdocs.Ginger.Common.MessageBoxResult.Yes) { ModelParametersGrid.DataSourceList.SaveUndoData(); ParamsList.ClearAll(); } else { ModelParametersGrid.DataSourceList.SaveUndoData(); List <object> SelectedItemsList = ModelParametersGrid.Grid.SelectedItems.Cast <object>().ToList(); foreach (object o in SelectedItemsList) { ModelParametersGrid.DataSourceList.Remove(o); } } } }
public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <Object> testPlanList) { if (testPlanList != null) { foreach (RQMTestPlan testPlan in testPlanList) { //Refresh Ginger repository and allow GingerRQM to use it ALMIntegration.Instance.AlmCore.GingerActivitiesGroupsRepo = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ActivitiesGroup>(); ALMIntegration.Instance.AlmCore.GingerActivitiesRepo = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>(); try { BusinessFlow existedBF = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>().Where(x => x.ExternalID == RQMID + "=" + testPlan.RQMID).FirstOrDefault(); if (existedBF != null) { Amdocs.Ginger.Common.MessageBoxResult userSelection = Reporter.ToUser(eUserMsgKeys.TestSetExists, testPlan.Name); if (userSelection == Amdocs.Ginger.Common.MessageBoxResult.Yes) { File.Delete(existedBF.FileName); } } Reporter.ToGingerHelper(eGingerHelperMsgKey.ALMTestSetImport, null, testPlan.Name); // convert test set into BF BusinessFlow tsBusFlow = ALMIntegration.Instance.AlmCore.ConvertRQMTestPlanToBF(testPlan); if (App.UserProfile.Solution.MainApplication != null) { //add the applications mapped to the Activities foreach (Activity activ in tsBusFlow.Activities) { if (string.IsNullOrEmpty(activ.TargetApplication) == false) { if (tsBusFlow.TargetApplications.Where(x => x.Name == activ.TargetApplication).FirstOrDefault() == null) { ApplicationPlatform appAgent = App.UserProfile.Solution.ApplicationPlatforms.Where(x => x.AppName == activ.TargetApplication).FirstOrDefault(); if (appAgent != null) { tsBusFlow.TargetApplications.Add(new TargetApplication() { AppName = appAgent.AppName }); } } } } //handle non mapped Activities if (tsBusFlow.TargetApplications.Count == 0) { tsBusFlow.TargetApplications.Add(new TargetApplication() { AppName = App.UserProfile.Solution.MainApplication }); } foreach (Activity activ in tsBusFlow.Activities) { if (string.IsNullOrEmpty(activ.TargetApplication)) { activ.TargetApplication = tsBusFlow.MainApplication; } } } else { foreach (Activity activ in tsBusFlow.Activities) { activ.TargetApplication = null; // no app configured on solution level } } WorkSpace.Instance.SolutionRepository.AddRepositoryItem(tsBusFlow); Reporter.CloseGingerHelper(); } catch (Exception ex) { Reporter.ToUser(eUserMsgKeys.ErrorInTestsetImport, testPlan.Name, ex.Message); } Reporter.ToUser(eUserMsgKeys.TestSetsImportedSuccessfully); } return(true); } 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(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); } TestSet matchingTS = null; Amdocs.Ginger.Common.MessageBoxResult userSelec = Amdocs.Ginger.Common.MessageBoxResult.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(eUserMsgKeys.BusinessFlowAlreadyMappedToTC, businessFlow.Name, matchingTS.TestSetFolder.Path + "\\" + matchingTS.Name); if (userSelec == Amdocs.Ginger.Common.MessageBoxResult.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.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 || ((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.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; //TODO : need to update to retrieve only Test Set Item Fields -->DONE ObservableList <ExternalItemFieldBase> testSetFields = App.UserProfile.Solution.ExternalItemsFields; ALMIntegration.Instance.RefreshALMItemFields(testSetFields, true, null); for (int indx = 0; indx < testSetFields.Count; indx++) { if (testSetFields[indx].Name == "Version") { } if (testSetFields[indx].ItemType != eQCItemType.TestSet.ToString()) { testSetFields.RemoveAt(indx); indx--; } } bool exportRes = ((QCCore)ALMIntegration.Instance.AlmCore).ExportBusinessFlowToALM(businessFlow, matchingTS, testLabUploadPath, testSetFields, 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); }
public override bool ExportActivitiesGroupToALM(ActivitiesGroup activtiesGroup, string uploadPath = null, bool performSaveAfterExport = false) { if (activtiesGroup == null) { return(false); } Test matchingTC = null; //check if the ActivitiesGroup already mapped to QC Test Case if (String.IsNullOrEmpty(activtiesGroup.ExternalID) == false) { matchingTC = ((QCCore)ALMIntegration.Instance.AlmCore).GetQCTest(activtiesGroup.ExternalID); if (matchingTC != null) { //ask user if want to continue Amdocs.Ginger.Common.MessageBoxResult userSelec = Reporter.ToUser(eUserMsgKeys.ActivitiesGroupAlreadyMappedToTC, activtiesGroup.Name, matchingTC["TS_SUBJECT"].Path + "\\" + matchingTC.Name); if (userSelec == Amdocs.Ginger.Common.MessageBoxResult.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.MessageBoxResult.No) { matchingTC = null; } } } if (matchingTC == null && String.IsNullOrEmpty(uploadPath)) { //get the QC Test Plan path to upload the activities group to uploadPath = SelectALMTestPlanPath(); if (String.IsNullOrEmpty(uploadPath)) { //no path to upload to return(false); } } //upload the Activities Group Reporter.ToGingerHelper(eGingerHelperMsgKey.ExportItemToALM, null, activtiesGroup.Name); string res = string.Empty; //TODO: retireve test case fields -->DONE ObservableList <ExternalItemFieldBase> testCaseFields = App.UserProfile.Solution.ExternalItemsFields; ALMIntegration.Instance.RefreshALMItemFields(testCaseFields, true, null); //Going through the fields to leave only Test Case fields for (int indx = 0; indx < testCaseFields.Count; indx++) { if (testCaseFields[indx].Name == "Version") { } if (testCaseFields[indx].ItemType != eQCItemType.TestCase.ToString()) { testCaseFields.RemoveAt(indx); indx--; } } bool exportRes = ((QCCore)ALMIntegration.Instance.AlmCore).ExportActivitiesGroupToALM(activtiesGroup, matchingTC, uploadPath, testCaseFields, ref res); Reporter.CloseGingerHelper(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToGingerHelper(eGingerHelperMsgKey.SaveItem, null, activtiesGroup.Name, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(activtiesGroup); Reporter.CloseGingerHelper(); } return(true); } else { Reporter.ToUser(eUserMsgKeys.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), activtiesGroup.Name, res); } return(false); }
public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <Object> selectedTestSets) { if (selectedTestSets != null && selectedTestSets.Count() > 0) { ObservableList <QCTestSetTreeItem> testSetsItemsToImport = new ObservableList <QCTestSetTreeItem>(); bool bfsWereDeleted = false; foreach (QCTestSetTreeItem testSetItem in selectedTestSets) { //check if some of the Test Set was already imported if (testSetItem.AlreadyImported == true) { Amdocs.Ginger.Common.MessageBoxResult userSelection = Reporter.ToUser(eUserMsgKeys.TestSetExists, testSetItem.TestSetName); if (userSelection == Amdocs.Ginger.Common.MessageBoxResult.Yes) { //Delete the mapped BF File.Delete(testSetItem.MappedBusinessFlow.FileName); bfsWereDeleted = true; testSetsItemsToImport.Add(testSetItem); } } else { testSetsItemsToImport.Add(testSetItem); } } if (testSetsItemsToImport.Count == 0) { return(false); //noting to import } //Refresh Ginger repository and allow GingerQC to use it ALMIntegration.Instance.AlmCore.GingerActivitiesGroupsRepo = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ActivitiesGroup>(); ALMIntegration.Instance.AlmCore.GingerActivitiesRepo = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>(); foreach (QCTestSetTreeItem testSetItemtoImport in testSetsItemsToImport) { try { //import test set data Reporter.ToGingerHelper(eGingerHelperMsgKey.ALMTestSetImport, null, testSetItemtoImport.TestSetName); QCTestSet TS = new QCTestSet(); TS.TestSetID = testSetItemtoImport.TestSetID; TS.TestSetName = testSetItemtoImport.TestSetName; TS.TestSetPath = testSetItemtoImport.Path; TS = ((QCCore)ALMIntegration.Instance.AlmCore).ImportTestSetData(TS); //convert test set into BF BusinessFlow tsBusFlow = ((QCCore)ALMIntegration.Instance.AlmCore).ConvertQCTestSetToBF(TS); //Set BF/Activities target application //if (App.UserProfile.Solution.MainApplication != null) //{ // if (tsBusFlow.TargetApplications.Count == 0) // { // tsBusFlow.TargetApplications.Add(new TargetApplication() { AppName = App.UserProfile.Solution.MainApplication }); // if (tsBusFlow.TargetApplications.Count > 0) // foreach (Activity activ in tsBusFlow.Activities) // activ.TargetApplication = tsBusFlow.TargetApplications[0].AppName; // } //} if (App.UserProfile.Solution.MainApplication != null) { //add the applications mapped to the Activities foreach (Activity activ in tsBusFlow.Activities) { if (string.IsNullOrEmpty(activ.TargetApplication) == false) { if (tsBusFlow.TargetApplications.Where(x => x.Name == activ.TargetApplication).FirstOrDefault() == null) { ApplicationPlatform appAgent = App.UserProfile.Solution.ApplicationPlatforms.Where(x => x.AppName == activ.TargetApplication).FirstOrDefault(); if (appAgent != null) { tsBusFlow.TargetApplications.Add(new TargetApplication() { AppName = appAgent.AppName }); } } } } //handle non mapped Activities if (tsBusFlow.TargetApplications.Count == 0) { tsBusFlow.TargetApplications.Add(new TargetApplication() { AppName = App.UserProfile.Solution.MainApplication }); } foreach (Activity activ in tsBusFlow.Activities) { if (string.IsNullOrEmpty(activ.TargetApplication)) { activ.TargetApplication = tsBusFlow.MainApplication; } } } else { foreach (Activity activ in tsBusFlow.Activities) { activ.TargetApplication = null; // no app configured on solution level } } //save bf WorkSpace.Instance.SolutionRepository.AddRepositoryItem(tsBusFlow); Reporter.CloseGingerHelper(); } catch (Exception ex) { Reporter.ToUser(eUserMsgKeys.ErrorInTestsetImport, testSetItemtoImport.TestSetName, ex.Message); Reporter.ToLog(eLogLevel.ERROR, "Error importing from QC", ex); } } Reporter.ToUser(eUserMsgKeys.TestSetsImportedSuccessfully); Reporter.ToLog(eLogLevel.INFO, "Imported from QC successfully"); return(true); } Reporter.ToLog(eLogLevel.ERROR, "Error importing from QC"); return(false); }
public override bool ExportActivitiesGroupToALM(ActivitiesGroup activtiesGroup, string uploadPath = null, bool performSaveAfterExport = false) { if (activtiesGroup == null) { return(false); } QCTestCase matchingTC = null; //check if the ActivitiesGroup already mapped to QC Test Case if (String.IsNullOrEmpty(activtiesGroup.ExternalID) == false) { matchingTC = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).GetQCTest(activtiesGroup.ExternalID); if (matchingTC != null) { //ask user if want to continute Amdocs.Ginger.Common.MessageBoxResult userSelec = Reporter.ToUser(eUserMsgKeys.ActivitiesGroupAlreadyMappedToTC, activtiesGroup.Name, matchingTC.Name); if (userSelec == Amdocs.Ginger.Common.MessageBoxResult.Cancel) { return(false); } else if (userSelec == Amdocs.Ginger.Common.MessageBoxResult.No) { matchingTC = null; } } } if (matchingTC == null && String.IsNullOrEmpty(uploadPath)) { //get the QC Test Plan path to upload the activities group to uploadPath = SelectALMTestPlanPath(); if (String.IsNullOrEmpty(uploadPath)) { //no path to upload to return(false); } } //upload the Activities Group Reporter.ToGingerHelper(eGingerHelperMsgKey.ExportItemToALM, null, activtiesGroup.Name); string res = string.Empty; ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(App.UserProfile.Solution.ExternalItemsFields); ALMIntegration.Instance.RefreshALMItemFields(allFields, true, null); ObservableList <ExternalItemFieldBase> testCaseFields = CleanUnrelvantFields(allFields, ResourceType.TEST_CASE); ObservableList <ExternalItemFieldBase> designStepsFields = CleanUnrelvantFields(allFields, ResourceType.DESIGN_STEP); ObservableList <ExternalItemFieldBase> designStepsParamsFields = CleanUnrelvantFields(allFields, ResourceType.DESIGN_STEP_PARAMETERS); bool exportRes = ((QCRestAPICore)ALMIntegration.Instance.AlmCore).ExportActivitiesGroupToALM(activtiesGroup, matchingTC, uploadPath, testCaseFields, designStepsFields, designStepsParamsFields, ref res); Reporter.CloseGingerHelper(); if (exportRes) { if (performSaveAfterExport) { Reporter.ToGingerHelper(eGingerHelperMsgKey.SaveItem, null, activtiesGroup.Name, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(activtiesGroup); Reporter.CloseGingerHelper(); } return(true); } else { Reporter.ToUser(eUserMsgKeys.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), activtiesGroup.Name, res); } return(false); }
private void XYesNoButton_Click(object sender, RoutedEventArgs e) { Amdocs.Ginger.Common.MessageBoxResult messageBoxResult = Reporter.ToUser(eUserMsgKeys.AskIfSureWantToClose, "param1", "param2"); MessageBox.Show("You selected: " + messageBoxResult); }
private void XSimpleInfoMessageButton_Click(object sender, RoutedEventArgs e) { Amdocs.Ginger.Common.MessageBoxResult messageBoxResult = Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "Simple Info Message"); MessageBox.Show("You selected: " + messageBoxResult); }