Beispiel #1
0
 public void LoadRunsetConfigurations(string content, CLIHelper cliHelper, RunsetExecutor runsetExecutor)
 {
     if (FileType == eFileType.JSON)
     {
         //Dynamic JSON
         GingerExecConfig exeConfiguration = DynamicExecutionManager.DeserializeDynamicExecutionFromJSON(content);
         RunsetExecConfig runset           = exeConfiguration.Runset;
         if (runset.EnvironmentName != null || runset.EnvironmentID != null)
         {
             ProjEnvironment env = DynamicExecutionManager.FindItemByIDAndName <ProjEnvironment>(
                 new Tuple <string, Guid?>(nameof(ProjEnvironment.Guid), runset.EnvironmentID),
                 new Tuple <string, string>(nameof(ProjEnvironment.Name), runset.EnvironmentName),
                 WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>());
             if (env != null)
             {
                 cliHelper.Env = env.Name;
             }
         }
         if (runset.RunAnalyzer != null)
         {
             cliHelper.RunAnalyzer = (bool)runset.RunAnalyzer;
         }
         DynamicExecutionManager.CreateUpdateRunSetFromJSON(runsetExecutor, exeConfiguration);
     }
     else
     {
         //Dynamic XML
         DynamicGingerExecution dynamicExecution = DynamicExecutionManager.LoadDynamicExecutionFromXML(content);
         AddRunset addRunset = dynamicExecution.AddRunsets[0];//for now supporting only one Run set execution
         cliHelper.Env         = addRunset.Environment;
         cliHelper.RunAnalyzer = addRunset.RunAnalyzer;
         DynamicExecutionManager.CreateRunSetFromXML(runsetExecutor, addRunset);
     }
 }
Beispiel #2
0
        private string CreateTempJSONConfigFile(string resourceJSONFilePath, string solutionPath)
        {
            GingerExecConfig config = DynamicExecutionManager.DeserializeDynamicExecutionFromJSON(System.IO.File.ReadAllText(resourceJSONFilePath));

            config.SolutionLocalPath = solutionPath;
            string tempJSONConfigFilePath = TestResources.GetTempFile(System.IO.Path.GetFileName(resourceJSONFilePath));

            System.IO.File.WriteAllText(tempJSONConfigFilePath, DynamicExecutionManager.SerializeDynamicExecutionToJSON(config));

            return(tempJSONConfigFilePath);
        }
Beispiel #3
0
        public void LoadGeneralConfigurations(string content, CLIHelper cliHelper)
        {
            if (FileType == eFileType.JSON)
            {
                //Dynamic JSON
                GingerExecConfig exeConfiguration = DynamicExecutionManager.DeserializeDynamicExecutionFromJSON(content);
                if (exeConfiguration.SolutionScmDetails != null)
                {
                    cliHelper.SetSourceControlType(exeConfiguration.SolutionScmDetails.SCMType.ToString());
                    cliHelper.SetSourceControlURL(exeConfiguration.SolutionScmDetails.SolutionRepositoryUrl);
                    cliHelper.SetSourceControlUser(exeConfiguration.SolutionScmDetails.User);
                    cliHelper.SetSourceControlPassword(exeConfiguration.SolutionScmDetails.Password);
                    cliHelper.PasswordEncrypted(exeConfiguration.SolutionScmDetails.PasswordEncrypted.ToString());
                    if (string.IsNullOrEmpty(exeConfiguration.SolutionScmDetails.ProxyServer) == false)
                    {
                        cliHelper.SourceControlProxyServer(exeConfiguration.SolutionScmDetails.ProxyServer);
                        cliHelper.SourceControlProxyPort(exeConfiguration.SolutionScmDetails.ProxyPort);
                    }

                    if (exeConfiguration.SolutionScmDetails.UndoSolutionLocalChanges != null)
                    {
                        cliHelper.UndoSolutionLocalChanges = (bool)exeConfiguration.SolutionScmDetails.UndoSolutionLocalChanges;
                    }
                }
                if (!string.IsNullOrEmpty(exeConfiguration.SolutionLocalPath))
                {
                    if (System.IO.Directory.Exists(exeConfiguration.SolutionLocalPath))
                    {
                        cliHelper.Solution = exeConfiguration.SolutionLocalPath;
                    }
                    else
                    {
                        Reporter.ToLog(eLogLevel.INFO, string.Format("Solution local path: '{0}' was not found so creating it", exeConfiguration.SolutionLocalPath));
                        try
                        {
                            System.IO.Directory.CreateDirectory(exeConfiguration.SolutionLocalPath);
                            cliHelper.Solution = exeConfiguration.SolutionLocalPath;
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToLog(eLogLevel.ERROR, string.Format("Falied to create the Solution local path: '{0}'", exeConfiguration.SolutionLocalPath), ex);
                        }
                    }
                }

                if (exeConfiguration.ShowAutoRunWindow != null && exeConfiguration.ShowAutoRunWindow == true)
                {
                    cliHelper.ShowAutoRunWindow = true;
                }
                if (!string.IsNullOrEmpty(exeConfiguration.ArtifactsPath))
                {
                    cliHelper.TestArtifactsFolder = exeConfiguration.ArtifactsPath;
                }
                if (exeConfiguration.VerboseLevel != null)
                {
                    CLIProcessor.SetVerboseLevel((OptionsBase.eVerboseLevel)Enum.Parse(typeof(OptionsBase.eVerboseLevel), exeConfiguration.VerboseLevel.ToString(), true));
                }
            }
            else
            {
                //Dynamic XML
                DynamicGingerExecution dynamicExecution = DynamicExecutionManager.LoadDynamicExecutionFromXML(content);
                if (dynamicExecution.SolutionDetails.SourceControlDetails != null)
                {
                    cliHelper.SetSourceControlType(dynamicExecution.SolutionDetails.SourceControlDetails.Type);
                    cliHelper.SetSourceControlURL(dynamicExecution.SolutionDetails.SourceControlDetails.Url);
                    cliHelper.SetSourceControlUser(dynamicExecution.SolutionDetails.SourceControlDetails.User);
                    cliHelper.SetSourceControlPassword(dynamicExecution.SolutionDetails.SourceControlDetails.Password);
                    cliHelper.PasswordEncrypted(dynamicExecution.SolutionDetails.SourceControlDetails.PasswordEncrypted);
                    if (string.IsNullOrEmpty(dynamicExecution.SolutionDetails.SourceControlDetails.ProxyServer) == false)
                    {
                        cliHelper.SourceControlProxyServer(dynamicExecution.SolutionDetails.SourceControlDetails.ProxyServer);
                        cliHelper.SourceControlProxyPort(dynamicExecution.SolutionDetails.SourceControlDetails.ProxyPort);
                    }
                }
                cliHelper.Solution          = dynamicExecution.SolutionDetails.Path;
                cliHelper.ShowAutoRunWindow = dynamicExecution.ShowAutoRunWindow;
            }
        }
