Search in sources :

Example 1 with Param

use of org.sonar.api.server.ws.WebService.Param in project sonarqube by SonarSource.

the class IssueTagsActionTest method should_define.

@Test
public void should_define() {
    Action action = tester.controller("api/issues").action("tags");
    assertThat(action.description()).isNotEmpty();
    assertThat(action.responseExampleAsString()).isNotEmpty();
    assertThat(action.isPost()).isFalse();
    assertThat(action.isInternal()).isFalse();
    assertThat(action.handler()).isEqualTo(tagsAction);
    assertThat(action.params()).hasSize(2);
    Param query = action.param("q");
    assertThat(query.isRequired()).isFalse();
    assertThat(query.description()).isNotEmpty();
    assertThat(query.exampleValue()).isNotEmpty();
    Param pageSize = action.param("ps");
    assertThat(pageSize.isRequired()).isFalse();
    assertThat(pageSize.defaultValue()).isEqualTo("10");
    assertThat(pageSize.description()).isNotEmpty();
    assertThat(pageSize.exampleValue()).isNotEmpty();
}
Also used : Action(org.sonar.api.server.ws.WebService.Action) Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Example 2 with Param

use of org.sonar.api.server.ws.WebService.Param in project sonarqube by SonarSource.

the class ProvisionedActionTest method verify_definition.

@Test
public void verify_definition() {
    WebService.Action action = underTest.getDef();
    assertThat(action.description()).isEqualTo("Get the list of provisioned projects.<br /> " + "Require 'Create Projects' permission.");
    assertThat(action.since()).isEqualTo("5.2");
    assertThat(action.params()).hasSize(5);
    Param organization = action.param(PARAM_ORGANIZATION);
    assertThat(organization.description()).isEqualTo("The key of the organization");
    assertThat(organization.isInternal()).isTrue();
    assertThat(organization.isRequired()).isFalse();
    assertThat(organization.since()).isEqualTo("6.3");
}
Also used : WebService(org.sonar.api.server.ws.WebService) Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Example 3 with Param

use of org.sonar.api.server.ws.WebService.Param in project sonarqube by SonarSource.

the class DeleteCommentActionTest method verify_ws_def.

@Test
public void verify_ws_def() {
    assertThat(actionTester.getDef().isInternal()).isTrue();
    assertThat(actionTester.getDef().isPost()).isTrue();
    Param commentKeyParam = actionTester.getDef().param("comment");
    assertThat(commentKeyParam).isNotNull();
    assertThat(commentKeyParam.isRequired()).isTrue();
}
Also used : Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Example 4 with Param

use of org.sonar.api.server.ws.WebService.Param in project sonarqube by SonarSource.

the class EditCommentActionTest method verify_ws_def.

@Test
public void verify_ws_def() {
    assertThat(actionTester.getDef().isInternal()).isTrue();
    assertThat(actionTester.getDef().isPost()).isTrue();
    Param commentKeyParam = actionTester.getDef().param("comment");
    assertThat(commentKeyParam).isNotNull();
    assertThat(commentKeyParam.isRequired()).isTrue();
    Param textParam = actionTester.getDef().param("text");
    assertThat(textParam).isNotNull();
    assertThat(textParam.isRequired()).isTrue();
    assertThat(textParam.maximumLength()).isEqualTo(1000);
}
Also used : Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Example 5 with Param

use of org.sonar.api.server.ws.WebService.Param in project sonarqube by SonarSource.

the class ComponentTagsActionTest method should_define.

@Test
public void should_define() {
    Action action = tester.getDef();
    assertThat(action.description()).isNotEmpty();
    assertThat(action.responseExampleAsString()).isNotEmpty();
    assertThat(action.isPost()).isFalse();
    assertThat(action.isInternal()).isTrue();
    assertThat(action.handler()).isEqualTo(underTest);
    assertThat(action.params()).hasSize(3);
    Param query = action.param("componentUuid");
    assertThat(query.isRequired()).isTrue();
    assertThat(query.description()).isNotEmpty();
    assertThat(query.exampleValue()).isNotEmpty();
    Param createdAfter = action.param("createdAfter");
    assertThat(createdAfter.isRequired()).isFalse();
    assertThat(createdAfter.description()).isNotEmpty();
    assertThat(createdAfter.exampleValue()).isNotEmpty();
    Param pageSize = action.param("ps");
    assertThat(pageSize.isRequired()).isFalse();
    assertThat(pageSize.defaultValue()).isEqualTo("10");
    assertThat(pageSize.description()).isNotEmpty();
    assertThat(pageSize.exampleValue()).isNotEmpty();
}
Also used : Action(org.sonar.api.server.ws.WebService.Action) Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)19 Param (org.sonar.api.server.ws.WebService.Param)19 WebService (org.sonar.api.server.ws.WebService)13 Action (org.sonar.api.server.ws.WebService.Action)4