use of org.sonarqube.ws.Issues.Issue 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.Issues.Issue in project sonarqube by SonarSource.
the class IssueTrackingTest method track_file_moves_based_on_identical_content.
@Test
public void track_file_moves_based_on_identical_content() {
ORCHESTRATOR.getServer().associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, "xoo", "issue-on-tag-foobar");
// version 1
runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v1", "sonar.projectDate", OLD_DATE);
List<Issue> issues = searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample.xoo");
assertThat(issues).hasSize(1);
Issue issueOnSample = issues.iterator().next();
// version 2
runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v3", "sonar.projectDate", NEW_DATE_STR);
assertThat(searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample.xoo")).isEmpty();
issues = searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample2.xoo");
assertThat(issues).hasSize(1);
Issue issueOnSample2 = issues.get(0);
assertThat(issueOnSample2.getKey()).isEqualTo(issueOnSample.getKey());
assertThat(issueOnSample2.getCreationDate()).isEqualTo(issueOnSample.getCreationDate());
assertThat(issueOnSample2.getUpdateDate()).isNotEqualTo(issueOnSample.getUpdateDate());
assertThat(issueOnSample2.getStatus()).isEqualTo("OPEN");
}
use of org.sonarqube.ws.Issues.Issue in project sonarqube by SonarSource.
the class IssueWorkflowTest method user_should_mark_as_false_positive_confirmed_issue.
/**
* SONAR-4329
*/
@Test
public void user_should_mark_as_false_positive_confirmed_issue() {
// mark as confirmed
issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "confirm"));
Issue confirmed = issueRule.getByKey(issue.getKey());
assertThat(confirmed.getStatus()).isEqualTo("CONFIRMED");
assertThat(confirmed.hasResolution()).isFalse();
assertThat(confirmed.getCreationDate()).isEqualTo(issue.getCreationDate());
// user mark the issue as false-positive
assertThat(transitions(confirmed.getKey())).contains("falsepositive");
issuesService.doTransition(new DoTransitionRequest(confirmed.getKey(), "falsepositive"));
Issue falsePositive = issueRule.getByKey(issue.getKey());
assertThat(falsePositive.getStatus()).isEqualTo("RESOLVED");
assertThat(falsePositive.getResolution()).isEqualTo("FALSE-POSITIVE");
assertThat(falsePositive.getCreationDate()).isEqualTo(confirmed.getCreationDate());
}
use of org.sonarqube.ws.Issues.Issue in project sonarqube by SonarSource.
the class IssueWorkflowTest method scan_should_close_no_more_existing_confirmed.
/**
* SONAR-4329
*/
@Test
public void scan_should_close_no_more_existing_confirmed() {
// mark as confirmed
issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "confirm"));
Issue falsePositive = issueRule.getByKey(issue.getKey());
assertThat(falsePositive.getStatus()).isEqualTo("CONFIRMED");
assertThat(falsePositive.hasResolution()).isFalse();
assertThat(falsePositive.getCreationDate()).isEqualTo(issue.getCreationDate());
// scan without any rules -> confirmed is closed
analysisWithoutIssues.run();
Issue closed = issueRule.getByKey(issue.getKey());
assertThat(closed.getStatus()).isEqualTo("CLOSED");
assertThat(closed.getResolution()).isEqualTo("REMOVED");
assertThat(closed.getCreationDate()).isEqualTo(issue.getCreationDate());
}
use of org.sonarqube.ws.Issues.Issue 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