]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7493 add integration test on max length of db column issues.message
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 17 Aug 2017 12:24:01 +0000 (14:24 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 17 Aug 2017 12:24:01 +0000 (14:24 +0200)
tests/src/test/java/org/sonarqube/tests/issue/IssueCreationTest.java

index b6afaf1730492f2eafeeea02974371bda7950941..81d2cd4a51b80c1e8cfe876199120e0e3274685b 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonarqube.tests.issue;
 
+import org.apache.commons.lang.StringUtils;
 import org.junit.Before;
 import org.junit.Test;
 import org.sonar.wsclient.issue.Issue;
@@ -75,4 +76,23 @@ public class IssueCreationTest extends AbstractIssueTest {
       assertThat(issue.severity()).isEqualTo("BLOCKER");
     }
   }
+
+  /**
+   * Test the maximum size of DB column issues.message, even if UTF8 characters
+   * are 3-bytes long
+   *
+   * SONAR-7493
+   */
+  @Test
+  public void issue_message_should_support_4000_utf8_characters() {
+    ORCHESTRATOR.getServer().provisionProject(SAMPLE_PROJECT_KEY, SAMPLE_PROJECT_KEY);
+    ItUtils.restoreProfile(ORCHESTRATOR, getClass().getResource("/issue/IssueCreationTest/with-custom-message.xml"));
+    ORCHESTRATOR.getServer().associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, "xoo", "with-custom-message");
+
+    String longMessage = StringUtils.repeat("を", 4_000);
+    runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample", "sonar.customMessage.message", longMessage);
+
+    Issue issue = issueClient().find(IssueQuery.create()).list().get(0);
+    assertThat(issue.message()).isEqualTo(longMessage);
+  }
 }