Skip to content

Commit

Permalink
SONAR-6012 Replace componentPath by componentKey
Browse files Browse the repository at this point in the history
  • Loading branch information
julienlancelot committed Jan 21, 2015
1 parent 45e68e7 commit 3d25feb
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
Expand Up @@ -111,7 +111,7 @@ public PreviousIssue apply(@Nullable BatchIssueDto batchIssueDto) {
if (batchIssueDto != null) { if (batchIssueDto != null) {
return new PreviousIssue() return new PreviousIssue()
.setKey(batchIssueDto.getKey()) .setKey(batchIssueDto.getKey())
.setComponentPath(batchIssueDto.getComponentPath()) .setComponentKey(batchIssueDto.getComponentKey())
.setChecksum(batchIssueDto.getChecksum()) .setChecksum(batchIssueDto.getChecksum())
.setAssigneeLogin(batchIssueDto.getAssigneeLogin()) .setAssigneeLogin(batchIssueDto.getAssigneeLogin())
.setAssigneeFullname(batchIssueDto.getAssigneeName()) .setAssigneeFullname(batchIssueDto.getAssigneeName())
Expand Down
Expand Up @@ -155,7 +155,7 @@ public void select_non_closed_issues_by_module_uuid() {
assertThat(batchIssueDto.getLine()).isEqualTo(200); assertThat(batchIssueDto.getLine()).isEqualTo(200);
assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE); assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE);
assertThat(batchIssueDto.getStatus()).isEqualTo(Issue.STATUS_RESOLVED); 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.getChecksum()).isEqualTo("123456");
assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john"); assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john");
assertThat(batchIssueDto.getAssigneeName()).isEqualTo("John Doo"); assertThat(batchIssueDto.getAssigneeName()).isEqualTo("John Doo");
Expand Down Expand Up @@ -183,7 +183,7 @@ public void select_non_closed_issues_by_project_uuid() {
assertThat(batchIssueDto.getLine()).isEqualTo(200); assertThat(batchIssueDto.getLine()).isEqualTo(200);
assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE); assertThat(batchIssueDto.getResolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE);
assertThat(batchIssueDto.getStatus()).isEqualTo(Issue.STATUS_RESOLVED); 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.getChecksum()).isEqualTo("123456");
assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john"); assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john");
assertThat(batchIssueDto.getAssigneeName()).isEqualTo("John Doo"); assertThat(batchIssueDto.getAssigneeName()).isEqualTo("John Doo");
Expand Down
@@ -1,7 +1,7 @@
[ [
{ {
"key": "EFGH", "key": "EFGH",
"componentPath": "src/main/java/Action.java", "componentKey": "Action.java",
"ruleKey": "AvoidCycle", "ruleKey": "AvoidCycle",
"ruleRepo": "squid", "ruleRepo": "squid",
"line": 200, "line": 200,
Expand Down
@@ -1,7 +1,7 @@
[ [
{ {
"key": "EFGH", "key": "EFGH",
"componentPath": "src/main/java/Action.java", "componentKey": "Action.java",
"ruleKey": "AvoidCycle", "ruleKey": "AvoidCycle",
"ruleRepo": "squid", "ruleRepo": "squid",
"line": 200, "line": 200,
Expand Down
Expand Up @@ -24,7 +24,7 @@
public class PreviousIssue { public class PreviousIssue {


private String key; private String key;
private String componentPath; private String componentKey;
private String ruleKey; private String ruleKey;
private String ruleRepo; private String ruleRepo;
private Integer line; private Integer line;
Expand All @@ -45,13 +45,13 @@ public String key() {
return key; return key;
} }


public PreviousIssue setComponentPath(@Nullable String path) { public PreviousIssue setComponentKey(@Nullable String key) {
this.componentPath = path; this.componentKey = key;
return this; return this;
} }


public String componentPath() { public String componentKey() {
return componentPath; return componentKey;
} }


public PreviousIssue setLine(Integer line) { public PreviousIssue setLine(Integer line) {
Expand Down
Expand Up @@ -38,7 +38,7 @@ public void writeIssues() throws JSONException {


PreviousIssue issue1 = new PreviousIssue(); PreviousIssue issue1 = new PreviousIssue();
issue1.setKey("key1"); issue1.setKey("key1");
issue1.setComponentPath("path"); issue1.setComponentKey("key");
issue1.setRuleKey("repokey", "rulekey"); issue1.setRuleKey("repokey", "rulekey");
issue1.setLine(2); issue1.setLine(2);
issue1.setMessage("message"); issue1.setMessage("message");
Expand All @@ -58,7 +58,7 @@ public void writeIssues() throws JSONException {


JSONAssert JSONAssert
.assertEquals( .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\"}]", "{\"key\": \"key2\"}]",
out.getBuffer().toString(), true); out.getBuffer().toString(), true);
Expand All @@ -77,7 +77,7 @@ public void readIssues() {
StringWriter out = new StringWriter(); StringWriter out = new StringWriter();
PreviousIssueHelper helper = PreviousIssueHelper.create(out); PreviousIssueHelper helper = PreviousIssueHelper.create(out);
StringReader reader = new StringReader( 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\"}]"); "{\"key\": \"key2\"}]");


Expand All @@ -88,7 +88,7 @@ public void readIssues() {
assertThat(iterator.hasNext()).isFalse(); assertThat(iterator.hasNext()).isFalse();


assertThat(issue1.key()).isEqualTo("key1"); assertThat(issue1.key()).isEqualTo("key1");
assertThat(issue1.componentPath()).isEqualTo("path"); assertThat(issue1.componentKey()).isEqualTo("key");
assertThat(issue1.ruleRepo()).isEqualTo("repokey"); assertThat(issue1.ruleRepo()).isEqualTo("repokey");
assertThat(issue1.ruleKey()).isEqualTo("rulekey"); assertThat(issue1.ruleKey()).isEqualTo("rulekey");
assertThat(issue1.line()).isEqualTo(2); assertThat(issue1.line()).isEqualTo(2);
Expand Down
Expand Up @@ -30,7 +30,7 @@ public class BatchIssueDto {
private String checksum; private String checksum;
private String assigneeLogin; private String assigneeLogin;
private String assigneeName; private String assigneeName;
private String componentPath; private String componentKey;
private String ruleKey; private String ruleKey;
private String ruleRepo; private String ruleRepo;


Expand Down Expand Up @@ -61,12 +61,12 @@ public BatchIssueDto setChecksum(String checksum) {
return this; return this;
} }


public String getComponentPath() { public String getComponentKey() {
return componentPath; return componentKey;
} }


public BatchIssueDto setComponentPath(String componentPath) { public BatchIssueDto setComponentKey(String componentKey) {
this.componentPath = componentPath; this.componentKey = componentKey;
return this; return this;
} }


Expand Down
Expand Up @@ -192,11 +192,11 @@
i.checksum as checksum, i.checksum as checksum,
r.plugin_rule_key as ruleKey, r.plugin_rule_key as ruleKey,
r.plugin_name as ruleRepo, r.plugin_name as ruleRepo,
component.path as componentPath, component.kee as componentKey,
i.assignee as assigneeLogin, i.assignee as assigneeLogin,
u.name as assigneeName u.name as assigneeName
FROM issues i 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 INNER JOIN rules r ON r.id=i.rule_id
LEFT OUTER JOIN users u ON u.login=i.assignee LEFT OUTER JOIN users u ON u.login=i.assignee
WHERE i.status <> 'CLOSED' WHERE i.status <> 'CLOSED'
Expand All @@ -212,7 +212,7 @@
i.checksum as checksum, i.checksum as checksum,
r.plugin_rule_key as ruleKey, r.plugin_rule_key as ruleKey,
r.plugin_name as ruleRepo, r.plugin_name as ruleRepo,
component.path as componentPath, component.kee as componentKey,
i.assignee as assigneeLogin, i.assignee as assigneeLogin,
u.name as assigneeName u.name as assigneeName
FROM issues i FROM issues i
Expand Down

0 comments on commit 3d25feb

Please sign in to comment.