use of org.sonarqube.ws.client.issue.SearchWsRequest in project sonarqube by SonarSource.
the class IssueQueryServiceTest method fail_if_since_leak_period_and_created_after_set_at_the_same_time.
@Test
public void fail_if_since_leak_period_and_created_after_set_at_the_same_time() {
expectedException.expect(BadRequestException.class);
expectedException.expectMessage("'createdAfter' and 'sinceLeakPeriod' cannot be set simultaneously");
underTest.createFromRequest(new SearchWsRequest().setSinceLeakPeriod(true).setCreatedAfter("2013-07-25T07:35:00+0100"));
}
use of org.sonarqube.ws.client.issue.SearchWsRequest in project sonarqube by SonarSource.
the class IssueQueryServiceTest method fail_if_several_components_provided_with_since_leak_period.
@Test
public void fail_if_several_components_provided_with_since_leak_period() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("One and only one component must be provided when searching since leak period");
underTest.createFromRequest(new SearchWsRequest().setSinceLeakPeriod(true).setComponentUuids(newArrayList("component-uuid", "project-uuid")));
}
use of org.sonarqube.ws.client.issue.SearchWsRequest in project sonarqube by SonarSource.
the class IssueTrackingTest method track_existing_unchanged_issues_on_multi_modules.
/**
* SONAR-4310
*/
@Test
public void track_existing_unchanged_issues_on_multi_modules() throws Exception {
// The custom rule on module is enabled
ORCHESTRATOR.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "com.sonarsource.it.samples:multi-modules-sample");
ORCHESTRATOR.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-module");
runProjectAnalysis(ORCHESTRATOR, "shared/xoo-multi-modules-sample");
// One issue by module are created
List<Issue> issues = searchIssues(new SearchWsRequest()).getIssuesList();
assertThat(issues).hasSize(4);
// Re analysis of the same project
runProjectAnalysis(ORCHESTRATOR, "shared/xoo-multi-modules-sample");
// No new issue should be created
assertThat(searchIssues(new SearchWsRequest()).getIssuesList()).hasSize(issues.size());
// Issues on modules should stay open and be the same from the first analysis
for (Issue issue : issues) {
Issue reloadIssue = getIssueByKey(issue.getKey());
assertThat(reloadIssue.getStatus()).isEqualTo("OPEN");
assertThat(reloadIssue.hasResolution()).isFalse();
assertThat(reloadIssue.getCreationDate()).isEqualTo(issue.getCreationDate());
assertThat(reloadIssue.getUpdateDate()).isEqualTo(issue.getUpdateDate());
}
}
use of org.sonarqube.ws.client.issue.SearchWsRequest in project sonarqube by SonarSource.
the class IssueTrackingTest method getIssueByKey.
private static Issue getIssueByKey(String issueKey) {
SearchWsResponse search = searchIssues(new SearchWsRequest().setIssues(singletonList(issueKey)));
assertThat(search.getTotal()).isEqualTo(1);
return search.getIssues(0);
}
use of org.sonarqube.ws.client.issue.SearchWsRequest in project sonarqube by SonarSource.
the class IssueWorkflowTest method issue_is_closed_as_removed_when_rule_is_disabled.
/**
* Issue on a disabled rule (uninstalled plugin or rule deactivated from quality profile) must
* be CLOSED with resolution REMOVED
*/
@Test
public void issue_is_closed_as_removed_when_rule_is_disabled() throws Exception {
SearchWsRequest ruleSearchRequest = new SearchWsRequest().setRules(singletonList("xoo:OneIssuePerLine"));
List<Issue> issues = issueRule.search(ruleSearchRequest).getIssuesList();
assertThat(issues).isNotEmpty();
// re-analyze with profile "empty". The rule is disabled so the issues must be closed
analysisWithoutIssues.run();
issues = issueRule.search(ruleSearchRequest).getIssuesList();
assertThat(issues).isNotEmpty();
for (Issue issue : issues) {
assertThat(issue.getStatus()).isEqualTo("CLOSED");
assertThat(issue.getResolution()).isEqualTo("REMOVED");
}
}
Aggregations