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});
		}
コード例 #2
0
		private void ValidateTasksList(PluginProfileErrorCollection errors)
		{
			if(TasksList.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "TasksList", Message = "Task list shoud not be empty" });
			}
		}
コード例 #3
0
		public void Execute(PluginProfileErrorCollection errors)
		{
			if (errors.Any())
				return;

			ExecuteConcreate(errors);
		}
コード例 #4
0
		private void ValidatePassword(PluginProfileErrorCollection errors)
		{
			if (Password.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "Password", Message = "Password should not be empty" });
			}
		}
コード例 #5
0
		private void ValidateLogin(PluginProfileErrorCollection errors)
		{
			if (Login.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "Login", Message = "Login should not be empty" });
			}
		}
		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 });
		}
コード例 #7
0
		private void ValidateCommand(PluginProfileErrorCollection errors)
		{
			if(CommandName.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "CommandName", Message = "Command name shoud not be empty" });
			}
		}
コード例 #8
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}")));
			}
		}
		private void ValidateProject(PluginProfileErrorCollection errors)
		{
			if (Project <= 0)
			{
				errors.Add(new PluginProfileError { FieldName = "Project", Message = "Project should be specified" });
			}
		}
コード例 #10
0
 private void ValidateNameIsNotEmpty(PluginProfileErrorCollection errors)
 {
     if (_dto.Name.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile Name is required"});
     }
 }
コード例 #11
0
		private void ValidateAuthTokenUserId(PluginProfileErrorCollection errors)
		{
			if (AuthTokenUserId <= 0)
			{
				errors.Add(new PluginProfileError { FieldName = "AuthTokenUserId", Message = "User for authentication should be specified" });
			}
		}
コード例 #12
0
		private void ValidateTestPlan(PluginProfileErrorCollection errors)
		{
			if (TestPlan <= 0)
			{
				errors.Add(new PluginProfileError { FieldName = "TestPlan", Message = "Test Plan should be specified" });
			}
		}
		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});
		}
コード例 #14
0
		protected static void HandleErrors(PluginProfileErrorCollection errors)
		{
			if (!errors.Empty())
			{
				throw new PluginProfileValidationException(errors);
			}
		}
コード例 #15
0
		public override void CheckRevision(RevisionId revision, PluginProfileErrorCollection errors)
		{
			TfsRevisionId revisionId = revision;
			if (Int32.Parse(revisionId.Value) <= 0 || Int32.Parse(revisionId.Value) > Int32.MaxValue)
			{
				_errorResolver.HandleConnectionError(new InvalidRevisionException(), errors);
			}
		}
コード例 #16
0
 private void ValidateSettings(PluginProfileErrorCollection errors)
 {
     var settings = _dto.Settings as IValidatable;
     if (settings != null)
     {
         settings.Validate(errors);
     }
 }
コード例 #17
0
        public void Validate(PluginProfileErrorCollection errors)
        {
            ValidateNameIsNotEmpty(errors);

            ValidateNameHasValidCharacters(errors);

            ValidateSettings(errors);
        }
コード例 #18
0
		public void Validate(PluginProfileErrorCollection errors)
		{
			ValidateProject(errors);

			ValidateCommand(errors);

			ValidateTasksList(errors);
		}
コード例 #19
0
		public void ValidateMapperData(PluginProfileErrorCollection errors)
		{
			ValidateResultsFilePathForMapping(errors);
			ValidateProject(errors);
			ValidateTestPlan(errors);
			ValidateFramework(errors);
			ValidateRegExp(errors);
		}
コード例 #20
0
		public override void CheckRevision(RevisionId revision, PluginProfileErrorCollection errors)
		{
			GitRevisionId revisionId = revision;
			if (revisionId.Time > GitRevisionId.UtcTimeMax)
			{
				_errorResolver.HandleConnectionError(new InvalidRevisionException(), errors);
			}
		}
コード例 #21
0
		public void ValidateConnection(PluginProfileErrorCollection errors)
		{
			ValidateProtocol(errors);
			ValidateMailServer(errors);
			ValidatePort(errors);
			ValidateLogin(errors);
			ValidatePassword(errors);
		}
コード例 #22
0
		public void Validate(PluginProfileErrorCollection errors)
		{
			var logger = ObjectFactory.TryGetInstance<IActivityLogger>();
			if (logger != null)
			{
				logger.Info("validation is in progress");
			}
		}
コード例 #23
0
		private static void CheckConnection(ConnectionSettings settings, PluginProfileErrorCollection errors)
		{
			using (IEmailClient client = new MailBeePop3EmailClient(settings))
			{
				client.CheckConnection(errors);
				client.Disconnect();
			}
		}
		private static PluginProfileErrorCollection Add(PluginProfileErrorCollection errors, Exception e)
		{
			errors.Add(new PluginProfileError
			{
				Message = e.Message
			});
			return errors;
		}
