aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-12-07 14:23:06 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-12-07 17:58:32 +0100
commit15dc8ea86dba565fa8f02814ca7c8fb9130ae3a7 (patch)
tree061520e3702b78ea06f799abfaa4caddd121e55b
parent269338c846f8c521a3c9767a77d1bdc6f2502272 (diff)
downloadsonarqube-15dc8ea86dba565fa8f02814ca7c8fb9130ae3a7.tar.gz
sonarqube-15dc8ea86dba565fa8f02814ca7c8fb9130ae3a7.zip
SONAR-7098 Add IT
-rw-r--r--it/it-tests/src/test/java/it/issue/AutoAssignTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/it/it-tests/src/test/java/it/issue/AutoAssignTest.java b/it/it-tests/src/test/java/it/issue/AutoAssignTest.java
index ad083ada417..2fe25024e31 100644
--- a/it/it-tests/src/test/java/it/issue/AutoAssignTest.java
+++ b/it/it-tests/src/test/java/it/issue/AutoAssignTest.java
@@ -1,9 +1,11 @@
package it.issue;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.sonar.wsclient.issue.Issue;
import org.sonar.wsclient.issue.IssueQuery;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsResponse;
@@ -68,6 +70,41 @@ public class AutoAssignTest extends AbstractIssueTest {
assertThat(search(IssueQuery.create().assigned(false)).list()).isEmpty();
}
+ /**
+ * SONAR-7098
+ *
+ * Given two versions of same project:
+ * v1: issue, but no SCM data
+ * v2: old issue and SCM data
+ * Expected: all issues should be associated with authors
+ */
+ @Test
+ public void update_author_and_assignee_when_scm_is_activated() {
+ createUser(SIMON_USER, SIMON_USER);
+
+ // Run a first analysis without SCM
+ projectAnalysis.withProperties("sonar.scm.disabled", "true").run();
+ List<Issue> issues = searchIssues();
+ assertThat(issues).isNotEmpty();
+
+ // No author and assignee are set
+ for (Issue issue : issues) {
+ assertThat(issue.author()).isEmpty();
+ }
+ assertThat(search(IssueQuery.create().assigned(true)).list()).isEmpty();
+
+ // Run a second analysis with SCM
+ projectAnalysis.run();
+ issues = searchIssues();
+ assertThat(issues).isNotEmpty();
+
+ // Authors and assignees are set
+ for (Issue issue : issues) {
+ assertThat(issue.author()).isNotEmpty();
+ }
+ assertThat(search(IssueQuery.create().assignees(SIMON_USER)).list()).hasSize(3);
+ }
+
private void createUser(String login, String password) {
WsResponse response = newAdminWsClient(ORCHESTRATOR).wsConnector().call(
new PostRequest("api/users/create")