Exemplo n.º 1
0
        public bool TestALMProjectConn(eALMConnectType almConectStyle)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

            bool connResult = false;

            try
            {
                connResult = AlmCore.ConnectALMProject();
            }
            catch (Exception e)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error connecting to ALM project", e);
                if (almConectStyle == eALMConnectType.Manual)
                {
                    Reporter.ToUser(eUserMsgKey.ALMLoginFailed, e.Message);
                }
                else if (almConectStyle == eALMConnectType.Auto)
                {
                    Reporter.ToUser(eUserMsgKey.ALMConnectFailureWithCurrSettings, e.Message);
                }
            }

            if (connResult)
            {
                DisconnectALMServer(almConectStyle);
            }

            Mouse.OverrideCursor = null;
            return(connResult);
        }
Exemplo n.º 2
0
 public void RefreshALMItemFields(ObservableList <ExternalItemFieldBase> exitingFields, bool online, BackgroundWorker bw = null)
 {
     if (ALMIntegration.Instance.AutoALMProjectConnect())
     {
         //Get latestALMFields from ALMCore with Online flag
         ObservableList <ExternalItemFieldBase> latestALMFields = AlmCore.GetALMItemFields(bw, online);
         ObservableList <ExternalItemFieldBase> mergedFields    = AlmCore.RefreshALMItemFields(exitingFields, latestALMFields);
     }
 }
Exemplo n.º 3
0
        public Dictionary <Guid, string> CreateNewALMDefects(Dictionary <Guid, Dictionary <string, string> > defectsForOpening, List <ExternalItemFieldBase> defectsFields)
        {
            Dictionary <Guid, string> defectsOpeningResults = new Dictionary <Guid, string>();

            if (ALMIntegration.Instance.AutoALMProjectConnect())
            {
                defectsOpeningResults = AlmCore.CreateNewALMDefects(defectsForOpening, defectsFields, true);
            }
            return(defectsOpeningResults);
        }
Exemplo n.º 4
0
        public ObservableList <ExternalItemFieldBase> GetALMItemFieldsREST(bool online, BackgroundWorker bw = null)
        {
            ObservableList <ExternalItemFieldBase> latestALMFieldsREST = new ObservableList <ExternalItemFieldBase>();

            if (ALMIntegration.Instance.AutoALMProjectConnect())
            {
                latestALMFieldsREST = AlmCore.GetALMItemFields(bw, online, true);
            }
            return(latestALMFieldsREST);
        }
Exemplo n.º 5
0
        public ObservableList <ExternalItemFieldBase> GetALMItemFieldsREST(bool online, ALM_Common.DataContracts.ResourceType resourceType, BackgroundWorker bw = null)
        {
            ObservableList <ExternalItemFieldBase> latestALMFieldsREST = new ObservableList <ExternalItemFieldBase>();

            if (ALMIntegration.Instance.AutoALMProjectConnect())
            {
                latestALMFieldsREST = AlmCore.GetALMItemFields(null, online, resourceType);
            }
            return(latestALMFieldsREST);
        }
Exemplo n.º 6
0
        public void RefreshALMItemFields(ObservableList <ExternalItemFieldBase> exitingFields, bool online, BackgroundWorker bw = null)
        {
            if (ALMIntegration.Instance.AutoALMProjectConnect())
            {
                //Get latestALMFields from ALMCore with Online flag
                ObservableList <ExternalItemFieldBase> latestALMFields = AlmCore.GetALMItemFields(bw, online);

                //Merging Latest with exiting
                if (exitingFields == null)
                {
                    exitingFields = new ObservableList <ExternalItemFieldBase>();
                }

                foreach (ExternalItemFieldBase latestField in latestALMFields)
                {
                    ExternalItemFieldBase existingField = exitingFields.Where(x => x.ID == latestField.ID).FirstOrDefault();
                    if (existingField != null)
                    {
                        existingField.Name       = latestField.Name;
                        existingField.ItemType   = latestField.ItemType;
                        existingField.Mandatory  = latestField.Mandatory;
                        existingField.ExternalID = latestField.ExternalID;

                        if (latestField.Mandatory == true)
                        {
                            existingField.ToUpdate = true;
                        }

                        existingField.PossibleValues = latestField.PossibleValues;
                        if (string.IsNullOrEmpty(existingField.SelectedValue) == false)
                        {
                            if (!latestField.PossibleValues.Contains(existingField.SelectedValue))
                            {
                                existingField.SelectedValue = latestField.SelectedValue;
                            }
                        }
                        else
                        {
                            existingField.SelectedValue = latestField.SelectedValue;
                        }
                    }
                    else
                    {
                        exitingFields.Add(latestField);
                    }
                }

                //Sorting the list
                ObservableList <ExternalItemFieldBase> sortedFields = new ObservableList <ExternalItemFieldBase>(from i in exitingFields orderby i.ItemType select i);
                exitingFields.ClearAll();
                exitingFields.Append(sortedFields);
            }
        }
