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}); }
private void ValidateTasksList(PluginProfileErrorCollection errors) { if(TasksList.IsNullOrWhitespace()) { errors.Add(new PluginProfileError { FieldName = "TasksList", Message = "Task list shoud not be empty" }); } }
public void Execute(PluginProfileErrorCollection errors) { if (errors.Any()) return; ExecuteConcreate(errors); }
private void ValidatePassword(PluginProfileErrorCollection errors) { if (Password.IsNullOrWhitespace()) { errors.Add(new PluginProfileError { FieldName = "Password", Message = "Password should not be empty" }); } }
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 }); }
private void ValidateCommand(PluginProfileErrorCollection errors) { if(CommandName.IsNullOrWhitespace()) { errors.Add(new PluginProfileError { FieldName = "CommandName", Message = "Command name shoud not be empty" }); } }
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" }); } }
private void ValidateNameIsNotEmpty(PluginProfileErrorCollection errors) { if (_dto.Name.IsNullOrWhitespace()) { errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile Name is required"}); } }
private void ValidateAuthTokenUserId(PluginProfileErrorCollection errors) { if (AuthTokenUserId <= 0) { errors.Add(new PluginProfileError { FieldName = "AuthTokenUserId", Message = "User for authentication should be specified" }); } }
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}); }
protected static void HandleErrors(PluginProfileErrorCollection errors) { if (!errors.Empty()) { throw new PluginProfileValidationException(errors); } }
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); } }
private void ValidateSettings(PluginProfileErrorCollection errors) { var settings = _dto.Settings as IValidatable; if (settings != null) { settings.Validate(errors); } }
public void Validate(PluginProfileErrorCollection errors) { ValidateNameIsNotEmpty(errors); ValidateNameHasValidCharacters(errors); ValidateSettings(errors); }
public void Validate(PluginProfileErrorCollection errors) { ValidateProject(errors); ValidateCommand(errors); ValidateTasksList(errors); }
public void ValidateMapperData(PluginProfileErrorCollection errors) { ValidateResultsFilePathForMapping(errors); ValidateProject(errors); ValidateTestPlan(errors); ValidateFramework(errors); ValidateRegExp(errors); }
public override void CheckRevision(RevisionId revision, PluginProfileErrorCollection errors) { GitRevisionId revisionId = revision; if (revisionId.Time > GitRevisionId.UtcTimeMax) { _errorResolver.HandleConnectionError(new InvalidRevisionException(), errors); } }
public void ValidateConnection(PluginProfileErrorCollection errors) { ValidateProtocol(errors); ValidateMailServer(errors); ValidatePort(errors); ValidateLogin(errors); ValidatePassword(errors); }
public void Validate(PluginProfileErrorCollection errors) { var logger = ObjectFactory.TryGetInstance<IActivityLogger>(); if (logger != null) { logger.Info("validation is in progress"); } }
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; }
public PluginProfileErrorCollection ValidateUpdate(MashupManagerProfile profile) { var errors = new PluginProfileErrorCollection(); ValidateNameNotEmpty(errors); ValidateNameContainsOnlyValidChars(errors); return errors; }
protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors) { if (string.IsNullOrEmpty(Name)) errors.Add(new PluginProfileError { FieldName = NameField, Message = "Mashup name should be specified" }); }
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" }); }
public void Validate(PluginProfileErrorCollection errors) { ValidateUri(errors); ValidateStartRevision(errors); ValidateUserMapping(errors); if (WorkItemsEnabled) ValidateStartWorkItem(errors); }
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" }); }
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"}); } }
protected override void CheckStartRevision(GitPluginProfile settings, IVersionControlSystem versionControlSystem, PluginProfileErrorCollection errors) { settings.ValidateStartRevision(errors); }
public void CheckConnection(PluginProfileErrorCollection errors) { }
public void Validate(PluginProfileErrorCollection errors) { ValidateCredentials(errors); ValidateMappings(errors); }
public bool ValidateStartRevision(PluginProfileErrorCollection errors) { return(StartRevisionShouldBeValidDate(errors) && (StartRevisionShouldBeNotLessThanMin(errors) && StartRevisionShouldNotExceedTheMax(errors))); }
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>() }); }
public void CheckRevision(RevisionId revision, PluginProfileErrorCollection errors) { }
public virtual void Validate(PluginProfileErrorCollection errors) { ValidateConnection(errors); }
public void ValidateMappings(PluginProfileErrorCollection errors) { ValidateUserMapping(errors); ValidateRolesMapping(errors); }
protected abstract void CheckStartRevision(TVcsPluginProfile settings, IVersionControlSystem versionControlSystem, PluginProfileErrorCollection errors);
protected virtual void OnCheckConnection(PluginProfileErrorCollection errors, TVcsPluginProfile settings) { var vcs = CreateVcs(settings); CheckStartRevision(settings, vcs, errors); }
protected override void ExecuteConcreate(PluginProfileErrorCollection errors) { CheckVersions(_deserializeValidator.Data, errors); }
protected abstract void ExecuteConcreate(PluginProfileErrorCollection errors);
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(); } } } }
public void ValidateProfileForMapping(TestRunImportPluginProfile settings, PluginProfileErrorCollection errors) { settings.ValidateMapperData(errors); }
public void CheckConnection(ConnectionSettings settings, PluginProfileErrorCollection errors) { }
public override void Validate(PluginProfileErrorCollection errors) { base.Validate(errors); ValidateRules(errors); }
protected static void ValidateProfile(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors) { new ProfileDtoValidator(pluginProfile).Validate(errors); }
public bool ValidateStartRevision(PluginProfileErrorCollection errors) { return(StartRevisionShouldNotBeEmpty(errors) && StartRevisionShouldBeNumber(errors) && StartRevisionShouldBeNonNegative(errors)); }
public void ValidateUri(PluginProfileErrorCollection errors) { ValidateUriIsNotEmpty(errors); ValidateUriFormat(errors); }
public void Validate(PluginProfileErrorCollection errors) { }
public void Validate(PluginProfileErrorCollection errors) { ValidateUri(errors); ValidateStartRevision(errors); ValidateUserMapping(errors); }
private static void HandleConnectionError(PluginProfileErrorCollection errors) { errors.Add(new PluginProfileError { FieldName = ConnectionSettings.UriField, Message = "Bad url format." }); }
public BugzillaPluginProfileException(BugzillaProfile bugzillaProfile, PluginProfileErrorCollection errorCollection) { _bugzillaProfile = bugzillaProfile; ErrorCollection = errorCollection; }
public TpWebClient(PluginProfileErrorCollection errors) { _errors = errors; }