From: Julien Lancelot Date: Wed, 21 Jan 2015 14:10:24 +0000 (+0100) Subject: SONAR-6012 Replace componentPath by componentKey X-Git-Tag: latest-silver-master-#65~149 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3d25febc1c4870c2f9d4d0f852824519c4544d38;p=sonarqube.git SONAR-6012 Replace componentPath by componentKey --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java b/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java index cc4cfcce10b..c65b965ab9c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java @@ -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()) diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java index 1a36eab8aa4..54a4d403171 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java @@ -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"); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_module-expected.json b/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_module-expected.json index 981ebb20ec7..491791042f9 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_module-expected.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_module-expected.json @@ -1,7 +1,7 @@ [ { "key": "EFGH", - "componentPath": "src/main/java/Action.java", + "componentKey": "Action.java", "ruleKey": "AvoidCycle", "ruleRepo": "squid", "line": 200, diff --git a/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_project-expected.json b/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_project-expected.json index 981ebb20ec7..491791042f9 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_project-expected.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/batch/IssuesActionTest/issues_on_project-expected.json @@ -1,7 +1,7 @@ [ { "key": "EFGH", - "componentPath": "src/main/java/Action.java", + "componentKey": "Action.java", "ruleKey": "AvoidCycle", "ruleRepo": "squid", "line": 200, diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java index 2711b8f1cae..32432f731e7 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/issues/PreviousIssue.java @@ -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) { diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java index 1e5264b4ad2..1462bb32e23 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/issues/PreviousIssueHelperTest.java @@ -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); diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/BatchIssueDto.java b/sonar-core/src/main/java/org/sonar/core/issue/db/BatchIssueDto.java index 2f2343ed426..bc576daf417 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/BatchIssueDto.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/BatchIssueDto.java @@ -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; } diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml index 61689902231..2e0228f9581 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml @@ -192,11 +192,11 @@ 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 <> 'CLOSED' @@ -212,7 +212,7 @@ 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