public bugzilla_properties CheckConnection(BugzillaProfile profile) { var errors = new PluginProfileErrorCollection(); try { SetServerCertificateValidationCallback(profile); 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 = string.Format("The connection with {0} is failed. {1}", profile, ex.Message) }); throw new BugzillaPluginProfileException(profile, errors); } }
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 = string.Format("The connection with {0} is failed. {1}", profile, ex.Message) }); throw new BugzillaPluginProfileException(profile, errors); } }
public BugzillaService(IStorageRepository storageRepository) { _storageRepository = storageRepository; _bugzillaProfile = _storageRepository.GetProfile<BugzillaProfile>(); }
public RemoteCertificateValidator(BugzillaProfile profile) { _profile = profile; }
private void SetServerCertificateValidationCallback(BugzillaProfile profile) { if (ServicePointManager.ServerCertificateValidationCallback == null) { var validator = new RemoteCertificateValidator(profile); ServicePointManager.ServerCertificateValidationCallback = validator.ValidateRemoteCertificate; } }
public BugzillaPluginProfileException(BugzillaProfile bugzillaProfile, PluginProfileErrorCollection errorCollection) { _bugzillaProfile = bugzillaProfile; ErrorCollection = errorCollection; }
public BugzillaService(IStorageRepository storageRepository) { _storageRepository = storageRepository; _bugzillaProfile = _storageRepository.GetProfile <BugzillaProfile>(); }