Search in sources :

Example 11 with Param

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

the class GroupsActionTest method verify_definition.

@Test
public void verify_definition() {
    WebService.Action action = ws.getDef();
    assertThat(action.since()).isEqualTo("5.2");
    assertThat(action.isPost()).isFalse();
    assertThat(action.isInternal()).isFalse();
    assertThat(action.responseExampleAsString()).isNotEmpty();
    assertThat(action.params()).extracting(Param::key).containsOnly("p", "q", "ps", "login", "selected");
    WebService.Param qualifiers = action.param("login");
    assertThat(qualifiers.isRequired()).isTrue();
}
Also used : WebService(org.sonar.api.server.ws.WebService) Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Example 12 with Param

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

the class SetTagsActionTest method should_define.

@Test
public void should_define() {
    Action action = tester.controller("api/issues").action("set_tags");
    assertThat(action.description()).isNotEmpty();
    assertThat(action.responseExampleAsString()).isNotEmpty();
    assertThat(action.isPost()).isTrue();
    assertThat(action.isInternal()).isFalse();
    assertThat(action.handler()).isEqualTo(sut);
    assertThat(action.params()).hasSize(2);
    Param query = action.param("issue");
    assertThat(query.isRequired()).isTrue();
    assertThat(query.description()).isNotEmpty();
    assertThat(query.exampleValue()).isNotEmpty();
    Param pageSize = action.param("tags");
    assertThat(pageSize.isRequired()).isFalse();
    assertThat(pageSize.defaultValue()).isNull();
    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 13 with Param

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

the class GhostsActionTest method verify_definition.

@Test
public void verify_definition() {
    WebService.Action action = underTest.getDef();
    assertThat(action.description()).isEqualTo("List ghost projects.<br /> Requires 'Administer System' permission.");
    assertThat(action.since()).isEqualTo("5.2");
    assertThat(action.isInternal()).isFalse();
    assertThat(action.params()).hasSize(5);
    Param organization = action.param("organization");
    assertThat(organization.description()).isEqualTo("the organization key");
    assertThat(organization.since()).isEqualTo("6.3");
    assertThat(organization.isRequired()).isFalse();
    assertThat(organization.isInternal()).isTrue();
}
Also used : WebService(org.sonar.api.server.ws.WebService) Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Example 14 with Param

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

the class SearchEventsActionTest method definition.

@Test
public void definition() {
    WebService.Action definition = ws.getDef();
    assertThat(definition.key()).isEqualTo("search_events");
    assertThat(definition.description()).isNotEmpty();
    assertThat(definition.isPost()).isFalse();
    assertThat(definition.isInternal()).isTrue();
    assertThat(definition.since()).isEqualTo("1.0");
    assertThat(definition.description()).isNotEmpty();
    assertThat(definition.responseExampleAsString()).isNotEmpty();
    assertThat(definition.params()).extracting(Param::key).containsOnly("projects", "from");
    Param projects = definition.param("projects");
    assertThat(projects.isRequired()).isTrue();
    assertThat(projects.exampleValue()).isEqualTo("my_project,another_project");
    assertThat(definition.param("from").isRequired()).isTrue();
}
Also used : WebService(org.sonar.api.server.ws.WebService) Param(org.sonar.api.server.ws.WebService.Param) Test(org.junit.Test)

Example 15 with Param

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

the class TreeActionTest method verify_definition.

@Test
public void verify_definition() {
    WebService.Action action = ws.getDef();
    assertThat(action.since()).isEqualTo("5.4");
    assertThat(action.description()).isNotNull();
    assertThat(action.responseExample()).isNotNull();
    assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder(tuple("7.6", "The use of 'BRC' as value for parameter 'qualifiers' is deprecated"), tuple("7.6", "The use of module keys in parameter 'component' is deprecated"));
    assertThat(action.params()).extracting(Param::key).containsExactlyInAnyOrder("component", "branch", "pullRequest", "qualifiers", "strategy", "q", "s", "p", "asc", "ps");
    Param component = action.param(PARAM_COMPONENT);
    assertThat(component.isRequired()).isTrue();
    assertThat(component.description()).isNotNull();
    assertThat(component.exampleValue()).isNotNull();
    Param branch = action.param(PARAM_BRANCH);
    assertThat(branch.isInternal()).isFalse();
    assertThat(branch.isRequired()).isFalse();
    assertThat(branch.since()).isEqualTo("6.6");
}
Also used : WebService(org.sonar.api.server.ws.WebService) 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