Ejemplo n.º 1
0
        /// <summary>
        /// Adding Activities from Shared Repository to the Business Flow in Context
        /// </summary>
        /// <param name="sharedActivitiesToAdd">Shared Repository Activities to Add Instances from</param>
        /// <param name="businessFlow">Business Flow to add to</param>
        public static void AddActivitiesFromSRHandler(List <Activity> sharedActivitiesToAdd, BusinessFlow businessFlow, string ActivitiesGroupID = null, int insertIndex = -1)
        {
            ActivitiesGroup parentGroup = null;

            if (!string.IsNullOrWhiteSpace(ActivitiesGroupID))
            {
                parentGroup = businessFlow.ActivitiesGroups.Where(g => g.Name == ActivitiesGroupID).FirstOrDefault();
            }
            else
            {
                parentGroup = (new ActivitiesGroupSelectionPage(businessFlow)).ShowAsWindow();
            }

            if (parentGroup != null)
            {
                eUserMsgSelection userSelection = eUserMsgSelection.None;
                foreach (Activity sharedActivity in sharedActivitiesToAdd)
                {
                    Activity activityIns = (Activity)sharedActivity.CreateInstance(true);
                    activityIns.Active = true;
                    //map activities target application to BF if missing in BF
                    userSelection = businessFlow.MapTAToBF(userSelection, activityIns, WorkSpace.Instance.Solution.ApplicationPlatforms);
                    businessFlow.SetActivityTargetApplication(activityIns);
                    businessFlow.AddActivity(activityIns, parentGroup, insertIndex);
                }
            }
        }
Ejemplo n.º 2
0
        public override Amdocs.Ginger.Common.eUserMsgSelection ToUser(string messageText, string caption, eUserMsgOption buttonsType, eUserMsgIcon messageImage, eUserMsgSelection defualtResault)
        {
            eUserMsgSelection result = defualtResault;  // if user just close the window we return the default defined result

            if (WorkSpace.Instance.RunningFromUnitTest)
            {
                result = eUserMsgSelection.Yes;
            }

            if (!WorkSpace.Instance.RunningInExecutionMode && !WorkSpace.Instance.RunningFromUnitTest)
            {
                App.MainWindow.Dispatcher.Invoke(() =>
                {
                    UserMessageBox messageBoxWindow = new UserMessageBox(messageText, caption, buttonsType, messageImage, defualtResault);
                    messageBoxWindow.ShowDialog();
                    result = messageBoxWindow.messageBoxResult;
                });
            }
            else
            {
                //not showing pop up message because running from config file and not wanting to get stuck
                ToLog(eLogLevel.WARN, string.Format("Not showing the User Message: '{0}' because application loaded in execution mode. Returning default selection value: '{1}'", messageText, defualtResault.ToString()));
            }

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// In case object of type Act was passed, adds relevant action being Legacy/PlugIn/One that Adds via Wizard
        /// </summary>
        /// <param name="selectedAction"></param>
        /// <param name="mContext"></param>
        /// <returns></returns>
        static Act GenerateSelectedAction(Act selectedAction, Context mContext)
        {
            if (selectedAction.AddActionWizardPage != null)
            {
                string classname = selectedAction.AddActionWizardPage;
                Type   t         = System.Reflection.Assembly.GetExecutingAssembly().GetType(classname);
                if (t == null)
                {
                    throw new Exception("Action edit page not found - " + classname);
                }

                WizardBase wizard = (WizardBase)Activator.CreateInstance(t, mContext);
                WizardWindow.ShowWizard(wizard);

                return(null);
            }
            else
            {
                Act instance = null;

                if (selectedAction.IsSharedRepositoryInstance || selectedAction.ContainingFolder.Contains("SharedRepository"))
                {
                    instance = (Act)selectedAction.CreateInstance(true);
                }
                else
                {
                    instance = (Act)selectedAction.CreateCopy();
                }

                if (selectedAction is IObsoleteAction && (selectedAction as IObsoleteAction).IsObsoleteForPlatform(mContext.Platform))
                {
                    eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.WarnAddLegacyActionAndOfferNew, ((IObsoleteAction)selectedAction).TargetActionTypeName());
                    if (userSelection == eUserMsgSelection.Yes)
                    {
                        instance             = ((IObsoleteAction)selectedAction).GetNewAction();
                        instance.Description = instance.ActionType;
                    }
                    else if (userSelection == eUserMsgSelection.Cancel)
                    {
                        return(null);            //do not add any action
                    }
                }

                for (int i = 0; i < selectedAction.InputValues.Count; i++)
                {
                    instance.InputValues[i].ParamTypeEX = selectedAction.InputValues[i].ParamTypeEX;
                }

                instance.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();

                if (instance is ActPlugIn)
                {
                    ActPlugIn p = (ActPlugIn)instance;
                    // TODO: add per group or... !!!!!!!!!

                    //Check if target already exist else add it
                    // TODO: search only in targetplugin type
                    TargetPlugin targetPlugin = (TargetPlugin)(from x in mContext.BusinessFlow.TargetApplications where x.Name == p.ServiceId select x).SingleOrDefault();
                    if (targetPlugin == null)
                    {
                        // check if interface add it
                        // App.BusinessFlow.TargetApplications.Add(new TargetPlugin() { AppName = p.ServiceId });

                        mContext.BusinessFlow.TargetApplications.Add(new TargetPlugin()
                        {
                            PluginId = p.PluginId, ServiceId = p.ServiceId
                        });

                        //Search for default agent which match
                        mContext.Runner.UpdateApplicationAgents();
                        // TODO: update automate page target/agent

                        // if agent not found auto add or ask user
                    }
                }

                return(instance);
            }
        }