Exemplo n.º 7
0
        public Dictionary <string, string> GetALMDomainProjects(string ALMDomain, eALMConnectType almConectStyle)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            Dictionary <string, string> projectsList = new Dictionary <string, string>();

            if (AutoALMServerConnect(almConectStyle))
            {
                projectsList = AlmCore.GetALMDomainProjects(ALMDomain);
                DisconnectALMServer(almConectStyle);
            }
            Mouse.OverrideCursor = null;
            return(projectsList);
        }
Exemplo n.º 8
0
        public List <string> GetALMDomains(eALMConnectType almConectStyle)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            List <string> domainList = new List <string>();

            if (AutoALMServerConnect(almConectStyle))
            {
                domainList = AlmCore.GetALMDomains();
                DisconnectALMServer(almConectStyle);
            }

            Mouse.OverrideCursor = null;
            return(domainList);
        }
Exemplo n.º 9
0
        public void RefreshALMItemFields(ObservableList <ExternalItemFieldBase> exitingFields, bool online, BackgroundWorker bw = null)
        {
            ObservableList <ExternalItemFieldBase> mergedFields = new ObservableList <ExternalItemFieldBase>();

            if (ALMIntegration.Instance.AutoALMProjectConnect())
            {
                //Get latestALMFields from ALMCore with Online flag
                ObservableList <ExternalItemFieldBase> latestALMFields = AlmCore.GetALMItemFields(bw, online);

                foreach (ExternalItemFieldBase latestField in latestALMFields)
                {
                    ExternalItemFieldBase currentField = exitingFields.Where(x => x.ID == latestField.ID && x.ItemType == latestField.ItemType).FirstOrDefault();
                    if (currentField != null)
                    {
                        currentField.Name           = latestField.Name;
                        currentField.ItemType       = latestField.ItemType;
                        currentField.Mandatory      = latestField.Mandatory;
                        currentField.ExternalID     = latestField.ExternalID;
                        currentField.PossibleValues = latestField.PossibleValues;
                        currentField.ToUpdate       = false;
                        if (string.IsNullOrEmpty(currentField.SelectedValue) == false)
                        {
                            if ((latestField.PossibleValues.Count == 0 && currentField.SelectedValue != latestField.SelectedValue) || (latestField.PossibleValues.Count > 0 && latestField.PossibleValues.Contains(currentField.SelectedValue) && currentField.SelectedValue != latestField.PossibleValues[0]))
                            {
                                currentField.ToUpdate = true;
                            }
                            else
                            {
                                currentField.SelectedValue = latestField.SelectedValue;
                                currentField.ToUpdate      = false;
                            }
                        }
                        else
                        {
                            currentField.SelectedValue = latestField.SelectedValue;
                            currentField.ToUpdate      = false;
                        }
                        mergedFields.Add(currentField);
                    }
                    else
                    {
                        mergedFields.Add(latestField);
                    }
                }

                exitingFields.ClearAll();
                exitingFields.Append(mergedFields);
            }
        }
Exemplo n.º 10
0
 public void DisconnectALMServer(eALMConnectType almConectStyle = eALMConnectType.Silence)
 {
     try
     {
         AlmCore.DisconnectALMServer();
     }
     catch (Exception e)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Error disconnecting from ALM", e);
         if (almConectStyle == eALMConnectType.Manual)
         {
             Reporter.ToUser(eUserMsgKey.ALMOperationFailed, "disconnect server", e.Message);
         }
     }
 }