Beispiel #4
0
 private void LoadALMDetailsFromJSON(GingerExecConfig gingerExecConfig)
 {
     foreach (AlmDetails almDetails in gingerExecConfig.AlmsDetails)
     {
         ALMIntegration.eALMType almTypeToConfigure;
         if (Enum.TryParse <ALMIntegration.eALMType>(almDetails.ALMType, out almTypeToConfigure))
         {
             try
             {
                 ALMConfig solutionAlmConfig = WorkSpace.Instance.Solution.ALMConfigs.FirstOrDefault(x => x.AlmType == almTypeToConfigure);
                 if (solutionAlmConfig == null)
                 {
                     //ADD
                     solutionAlmConfig = new ALMConfig()
                     {
                         AlmType = almTypeToConfigure
                     };
                     WorkSpace.Instance.Solution.ALMConfigs.Add(solutionAlmConfig);
                 }
                 ALMUserConfig userProfileAlmConfig = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almTypeToConfigure);
                 if (userProfileAlmConfig == null)
                 {
                     //ADD
                     userProfileAlmConfig = new ALMUserConfig()
                     {
                         AlmType = almTypeToConfigure
                     };
                     WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(userProfileAlmConfig);
                 }
                 if (almDetails.ALMSubType != null)
                 {
                     solutionAlmConfig.JiraTestingALM = (ALMIntegration.eTestingALMType)Enum.Parse(typeof(ALMIntegration.eTestingALMType), almDetails.ALMSubType);
                 }
                 if (almDetails.ServerURL != null)
                 {
                     solutionAlmConfig.ALMServerURL    = almDetails.ServerURL;
                     userProfileAlmConfig.ALMServerURL = almDetails.ServerURL;
                 }
                 if (almDetails.User != null)
                 {
                     solutionAlmConfig.ALMUserName    = almDetails.User;
                     userProfileAlmConfig.ALMUserName = almDetails.User;
                 }
                 if (almDetails.Password != null)
                 {
                     if (almDetails.PasswordEncrypted)
                     {
                         string pass = EncryptionHandler.DecryptwithKey(almDetails.Password);
                         solutionAlmConfig.ALMPassword    = pass;
                         userProfileAlmConfig.ALMPassword = pass;
                     }
                     else
                     {
                         solutionAlmConfig.ALMPassword    = almDetails.Password;
                         userProfileAlmConfig.ALMPassword = almDetails.Password;
                     }
                 }
                 if (almDetails.Domain != null)
                 {
                     solutionAlmConfig.ALMDomain = almDetails.Domain;
                 }
                 if (almDetails.Project != null)
                 {
                     solutionAlmConfig.ALMProjectName = almDetails.Project;
                 }
                 if (almDetails.ProjectKey != null)
                 {
                     solutionAlmConfig.ALMProjectKey = almDetails.ProjectKey;
                 }
                 if (almDetails.ConfigPackageFolderPath != null)
                 {
                     solutionAlmConfig.ALMConfigPackageFolderPath    = almDetails.ConfigPackageFolderPath;
                     userProfileAlmConfig.ALMConfigPackageFolderPath = almDetails.ConfigPackageFolderPath;
                 }
                 if (almDetails.UseRest != null)
                 {
                     solutionAlmConfig.UseRest = (bool)almDetails.UseRest;
                 }
                 if (almDetails.IsDefault != null)
                 {
                     if (almDetails.IsDefault == true)
                     {
                         //clear previous default
                         ALMConfig currentDefAlm = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.DefaultAlm == true).FirstOrDefault();
                         currentDefAlm.DefaultAlm = false;
                     }
                     solutionAlmConfig.DefaultAlm = (bool)almDetails.IsDefault;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(string.Format("Failed to load the ALM type: '{0}' details, due to error: '{1}'", almDetails.ALMType, ex.Message), ex);
             }
         }
         else
         {
             throw new Exception(string.Format("Failed to find the ALM type: '{0}'", almDetails.ALMType));
         }
     }
 }