public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
		{
			_log.GetLogger("Mercurial").Warn("Check connection failed", exception);
			exception = exception.InnerException ?? exception;
			const string uriFieldName = "Uri";
			if (exception is MercurialExecutionException)
			{
                errors.Add(new PluginProfileError { FieldName = "Login", Message = ExtractValidErrorMessage(exception)});
                errors.Add(new PluginProfileError { FieldName = "Password", Message = ExtractValidErrorMessage(exception) });
                errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = ExtractValidErrorMessage(exception) });
				return;
			}

            if (exception is ArgumentNullException || exception is DirectoryNotFoundException)
			{
				errors.Add(new PluginProfileError{ FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE });
			}

            if (exception is MercurialMissingException)
            {
                errors.Add(new PluginProfileError { Message = MERCURIAL_IS_NOT_INSTALLED_ERROR_MESSAGE });
            }

			var fieldName = string.Empty;
			if (exception is InvalidRevisionException)
			{
				fieldName = "Revision";
			}

			errors.Add(new PluginProfileError {FieldName = fieldName, Message = exception.Message});
		}
		public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
		{
			_log.GetLogger("Git").Warn("Check connection failed", exception);
			exception = exception.InnerException ?? exception;
			const string uriFieldName = "Uri";
			if (exception is TransportException)
			{
				errors.Add(new PluginProfileError {FieldName = "Login", Message = exception.Message});
				errors.Add(new PluginProfileError {FieldName = "Password", Message = exception.Message});
				errors.Add(new PluginProfileError {FieldName = uriFieldName, Message = exception.Message});
				return;
			}

			if (exception is ArgumentNullException)
			{
				errors.Add(new PluginProfileError{FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE});
			}

			var fieldName = string.Empty;
			if (exception is JGitInternalException)
			{
				if (exception.Message.ToLower().Contains("invalid remote") || exception.Message.ToLower().Contains("uri"))
				{
					fieldName = uriFieldName;
				}
			}

			if (exception is InvalidRevisionException)
			{
				fieldName = "Revision";
			}

			errors.Add(new PluginProfileError {FieldName = fieldName, Message = exception.Message});
		}
		public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
		{
			_log.GetLogger("Tfs").Warn("Check connection failed", exception);
			exception = exception.InnerException ?? exception;
			const string uriFieldName = "Uri";
			if (exception is TeamFoundationServiceException)
			{
				errors.Add(new PluginProfileError { FieldName = "Login", Message = exception.Message });
				errors.Add(new PluginProfileError { FieldName = "Password", Message = exception.Message });
				errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = exception.Message });
				return;
			}

			if (exception is ArgumentNullException || exception is DirectoryNotFoundException)
			{
				errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE });
			}

			var fieldName = string.Empty;
			if (exception is InvalidRevisionException)
			{
				fieldName = "Revision";
			}

			errors.Add(new PluginProfileError { FieldName = fieldName, Message = exception.Message });
		}
コード例 #4
0
 protected override void ExecuteConcreate(PluginProfileErrorCollection errors)
 {
     try
     {
         var       url       = new BugzillaUrl(ConnectionSettings);
         WebClient webClient = new TpWebClient(errors)
         {
             Encoding = Encoding.UTF8
         };
         webClient.DownloadString(url.Url);
     }
     catch (WebException webException)
     {
         if (webException.Status != WebExceptionStatus.TrustFailure)
         {
             errors.Add(new PluginProfileError {
                 FieldName = BugzillaProfile.UrlField, Message = webException.Message, AdditionalInfo = ValidationErrorType.BugzillaNotFound.ToString()
             });
         }
     }
     catch (Exception exception)
     {
         errors.Add(new PluginProfileError {
             FieldName = BugzillaProfile.UrlField, Message = exception.Message, AdditionalInfo = ValidationErrorType.BugzillaNotFound.ToString()
         });
     }
 }
コード例 #5
0
 private static void AddCredentialsErrors(PluginProfileErrorCollection errors)
 {
     errors.Add(new PluginProfileError {
         FieldName = ConnectionSettings.LoginField, Message = "Check credentials"
     });
     errors.Add(new PluginProfileError {
         FieldName = ConnectionSettings.PasswordField, Message = "Check credentials"
     });
 }
