use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method param_componentUuids_enables_search_in_view_tree_if_user_has_permission_on_view.
@Test
public void param_componentUuids_enables_search_in_view_tree_if_user_has_permission_on_view() {
ComponentDto view = db.components().insertPublicPortfolio();
SearchRequest request = new SearchRequest().setComponentUuids(singletonList(view.uuid()));
userSession.registerComponents(view);
IssueQuery query = underTest.create(request);
assertThat(query.viewUuids()).containsOnly(view.uuid());
assertThat(query.onComponentOnly()).isFalse();
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method creation_date_support_localdate.
@Test
public void creation_date_support_localdate() {
when(clock.getZone()).thenReturn(ZoneId.of("Europe/Paris"));
SearchRequest request = new SearchRequest().setCreatedAt("2013-04-16");
IssueQuery query = underTest.create(request);
assertThat(query.createdAt()).isEqualTo(parseDateTime("2013-04-16T00:00:00+0200"));
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method search_issues_from_main_branch.
@Test
public void search_issues_from_main_branch() {
ComponentDto project = db.components().insertPublicProject();
ComponentDto branch = db.components().insertProjectBranch(project);
assertThat(underTest.create(new SearchRequest().setProjects(singletonList(project.getKey())).setBranch("master"))).extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch).containsOnly(project.uuid(), singletonList(project.uuid()), true);
assertThat(underTest.create(new SearchRequest().setComponents(singletonList(project.getKey())).setBranch("master"))).extracting(IssueQuery::branchUuid, query -> new ArrayList<>(query.projectUuids()), IssueQuery::isMainBranch).containsOnly(project.uuid(), singletonList(project.uuid()), true);
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method fail_if_invalid_timezone.
@Test
public void fail_if_invalid_timezone() {
SearchRequest request = new SearchRequest().setTimeZone("Poitou-Charentes");
assertThatThrownBy(() -> underTest.create(request)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("TimeZone 'Poitou-Charentes' cannot be parsed as a valid zone ID");
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method param_componentUuids_enables_search_on_project_tree_by_default.
@Test
public void param_componentUuids_enables_search_on_project_tree_by_default() {
ComponentDto project = db.components().insertPrivateProject();
SearchRequest request = new SearchRequest().setComponentUuids(asList(project.uuid()));
IssueQuery query = underTest.create(request);
assertThat(query.projectUuids()).containsExactly(project.uuid());
assertThat(query.onComponentOnly()).isFalse();
}
Aggregations