use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class SearchAction method handle.
@Override
public final void handle(Request request, Response response) {
try (DbSession dbSession = dbClient.openSession(false)) {
SearchRequest searchRequest = toSearchWsRequest(dbSession, request);
checkIfNeedIssueSync(dbSession, searchRequest);
SearchWsResponse searchWsResponse = doHandle(searchRequest);
writeProtobuf(searchWsResponse, request, response);
}
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method fail_if_in_new_code_period_and_created_in_last_set_at_the_same_time.
@Test
public void fail_if_in_new_code_period_and_created_in_last_set_at_the_same_time() {
SearchRequest searchRequest = new SearchRequest().setInNewCodePeriod(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 dates_are_inclusive.
@Test
public void dates_are_inclusive() {
when(clock.getZone()).thenReturn(ZoneId.of("Europe/Paris"));
SearchRequest request = new SearchRequest().setCreatedAfter("2013-04-16").setCreatedBefore("2013-04-17");
IssueQuery query = underTest.create(request);
assertThat(query.createdAfter().date()).isEqualTo(parseDateTime("2013-04-16T00:00:00+0200"));
assertThat(query.createdAfter().inclusive()).isTrue();
assertThat(query.createdBefore()).isEqualTo(parseDateTime("2013-04-18T00:00:00+0200"));
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method fail_if_no_component_provided_with_in_new_code_period.
@Test
public void fail_if_no_component_provided_with_in_new_code_period() {
SearchRequest searchRequest = new SearchRequest().setInNewCodePeriod(true);
assertThatThrownBy(() -> underTest.create(searchRequest)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("One and only one component must be provided when searching in new code period");
}
use of org.sonar.server.issue.SearchRequest in project sonarqube by SonarSource.
the class IssueQueryFactoryTest method create_with_rule_key_that_does_not_exist_in_the_db.
@Test
public void create_with_rule_key_that_does_not_exist_in_the_db() {
db.users().insertUser(u -> u.setLogin("joanna"));
ComponentDto project = db.components().insertPrivateProject();
db.components().insertComponent(newModuleDto(project));
db.components().insertComponent(newFileDto(project));
newRule(RuleKey.of("findbugs", "NullReference"));
SearchRequest request = new SearchRequest().setRules(asList("unknown:key1", "unknown:key2"));
IssueQuery query = underTest.create(request);
assertThat(query.rules()).isEmpty();
assertThat(query.ruleUuids()).containsExactly("non-existing-uuid");
}
Aggregations