コード例 #6
0
 private static void AddConnectionErrors(PluginProfileErrorCollection errors)
 {
     errors.Add(new PluginProfileError {
         FieldName = ConnectionSettings.PortField, Message = "Check connection settings"
     });
     errors.Add(new PluginProfileError
     {
         FieldName = ConnectionSettings.MailServerField, Message = "Check connection settings"
     });
 }
コード例 #7
0
		private static void HandleConnectionError(SvnException e, PluginProfileErrorCollection errors)
		{
			if (e is SvnAuthorizationException)
			{
				errors.Add(ErrorFor(ConnectionSettings.LoginField, "Authorization failed"));
				errors.Add(ErrorFor(ConnectionSettings.PasswordField));
			}
			else if (e is SvnAuthenticationException || e.RootCause is SvnAuthenticationException)
			{
				errors.Add(ErrorFor(ConnectionSettings.LoginField, "Authentication failed"));
				errors.Add(ErrorFor(ConnectionSettings.PasswordField));
			}
			else if (e.Message.Contains("200 OK"))
			{
				errors.Add(ErrorFor(ConnectionSettings.UriField, "Invalid path to repository"));
			}
			else if (e is SvnRepositoryIOException)
			{
				errors.Add(ErrorFor(ConnectionSettings.UriField, "Could not connect to server"));
			}
			else if (e is SvnFileSystemException || e is SvnClientUnrelatedResourcesException)
			{
				errors.Add(ErrorFor(SubversionPluginProfile.StartRevisionField));
			}
			else
			{
				errors.Add(ErrorFor(ConnectionSettings.UriField, e.Message.Fmt("Connection failed. {0}")));
			}
		}
コード例 #8
0
		private void ValidateCommand(PluginProfileErrorCollection errors)
		{
			if(CommandName.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "CommandName", Message = "Command name shoud not be empty" });
			}
		}
コード例 #9
0
		private void ValidateTasksList(PluginProfileErrorCollection errors)
		{
			if(TasksList.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "TasksList", Message = "Task list shoud not be empty" });
			}
		}
コード例 #10
0
		private void ValidateAuthTokenUserId(PluginProfileErrorCollection errors)
		{
			if (AuthTokenUserId <= 0)
			{
				errors.Add(new PluginProfileError { FieldName = "AuthTokenUserId", Message = "User for authentication should be specified" });
			}
		}
コード例 #11
0
		private void ValidateProject(PluginProfileErrorCollection errors)
		{
			if (Project <= 0)
			{
				errors.Add(new PluginProfileError { FieldName = "Project", Message = "Project should be specified" });
			}
		}
コード例 #12
0
 private void ValidateNameIsNotEmpty(PluginProfileErrorCollection errors)
 {
     if (_dto.Name.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile Name is required"});
     }
 }
コード例 #13
0
		private void ValidatePassword(PluginProfileErrorCollection errors)
		{
			if (Password.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "Password", Message = "Password should not be empty" });
			}
		}
コード例 #14
0
        public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
        {
            _log.GetLogger("Git").Warn("Check connection failed", exception);
            exception = exception.InnerException ?? exception;
            const string uriFieldName = "Uri";

            if (exception is TransportException)
            {
                errors.Add(new PluginProfileError {
                    FieldName = "Login", Message = exception.Message
                });
                errors.Add(new PluginProfileError {
                    FieldName = "Password", Message = exception.Message
                });
                errors.Add(new PluginProfileError {
                    FieldName = uriFieldName, Message = exception.Message
                });
                return;
            }

            if (exception is ArgumentNullException)
            {
                errors.Add(new PluginProfileError {
                    FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE
                });
            }

            var fieldName = string.Empty;

            if (exception is JGitInternalException)
            {
                if (exception.Message.ToLower().Contains("invalid remote") || exception.Message.ToLower().Contains("uri"))
                {
                    fieldName = uriFieldName;
                }
            }

            if (exception is InvalidRevisionException)
            {
                fieldName = "Revision";
            }

            errors.Add(new PluginProfileError {
                FieldName = fieldName, Message = exception.Message
            });
        }
コード例 #15
0
 protected override void ExecuteConcreate(PluginProfileErrorCollection errors)
 {
     try
     {
         Data = new BugzillaParser <bugzilla_properties>().Parse(_dataHolder.Data);
     }
     catch (InvalidOperationException)
     {
         errors.Add(new PluginProfileError {
             FieldName = BugzillaProfile.LoginField, Message = "The credentials are invalid.", AdditionalInfo = ValidationErrorType.InvalidCredentials.ToString()
         });
         errors.Add(new PluginProfileError
         {
             FieldName = BugzillaProfile.PasswordField, Message = "The credentials are invalid.", AdditionalInfo = ValidationErrorType.InvalidCredentials.ToString()
         });
     }
 }
		private static PluginProfileErrorCollection Add(PluginProfileErrorCollection errors, Exception e)
		{
			errors.Add(new PluginProfileError
			{
				Message = e.Message
			});
			return errors;
		}