Ejemplo n.º 4
0
        public override bool ExportBusinessFlowToALM(BusinessFlow businessFlow, bool performSaveAfterExport = false, eALMConnectType almConectStyle = eALMConnectType.Silence, string parentObjectId = null, string testCaseParentObjectId = 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;

            eUserMsgSelection userSelec = 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 == eUserMsgSelection.Cancel)
                    {
                        return(false);
                    }
                    else if (userSelec == 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
                        eUserMsgSelection userSelect = Reporter.ToUser(eUserMsgKey.ActivitiesGroupAlreadyMappedToTC, ag.Name, matchingTC.TestName);
                        if (userSelect == eUserMsgSelection.Cancel)
                        {
                            return(false);
                        }
                        else if (userSelect == 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
                    testCaseParentObjectId = SelectALMTestPlanPath();
                    if (String.IsNullOrEmpty(testCaseParentObjectId))
                    {
                        //no path to upload to
                        return(false);
                    }
                }
                ExportActivitiesGroupToALM(ag, testCaseParentObjectId);
            }

            if (matchingTS == null && string.IsNullOrEmpty(parentObjectId))
            {
                if (userSelec == eUserMsgSelection.No)
                {
                    Reporter.ToUser(eUserMsgKey.ExportQCNewTestSetSelectDiffFolder);
                }
                parentObjectId = SelectALMTestLabPath();
                if (String.IsNullOrEmpty(parentObjectId))
                {
                    //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);    // 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 != 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(false);
        }
Ejemplo n.º 5
0
        public override eUserMsgSelection ToUser(string messageText, string caption, eUserMsgOption buttonsType, eUserMsgIcon messageImage, eUserMsgSelection defualtResault)
        {
            string txt = caption + Environment.NewLine;

            txt += messageText;
            Console.WriteLine("ToUser: " + txt);
            return(defualtResault);
        }
Ejemplo n.º 6
0
        public static eUserMsgSelection ToUser(eUserMsgKey messageKey, params object[] messageArgs)
        {
            UserMsg      messageToShow = null;
            string       messageText   = string.Empty;
            eUserMsgIcon messageImage  = eUserMsgIcon.None;

            try
            {
                //get the message from pool
                // FIXME improve if as already found !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                if ((UserMsgsPool != null) && UserMsgsPool.Keys.Contains(messageKey))
                {
                    messageToShow = UserMsgsPool[messageKey];
                }
                if (messageToShow == null) // Message not found in message pool
                {
                    // We do want to pop the error message so below is just in case...
                    string mess = "";
                    foreach (object o in messageArgs)
                    {
                        mess += o.ToString() + " ";
                    }

                    string txt = messageKey.ToString() + " - " + mess + "{Error message key not found!}";
                    WorkSpaceReporter.ToUser(txt, "Ginger", eUserMsgOption.OK, eUserMsgIcon.Information, eUserMsgSelection.OK);

                    ToLog(eLogLevel.WARN, "The user message with key: '" + messageKey + "' was not found! and won't show to the user!");
                    return(eUserMsgSelection.None);
                }

                //set the message type
                switch (messageToShow.MessageType)
                {
                case eUserMsgType.ERROR:
                    messageImage = eUserMsgIcon.Error;
                    break;

                case eUserMsgType.INFO:
                    messageImage = eUserMsgIcon.Information;
                    break;

                case eUserMsgType.QUESTION:
                    messageImage = eUserMsgIcon.Question;
                    break;

                case eUserMsgType.WARN:
                    messageImage = eUserMsgIcon.Warning;
                    break;

                default:
                    messageImage = eUserMsgIcon.Information;
                    break;
                }

                //enter message args if exist
                if (messageArgs.Length > 0)
                {
                    messageText = string.Format(messageToShow.Message, messageArgs);
                }
                else
                {
                    messageText = messageToShow.Message;
                }

                if (AppLoggingLevel == eAppReporterLoggingLevel.Debug)
                {
                    ToLog(eLogLevel.DEBUG, "Showing User Message: '" + messageText + "'");
                }
                else if (ReportAllAlsoToConsole)
                {
                    ToConsole(eLogLevel.DEBUG, "Showing User Message: '" + messageText + "'");
                }

                //show the messege and return user selection
                eUserMsgSelection userSelection = WorkSpaceReporter.ToUser(messageText, messageToShow.Caption, messageToShow.SelectionOptions, messageImage, messageToShow.DefualtSelectionOption);

                if (AppLoggingLevel == eAppReporterLoggingLevel.Debug)
                {
                    ToLog(eLogLevel.DEBUG, "User Message Option Selection: '" + userSelection.ToString() + "'");
                }
                else if (ReportAllAlsoToConsole)
                {
                    ToConsole(eLogLevel.DEBUG, "User Message Option Selection: '" + userSelection.ToString() + "'");
                }

                return(userSelection);
            }
            catch (Exception ex)
            {
                string txt = "Failed to show the user message with the key: " + messageKey;

                ToLog(eLogLevel.ERROR, txt, ex);

                if (ReportAllAlsoToConsole)
                {
                    ToConsole(eLogLevel.ERROR, txt, ex);
                }

                WorkSpaceReporter.ToUser(txt, "Ginger", eUserMsgOption.OK, eUserMsgIcon.Information, eUserMsgSelection.OK);

                return(eUserMsgSelection.None);
            }
        }
Ejemplo n.º 7
0
 public abstract eUserMsgSelection ToUser(string messageText, string caption, eUserMsgOption buttonsType, eUserMsgIcon messageImage, eUserMsgSelection defualtResualt);
        public override eUserMsgSelection ToUser(string messageText, string caption, eUserMsgOption buttonsType, eUserMsgIcon messageImage, eUserMsgSelection defualtResualt)
        {
            string txt = caption + Environment.NewLine;

            txt += messageText;
            // TODO: change console color
            switch (buttonsType)
            {
                // TODO: !!!!!!!!!!!!!!!!!!!!!!
                // show buttons [Ok] - O
                // Y, N, C
            }
            Console.WriteLine(txt);

            Console.ReadKey();
            return(defualtResualt); // TEMP !!!!!!!!!
        }
Ejemplo n.º 9
0
 public UserMsg(eUserMsgType MessageType, string Caption, string Message, eUserMsgOption SelectionOptions, eUserMsgSelection DefualtSelectionOption)
 {
     this.MessageType            = MessageType;
     this.Caption                = Caption;
     this.Message                = Message;
     this.SelectionOptions       = SelectionOptions;
     this.DefualtSelectionOption = DefualtSelectionOption;
 }
Ejemplo n.º 10
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.º 11
0
        private void AddAction()
        {
            if (ActionsTabs.SelectedContent != null && ((ucGrid)ActionsTabs.SelectedContent).CurrentItem != null)
            {
                Act selectedAction = (Act)(((ucGrid)ActionsTabs.SelectedContent).CurrentItem);

                //warn regarding Leagacy Actions
                if (LegacyActionsTab.IsSelected)
                {
                    if (selectedAction is IObsoleteAction)
                    {
                        eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.WarnAddLegacyActionAndOfferNew, ((IObsoleteAction)selectedAction).TargetActionTypeName());
                        if (userSelection == eUserMsgSelection.Yes)
                        {
                            selectedAction = ((IObsoleteAction)selectedAction).GetNewAction();
                        }
                        else if (userSelection == eUserMsgSelection.Cancel)
                        {
                            return;//do not add any action
                        }
                    }
                    else
                    {
                        if (Reporter.ToUser(eUserMsgKey.WarnAddLegacyAction) == eUserMsgSelection.No)
                        {
                            return;//do not add any action
                        }
                    }
                }

                if (selectedAction.AddActionWizardPage != null)
                {
                    _pageGenericWin.Close();
                    string classname = selectedAction.AddActionWizardPage;
                    Type   t         = Assembly.GetExecutingAssembly().GetType(classname);
                    if (t == null)
                    {
                        throw new Exception("Action edit page not found - " + classname);
                    }

                    WizardBase wizard = (GingerWPF.WizardLib.WizardBase)Activator.CreateInstance(t, mContext);
                    WizardWindow.ShowWizard(wizard);
                }
                else
                {
                    Act newAction = null;
                    newAction         = (Act)selectedAction.CreateCopy();
                    newAction.Context = mContext;
                    // copy param ex info
                    for (int i = 0; i < selectedAction.InputValues.Count; i++)
                    {
                        newAction.InputValues[i].ParamTypeEX = selectedAction.InputValues[i].ParamTypeEX;
                    }

                    newAction.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();

                    //adding the new act after the selected action in the grid
                    //TODO: Add should be after the last, Insert should be in the middle...
                    int selectedActIndex = -1;
                    if (mActionsList.CurrentItem != null)
                    {
                        selectedActIndex = mActionsList.IndexOf((IAct)mActionsList.CurrentItem);
                    }
                    mActionsList.Add(newAction);
                    if (selectedActIndex >= 0)
                    {
                        mActionsList.Move(mActionsList.Count - 1, selectedActIndex + 1);
                    }

                    _pageGenericWin.Close();

                    //allowing to edit the action
                    ActionEditPage actedit = new ActionEditPage(newAction);
                    actedit.ShowAsWindow();

                    if (newAction is ActPlugIn)
                    {
                        ActPlugIn p = (ActPlugIn)newAction;
                        // TODO: add per group or... !!!!!!!!!

                        //Check if target already exist else add it
                        // TODO: search only in targetplugin type
                        TargetPlugin targetPlugin = (TargetPlugin)(from x in mBusinessFlow.TargetApplications where x.Name == p.ServiceId select x).SingleOrDefault();
                        if (targetPlugin == null)
                        {
                            // check if interface add it
                            // App.BusinessFlow.TargetApplications.Add(new TargetPlugin() { AppName = p.ServiceId });

                            mBusinessFlow.TargetApplications.Add(new TargetPlugin()
                            {
                                PluginId = p.PluginId, ServiceId = p.ServiceId
                            });

                            //Search for default agent which match
                            mContext.Runner.UpdateApplicationAgents();
                            // TODO: update automate page target/agent

                            // if agent not found auto add or ask user
                        }
                    }
                }
            }
            else
            {
                Reporter.ToUser(eUserMsgKey.NoItemWasSelected);
                return;
            }
        }
