use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method should_search_in_tree_with_module_uuid.
@Test
public void should_search_in_tree_with_module_uuid() {
ComponentDto project = db.components().insertPrivateProject();
ComponentDto module = db.components().insertComponent(newModuleDto(project));
SearchRequest request = new SearchRequest().setComponentUuids(asList(module.uuid()));
IssueQuery query = underTest.create(request);
assertThat(query.moduleRootUuids()).containsExactly(module.uuid());
assertThat(query.onComponentOnly()).isFalse();
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method param_componentUuids_enables_search_by_test_file.
@Test
public void param_componentUuids_enables_search_by_test_file() {
ComponentDto project = db.components().insertPrivateProject();
ComponentDto file = db.components().insertComponent(newFileDto(project).setQualifier(Qualifiers.UNIT_TEST_FILE));
SearchRequest request = new SearchRequest().setComponentUuids(asList(file.uuid()));
IssueQuery query = underTest.create(request);
assertThat(query.componentUuids()).containsExactly(file.uuid());
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method application_search_project_issues.
@Test
public void application_search_project_issues() {
ComponentDto project1 = db.components().insertPublicProject();
ComponentDto project2 = db.components().insertPublicProject();
ComponentDto application = db.components().insertPublicApplication();
db.components().insertComponents(newProjectCopy("PC1", project1, application));
db.components().insertComponents(newProjectCopy("PC2", project2, application));
userSession.registerApplication(application, project1, project2);
IssueQuery result = underTest.create(new SearchRequest().setComponentUuids(singletonList(application.uuid())));
assertThat(result.viewUuids()).containsExactlyInAnyOrder(application.uuid());
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method fail_if_since_leak_period_and_created_in_last_set_at_the_same_time.
@Test
public void fail_if_since_leak_period_and_created_in_last_set_at_the_same_time() {
SearchRequest searchRequest = new SearchRequest().setSinceLeakPeriod(true).setCreatedInLast("1y2m3w4d");
assertThatThrownBy(() -> underTest.create(searchRequest)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("Parameters 'createdInLast' and 'inNewCodePeriod' or 'sinceLeakPeriod' cannot be set simultaneously");
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method fail_if_several_components_provided_with_in_new_code_period.
@Test
public void fail_if_several_components_provided_with_in_new_code_period() {
ComponentDto project1 = db.components().insertPrivateProject();
ComponentDto project2 = db.components().insertPrivateProject();
SearchRequest searchRequest = new SearchRequest().setInNewCodePeriod(true).setComponents(asList(project1.getKey(), project2.getKey()));
assertThatThrownBy(() -> underTest.create(searchRequest)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("One and only one component must be provided when searching in new code period");
}
Aggregations