コード例 #17
0
 private void ValidatePassword(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrEmpty(Password))
     {
         errors.Add(new PluginProfileError {
             FieldName = PasswordField, Message = "Password is required"
         });
     }
 }
コード例 #18
0
 private void ValidateQueries(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrEmpty(SavedSearches))
     {
         errors.Add(new PluginProfileError {
             FieldName = QueriesField, Message = "Saved Search is required"
         });
     }
 }
コード例 #19
0
 private void ValidateUrl(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrEmpty(Url))
     {
         errors.Add(new PluginProfileError {
             FieldName = UrlField, Message = "URL is required"
         });
     }
 }
コード例 #20
0
 private void ValidateProject(PluginProfileErrorCollection errors)
 {
     if (Project <= 0)
     {
         errors.Add(new PluginProfileError {
             FieldName = ProjectField, Message = "Project is required"
         });
     }
 }
コード例 #21
0
 private void ValidateLogin(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrEmpty(Login))
     {
         errors.Add(new PluginProfileError {
             FieldName = LoginField, Message = "Login is required"
         });
     }
 }
コード例 #22
0
 private void ValidateMailServer(PluginProfileErrorCollection errors)
 {
     if (MailServer.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {
             FieldName = "MailServer", Message = "Server should not be empty"
         });
     }
 }
コード例 #23
0
 private void ValidateUriIsNotSsh(PluginProfileErrorCollection errors)
 {
     if (!string.IsNullOrEmpty(Uri) && Uri.StartsWith("svn+ssh://", StringComparison.OrdinalIgnoreCase))
     {
         errors.Add(new PluginProfileError {
             FieldName = UriField, Message = "Connection via SSH is not supported."
         });
     }
 }
コード例 #24
0
 private void ValidateRemoteResultsUrl(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrEmpty(RemoteResultsUrl) || string.IsNullOrEmpty(RemoteResultsUrl.Trim()))
     {
         errors.Add(new PluginProfileError {
             FieldName = "RemoteResultsUrl", Message = string.Empty
         });
     }
 }
コード例 #25
0
 private void ValidateAuthTokenUserId(PluginProfileErrorCollection errors)
 {
     if (AuthTokenUserId <= 0)
     {
         errors.Add(new PluginProfileError {
             FieldName = "AuthTokenUserId", Message = "User for authentication should be specified"
         });
     }
 }
コード例 #26
0
 private void ValidateProject(PluginProfileErrorCollection errors)
 {
     if (Project <= 0)
     {
         errors.Add(new PluginProfileError {
             FieldName = "Project", Message = "Project should be specified"
         });
     }
 }
コード例 #27
0
 private void ValidateUriIsNotEmpty(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrEmpty(Uri))
     {
         errors.Add(new PluginProfileError {
             FieldName = UriField, Message = "URI should not be empty."
         });
     }
 }
コード例 #28
0
 private void ValidateTestPlan(PluginProfileErrorCollection errors)
 {
     if (TestPlan <= 0)
     {
         errors.Add(new PluginProfileError {
             FieldName = "TestPlan", Message = "Test Plan should be specified"
         });
     }
 }
コード例 #29
0
 private void ValidatePassword(PluginProfileErrorCollection errors)
 {
     if (Password.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {
             FieldName = "Password", Message = "Password should not be empty"
         });
     }
 }
コード例 #30
0
 private void ValidateFramework(PluginProfileErrorCollection errors)
 {
     if (FrameworkType == FrameworkTypes.FrameworkTypes.None)
     {
         errors.Add(new PluginProfileError {
             FieldName = "FrameworkType", Message = "Framework type should be specified"
         });
     }
 }
コード例 #31
0
		protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
		{
			if (string.IsNullOrWhiteSpace(Name))
				errors.Add(new PluginProfileError
				{
					FieldName = NameField,
					Message = "Mashup name cannot be empty or consist of whitespace characters only"
				});
		}
