Esempio n. 1
0
 public static GingerCoreNET.ALMLib.ALMConfig GetCurrentAlmConfig(GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType almType)
 {
     GingerCoreNET.ALMLib.ALMConfig AlmConfig = WorkSpace.Instance.Solution.ALMConfigs.FirstOrDefault(x => x.AlmType == almType);
     if (AlmConfig == null)
     {
         AlmConfig         = new GingerCoreNET.ALMLib.ALMConfig();
         AlmConfig.AlmType = almType;
         WorkSpace.Instance.Solution.ALMConfigs.Add(AlmConfig);
     }
     return(AlmConfig);
 }
        private void ALMRadioButton_Checked_Changed(object sender, RoutedEventArgs e)
        {
            string prevAlmType = string.Empty;

            if (sender == null || ALMSettingsPannel == null)
            {
                return;
            }
            if (CurrentAlmConfigurations != null)
            {
                prevAlmType = CurrentAlmConfigurations.AlmType.ToString();
                ALMIntegration.Instance.SetALMCoreConfigurations(CurrentAlmConfigurations.AlmType);
            }
            GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.QC;
            RadioButton rBtn = sender as RadioButton;

            if ((bool)rBtn.IsChecked)
            {
                switch (rBtn.Name)
                {
                case "QCRadioButton":
                    almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.QC;
                    break;

                case "RQMRadioButton":
                    almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.RQM;
                    SetLoadPackageButtonContent();
                    break;

                case "RallyRadioButton":
                    almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.RALLY;
                    break;

                case "JiraRadioButton":
                    almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Jira;
                    break;

                case "qTestRadioButton":
                    almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Qtest;
                    break;

                case "OctaneRadioButton":
                    almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Octane;
                    break;

                case "ZephyrEntRadioButton":
                    almType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.ZephyrEnterprise;
                    break;

                default:
                    //Not used
                    break;
                }
                //Clear bindings
                BindingOperations.ClearAllBindings(ConfigPackageTextBox);
                BindingOperations.ClearAllBindings(ServerURLTextBox);
                BindingOperations.ClearAllBindings(RestAPICheckBox);
                BindingOperations.ClearAllBindings(UserNameTextBox);
                BindingOperations.ClearAllBindings(TokenCheckBox);
                BindingOperations.ClearAllBindings(PasswordTextBox);
                BindingOperations.ClearAllBindings(DomainComboBox);
                BindingOperations.ClearAllBindings(ProjectComboBox);
                BindingOperations.ClearAllBindings(JiraTestingALMComboBox);

                ALMIntegration.Instance.SetDefaultAlmConfig(almType);
                ALMIntegration.Instance.UpdateALMType(almType);
                CurrentAlmConfigurations     = ALMCore.GetCurrentAlmConfig(almType);
                CurrentAlmUserConfigurations = ALMIntegration.Instance.GetCurrentAlmUserConfig(almType);


                //Bind again as we changed the AlmConfig object
                Bind();

                //Select domain and project based on new AlmConfig
                LoginServerButton.Content = "Get Projects Details";
                if (!prevAlmType.Equals(CurrentAlmConfigurations.AlmType.ToString()))
                {
                    GetProjectsDetails();
                }
                StyleRadioButtons();
                SetControls();
            }
        }
Esempio n. 3
0
        public virtual void SetALMConfigurations(string ALMServerUrl, bool UseRest, string ALMUserName, string ALMPassword,
                                                 string ALMDomain, string ALMProject, string ALMProjectKey, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType almType,
                                                 string ALMConfigPackageFolderPath, bool UseToken, GingerCoreNET.ALMLib.ALMIntegrationEnums.eTestingALMType jiraTestingALM = GingerCoreNET.ALMLib.ALMIntegrationEnums.eTestingALMType.None)
        {
            GingerCoreNET.ALMLib.ALMConfig AlmConfig = ALMCore.AlmConfigs.FirstOrDefault(x => x.AlmType == almType);
            if (AlmConfig == null)
            {
                AlmConfig = new GingerCoreNET.ALMLib.ALMConfig();
                AlmConfigs.Add(AlmConfig);
            }

            GingerCoreNET.ALMLib.ALMUserConfig CurrentAlmUserConfigurations = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almType);
            if (CurrentAlmUserConfigurations == null)
            {
                CurrentAlmUserConfigurations         = new GingerCoreNET.ALMLib.ALMUserConfig();
                CurrentAlmUserConfigurations.AlmType = almType;
                WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(CurrentAlmUserConfigurations);
            }

            if (AlmConfig == null)
            {
                AlmConfig = new GingerCoreNET.ALMLib.ALMConfig();
                AlmConfigs.Add(AlmConfig);
            }
            if (CurrentAlmUserConfigurations.ALMServerURL != null)
            {
                AlmConfig.ALMServerURL = CurrentAlmUserConfigurations.ALMServerURL;
            }
            else
            {
                AlmConfig.ALMServerURL = ALMServerUrl;
            }
            AlmConfig.UseRest        = UseRest;
            AlmConfig.ALMUserName    = CurrentAlmUserConfigurations.ALMUserName;
            AlmConfig.ALMPassword    = CurrentAlmUserConfigurations.ALMPassword;
            AlmConfig.UseToken       = UseToken;
            AlmConfig.ALMDomain      = ALMDomain;
            AlmConfig.ALMProjectName = ALMProject;
            AlmConfig.ALMProjectKey  = ALMProjectKey;
            AlmConfig.AlmType        = almType;
            AlmConfig.JiraTestingALM = jiraTestingALM;

            if (CurrentAlmUserConfigurations.ALMConfigPackageFolderPath != null)
            {
                AlmConfig.ALMConfigPackageFolderPath = CurrentAlmUserConfigurations.ALMConfigPackageFolderPath;
            }
            else
            {
                if (!String.IsNullOrEmpty(ALMConfigPackageFolderPath))
                {
                    AlmConfig.ALMConfigPackageFolderPath = ALMConfigPackageFolderPath;
                }
            }
            if (!string.IsNullOrEmpty(AlmConfig.ALMConfigPackageFolderPath))
            {
                AlmConfig.ALMConfigPackageFolderPath = WorkSpace.Instance.SolutionRepository.ConvertFullPathToBeRelative(AlmConfig.ALMConfigPackageFolderPath);
            }
        }
        public void CreateNewALMDefects(Dictionary <Guid, Dictionary <string, string> > defectsForOpening, List <ExternalItemFieldBase> defectsFields, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType almType)
        {
            //update alm type to open defect
            ALMIntegration.Instance.UpdateALMType(almType, true);

            Dictionary <Guid, string> defectsOpeningResults;

            if ((defectsForOpening != null) && (defectsForOpening.Count > 0))
            {
                defectsOpeningResults = ALMIntegration.Instance.CreateNewALMDefects(defectsForOpening, defectsFields);
            }
            else
            {
                return;
            }

            if ((defectsOpeningResults != null) && (defectsOpeningResults.Count > 0))
            {
                foreach (KeyValuePair <Guid, string> defectOpeningResult in defectsOpeningResults)
                {
                    if ((defectOpeningResult.Value != null) && (defectOpeningResult.Value != "0"))
                    {
                        WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.DefectSuggestionGuid == defectOpeningResult.Key).ToList().ForEach(z => { z.ALMDefectID = defectOpeningResult.Value; z.IsOpenDefectFlagEnabled = false; });
                    }
                }
            }

            //Set back Default Alm
            ALMIntegration.Instance.UpdateALMType(ALMCore.GetDefaultAlmConfig().AlmType);
        }