Search in sources :

Example 6 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class QualityGatesServiceTest method associate_project.

@Test
public void associate_project() {
    underTest.associateProject(new SelectWsRequest().setGateId(GATE_ID_VALUE).setProjectId(PROJECT_ID_VALUE).setProjectKey(PROJECT_KEY_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("select").hasParam(PARAM_GATE_ID, String.valueOf(GATE_ID_VALUE)).hasParam(PARAM_PROJECT_ID, String.valueOf(PROJECT_ID_VALUE)).hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 7 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class QualityGatesServiceTest method update_condition.

@Test
public void update_condition() {
    underTest.updateCondition(UpdateConditionRequest.builder().setConditionId(10).setMetricKey("metric").setOperator("LT").setWarning("warning").setError("error").setPeriod(1).build());
    PostRequest request = serviceTester.getPostRequest();
    assertThat(serviceTester.getPostParser()).isSameAs(UpdateConditionWsResponse.parser());
    serviceTester.assertThat(request).hasPath("update_condition").hasParam(PARAM_ID, 10).hasParam(PARAM_METRIC, "metric").hasParam(PARAM_OPERATOR, "LT").hasParam(PARAM_WARNING, "warning").hasParam(PARAM_ERROR, "error").hasParam(PARAM_PERIOD, 1).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 8 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class QualityGatesServiceTest method create_condition.

@Test
public void create_condition() {
    underTest.createCondition(CreateConditionRequest.builder().setQualityGateId(10).setMetricKey("metric").setOperator("LT").setWarning("warning").setError("error").setPeriod(1).build());
    PostRequest request = serviceTester.getPostRequest();
    assertThat(serviceTester.getPostParser()).isSameAs(CreateConditionWsResponse.parser());
    serviceTester.assertThat(request).hasPath("create_condition").hasParam(PARAM_GATE_ID, 10).hasParam(PARAM_METRIC, "metric").hasParam(PARAM_OPERATOR, "LT").hasParam(PARAM_WARNING, "warning").hasParam(PARAM_ERROR, "error").hasParam(PARAM_PERIOD, 1).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 9 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class FavoritesService method remove.

public void remove(String component) {
    PostRequest post = new PostRequest(path(ACTION_REMOVE)).setParam(PARAM_COMPONENT, component);
    call(post);
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest)

Example 10 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class FavoritesService method add.

public void add(String component) {
    PostRequest post = new PostRequest(path(ACTION_ADD)).setParam(PARAM_COMPONENT, component);
    call(post);
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest)

Aggregations

PostRequest (org.sonarqube.ws.client.PostRequest)44 Test (org.junit.Test)33 MimeMessage (javax.mail.internet.MimeMessage)2 Before (org.junit.Before)2 WsClient (org.sonarqube.ws.client.WsClient)2 WsResponse (org.sonarqube.ws.client.WsResponse)2 WiserMessage (org.subethamail.wiser.WiserMessage)2 ItUtils.newAdminWsClient (util.ItUtils.newAdminWsClient)2 ItUtils.newUserWsClient (util.ItUtils.newUserWsClient)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 SonarScanner (com.sonar.orchestrator.build.SonarScanner)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 BeforeClass (org.junit.BeforeClass)1 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)1 MessageException (org.sonar.api.utils.MessageException)1 QualityGate (org.sonar.wsclient.qualitygate.QualityGate)1 HttpException (org.sonarqube.ws.client.HttpException)1 Wiser (org.subethamail.wiser.Wiser)1 ProjectsPage (pageobjects.projects.ProjectsPage)1