Search in sources :

Example 36 with PostRequest

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

the class PermissionsServiceTest method bulk_apply_template.

@Test
public void bulk_apply_template() {
    underTest.bulkApplyTemplate(new BulkApplyTemplateWsRequest().setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE).setQualifier(QUALIFIER_VALUE).setQuery(QUERY_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("bulk_apply_template").hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE).hasParam("q", QUERY_VALUE).hasParam(PARAM_QUALIFIER, QUALIFIER_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 37 with PostRequest

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

the class PermissionsServiceTest method removeUserFromTemplate_does_POST_on_Ws_remove_user_from_template.

@Test
public void removeUserFromTemplate_does_POST_on_Ws_remove_user_from_template() {
    underTest.removeUserFromTemplate(new RemoveUserFromTemplateWsRequest().setPermission(PERMISSION_VALUE).setLogin(LOGIN_VALUE).setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("remove_user_from_template").hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_USER_LOGIN, LOGIN_VALUE).hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 38 with PostRequest

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

the class PermissionsServiceTest method add_project_creator_to_template.

@Test
public void add_project_creator_to_template() {
    underTest.addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest.builder().setPermission(PERMISSION_VALUE).setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE).build());
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest getRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(getRequest).hasPath("add_project_creator_to_template").hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 39 with PostRequest

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

the class PermissionsServiceTest method addUserToTemplate_does_POST_on_Ws_add_user_to_template.

@Test
public void addUserToTemplate_does_POST_on_Ws_add_user_to_template() {
    underTest.addUserToTemplate(new AddUserToTemplateWsRequest().setPermission(PERMISSION_VALUE).setLogin(LOGIN_VALUE).setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("add_user_to_template").hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_USER_LOGIN, LOGIN_VALUE).hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 40 with PostRequest

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

the class PermissionsServiceTest method addGroupToTemplate_does_POST_on_Ws_add_group_to_template.

@Test
public void addGroupToTemplate_does_POST_on_Ws_add_group_to_template() {
    underTest.addGroupToTemplate(new AddGroupToTemplateWsRequest().setGroupId(GROUP_ID_VALUE).setGroupName(GROUP_NAME_VALUE).setPermission(PERMISSION_VALUE).setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("add_group_to_template").hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE).hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE).hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

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