コード例 #32
0
 private void ValidateProtocol(PluginProfileErrorCollection errors)
 {
     if (Protocol.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {
             FieldName = "Protocol", Message = "Protocol should not be empty"
         });
     }
 }
コード例 #33
0
 private void ValidateCommand(PluginProfileErrorCollection errors)
 {
     if (CommandName.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {
             FieldName = "CommandName", Message = "Command name shoud not be empty"
         });
     }
 }
コード例 #34
0
 private void ValidatePort(PluginProfileErrorCollection errors)
 {
     if (Port <= 0)
     {
         errors.Add(new PluginProfileError {
             FieldName = "Port", Message = "Port should not be empty"
         });
     }
 }
コード例 #35
0
 private void ValidateTasksList(PluginProfileErrorCollection errors)
 {
     if (TasksList.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {
             FieldName = "TasksList", Message = "Task list shoud not be empty"
         });
     }
 }
コード例 #36
0
		private void ValidateUniqueness(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
		{
			if (
				ProfileCollection.Any(
					x => string.Equals(x.Name.Value, pluginProfile.Name, StringComparison.InvariantCultureIgnoreCase)))
			{
				errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile name should be unique for plugin"});
			}
		}
コード例 #37
0
		protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
		{
			if (string.IsNullOrEmpty(Name))
				errors.Add(new PluginProfileError
				{
					FieldName = NameField,
					Message = "Mashup name should be specified"
				});
		}
コード例 #38
0
 private void ValidateUserMapping(PluginProfileErrorCollection errors)
 {
     if (UserMapping.Select(x => x.Key.ToLower()).Distinct().Count() != UserMapping.Count)
     {
         errors.Add(new PluginProfileError {
             FieldName = "user-mapping", Message = "Can't map a TFS user to TargetProcess user twice."
         });
     }
 }
コード例 #39
0
 private void ValidateLogin(PluginProfileErrorCollection errors)
 {
     if (Login.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {
             FieldName = "Login", Message = "Login should not be empty"
         });
     }
 }
コード例 #40
0
		protected void ValidateNameContainsOnlyValidChars(PluginProfileErrorCollection errors)
		{
			if (!ProfileDtoValidator.IsValid(Name))
				errors.Add(new PluginProfileError
				{
					FieldName = NameField,
					Message = "You can only use letters, numbers, space and underscore symbol in Mashup name"
				});
		}
コード例 #41
0
		private bool StartRevisionShouldBeNumber(PluginProfileErrorCollection errors)
		{
			int result;
			if (!int.TryParse(StartRevision, out result))
			{
				errors.Add(new PluginProfileError{FieldName = StartRevisionField, Message = "Start Revision should be a number."});
				return false;
			}
			return true;
		}
		private static PluginProfileErrorCollection ValidateProfileForSeleniumUrl(PluginProfileDto profileDto)
		{
			var errors = new PluginProfileErrorCollection();
			if (string.IsNullOrEmpty(profileDto.Name) || string.IsNullOrEmpty(profileDto.Name.Trim()))
			{
				errors.Add(new PluginProfileError { FieldName = "Name", Message = "Profile name should not be empty" });
			}
			((TestRunImportPluginProfile)profileDto.Settings).ValidateSeleniumUrlData(errors);
			return errors;
		}
コード例 #43
0
 private void ValidateRolesMapping(PluginProfileErrorCollection errors)
 {
     if (RolesMapping.Any(x => x.Value == null || string.IsNullOrEmpty(x.Value.Name)))
     {
         errors.Add(new PluginProfileError
         {
             FieldName = RolesMappingField, Message = "All Bugzilla roles should be mapped to TP roles"
         });
     }
 }
コード例 #44
0
		private bool StartRevisionShouldNotBeEmpty(PluginProfileErrorCollection errors)
		{
			if (!RevisionSpecified)
			{
				errors.Add(new PluginProfileError{FieldName = StartRevisionField, Message = "Start Revision should not be empty."});
				return false;
			}

			return true;
		}
コード例 #45
0
		private bool StartRevisionShouldBeValidDate(PluginProfileErrorCollection errors)
		{
			DateTime result;
			if (!DateTime.TryParse(StartRevision, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AdjustToUniversal, out result))
			{
				errors.Add(new PluginProfileError {FieldName = StartRevisionField, Message = string.Format("Start Revision Date should be specified in mm/dd/yyyy format")});
				return false;
			}
			return true;
		}
