Ejemplo n.º 1
0
        public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <object> selectedTests)
        {
            if (selectedTests != null && selectedTests.Count() > 0)
            {
                ObservableList <JiraTestSet> testSetsItemsToImport = new ObservableList <JiraTestSet>();
                foreach (GingerCore.ALM.JIRA.JiraTestSet selectedTS in selectedTests)
                {
                    try
                    {
                        BusinessFlow existedBF = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>().Where(x => x.ExternalID == selectedTS.Key).FirstOrDefault();
                        if (existedBF != null)
                        {
                            Amdocs.Ginger.Common.eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, selectedTS.Name);
                            if (userSelection == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                            {
                                File.Delete(existedBF.FileName);
                            }
                        }
                        Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, selectedTS.Name);
                        JiraTestSet jiraImportedTSData = ((JiraCore)this.AlmCore).GetJiraTestSetData(selectedTS);

                        SetImportedTS(jiraImportedTSData);
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToUser(eUserMsgKey.ErrorInTestsetImport, selectedTS.Name, ex.Message);
                    }
                }
                Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        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(eUserMsgKey.AskIfSureWantToClose);
                Amdocs.Ginger.Common.eUserMsgSelection result = Reporter.ToUser(eUserMsgKey.GherkinAskToSaveFeatureFile);
                if (result == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                {
                    Save();
                    return(true);
                }
                else if (result == Amdocs.Ginger.Common.eUserMsgSelection.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.eUserMsgSelection.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;
            eUserMsgKey mess        = messageInfo.MessageKey;

            Amdocs.Ginger.Common.eUserMsgSelection messageBoxResult = Reporter.ToUser(mess, "%1", "%2", "%3");
            MessageBox.Show("You selected: " + messageBoxResult);
        }
Ejemplo n.º 4
0
        private void DoSearch(object sender, RoutedEventArgs e)
        {
            bool isSearched      = mWindowExlorerPage.DoSearchControls();
            int  FoundItemsCount = mWindowExlorerPage.WindowControlsGridView.DataSourceList.Count;

            if (isSearched)
            {
                Amdocs.Ginger.Common.eUserMsgSelection resultCloseWindow = Reporter.ToUser(eUserMsgKey.CloseFilterPage, FoundItemsCount);
                if (resultCloseWindow == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                {
                    _GenWin.Close();
                }
            }
        }
        private void DeleteParams(bool ClearAllParams)
        {
            Amdocs.Ginger.Common.eUserMsgSelection messageResult = Amdocs.Ginger.Common.eUserMsgSelection.No;
            if (mApplicationModel is ApplicationAPIModel && (((ApplicationAPIModel)mApplicationModel).ContentType == ApplicationAPIUtils.eContentType.XML || ((ApplicationAPIModel)mApplicationModel).ContentType == ApplicationAPIUtils.eContentType.JSon))
            {
                messageResult = Reporter.ToUser(eUserMsgKey.DeleteNodesFromRequest);
            }

            if (messageResult == Amdocs.Ginger.Common.eUserMsgSelection.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.eUserMsgSelection.No)
            {
                if (ModelParametersGrid.Grid.Items.Count == 0)
                {
                    Reporter.ToUser(eUserMsgKey.NoItemToDelete);
                    return;
                }

                if (ClearAllParams && (Reporter.ToUser(eUserMsgKey.SureWantToDeleteAll)) == Amdocs.Ginger.Common.eUserMsgSelection.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);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <Object> selectedTestSuites)
        {
            if (selectedTestSuites != null && selectedTestSuites.Count() > 0)
            {
                ObservableList <QtestSuiteTreeItem> testSuitesItemsToImport = new ObservableList <QtestSuiteTreeItem>();
                foreach (QtestSuiteTreeItem testSuiteItem in selectedTestSuites)
                {
                    //check if some of the Test Set was already imported
                    if (testSuiteItem.AlreadyImported)
                    {
                        Amdocs.Ginger.Common.eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, testSuiteItem.Name);
                        if (userSelection == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                        {
                            //Delete the mapped BF
                            File.Delete(testSuiteItem.MappedBusinessFlow.FileName);
                            testSuitesItemsToImport.Add(testSuiteItem);
                        }
                    }
                    else
                    {
                        testSuitesItemsToImport.Add(testSuiteItem);
                    }
                }

                if (testSuitesItemsToImport.Count == 0)
                {
                    return(false); //noting to import
                }

                //Refresh Ginger repository and allow GingerQC to use it
                ALMIntegration.Instance.AlmCore.InitCoreObjs();

                foreach (QtestSuiteTreeItem testSetItemtoImport in testSuitesItemsToImport)
                {
                    try
                    {
                        Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, testSetItemtoImport.Name);
                        QtestTestSuite TS = new QtestTestSuite();
                        TS.ID   = testSetItemtoImport.ID;
                        TS.Name = testSetItemtoImport.Name;
                        TS      = ((QtestCore)ALMIntegration.Instance.AlmCore).ImportTestSetData(TS);

                        //convert test set into BF
                        BusinessFlow tsBusFlow = ((QtestCore)ALMIntegration.Instance.AlmCore).ConvertQCTestSetToBF(TS);

                        if (WorkSpace.Instance.Solution.MainApplication != null)
                        {
                            //add the applications mapped to the Activities
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                if (!string.IsNullOrEmpty(activ.TargetApplication))
                                {
                                    if (tsBusFlow.TargetApplications.Where(x => x.Name == activ.TargetApplication).FirstOrDefault() == null)
                                    {
                                        ApplicationPlatform appAgent = WorkSpace.Instance.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 = WorkSpace.Instance.Solution.MainApplication
                                });
                            }
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                if (string.IsNullOrEmpty(activ.TargetApplication))
                                {
                                    activ.TargetApplication = tsBusFlow.MainApplication;
                                }
                                activ.Active = true;
                            }
                        }
                        else
                        {
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                activ.TargetApplication = null; // no app configured on solution level
                            }
                        }

                        //save bf
                        AddTestSetFlowToFolder(tsBusFlow, importDestinationPath);
                        Reporter.HideStatusMessage();
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToUser(eUserMsgKey.ErrorInTestsetImport, testSetItemtoImport.Name, ex.Message);
                        Reporter.ToLog(eLogLevel.ERROR, "Error importing from QC", ex);
                    }
                }

                Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);

                Reporter.ToLog(eLogLevel.DEBUG, "Imported from QC successfully");
                return(true);
            }
            Reporter.ToLog(eLogLevel.ERROR, "Error importing from QC");
            return(false);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <Object> testPlanList)
        {
            if (testPlanList != null)
            {
                foreach (RallyTestPlan testPlan in testPlanList)
                {
                    //Refresh Ginger repository and allow GingerRally 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 == RallyID + "=" + testPlan.RallyID).FirstOrDefault();
                        if (existedBF != null)
                        {
                            Amdocs.Ginger.Common.eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, testPlan.Name);
                            if (userSelection == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                            {
                                File.Delete(existedBF.FileName);
                            }
                        }

                        Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, testPlan.Name);

                        // convert test set into BF
                        BusinessFlow tsBusFlow = ALMIntegration.Instance.AlmCore.ConvertRallyTestPlanToBF(testPlan);

                        if (WorkSpace.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 = WorkSpace.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 = WorkSpace.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.HideStatusMessage();
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToUser(eUserMsgKey.ErrorInTestsetImport, testPlan.Name, ex.Message);
                    }

                    Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);
                }
                return(true);
            }

            return(false);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Manual, string testPlanUploadPath = null, string testLabUploadPath = null)
        {
            tcsRepositoryList = new List <TestCaseResource>();
            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.DEBUG, "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 != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMSucceed);
                }
                return(true);
            }
            else
            {
                if (almConectStyle != eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res);
                }
            }

            return(exportRes);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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.eUserMsgSelection userSelec = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, activtiesGroup.Name, matchingTC["TS_SUBJECT"].Path + "\\" + matchingTC.Name);
                    if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel)
                    {
                        return(false);
                    }
                    else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.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.ToStatus(eStatusMsgKey.ExportItemToALM, null, activtiesGroup.Name);
            string res = string.Empty;
            //TODO: retireve test case fields -->DONE
            ObservableList <ExternalItemFieldBase> testCaseFields = WorkSpace.UserProfile.Solution.ExternalItemsFields;

            ALMIntegration.Instance.RefreshALMItemFields(testCaseFields, true, null);

            //Going through the fields to leave only Test Case fields
            for (int indx = testCaseFields.Count - 1; indx >= 0; indx--)
            {
                if (testCaseFields[indx].ItemType != eQCItemType.TestCase.ToString())
                {
                    testCaseFields.RemoveAt(indx);
                }
            }

            bool exportRes = ((QCCore)ALMIntegration.Instance.AlmCore).ExportActivitiesGroupToALM(activtiesGroup, matchingTC, uploadPath, testCaseFields, ref res);

            Reporter.HideStatusMessage();
            if (exportRes)
            {
                if (performSaveAfterExport)
                {
                    Reporter.ToStatus(eStatusMsgKey.SaveItem, null, activtiesGroup.Name, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup));
                    WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(activtiesGroup);
                    Reporter.HideStatusMessage();
                }
                return(true);
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), activtiesGroup.Name, res);
            }

            return(false);
        }
