Exemple #1
0
    public void NullPasswordCredentials()
    {
        string baseUri  = "http://sonarqube.test.de/";
        string username = "******";
        string password = null;

        SqProjectUriBuilder uri = new SqProjectUriBuilder(baseUri);

        uri.UserCredentials(username, password);

        Assert.AreEqual(baseUri + "api/projects/index", uri.GetSqUri().ToString());
    }
Exemple #2
0
    public void CredentialsInsertedCorrect()
    {
        string baseUri  = "http://sonarqube.test.de/";
        string username = "******";
        string password = "******";

        SqProjectUriBuilder uri = new SqProjectUriBuilder(baseUri);

        uri.UserCredentials(username, password);

        Assert.AreEqual("http://" + username + ":" + password + "@" + "sonarqube.test.de/api/projects/index", uri.GetSqUri().ToString());
    }
Exemple #3
0
        /// <summary>
        /// Load List of SonarQube Projects from the predefined Uri.
        /// Depends on the Permissionlevel in SonarQube.
        /// </summary>
        /// <param name="callback">Function with List of Projects (can be empty) and long HTML Error Code.</param>
        public void LoadOnlineProjects(Action <List <SQProject>, long> callback)
        {
            SqProjectUriBuilder uriBuilder = new SqProjectUriBuilder(model.GetBaseUrl());

            if (model.GetUsername() != "" && model.GetPassword() != "")
            {
                uriBuilder.UserCredentials(model.GetUsername(), model.GetPassword());
            }

            StartCoroutine(WebInterface.WebRequest <ArrayResponseSQProject>(
                               uriBuilder.GetSqUri(),
                               (res, err) =>
            {
                Debug.Log("LoadProjectList ResponseCode: " + err);
                List <SQProject> projects = new List <SQProject>(res.array);
                projects.Sort();
                callback(projects, err);
            }));
        }