]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9567 drop fields manual_severity and message from ES index issues
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 18 Jul 2017 20:44:53 +0000 (22:44 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 19 Jul 2017 18:47:45 +0000 (20:47 +0200)
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/IssueIteratorForSingleChunk.java
server/sonar-server/src/test/java/org/sonar/server/issue/IssueDocTesting.java
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIteratorFactoryTest.java

index c0027758b0df6dfd5c6a9d871a9774db27ff6280..3a93ccd41abd4e0ba3c1758a9f85537c429f74a0 100644 (file)
@@ -25,7 +25,6 @@ import java.util.Date;
 import java.util.Map;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
-import org.apache.commons.lang.BooleanUtils;
 import org.sonar.api.rule.RuleKey;
 import org.sonar.api.rule.Severity;
 import org.sonar.api.rules.RuleType;
@@ -90,20 +89,6 @@ public class IssueDoc extends BaseDoc {
     return getField(IssueIndexDefinition.FIELD_ISSUE_SEVERITY);
   }
 
-  public boolean isManualSeverity() {
-    return BooleanUtils.isTrue(getField(IssueIndexDefinition.FIELD_ISSUE_MANUAL_SEVERITY));
-  }
-
-  @Nullable
-  public String checksum() {
-    return getNullableField(IssueIndexDefinition.FIELD_ISSUE_CHECKSUM);
-  }
-
-  @CheckForNull
-  public String message() {
-    return getNullableField(IssueIndexDefinition.FIELD_ISSUE_MESSAGE);
-  }
-
   @CheckForNull
   public Integer line() {
     return getNullableField(IssueIndexDefinition.FIELD_ISSUE_LINE);
@@ -208,21 +193,6 @@ public class IssueDoc extends BaseDoc {
     return this;
   }
 
-  public IssueDoc setManualSeverity(boolean b) {
-    setField(IssueIndexDefinition.FIELD_ISSUE_MANUAL_SEVERITY, b);
-    return this;
-  }
-
-  public IssueDoc setMessage(@Nullable String s) {
-    setField(IssueIndexDefinition.FIELD_ISSUE_MESSAGE, s);
-    return this;
-  }
-
-  public IssueDoc setChecksum(@Nullable String s) {
-    setField(IssueIndexDefinition.FIELD_ISSUE_CHECKSUM, s);
-    return this;
-  }
-
   public IssueDoc setLine(@Nullable Integer i) {
     setField(IssueIndexDefinition.FIELD_ISSUE_LINE, i);
     return this;
index 14acde7b959efe5266d4bc17f1d2c3093e57c7ec..e5506ca42f9ca072be795b3115ce6bda413295b8 100644 (file)
@@ -52,7 +52,6 @@ public class IssueIndexDefinition implements IndexDefinition {
   public static final String FIELD_ISSUE_KEY = "key";
   public static final String FIELD_ISSUE_LANGUAGE = "language";
   public static final String FIELD_ISSUE_LINE = "line";
-  public static final String FIELD_ISSUE_MESSAGE = "message";
   public static final String FIELD_ISSUE_MODULE_UUID = "module";
   public static final String FIELD_ISSUE_MODULE_PATH = "modulePath";
   public static final String FIELD_ISSUE_ORGANIZATION_UUID = "organization";
@@ -62,9 +61,7 @@ public class IssueIndexDefinition implements IndexDefinition {
   public static final String FIELD_ISSUE_RULE_KEY = "ruleKey";
   public static final String FIELD_ISSUE_SEVERITY = "severity";
   public static final String FIELD_ISSUE_SEVERITY_VALUE = "severityValue";
-  public static final String FIELD_ISSUE_MANUAL_SEVERITY = "manualSeverity";
   public static final String FIELD_ISSUE_STATUS = "status";
-  public static final String FIELD_ISSUE_CHECKSUM = "checksum";
   public static final String FIELD_ISSUE_TAGS = "tags";
   public static final String FIELD_ISSUE_TYPE = "type";
 
@@ -95,7 +92,6 @@ public class IssueIndexDefinition implements IndexDefinition {
     type.stringFieldBuilder(FIELD_ISSUE_KEY).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
     type.stringFieldBuilder(FIELD_ISSUE_LANGUAGE).disableNorms().build();
     type.createIntegerField(FIELD_ISSUE_LINE);
-    type.stringFieldBuilder(FIELD_ISSUE_MESSAGE).disableNorms().build();
     type.stringFieldBuilder(FIELD_ISSUE_MODULE_UUID).disableNorms().build();
     type.createUuidPathField(FIELD_ISSUE_MODULE_PATH);
     type.stringFieldBuilder(FIELD_ISSUE_ORGANIZATION_UUID).disableNorms().build();
index ff61ab972e5aca5ce721b47b9261967b96f39390..081d44c6afeb87337136f82073232b4372a96436 100644 (file)
@@ -57,17 +57,14 @@ class IssueIteratorForSingleChunk implements IssueIterator {
     "root.uuid",
     "i.assignee",
     "i.line",
-    "i.message",
     "i.resolution",
     "i.severity",
-    "i.manual_severity",
-    "i.checksum",
     "i.status",
-
-    // column 11
     "i.effort",
     "i.author_login",
     "i.issue_close_date",
+
+    // column 11
     "i.issue_creation_date",
     "i.issue_update_date",
     "r.plugin_name",
@@ -75,11 +72,11 @@ class IssueIteratorForSingleChunk implements IssueIterator {
     "r.language",
     "p.uuid",
     "p.module_uuid_path",
-
-    // column 21
     "p.path",
     "p.scope",
     "p.organization_uuid",
+
+    // column 21
     "i.tags",
     "i.issue_type"
   };
@@ -197,33 +194,30 @@ class IssueIteratorForSingleChunk implements IssueIterator {
       doc.setProjectUuid(projectUuid);
       doc.setAssignee(rs.getString(3));
       doc.setLine(DatabaseUtils.getInt(rs, 4));
-      doc.setMessage(rs.getString(5));
-      doc.setResolution(rs.getString(6));
-      doc.setSeverity(rs.getString(7));
-      doc.setManualSeverity(rs.getBoolean(8));
-      doc.setChecksum(rs.getString(9));
-      doc.setStatus(rs.getString(10));
-      doc.setEffort(getLong(rs, 11));
-      doc.setAuthorLogin(rs.getString(12));
-      doc.setFuncCloseDate(longToDate(getLong(rs, 13)));
-      doc.setFuncCreationDate(longToDate(getLong(rs, 14)));
-      doc.setFuncUpdateDate(longToDate(getLong(rs, 15)));
-      String ruleRepo = rs.getString(16);
-      String ruleKey = rs.getString(17);
+      doc.setResolution(rs.getString(5));
+      doc.setSeverity(rs.getString(6));
+      doc.setStatus(rs.getString(7));
+      doc.setEffort(getLong(rs, 8));
+      doc.setAuthorLogin(rs.getString(9));
+      doc.setFuncCloseDate(longToDate(getLong(rs, 10)));
+      doc.setFuncCreationDate(longToDate(getLong(rs, 11)));
+      doc.setFuncUpdateDate(longToDate(getLong(rs, 12)));
+      String ruleRepo = rs.getString(13);
+      String ruleKey = rs.getString(14);
       doc.setRuleKey(RuleKey.of(ruleRepo, ruleKey).toString());
-      doc.setLanguage(rs.getString(18));
-      doc.setComponentUuid(rs.getString(19));
-      String moduleUuidPath = rs.getString(20);
+      doc.setLanguage(rs.getString(15));
+      doc.setComponentUuid(rs.getString(16));
+      String moduleUuidPath = rs.getString(17);
       doc.setModuleUuid(extractModule(moduleUuidPath));
       doc.setModuleUuidPath(moduleUuidPath);
-      String scope = rs.getString(22);
-      String filePath = extractFilePath(rs.getString(21), scope);
+      String scope = rs.getString(19);
+      String filePath = extractFilePath(rs.getString(18), scope);
       doc.setFilePath(filePath);
       doc.setDirectoryPath(extractDirPath(doc.filePath(), scope));
-      doc.setOrganizationUuid(rs.getString(23));
-      String tags = rs.getString(24);
+      doc.setOrganizationUuid(rs.getString(20));
+      String tags = rs.getString(21);
       doc.setTags(ImmutableList.copyOf(IssueIteratorForSingleChunk.TAGS_SPLITTER.split(tags == null ? "" : tags)));
-      doc.setType(RuleType.valueOf(rs.getInt(25)));
+      doc.setType(RuleType.valueOf(rs.getInt(22)));
       return doc;
     }
 
index f3195d162d928a70c9db9bbaea19b82d7ceccabb..138e29114fc244f05cb4baea996bc5af74cf2237 100644 (file)
@@ -42,7 +42,6 @@ public class IssueDocTesting {
     doc.setComponentUuid("FILE_1");
     doc.setFilePath("src/Foo.xoo");
     doc.setDirectoryPath("/src");
-    doc.setMessage("the message");
     doc.setModuleUuid("MODULE_1");
     doc.setModuleUuidPath("MODULE_1");
     doc.setProjectUuid("PROJECT_1");
@@ -50,9 +49,7 @@ public class IssueDocTesting {
     doc.setStatus(Issue.STATUS_OPEN);
     doc.setResolution(null);
     doc.setSeverity(Severity.MAJOR);
-    doc.setManualSeverity(true);
     doc.setEffort(10L);
-    doc.setChecksum("12345");
     doc.setFuncCreationDate(DateUtils.parseDate("2014-09-04"));
     doc.setFuncUpdateDate(DateUtils.parseDate("2014-12-04"));
     doc.setFuncCloseDate(null);
index 81249569b4e3a066a53ed2fade993e293e1180fa..c6a3d7fdc4b4dcc6ebd8a0899a74b88fcb44194f 100644 (file)
@@ -47,10 +47,8 @@ public class IssueIteratorFactoryTest {
     assertThat(issue.resolution()).isEqualTo("FIXED");
     assertThat(issue.status()).isEqualTo("RESOLVED");
     assertThat(issue.severity()).isEqualTo("BLOCKER");
-    assertThat(issue.isManualSeverity()).isFalse();
     assertThat(issue.assignee()).isEqualTo("guy1");
     assertThat(issue.authorLogin()).isEqualTo("guy2");
-    assertThat(issue.checksum()).isEqualTo("FFFFF");
     assertThat(issue.line()).isEqualTo(444);
     assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("squid", "AvoidCycles"));
     assertThat(issue.componentUuid()).isEqualTo("FILE1");