コード例 #46
0
		private bool StartRevisionShouldBeNonNegative(PluginProfileErrorCollection errors)
		{
			int revisionNumber = int.Parse(StartRevision);
			if (revisionNumber < 0)
			{
				errors.Add(new PluginProfileError { FieldName = StartRevisionField, Message = "Start Revision cannot be less than zero." });
				return false;
			}
			return true;
		}
コード例 #47
0
 protected void ValidateNameContainsOnlyValidChars(PluginProfileErrorCollection errors)
 {
     if (!ProfileDtoValidator.IsValid(Name))
     {
         errors.Add(new PluginProfileError
         {
             FieldName = NameField,
             Message   = "You can only use letters, numbers, space and underscore symbol in Mashup name"
         });
     }
 }
コード例 #48
0
 private void ValidateNameHasValidCharacters(PluginProfileErrorCollection errors)
 {
     if (!IsValid(_dto.Name))
     {
         errors.Add(new PluginProfileError
                    	{
                    		FieldName = "Name",
                    		Message = "You can only use letters, numbers, space and underscore symbol in Profile Name"
                    	});
     }
 }
コード例 #49
0
 private void ValidateUniqueness(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
 {
     if (
         ProfileCollection.Any(
             x => string.Equals(x.Name.Value, pluginProfile.Name, StringComparison.InvariantCultureIgnoreCase)))
     {
         errors.Add(new PluginProfileError {
             FieldName = "Name", Message = "Profile name should be unique for plugin"
         });
     }
 }
コード例 #50
0
		private void ValidateRules(PluginProfileErrorCollection errors)
		{
			if (Rules.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "Rules", Message = "Rules should not be empty" });
			}
			else
			{
				ValidateRulesFormat(errors);
			}
		}
コード例 #51
0
		private void ValidateRulesFormat(PluginProfileErrorCollection errors)
		{
			var parser = ObjectFactory.GetInstance<RuleParser>();
			var parsed = parser.Parse(this);

			var stringRules = RuleParser.GetRuleLines(this);
			if(parsed.Count() != stringRules.Count())
			{
				errors.Add(new PluginProfileError { FieldName = "Rules", Message = "Invalid rules format" });
			}
		}
コード例 #52
0
 protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrEmpty(Name))
     {
         errors.Add(new PluginProfileError
         {
             FieldName = NameField,
             Message   = "Mashup name should be specified"
         });
     }
 }
コード例 #53
0
		private bool StartRevisionShouldNotExceedTheMax(PluginProfileErrorCollection errors)
		{
			DateTime result = DateTime.Parse(StartRevision, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AdjustToUniversal);
			if (result > GitRevisionId.UtcTimeMax)
			{
				errors.Add(new PluginProfileError
				{FieldName = StartRevisionField, Message = string.Format("Start Revision Date should be not behind {0}", GitRevisionId.UtcTimeMax.ToShortDateString())});
				return false;
			}
			return true;
		}
コード例 #54
0
		protected override void ExecuteConcreate(PluginProfileErrorCollection errors)
		{
			try
			{
				var url = new BugzillaUrl(ConnectionSettings);
				WebClient webClient = new TpWebClient(errors) {Encoding = Encoding.UTF8};
				webClient.DownloadString(url.Url);
			}
			catch (WebException webException)
			{
				if (webException.Status != WebExceptionStatus.TrustFailure)
				{
					errors.Add(new PluginProfileError { FieldName = BugzillaProfile.UrlField, Message = webException.Message, AdditionalInfo = ValidationErrorType.BugzillaNotFound.ToString() });
				}
			}
			catch (Exception exception)
			{
				errors.Add(new PluginProfileError {FieldName = BugzillaProfile.UrlField, Message = exception.Message, AdditionalInfo = ValidationErrorType.BugzillaNotFound.ToString()});
			}
		}
コード例 #55
0
 protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
 {
     if (string.IsNullOrWhiteSpace(Name))
     {
         errors.Add(new PluginProfileError
         {
             FieldName = NameField,
             Message   = "Mashup name cannot be empty or consist of whitespace characters only"
         });
     }
 }
