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); } }
/// <summary>Create a saved query on SlicingDice API</summary> /// <param name="query">The query to send to SlicingDice API</param> public Dictionary <string, dynamic> CreateSavedQuery(Dictionary <string, dynamic> query) { var url = this._baseUrl + URLResources.QuerySaved; var savedQuery = new SavedQueryValidator(query); if (savedQuery.Validator()) { return(this.MakeRequest(url, query, false, 2)); } return(null); }
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); } }