Search in sources :

Example 1 with TagsResponse

use of org.sonarqube.ws.Issues.TagsResponse in project sonarqube by SonarSource.

the class TagsActionTest method return_limited_size.

@Test
public void return_limited_size() {
    RuleDefinitionDto rule = db.rules().insertIssueRule();
    ComponentDto project = db.components().insertPrivateProject();
    db.issues().insertIssue(rule, project, project, issue -> issue.setTags(asList("tag1", "tag2")));
    db.issues().insertIssue(rule, project, project, issue -> issue.setTags(asList("tag3", "tag4", "tag5")));
    indexIssues();
    permissionIndexer.allowOnlyAnyone(project);
    TagsResponse result = ws.newRequest().setParam("ps", "2").executeProtobuf(TagsResponse.class);
    assertThat(result.getTagsList()).containsExactly("tag1", "tag2");
}
Also used : TagsResponse(org.sonarqube.ws.Issues.TagsResponse) ComponentDto(org.sonar.db.component.ComponentDto) RuleDefinitionDto(org.sonar.db.rule.RuleDefinitionDto) Test(org.junit.Test)

Example 2 with TagsResponse

use of org.sonarqube.ws.Issues.TagsResponse in project sonarqube by SonarSource.

the class TagsActionTest method do_not_return_issues_without_permission.

@Test
public void do_not_return_issues_without_permission() {
    RuleDefinitionDto rule = db.rules().insertIssueRule();
    ComponentDto project1 = db.components().insertPrivateProject();
    ComponentDto project2 = db.components().insertPrivateProject();
    db.issues().insertIssue(rule, project1, project1, issue -> issue.setTags(asList("tag1", "tag2")));
    db.issues().insertIssue(rule, project2, project2, issue -> issue.setTags(asList("tag3", "tag4", "tag5")));
    indexIssues();
    // Project 2 is not visible to current user
    permissionIndexer.allowOnlyAnyone(project1);
    TagsResponse result = ws.newRequest().executeProtobuf(TagsResponse.class);
    assertThat(result.getTagsList()).containsExactly("tag1", "tag2");
}
Also used : TagsResponse(org.sonarqube.ws.Issues.TagsResponse) ComponentDto(org.sonar.db.component.ComponentDto) RuleDefinitionDto(org.sonar.db.rule.RuleDefinitionDto) Test(org.junit.Test)

Example 3 with TagsResponse

use of org.sonarqube.ws.Issues.TagsResponse in project sonarqube by SonarSource.

the class TagsActionTest method empty_list.

@Test
public void empty_list() {
    TagsResponse result = ws.newRequest().executeProtobuf(TagsResponse.class);
    assertThat(result.getTagsList()).isEmpty();
}
Also used : TagsResponse(org.sonarqube.ws.Issues.TagsResponse) Test(org.junit.Test)

Example 4 with TagsResponse

use of org.sonarqube.ws.Issues.TagsResponse in project sonarqube by SonarSource.

the class TagsActionTest method search_tags.

@Test
public void search_tags() {
    RuleDefinitionDto rule = db.rules().insertIssueRule();
    ComponentDto project = db.components().insertPrivateProject();
    db.issues().insertIssue(rule, project, project, issue -> issue.setTags(asList("tag1", "tag2")));
    db.issues().insertIssue(rule, project, project, issue -> issue.setTags(asList("tag3", "tag4", "tag5")));
    indexIssues();
    permissionIndexer.allowOnlyAnyone(project);
    TagsResponse result = ws.newRequest().executeProtobuf(TagsResponse.class);
    assertThat(result.getTagsList()).containsExactly("tag1", "tag2", "tag3", "tag4", "tag5");
    verify(issueIndexSyncProgressChecker).checkIfIssueSyncInProgress(any());
}
Also used : TagsResponse(org.sonarqube.ws.Issues.TagsResponse) ComponentDto(org.sonar.db.component.ComponentDto) RuleDefinitionDto(org.sonar.db.rule.RuleDefinitionDto) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 TagsResponse (org.sonarqube.ws.Issues.TagsResponse)4 ComponentDto (org.sonar.db.component.ComponentDto)3 RuleDefinitionDto (org.sonar.db.rule.RuleDefinitionDto)3