Ejemplo n.º 12
0
        public override bool ImportSelectedTests(string importDestinationPath, IEnumerable <object> selectedTestSets)
        {
            if (selectedTestSets != null && selectedTestSets.Count() > 0)
            {
                ObservableList <QCTestSetTreeItem> testSetsItemsToImport = new ObservableList <QCTestSetTreeItem>();
                foreach (QCTestSetTreeItem testSetItem in selectedTestSets)
                {
                    //check if some of the Test Set was already imported
                    if (testSetItem.AlreadyImported)
                    {
                        eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, testSetItem.TestSetName);
                        if (userSelection == eUserMsgSelection.Yes)
                        {
                            //Delete the mapped BF
                            File.Delete(testSetItem.MappedBusinessFlow.FileName);
                            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.InitCoreObjs();

                foreach (QCTestSetTreeItem testSetItemtoImport in testSetsItemsToImport)
                {
                    try
                    {
                        //import test set data
                        Reporter.ToStatus(eStatusMsgKey.ALMTestSetImport, null, testSetItemtoImport.TestSetName);
                        GingerCore.ALM.QC.ALMTestSet TS = new GingerCore.ALM.QC.ALMTestSet();
                        TS.TestSetID   = testSetItemtoImport.TestSetID;
                        TS.TestSetName = testSetItemtoImport.TestSetName;
                        TS.TestSetPath = testSetItemtoImport.Path;
                        TS             = ((OctaneCore)ALMIntegration.Instance.AlmCore).ImportTestSetData(TS);

                        //convert test set into BF
                        BusinessFlow tsBusFlow = ((OctaneCore)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;
                                }
                            }
                        }
                        else
                        {
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                activ.TargetApplication = null; // no app configured on solution level
                            }
                        }

                        AddTestSetFlowToFolder(tsBusFlow, importDestinationPath);
                        Reporter.HideStatusMessage();
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToUser(eUserMsgKey.ErrorInTestsetImport, testSetItemtoImport.TestSetName, ex.Message);
                        Reporter.ToLog(eLogLevel.ERROR, "Error importing from Octane", ex);
                    }
                }

                Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);
                Reporter.ToLog(eLogLevel.DEBUG, "Imported from Octane successfully");
                return(true);
            }
            Reporter.ToLog(eLogLevel.ERROR, "Error importing from Octane");
            return(false);
        }
