Esempio n. 1
0
    public void UriIsSetCorrect()
    {
        string baseUri = "http://sonarqube.test.de/";

        SqProjectUriBuilder uri = new SqProjectUriBuilder(baseUri);

        Assert.AreEqual(baseUri + "api/projects/index", uri.GetSqUri().ToString());
    }
Esempio n. 2
0
    public void IsQueryAppendedCorrect()
    {
        string baseUri = "http://sonarqube.test.de/";
        string query   = "key=value";

        SqProjectUriBuilder uri = new SqProjectUriBuilder(baseUri);

        uri.AppendToQuery(query);

        Assert.AreEqual(baseUri + "api/projects/index" + "?" + query, uri.GetSqUri().ToString());
    }
Esempio n. 3
0
    public void IsPathAppendedCorrect()
    {
        string baseUri  = "http://sonarqube.test.de/";
        string toAppend = "some/path/";

        SqProjectUriBuilder uri = new SqProjectUriBuilder(baseUri);

        uri.AppendToPath(toAppend);

        Assert.AreEqual(baseUri + "api/projects/index/" + toAppend, uri.GetSqUri().ToString());
    }
Esempio n. 4
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());
    }
Esempio n. 5
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);
            }));
        }
Esempio n. 6
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());
    }
Esempio n. 7
0
    public void AreMultipleQuerysAppendedCorrect()
    {
        string baseUri      = "http://sonarqube.test.de/";
        string query        = "key=value";
        string alsoToAppend = "anotherKey=anotherValue";

        SqProjectUriBuilder uri = new SqProjectUriBuilder(baseUri);

        uri.AppendToQuery(query);
        uri.AppendToQuery(alsoToAppend);

        Assert.AreEqual(baseUri + "api/projects/index" + "?" + query + "&" + alsoToAppend, uri.GetSqUri().ToString());
    }