コード例 #25
0
		public PluginProfileErrorCollection ValidateUpdate(MashupManagerProfile profile)
		{
			var errors = new PluginProfileErrorCollection();

			ValidateNameNotEmpty(errors);
			ValidateNameContainsOnlyValidChars(errors);

			return errors;
		}
コード例 #26
0
		protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
		{
			if (string.IsNullOrEmpty(Name))
				errors.Add(new PluginProfileError
				{
					FieldName = NameField,
					Message = "Mashup name should be specified"
				});
		}
コード例 #27
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"
				});
		}
コード例 #28
0
		public void Validate(PluginProfileErrorCollection errors)
		{
			ValidateUri(errors);
			ValidateStartRevision(errors);
			ValidateUserMapping(errors);

			if (WorkItemsEnabled)
				ValidateStartWorkItem(errors);
		}
コード例 #29
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"
				});
		}
コード例 #30
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"});
			}
		}
コード例 #31
0
 protected override void CheckStartRevision(GitPluginProfile settings, IVersionControlSystem versionControlSystem, PluginProfileErrorCollection errors)
 {
     settings.ValidateStartRevision(errors);
 }
コード例 #32
0
 public void CheckConnection(PluginProfileErrorCollection errors)
 {
 }
コード例 #33
0
 public void Validate(PluginProfileErrorCollection errors)
 {
     ValidateCredentials(errors);
     ValidateMappings(errors);
 }
コード例 #34
0
 public bool ValidateStartRevision(PluginProfileErrorCollection errors)
 {
     return(StartRevisionShouldBeValidDate(errors) && (StartRevisionShouldBeNotLessThanMin(errors) && StartRevisionShouldNotExceedTheMax(errors)));
 }
コード例 #35
0
        public CheckMappingResult CheckMapping(TestRunImportPluginProfile settings,
                                               IEnumerable <TestCaseTestPlanDTO> testCaseTestPlans,
                                               PluginProfileErrorCollection errors)
        {
            try
            {
                var uri = settings.FrameworkType == FrameworkTypes.FrameworkTypes.JenkinsHudson
                                                ? new Uri(string.Format("{0}/lastCompletedBuild/testReport/api/xml", settings.ResultsFilePath.TrimEnd(new[] { '/', '\\' })))
                                                : new Uri(settings.ResultsFilePath);
                var factoryResult = _streamFactory.OpenStream(uri, settings.PassiveMode);

                if (factoryResult != null)
                {
                    using (factoryResult.Stream)
                    {
                        using (var reader = new StreamReader(factoryResult.Stream))
                        {
                            try
                            {
                                var result = _resultsReaderFactory.GetResolver(settings, reader).GetTestRunImportResults();
                                if (result.Count > 0)
                                {
                                    var resolver = _resolverFactory.GetResolver(settings, result, testCaseTestPlans);
                                    return(resolver.ResolveTestCaseNames(errors));
                                }
                            }
                            catch (ApplicationException)
                            {
                                throw;
                            }
                            catch (XmlException ex)
                            {
                                throw new ApplicationException("Error parsing NUnit results XML file", ex);
                            }
                            catch (Exception ex)
                            {
                                throw new ApplicationException("Error importing NUnit results XML file", ex);
                            }
                        }
                    }
                }
            }
            catch (UriFormatException ex)
            {
                errors.Add(new PluginProfileError
                {
                    FieldName = "ResultsFilePath",
                    Message   = ex.Message
                });
            }
            catch (ApplicationException ex)
            {
                errors.Add(new PluginProfileError
                {
                    FieldName = "ResultsFilePath",
                    Message   = ex.Message
                });
            }
            catch (Exception ex)
            {
                errors.Add(new PluginProfileError
                {
                    FieldName = "ResultsFilePath",
                    Message   = string.Format("Could not read file \"{0}\": {1}", settings.ResultsFilePath, ex.Message)
                });
            }
            return(new CheckMappingResult {
                Errors = errors, NamesMappers = new List <NamesMapper>()
            });
        }
コード例 #36
0
 public void CheckRevision(RevisionId revision, PluginProfileErrorCollection errors)
 {
 }
コード例 #37
0
 public virtual void Validate(PluginProfileErrorCollection errors)
 {
     ValidateConnection(errors);
 }
コード例 #38
0
 public void ValidateMappings(PluginProfileErrorCollection errors)
 {
     ValidateUserMapping(errors);
     ValidateRolesMapping(errors);
 }
コード例 #39
0
 protected abstract void CheckStartRevision(TVcsPluginProfile settings, IVersionControlSystem versionControlSystem,
                                            PluginProfileErrorCollection errors);
コード例 #40
0
        protected virtual void OnCheckConnection(PluginProfileErrorCollection errors, TVcsPluginProfile settings)
        {
            var vcs = CreateVcs(settings);

            CheckStartRevision(settings, vcs, errors);
        }
コード例 #41
0
 protected override void ExecuteConcreate(PluginProfileErrorCollection errors)
 {
     CheckVersions(_deserializeValidator.Data, errors);
 }