コード例 #56
0
		public bugzilla_properties CheckConnection(BugzillaProfile profile)
		{
			var errors = new PluginProfileErrorCollection();
			try
			{
				var validators = new Queue<Validator>();

				var connectionValidator = new ConnectionValidator(profile);
				validators.Enqueue(connectionValidator);

				var scriptValidator = new ScriptValidator(profile);
				validators.Enqueue(scriptValidator);

				var responseValidator = new ResponseValidator(profile, scriptValidator);
				validators.Enqueue(responseValidator);

				var deserializeValidator = new DeserializeValidator(profile, responseValidator);
				validators.Enqueue(deserializeValidator);

				var settingsValidator = new SettingsValidator(profile, deserializeValidator);
				validators.Enqueue(settingsValidator);

				var savedQueryValidator = new SavedQueryValidator(profile);
				validators.Enqueue(savedQueryValidator);

				while (validators.Count > 0)
				{
					var validator = validators.Dequeue();
					validator.Execute(errors);
				}

				if (errors.Any())
				{
					throw new BugzillaPluginProfileException(profile, errors);
				}

				return deserializeValidator.Data;
			}
			catch (BugzillaPluginProfileException)
			{
				throw;
			}
			catch (Exception ex)
			{
				errors.Add(new PluginProfileError
					{
						FieldName = BugzillaProfile.ProfileField,
						Message = $"The connection with {profile} is failed. {ex.Message}"
					});
				throw new BugzillaPluginProfileException(profile, errors);
			}
		}
コード例 #57
0
		public void ValidateStartWorkItem(PluginProfileErrorCollection errors)
		{
			Int32 startWorkItem;
			if (!Int32.TryParse(StartWorkItem, out startWorkItem) || startWorkItem < 1)
			{
				errors.Add(new PluginProfileError
				{
					FieldName = StartWorkItemField,
					Message = string.Format("Specify a start workitem number in the range of 1 - 2147483647"),
					Status = PluginProfileErrorStatus.WrongRevisionNumberError
				});
			}
		}
		private static PluginProfileErrorCollection ValidateProfileForMapping(PluginProfileDto profileDto)
		{
			var errors = new PluginProfileErrorCollection();
			if (((TestRunImportPluginProfile)profileDto.Settings).PostResultsToRemoteUrl)
			{
				errors.Add(new PluginProfileError { FieldName = "Mapping", Message = "Check mapping is not available when results are posted to the remote Url" });
			}
			else
			{
				ObjectFactory.GetInstance<IMappingProfileValidator>().ValidateProfileForMapping(
					((TestRunImportPluginProfile) profileDto.Settings), errors);
			}
			return errors;
		}
コード例 #59
0
		private bool StartRevisionShouldBeNotLessThanMin(PluginProfileErrorCollection errors)
		{
			DateTime result = DateTime.Parse(StartRevision, CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AdjustToUniversal);
            if (result < MercurialRevisionId.UtcTimeMin)
			{
				errors.Add(new PluginProfileError
				{
				    FieldName = StartRevisionField, 
                    Message = string.Format("Start Revision Date should be not before {0}", MercurialRevisionId.UtcTimeMin.ToShortDateString())
				});
				return false;
			}
			return true;
		}
コード例 #60
0
		private static void CheckVersions(bugzilla_properties bugzillaProperties, PluginProfileErrorCollection errors)
		{
			if (!ScriptVersionIsValid(bugzillaProperties.script_version))
			{
				errors.Add(
					new PluginProfileError
						{
							Message = string.Format(
								TP2_CGI_IS_NOT_SUPPORTED_BY_THIS_PLUGIN,
								string.IsNullOrEmpty(bugzillaProperties.script_version) ? "undefined" : bugzillaProperties.script_version),
							AdditionalInfo = ValidationErrorType.InvalidTpCgiVersion.ToString()
						});
			}

			if (!errors.Any() && !BugzillaVersionIsSupported(bugzillaProperties.version))
			{
				errors.Add(new PluginProfileError
				           	{
				           		Message = string.Format(
				           			BUGZILLA_VERSION_IS_NOT_SUPPORTED_BY_PLUGIN,
				           			bugzillaProperties.version),
									AdditionalInfo = ValidationErrorType.InvalidBugzillaVersion.ToString()
				           	});
			}

			if (!errors.Any() && !ScriptSupportsProvidedBugzillaVersion(bugzillaProperties.version, bugzillaProperties.supported_bugzilla_version))
			{
				errors.Add(new PluginProfileError
				           	{
								Message = string.Format(
									BUGZILLA_VERSION_IS_NOT_SUPPORTED_BY_TP2_CGI,
									bugzillaProperties.version),
								AdditionalInfo = ValidationErrorType.InvalidTpCgiVersion.ToString()
							});
			}
		}