Ejemplo n.º 13
0
        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.eUserMsgSelection userSelec = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, activtiesGroup.Name, matchingTC.Name);
                    if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.Cancel)
                    {
                        return(false);
                    }
                    else if (userSelec == Amdocs.Ginger.Common.eUserMsgSelection.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.ToStatus(eStatusMsgKey.ExportItemToALM, null, activtiesGroup.Name);
            string res = string.Empty;

            ObservableList <ExternalItemFieldBase> allFields = new ObservableList <ExternalItemFieldBase>(WorkSpace.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.HideStatusMessage();
            if (exportRes)
            {
                if (performSaveAfterExport)
                {
                    Reporter.ToStatus(eStatusMsgKey.SaveItem, null, activtiesGroup.Name, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup));
                    WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(activtiesGroup);
                    Reporter.HideStatusMessage();
                }
                return(true);
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup), activtiesGroup.Name, res);
            }

            return(false);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        public bool ImportSelectedZephyrCyclesAndFolders(string importDestinationPath, IEnumerable<object> selectedObjects)
        {
            if (selectedObjects != null && selectedObjects.Count() > 0)
            {
                foreach (JiraZephyrTreeItem obj in selectedObjects)
                {
                    BusinessFlow existedBF;
                    if (obj is JiraZephyrFolderTreeItem)
                    {
                        existedBF = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<BusinessFlow>().Where(x => x.ExternalID == ((JiraZephyrFolderTreeItem)obj).CycleId  && x.ExternalID2 == obj.Id).FirstOrDefault();
                    }
                    else
                    {
                        existedBF = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<BusinessFlow>().Where(x => x.ExternalID == obj.Id && x.ExternalID2 == null).FirstOrDefault();
                    }

                    if (existedBF != null)
                    {
                        Amdocs.Ginger.Common.eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, obj.Name);
                        if (userSelection == Amdocs.Ginger.Common.eUserMsgSelection.Yes)
                        {
                            File.Delete(existedBF.FileName);
                        }
                    }
                    Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, obj.Name);
                }

                //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 (JiraZephyrTreeItem obj in selectedObjects)
                {
                    try
                    {
                        Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, obj.Name);
                        JiraZephyrCycle currentCycle;
                        BusinessFlow tsBusFlow;
                        if (obj is JiraZephyrFolderTreeItem)
                        {
                            currentCycle = ((JiraCore)ALMIntegration.Instance.AlmCore).GetZephyrCycleOrFolderWithIssuesAndStepsAsCycle(obj.VersionId, ((JiraZephyrFolderTreeItem)obj).CycleId, ((JiraZephyrFolderTreeItem)obj).Id);
                            currentCycle.name = obj.Name;
                            currentCycle.description = ((JiraZephyrFolderTreeItem)obj).Description;
                            tsBusFlow = ((JiraCore)ALMIntegration.Instance.AlmCore).ConvertJiraZypherCycleToBF(currentCycle);
                            tsBusFlow.ExternalID = ((JiraZephyrFolderTreeItem)obj).CycleId;
                            tsBusFlow.ExternalID2 = obj.Id;
                        }
                        else
                        {
                            currentCycle = ((JiraCore)ALMIntegration.Instance.AlmCore).GetZephyrCycleOrFolderWithIssuesAndStepsAsCycle(obj.VersionId, obj.Id);
                            tsBusFlow = ((JiraCore)ALMIntegration.Instance.AlmCore).ConvertJiraZypherCycleToBF(currentCycle);
                        }

                        if (WorkSpace.Instance.Solution.MainApplication != null)
                        {
                            //add the applications mapped to the Activities
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                if (!string.IsNullOrEmpty(activ.TargetApplication))
                                {
                                    if (tsBusFlow.TargetApplications.Where(x => x.Name == activ.TargetApplication).FirstOrDefault() == null)
                                    {
                                        ApplicationPlatform appAgent = WorkSpace.Instance.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 = WorkSpace.Instance.Solution.MainApplication });
                            }
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                if (string.IsNullOrEmpty(activ.TargetApplication))
                                {
                                    activ.TargetApplication = tsBusFlow.MainApplication;
                                }
                                activ.Active = true;
                            }
                        }
                        else
                        {
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                activ.TargetApplication = null; // no app configured on solution level
                            }
                        }

                        //save bf
                        AddTestSetFlowToFolder(tsBusFlow, importDestinationPath);
                        Reporter.HideStatusMessage();
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToUser(eUserMsgKey.ErrorInTestsetImport, obj.Name, ex.Message);
                        Reporter.ToLog(eLogLevel.ERROR, "Error importing from Jira-Zephyr", ex);
                    }
                }

                Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);

                Reporter.ToLog(eLogLevel.DEBUG, "Imported from Jira-Zephyr successfully");
                return true;
            }
            Reporter.ToLog(eLogLevel.ERROR, "Error importing from Jira-Zephyr");
            return false;
        }