コード例 #42
0
 protected abstract void ExecuteConcreate(PluginProfileErrorCollection errors);
コード例 #43
0
        protected override void OnCheckConnection(PluginProfileErrorCollection errors, TfsPluginProfile settings)
        {
            settings.ValidateStartRevision(errors);
            settings.ValidateUri(errors);

            if (!errors.Any())
            {
                TfsTeamProjectCollection collection = null;

                try
                {
                    TfsConnectionParameters parameters = TfsConnectionHelper.GetTfsConnectionParameters(settings);

                    switch (parameters.SegmentsCount)
                    {
                    case UriTfsProjectCollection:
                    {
                        collection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential);
                        collection.EnsureAuthenticated();
                        collection.Connect(ConnectOptions.None);

                        var vcs = collection.GetService <VersionControlServer>();
                        CheckChangeset(settings, vcs);

                        break;
                    }

                    case UriTfsTeamProject:
                    {
                        collection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential);
                        collection.EnsureAuthenticated();
                        collection.Connect(ConnectOptions.None);

                        var         vcs         = collection.GetService <VersionControlServer>();
                        TeamProject teamProject = vcs.GetTeamProject(parameters.TeamProjectName);

                        CheckChangeset(settings, vcs, teamProject);

                        break;
                    }

                    default:
                        errors.Add(new PluginProfileError {
                            FieldName = "Uri", Message = "Could not connect to server."
                        });
                        break;
                    }
                }
                catch (TeamFoundationServerUnauthorizedException e)
                {
                    errors.Add(
                        new PluginProfileError
                    {
                        Status         = PluginProfileErrorStatus.WrongCredentialsError,
                        FieldName      = "Login",
                        Message        = "Authorization failed.",
                        AdditionalInfo = e.Message
                    });
                    errors.Add(
                        new PluginProfileError
                    {
                        Status         = PluginProfileErrorStatus.WrongCredentialsError,
                        FieldName      = "Password",
                        Message        = "Authorization failed.",
                        AdditionalInfo = e.Message
                    });
                }
                catch (ResourceAccessException e)
                {
                    errors.Add(new PluginProfileError
                    {
                        AdditionalInfo = e.Message,
                        FieldName      = "Uri",
                        Message        = "Resource access denied",
                        Status         = PluginProfileErrorStatus.Error
                    });
                }
                catch (ChangesetNotFoundException e)
                {
                    errors.Add(new PluginProfileError
                    {
                        AdditionalInfo = e.Message,
                        FieldName      = "StartRevision",
                        Message        = "There’s no such revision.",
                        Status         = PluginProfileErrorStatus.UnexistedRevisionWarning
                    });
                }
                catch (TeamFoundationServiceUnavailableException e)
                {
                    errors.Add(new PluginProfileError
                    {
                        AdditionalInfo = e.Message,
                        FieldName      = "Uri",
                        Message        = "Could not connect to server.",
                    });
                }
                finally
                {
                    if (collection != null)
                    {
                        collection.Dispose();
                    }
                }
            }
        }
コード例 #44
0
 public void ValidateProfileForMapping(TestRunImportPluginProfile settings, PluginProfileErrorCollection errors)
 {
     settings.ValidateMapperData(errors);
 }
コード例 #45
0
 public void CheckConnection(ConnectionSettings settings, PluginProfileErrorCollection errors)
 {
 }
コード例 #46
0
 public override void Validate(PluginProfileErrorCollection errors)
 {
     base.Validate(errors);
     ValidateRules(errors);
 }
コード例 #47
0
 protected static void ValidateProfile(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
 {
     new ProfileDtoValidator(pluginProfile).Validate(errors);
 }
コード例 #48
0
 public bool ValidateStartRevision(PluginProfileErrorCollection errors)
 {
     return(StartRevisionShouldNotBeEmpty(errors) && StartRevisionShouldBeNumber(errors) && StartRevisionShouldBeNonNegative(errors));
 }
コード例 #49
0
 public void ValidateUri(PluginProfileErrorCollection errors)
 {
     ValidateUriIsNotEmpty(errors);
     ValidateUriFormat(errors);
 }
コード例 #50
0
 public void Validate(PluginProfileErrorCollection errors)
 {
 }
コード例 #51
0
 public void Validate(PluginProfileErrorCollection errors)
 {
     ValidateUri(errors);
     ValidateStartRevision(errors);
     ValidateUserMapping(errors);
 }
コード例 #52
0
 private static void HandleConnectionError(PluginProfileErrorCollection errors)
 {
     errors.Add(new PluginProfileError {
         FieldName = ConnectionSettings.UriField, Message = "Bad url format."
     });
 }
コード例 #53
0
 public BugzillaPluginProfileException(BugzillaProfile bugzillaProfile, PluginProfileErrorCollection errorCollection)
 {
     _bugzillaProfile = bugzillaProfile;
     ErrorCollection  = errorCollection;
 }
コード例 #54
0
 public TpWebClient(PluginProfileErrorCollection errors)
 {
     _errors = errors;
 }