コード例 #1
0
 public override bool SerializationError(SerializationErrorType errorType, string name, string value)
 {
     if (errorType == SerializationErrorType.PropertyNotFound)
     {
         if (name.ToLower().Contains("alm"))
         {
             ALMUserConfig AlmUserConfig = ALMUserConfigs.FirstOrDefault();
             if (AlmUserConfig == null)
             {
                 AlmUserConfig = new ALMUserConfig();
                 ALMUserConfigs.Add(AlmUserConfig);
             }
             if (name == "ALMUserName")
             {
                 AlmUserConfig.ALMUserName = value;
                 return(true);
             }
             if (name == "EncryptedALMPassword")
             {
                 AlmUserConfig.EncryptedALMPassword = value;
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #2
0
        public ALMUserConfig GetCurrentAlmUserConfig(eALMType almType)
        {
            ALMUserConfig AlmUserConfig = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almType);

            if (AlmUserConfig == null)
            {
                AlmUserConfig         = new ALMUserConfig();
                AlmUserConfig.AlmType = almType;
                WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(AlmUserConfig);
            }

            return(AlmUserConfig);
        }
コード例 #3
0
ファイル: CLIDynamicFile.cs プロジェクト: lanicon/Ginger
 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));
         }
     }
 }