Ejemplo n.º 16
0
        public UserMessageBox(string txt, string caption, eUserMsgOption buttonsType,
                              eUserMsgIcon messageImage, eUserMsgSelection defualtResualt)
        {
            InitializeComponent();

            this.Title = caption;

            xMessageTextBlock.Text = txt;
            messageBoxResult       = defualtResualt;

            xOKButton.Visibility     = Visibility.Collapsed;
            xYesButton.Visibility    = Visibility.Collapsed;
            xNoButton.Visibility     = Visibility.Collapsed;
            xCancelButton.Visibility = Visibility.Collapsed;

            switch (buttonsType)
            {
            case Amdocs.Ginger.Common.eUserMsgOption.OKCancel:
                xOKButton.Visibility     = Visibility.Visible;
                xCancelButton.Visibility = Visibility.Visible;
                break;

            case Amdocs.Ginger.Common.eUserMsgOption.YesNo:
                xYesButton.Visibility = Visibility.Visible;;
                xNoButton.Visibility  = Visibility.Visible;
                break;

            case Amdocs.Ginger.Common.eUserMsgOption.YesNoCancel:
                xYesButton.Visibility    = Visibility.Visible;
                xNoButton.Visibility     = Visibility.Visible;
                xCancelButton.Visibility = Visibility.Visible;
                break;

            case Amdocs.Ginger.Common.eUserMsgOption.OK:
            default:
                xOKButton.Visibility = Visibility.Visible;
                break;
            }

            switch (messageImage)
            {
            case eUserMsgIcon.Error:
                xMessageImage.ImageType       = Amdocs.Ginger.Common.Enums.eImageType.Error;
                xMessageImage.ImageForeground = Brushes.DarkRed;
                break;

            case eUserMsgIcon.None:
                xMessageImage.Visibility = Visibility.Collapsed;
                break;

            case eUserMsgIcon.Question:
                xMessageImage.ImageType       = Amdocs.Ginger.Common.Enums.eImageType.Question;
                xMessageImage.ImageForeground = Brushes.Purple;
                break;

            case eUserMsgIcon.Warning:
                xMessageImage.ImageType       = Amdocs.Ginger.Common.Enums.eImageType.Warn;
                xMessageImage.ImageForeground = Brushes.DarkOrange;
                break;

            case eUserMsgIcon.Information:
            default:
                xMessageImage.ImageType       = Amdocs.Ginger.Common.Enums.eImageType.Info;
                xMessageImage.ImageForeground = Brushes.DarkBlue;
                break;
            }
        }
Ejemplo n.º 17
0
 private void XCancelButton_Click(object sender, RoutedEventArgs e)
 {
     messageBoxResult = Amdocs.Ginger.Common.eUserMsgSelection.Cancel;
     this.Close();
 }
 private void XSimpleInfoMessageButton_Click(object sender, RoutedEventArgs e)
 {
     Amdocs.Ginger.Common.eUserMsgSelection messageBoxResult = Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "Simple Info Message");
     MessageBox.Show("You selected: " + messageBoxResult);
 }
 private void XYesNoButton_Click(object sender, RoutedEventArgs e)
 {
     Amdocs.Ginger.Common.eUserMsgSelection messageBoxResult = Reporter.ToUser(eUserMsgKey.AskIfSureWantToClose, "param1", "param2");
     MessageBox.Show("You selected: " + messageBoxResult);
 }