]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7473 Drop 'reporter' field from ES
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 23 Mar 2016 14:47:05 +0000 (15:47 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 29 Mar 2016 17:10:51 +0000 (19:10 +0200)
server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueDoc.java
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueResultSetIterator.java
server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/IssueTesting.java
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java
server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml

index 616a256f0ed0e8679c8520c49571e9e1244bd25b..6131f87787bb2a610c857781034c95895958cd70 100644 (file)
@@ -191,7 +191,6 @@ public class IssueIndexBenchmarkTest {
       issue.setEffort(1000L);
       issue.setGap(3.14);
       issue.setLanguage("php");
-      issue.setReporter(users.next());
       issue.setRuleKey(rules.next());
       issue.setResolution(resolutions.next());
       issue.setStatus(statuses.next());
index 03a29a0fbe642ba6acc581c032cdb38c01ae87c8..777f4b14dfdcaee7c9cbdd7f43149cf06170de7d 100644 (file)
@@ -144,10 +144,14 @@ public class IssueDoc extends BaseDoc implements Issue {
     return getNullableField(IssueIndexDefinition.FIELD_ISSUE_RESOLUTION);
   }
 
+  /**
+   * @deprecated since 5.5
+   */
+  @Deprecated
   @Override
   @CheckForNull
   public String reporter() {
-    return getNullableField(IssueIndexDefinition.FIELD_ISSUE_REPORTER);
+    throw new UnsupportedOperationException("manual issue feature has been dropped");
   }
 
   @Override
@@ -324,11 +328,6 @@ public class IssueDoc extends BaseDoc implements Issue {
     return this;
   }
 
-  public IssueDoc setReporter(@Nullable String s) {
-    setField(IssueIndexDefinition.FIELD_ISSUE_REPORTER, s);
-    return this;
-  }
-
   public IssueDoc setAssignee(@Nullable String s) {
     setField(IssueIndexDefinition.FIELD_ISSUE_ASSIGNEE, s);
     return this;
index 6945a72e2f68dd12acc5ab2f5355e766b8199663..224556589c28d3b84fd97a73a43beb26eee5bfcc 100644 (file)
@@ -66,7 +66,6 @@ public class IssueIndexDefinition implements IndexDefinition {
   public static final String FIELD_ISSUE_MODULE_PATH = "modulePath";
   public static final String FIELD_ISSUE_PROJECT_UUID = "project";
   public static final String FIELD_ISSUE_DIRECTORY_PATH = "dirPath";
-  public static final String FIELD_ISSUE_REPORTER = "reporter";
   public static final String FIELD_ISSUE_RESOLUTION = "resolution";
   public static final String FIELD_ISSUE_RULE_KEY = "ruleKey";
   public static final String FIELD_ISSUE_SEVERITY = "severity";
@@ -125,7 +124,6 @@ public class IssueIndexDefinition implements IndexDefinition {
     issueMapping.createUuidPathField(FIELD_ISSUE_MODULE_PATH);
     issueMapping.stringFieldBuilder(FIELD_ISSUE_PROJECT_UUID).enableSorting().build();
     issueMapping.stringFieldBuilder(FIELD_ISSUE_DIRECTORY_PATH).docValues().build();
-    issueMapping.stringFieldBuilder(FIELD_ISSUE_REPORTER).docValues().build();
     issueMapping.stringFieldBuilder(FIELD_ISSUE_RESOLUTION).build();
     issueMapping.stringFieldBuilder(FIELD_ISSUE_RULE_KEY).build();
     issueMapping.stringFieldBuilder(FIELD_ISSUE_SEVERITY).build();
index 31f3eda2f2212c6ce01994f812ece7e5f8afa97a..823647b60a207e8921d3d8569082a7810be4cb8d 100644 (file)
@@ -66,15 +66,14 @@ class IssueResultSetIterator extends ResultSetIterator<IssueDoc> {
     "i.checksum",
     "i.status",
     "i.effort",
-    "i.reporter",
     "i.author_login",
     "i.issue_close_date",
     "i.issue_creation_date",
     "i.issue_update_date",
     "r.plugin_name",
+    "r.plugin_rule_key",
 
     // column 21
-    "r.plugin_rule_key",
     "r.language",
     "p.uuid",
     "p.module_uuid_path",
@@ -172,26 +171,25 @@ class IssueResultSetIterator extends ResultSetIterator<IssueDoc> {
     doc.setChecksum(rs.getString(12));
     doc.setStatus(rs.getString(13));
     doc.setEffort(getLong(rs, 14));
-    doc.setReporter(rs.getString(15));
-    doc.setAuthorLogin(rs.getString(16));
-    doc.setFuncCloseDate(longToDate(getLong(rs, 17)));
-    doc.setFuncCreationDate(longToDate(getLong(rs, 18)));
-    doc.setFuncUpdateDate(longToDate(getLong(rs, 19)));
-    String ruleRepo = rs.getString(20);
-    String ruleKey = rs.getString(21);
+    doc.setAuthorLogin(rs.getString(15));
+    doc.setFuncCloseDate(longToDate(getLong(rs, 16)));
+    doc.setFuncCreationDate(longToDate(getLong(rs, 17)));
+    doc.setFuncUpdateDate(longToDate(getLong(rs, 18)));
+    String ruleRepo = rs.getString(19);
+    String ruleKey = rs.getString(20);
     doc.setRuleKey(RuleKey.of(ruleRepo, ruleKey).toString());
-    doc.setLanguage(rs.getString(22));
-    doc.setComponentUuid(rs.getString(23));
-    String moduleUuidPath = rs.getString(24);
+    doc.setLanguage(rs.getString(21));
+    doc.setComponentUuid(rs.getString(22));
+    String moduleUuidPath = rs.getString(23);
     doc.setModuleUuid(extractModule(moduleUuidPath));
     doc.setModuleUuidPath(moduleUuidPath);
-    String scope = rs.getString(26);
-    String filePath = extractFilePath(rs.getString(25), scope);
+    String scope = rs.getString(25);
+    String filePath = extractFilePath(rs.getString(24), scope);
     doc.setFilePath(filePath);
     doc.setDirectoryPath(extractDirPath(doc.filePath(), scope));
-    String tags = rs.getString(27);
+    String tags = rs.getString(26);
     doc.setTags(ImmutableList.copyOf(TAGS_SPLITTER.split(tags == null ? "" : tags)));
-    doc.setType(RuleType.valueOf(rs.getInt(28)));
+    doc.setType(RuleType.valueOf(rs.getInt(27)));
     return doc;
   }
 }
index bd8f8b59a7048f3b5c968d596eb020f573c04867..d8009ea2ac8ee25d3a51ee237859510055663bc8 100644 (file)
@@ -260,7 +260,6 @@ public class IssueServiceMediumTest {
     assertThat(manualIssue.message()).isEqualTo("Fix it");
     assertThat(manualIssue.line()).isNull();
     assertThat(manualIssue.severity()).isEqualTo(Severity.MINOR);
-    assertThat(manualIssue.reporter()).isEqualTo("john");
   }
 
   @Test
@@ -286,7 +285,6 @@ public class IssueServiceMediumTest {
     assertThat(manualIssue.line()).isEqualTo(1);
     assertThat(manualIssue.severity()).isEqualTo(Severity.MINOR);
     assertThat(manualIssue.gap()).isNull();
-    assertThat(manualIssue.reporter()).isEqualTo("john");
     assertThat(manualIssue.assignee()).isEqualTo("arthur");
   }
 
index ded112a90ef7fbf0035d372d111d592d1f2278bc..d37888487bdfd22fe8cf87fe92a12b852889b644 100644 (file)
@@ -64,7 +64,6 @@ public class IssueTesting {
     doc.setKey("ABC");
     doc.setRuleKey(RuleTesting.XOO_X1.toString());
     doc.setType(RuleType.CODE_SMELL);
-    doc.setReporter(null);
     doc.setAssignee("steve");
     doc.setAuthorLogin("roger");
     doc.setLanguage("xoo");
index 93acb15a7ed7e5605567da95a5e0b3653b9adebf..25fb7a093b1469da350b144890440d9a1fcf177a 100644 (file)
@@ -69,7 +69,6 @@ public class IssueResultSetIteratorTest {
     assertThat(issue.isManualSeverity()).isFalse();
     assertThat(issue.assignee()).isEqualTo("guy1");
     assertThat(issue.authorLogin()).isEqualTo("guy2");
-    assertThat(issue.reporter()).isEqualTo("john");
     assertThat(issue.checksum()).isEqualTo("FFFFF");
     assertThat(issue.line()).isEqualTo(444);
     assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("squid", "AvoidCycles"));
index 5b8f3cd046c6e55d67ce55024e3d2e559472fe5e..d4343d23191fbddbaa1fcdd4f265763ba5b33896 100644 (file)
@@ -24,7 +24,7 @@
       component_uuid="FILE1"
       project_uuid="PROJECT1"
       rule_id="200"
-      reporter="john"
+      reporter="[null]"
       issue_attributes="JIRA=http://jira.com"
       action_plan_key="PLAN1"
       tags="tag1,tag2,tag3"