Exemplo n.º 11
0
        public bool ExportBusinessFlowsResultToALM(ObservableList <BusinessFlow> BusinessFlows, ref string result, PublishToALMConfig publishToALMConfig, eALMConnectType almConnectionType, bool exectutedFromAutomateTab = false)
        {
            ObservableList <ExternalItemFieldBase> solutionAlmFields = null;

            try
            {
                solutionAlmFields      = SetALMTypeAndFieldsFromSolutionToOperation(publishToALMConfig, solutionAlmFields);
                ALMCore.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();
                if (AutoALMProjectConnect(almConnectionType, false))
                {
                    return(AlmCore.ExportBusinessFlowsResultToALM(BusinessFlows, ref result, publishToALMConfig, almConnectionType, exectutedFromAutomateTab));
                }
                else
                {
                    if (exectutedFromAutomateTab)
                    {
                        result += "Execution results were not published, Failed to connect to ALM";
                        Reporter.ToLog(eLogLevel.WARN, "Execution results were not published, Failed to connect to ALM");
                    }
                    else
                    {
                        foreach (BusinessFlow BizFlow in BusinessFlows)
                        {
                            BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                        }
                        result += "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action 'Publish to ALM', Failed to connect to ALM";
                        Reporter.ToLog(eLogLevel.WARN, "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action Publish to ALM, Failed to connect to ALM");
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                ResetALMTypeAndFieldsFromOperationToSolution(publishToALMConfig, solutionAlmFields);
            }
        }
Exemplo n.º 12
0
        public bool ExportBusinessFlowsResultToALM(ObservableList <BusinessFlow> BusinessFlows, ref string result, PublishToALMConfig publishToALMConfig, eALMConnectType almConnectionType, bool exectutedFromAutomateTab = false)
        {
            ALMCore.SolutionFolder = WorkSpace.Instance.Solution.Folder.ToUpper();
            bool isExportSucc = false;

            if (AutoALMProjectConnect(almConnectionType, false))
            {
                try
                {
                    foreach (BusinessFlow BizFlow in BusinessFlows) //Here going for each businessFlow
                    {
                        try
                        {
                            if (BizFlow.ExternalID != "0" && !String.IsNullOrEmpty(BizFlow.ExternalID))
                            {
                                Reporter.ToLog(eLogLevel.DEBUG, "Executing RunSet Action Publish to ALM for " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " " + BizFlow.Name);
                                Reporter.ToStatus(eStatusMsgKey.ExportExecutionDetails, null, BizFlow.Name, "ALM");

                                if (publishToALMConfig.ToAttachActivitiesGroupReport)
                                {
                                    Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateActivitiesGroupReportsOfBusinessFlow(null, BizFlow);//need to find a way to specify the releveant environment
                                }

                                isExportSucc = AlmCore.ExportExecutionDetailsToALM(BizFlow, ref result, exectutedFromAutomateTab, publishToALMConfig);
                                if (isExportSucc)
                                {
                                    BizFlow.PublishStatus = BusinessFlow.ePublishStatus.Published;
                                }
                                else
                                {
                                    if ((result == null) || (result == string.Empty))
                                    {
                                        result = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " - " + BizFlow.Name + " - Error when uploading to ALM." + Environment.NewLine;
                                    }
                                    BizFlow.PublishStatus = BusinessFlow.ePublishStatus.PublishFailed;
                                }
                                Reporter.HideStatusMessage();
                            }
                            else
                            {
                                BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                                result += GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " - " + BizFlow.Name + " - doesn't have ExternalID, cannot execute publish to ALM RunSet Action" + Environment.NewLine;
                                Reporter.ToLog(eLogLevel.WARN, BizFlow.Name + " - doesn't have ExternalID, cannot execute publish to ALM RunSet Action");
                            }
                        }
                        catch (Exception ex)
                        {
                            result = ex.Message.ToString();
                            BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                            Reporter.ToLog(eLogLevel.ERROR, BizFlow.Name + " - Export results to ALM failed due to exception", ex);
                        }
                    }

                    return(isExportSucc);
                }
                finally
                {
                    DisconnectALMServer();
                }
            }
            else
            {
                if (exectutedFromAutomateTab)
                {
                    result += "Execution results were not published, Failed to connect to ALM";
                    Reporter.ToLog(eLogLevel.WARN, "Execution results were not published, Failed to connect to ALM");
                }
                else
                {
                    foreach (BusinessFlow BizFlow in BusinessFlows)
                    {
                        BizFlow.PublishStatus = BusinessFlow.ePublishStatus.NotPublished;
                    }
                    result += "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action 'Publish to ALM', Failed to connect to ALM";
                    Reporter.ToLog(eLogLevel.WARN, "Didn't execute " + GingerDicser.GetTermResValue(eTermResKey.RunSet) + " action Publish to ALM, Failed to connect to ALM");
                }
                return(false);
            }
        }
Exemplo n.º 13
0
 public bool DisconnectALMProjectStayLoggedIn()
 {
     return(AlmCore.DisconnectALMProjectStayLoggedIn());
 }
Exemplo n.º 14
0
 private bool ConnectALMProject()
 {
     return(AlmCore.ConnectALMProject());
 }
Exemplo n.º 15
0
 public Dictionary <string, string> GetSSOTokens()
 {
     return(AlmCore.GetSSOTokens());
 }
Exemplo n.º 16
0
 public bool IsServerConnected()
 {
     return(AlmCore.IsServerConnected());
 }
Exemplo n.º 17
0
 public Dictionary <string, string> GetConnectionInfo()
 {
     return(AlmCore.GetConnectionInfo());
 }