Ejemplo n.º 13
0
        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.InitCoreObjs();

                    try
                    {
                        BusinessFlow existedBF = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>().Where(x => x.ExternalID == RQMID + "=" + testPlan.RQMID).FirstOrDefault();
                        if (existedBF != null)
                        {
                            eUserMsgSelection userSelection = Reporter.ToUser(eUserMsgKey.TestSetExists, testPlan.Name);
                            if (userSelection == eUserMsgSelection.Yes)
                            {
                                File.Delete(existedBF.FileName);
                            }
                        }

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

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

                        if (WorkSpace.Instance.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.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;
                                }
                            }
                        }
                        else
                        {
                            foreach (Activity activ in tsBusFlow.Activities)
                            {
                                activ.TargetApplication = null; // no app configured on solution level
                            }
                        }

                        AddTestSetFlowToFolder(tsBusFlow, importDestinationPath);
                        Reporter.HideStatusMessage();
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToUser(eUserMsgKey.ErrorInTestsetImport, testPlan.Name, ex.Message);
                    }

                    Reporter.ToUser(eUserMsgKey.TestSetsImportedSuccessfully);
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 14
0
 public override eUserMsgSelection ToUser(string messageText, string caption, eUserMsgOption buttonsType, eUserMsgIcon messageImage, eUserMsgSelection defualtResualt)
 {
     Console.WriteLine("ToStatus select: " + caption + " - " + messageText + " - AutoSelect - " + defualtResualt);
     return(defualtResualt);
 }