]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6012 Replace componentPath by componentKey
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 21 Jan 2015 14:10:24 +0000 (15:10 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 21 Jan 2015 14:10:30 +0000 (15:10 +0100)
server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java
server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java
server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_module-expected.json
server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_project-expected.json
sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java
sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java
sonar-core/src/main/java/org/sonar/core/issue/db/BatchIssueDto.java
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml

index cc4cfcce10b361eea6cbbc3379d9c67c13c39329..c65b965ab9c3643d7581760b8a3624e01092bfe8 100644 (file)
@@ -111,7 +111,7 @@ public class IssuesAction implements RequestHandler {
       if (batchIssueDto != null) {
         return new PreviousIssue()
           .setKey(batchIssueDto.getKey())
-          .setComponentPath(batchIssueDto.getComponentPath())
+          .setComponentKey(batchIssueDto.getComponentKey())
           .setChecksum(batchIssueDto.getChecksum())
           .setAssigneeLogin(batchIssueDto.getAssigneeLogin())
           .setAssigneeFullname(batchIssueDto.getAssigneeName())
index 1a36eab8aa484333e81a3e567e7fe7bef792dafc..54a4d403171632c1531d48c383d5099cd8e50b34 100644 (file)
@@ -155,7 +155,7 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     assertThat(batchIssueDto.getLine()).isEqualTo(200);
     assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE);
     assertThat(batchIssueDto.getStatus()).isEqualTo(Issue.STATUS_RESOLVED);
-    assertThat(batchIssueDto.getComponentPath()).isEqualTo("src/main/java/Sample.java");
+    assertThat(batchIssueDto.getComponentKey()).isEqualTo("Sample.java");
     assertThat(batchIssueDto.getChecksum()).isEqualTo("123456");
     assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john");
     assertThat(batchIssueDto.getAssigneeName()).isEqualTo("John Doo");
@@ -183,7 +183,7 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     assertThat(batchIssueDto.getLine()).isEqualTo(200);
     assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE);
     assertThat(batchIssueDto.getStatus()).isEqualTo(Issue.STATUS_RESOLVED);
-    assertThat(batchIssueDto.getComponentPath()).isEqualTo("src/main/java/Sample.java");
+    assertThat(batchIssueDto.getComponentKey()).isEqualTo("Sample.java");
     assertThat(batchIssueDto.getChecksum()).isEqualTo("123456");
     assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john");
     assertThat(batchIssueDto.getAssigneeName()).isEqualTo("John Doo");
index 981ebb20ec72f59128122bb3b1396196f1ea5c31..491791042f980c98e56ac9c6ec7e100b2e8698ca 100644 (file)
@@ -1,7 +1,7 @@
 [
   {
     "key": "EFGH",
-    "componentPath": "src/main/java/Action.java",
+    "componentKey": "Action.java",
     "ruleKey": "AvoidCycle",
     "ruleRepo": "squid",
     "line": 200,
index 981ebb20ec72f59128122bb3b1396196f1ea5c31..491791042f980c98e56ac9c6ec7e100b2e8698ca 100644 (file)
@@ -1,7 +1,7 @@
 [
   {
     "key": "EFGH",
-    "componentPath": "src/main/java/Action.java",
+    "componentKey": "Action.java",
     "ruleKey": "AvoidCycle",
     "ruleRepo": "squid",
     "line": 200,
index 2711b8f1cae41ea2f0378685ef607880d08afb7c..32432f731e70925dc347df2dd4e7c3dc711d080d 100644 (file)
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
 public class PreviousIssue {
 
   private String key;
-  private String componentPath;
+  private String componentKey;
   private String ruleKey;
   private String ruleRepo;
   private Integer line;
@@ -45,13 +45,13 @@ public class PreviousIssue {
     return key;
   }
 
-  public PreviousIssue setComponentPath(@Nullable String path) {
-    this.componentPath = path;
+  public PreviousIssue setComponentKey(@Nullable String key) {
+    this.componentKey = key;
     return this;
   }
 
-  public String componentPath() {
-    return componentPath;
+  public String componentKey() {
+    return componentKey;
   }
 
   public PreviousIssue setLine(Integer line) {
index 1e5264b4ad29193a0f4928994ff7acba3879d79f..1462bb32e23a74ba694985e3b263b3b8a6772e8b 100644 (file)
@@ -38,7 +38,7 @@ public class PreviousIssueHelperTest {
 
     PreviousIssue issue1 = new PreviousIssue();
     issue1.setKey("key1");
-    issue1.setComponentPath("path");
+    issue1.setComponentKey("key");
     issue1.setRuleKey("repokey", "rulekey");
     issue1.setLine(2);
     issue1.setMessage("message");
@@ -58,7 +58,7 @@ public class PreviousIssueHelperTest {
 
     JSONAssert
       .assertEquals(
-        "[{\"key\": \"key1\", \"componentPath\": \"path\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", \"severity\": \"severity\", \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\", \"assigneeFullname\": \"fullname\"},"
+        "[{\"key\": \"key1\", \"componentKey\": \"key\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", \"severity\": \"severity\", \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\", \"assigneeFullname\": \"fullname\"},"
           +
           "{\"key\": \"key2\"}]",
         out.getBuffer().toString(), true);
@@ -77,7 +77,7 @@ public class PreviousIssueHelperTest {
     StringWriter out = new StringWriter();
     PreviousIssueHelper helper = PreviousIssueHelper.create(out);
     StringReader reader = new StringReader(
-      "[{\"key\": \"key1\", \"componentPath\": \"path\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", \"severity\": \"severity\", \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\", \"assigneeFullname\": \"fullname\"},"
+      "[{\"key\": \"key1\", \"componentKey\": \"key\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", \"severity\": \"severity\", \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\", \"assigneeFullname\": \"fullname\"},"
         +
         "{\"key\": \"key2\"}]");
 
@@ -88,7 +88,7 @@ public class PreviousIssueHelperTest {
     assertThat(iterator.hasNext()).isFalse();
 
     assertThat(issue1.key()).isEqualTo("key1");
-    assertThat(issue1.componentPath()).isEqualTo("path");
+    assertThat(issue1.componentKey()).isEqualTo("key");
     assertThat(issue1.ruleRepo()).isEqualTo("repokey");
     assertThat(issue1.ruleKey()).isEqualTo("rulekey");
     assertThat(issue1.line()).isEqualTo(2);
index 2f2343ed4260602ef6367af70778cb2dca68439e..bc576daf4176a8e34c58ea191ed4fe3e6623fed1 100644 (file)
@@ -30,7 +30,7 @@ public class BatchIssueDto {
   private String checksum;
   private String assigneeLogin;
   private String assigneeName;
-  private String componentPath;
+  private String componentKey;
   private String ruleKey;
   private String ruleRepo;
 
@@ -61,12 +61,12 @@ public class BatchIssueDto {
     return this;
   }
 
-  public String getComponentPath() {
-    return componentPath;
+  public String getComponentKey() {
+    return componentKey;
   }
 
-  public BatchIssueDto setComponentPath(String componentPath) {
-    this.componentPath = componentPath;
+  public BatchIssueDto setComponentKey(String componentKey) {
+    this.componentKey = componentKey;
     return this;
   }
 
index 616899022318aa44e353ae3b59c33c55232a5180..2e0228f95817a2a244ba6097ae2e702776d8833a 100644 (file)
     i.checksum as checksum,
     r.plugin_rule_key as ruleKey,
     r.plugin_name as ruleRepo,
-    component.path as componentPath,
+    component.kee as componentKey,
     i.assignee as assigneeLogin,
     u.name as assigneeName
     FROM issues i
-    INNER JOIN (SELECT p.id,p.path FROM projects p WHERE p.module_uuid=#{uuid} OR p.uuid=#{uuid}) component ON component.id=i.component_id
+    INNER JOIN (SELECT p.id,p.kee FROM projects p WHERE p.module_uuid=#{uuid} OR p.uuid=#{uuid}) component ON component.id=i.component_id
     INNER JOIN rules r ON r.id=i.rule_id
     LEFT OUTER JOIN users u ON u.login=i.assignee
     WHERE i.status &lt;&gt; 'CLOSED'
     i.checksum as checksum,
     r.plugin_rule_key as ruleKey,
     r.plugin_name as ruleRepo,
-    component.path as componentPath,
+    component.kee as componentKey,
     i.assignee as assigneeLogin,
     u.name as assigneeName
     FROM issues i