public static bool IsConfigPackageExists(string PackagePath, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType eALMType) { string settingsFolder = string.Empty; switch (eALMType) { case GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Jira: settingsFolder = "JiraSettings"; break; case GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Qtest: settingsFolder = "QTestSettings"; break; default: settingsFolder = "JiraSettings"; break; } if (Directory.Exists(Path.Combine(PackagePath, settingsFolder))) { return(true); } else { Reporter.ToLog(eLogLevel.WARN, "Configuration package not exist in solution, Settings not exist at: " + Path.Combine(PackagePath, settingsFolder)); } return(false); }
ObservableList <ExternalItemFieldBase> FetchDefectFields(GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType AlmType) { try { Mouse.OverrideCursor = Cursors.Wait; ALMIntegration.Instance.UpdateALMType(AlmType, true); mALMDefectProfileFields = ALMIntegration.Instance.GetALMItemFieldsREST(true, ResourceType.DEFECT, null); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Error occurred while Fetching Fields", ex); } finally { ALMIntegration.Instance.UpdateALMType(ALMCore.GetDefaultAlmConfig().AlmType); Mouse.OverrideCursor = null; } return(mALMDefectProfileFields); }
public static bool LoadALMSettings(string fileName, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType eALMType) { if (!ValidateConfigurationFile(fileName, eALMType)) { return(false); } { string folderPath = Path.Combine(WorkSpace.Instance.Solution.Folder, "Configurations"); DirectoryInfo di = Directory.CreateDirectory(folderPath); string configPackageFolder = string.Empty; switch (eALMType) { case GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Jira: configPackageFolder = "JiraConfigurationsPackage"; break; case GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Qtest: configPackageFolder = "QTestConfigurationsPackage"; break; default: configPackageFolder = "JiraConfigurationsPackage"; break; } folderPath = Path.Combine(folderPath, configPackageFolder); if (Directory.Exists(folderPath)) { Amdocs.Ginger.Common.GeneralLib.General.ClearDirectoryContent(folderPath); } ZipFile.ExtractToDirectory(fileName, folderPath); ALMCore.DefaultAlmConfig.ALMConfigPackageFolderPath = folderPath; ALMCore.DefaultAlmConfig.ALMConfigPackageFolderPath = WorkSpace.Instance.SolutionRepository.ConvertFullPathToBeRelative(ALMCore.DefaultAlmConfig.ALMConfigPackageFolderPath); if (!IsConfigPackageExists(folderPath, eALMType)) { return(false); } } return(true); }
static bool ValidateConfigurationFile(string PackageFileName, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType eALMType) { bool containSettingsFile = false; string configPackageFile = string.Empty; switch (eALMType) { case GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Jira: configPackageFile = @"JiraSettings/JiraSettings.json"; break; case GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType.Qtest: configPackageFile = @"QTestSettings/QTestSettings.json"; break; default: configPackageFile = @"JiraSettings/JiraSettings.json"; break; } using (FileStream configPackageZipFile = new FileStream(PackageFileName, FileMode.Open)) { using (ZipArchive zipArchive = new ZipArchive(configPackageZipFile)) { foreach (ZipArchiveEntry entry in zipArchive.Entries) { if (entry.FullName == configPackageFile) { containSettingsFile = true; break; } } } } return(containSettingsFile); }
public override void SetALMConfigurations(string ALMServerUrl, bool UseRest, string ALMUserName, string ALMPassword, string ALMDomain, string ALMProject, string ALMProjectKey, GingerCoreNET.ALMLib.ALMIntegrationEnums.eALMType almType, string ALMConfigPackageFolderPath, bool ZephyrEntToken, GingerCoreNET.ALMLib.ALMIntegrationEnums.eTestingALMType testingALMType = GingerCoreNET.ALMLib.ALMIntegrationEnums.eTestingALMType.None) { GingerCoreNET.ALMLib.ALMConfig AlmConfig = amdocs.ginger.GingerCoreNET.WorkSpace.Instance.Solution.ALMConfigs.FirstOrDefault(x => x.AlmType == almType); GingerCoreNET.ALMLib.ALMConfig AlmCoreConfig = AlmConfigs.FirstOrDefault(x => x.AlmType == almType); GingerCoreNET.ALMLib.ALMUserConfig CurrentAlmUserConfigurations = amdocs.ginger.GingerCoreNET.WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almType); //if not exist add otherwise update if (AlmConfig == null) { AlmConfig = new GingerCoreNET.ALMLib.ALMConfig(); AlmConfigs.Add(AlmConfig); } AlmConfig.ALMServerURL = GetServerValueFromDict(GetDynamicServerConfigAndSetPaths()); AlmConfig.UseRest = UseRest; AlmConfig.ALMUserName = CurrentAlmUserConfigurations.ALMUserName; AlmConfig.ALMPassword = CurrentAlmUserConfigurations.ALMPassword; AlmConfig.ALMDomain = ALMDomain; AlmConfig.ALMProjectName = ALMProject; AlmConfig.ALMProjectKey = ALMProjectKey; AlmConfig.AlmType = almType; AlmConfig.ALMConfigPackageFolderPath = amdocs.ginger.GingerCoreNET.WorkSpace.Instance.SolutionRepository.ConvertFullPathToBeRelative(ALMConfigPackageFolderPath); AlmConfig.JiraTestingALM = testingALMType; AlmCoreConfig = AlmConfig; }