aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2019-04-08 17:41:06 +0200
committerSonarTech <sonartech@sonarsource.com>2019-04-23 20:21:08 +0200
commit0d17e454b4a6adbb1f7ff38293a0966d0306c3bd (patch)
tree6f6fab5d0a2fbdde3258fbbacca1055ac5940055 /server/sonar-db-dao
parentafbb758004d62375c5d91c1180ad6050e8f4e253 (diff)
downloadsonarqube-0d17e454b4a6adbb1f7ff38293a0966d0306c3bd.tar.gz
sonarqube-0d17e454b4a6adbb1f7ff38293a0966d0306c3bd.zip
SONAR-11859 Fix issue changelog
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/issue/ShortBranchIssueDto.java24
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml3
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java4
3 files changed, 24 insertions, 7 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ShortBranchIssueDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ShortBranchIssueDto.java
index 7876c944ab3..bdb34339ab8 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ShortBranchIssueDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ShortBranchIssueDto.java
@@ -25,6 +25,7 @@ import javax.annotation.Nullable;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.rule.RuleKey;
+import org.sonar.db.component.KeyType;
public final class ShortBranchIssueDto implements Serializable {
@@ -38,7 +39,8 @@ public final class ShortBranchIssueDto implements Serializable {
// joins
private String ruleKey;
private String ruleRepo;
- private String branchName;
+ private String branchKey;
+ private KeyType keyType;
public String getKey() {
return kee;
@@ -69,12 +71,24 @@ public final class ShortBranchIssueDto implements Serializable {
return this;
}
- public String getBranchName() {
- return branchName;
+ /**
+ * Branch name for SLB, PR key for PR
+ */
+ public String getBranchKey() {
+ return branchKey;
}
- public ShortBranchIssueDto setBranchName(String s) {
- this.branchName = s;
+ public ShortBranchIssueDto setBranchKey(String s) {
+ this.branchKey = s;
+ return this;
+ }
+
+ public KeyType getKeyType() {
+ return keyType;
+ }
+
+ public ShortBranchIssueDto setKeyType(KeyType s) {
+ this.keyType = s;
return this;
}
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml
index b636849ce36..b4b6649574c 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml
@@ -293,7 +293,8 @@
i.issue_update_date as issueUpdateDate,
r.plugin_rule_key as ruleKey,
r.plugin_name as ruleRepo,
- b.kee as branchName
+ b.kee as branchKey,
+ b.key_type as keyType
from issues i
inner join rules r on r.id = i.rule_id
inner join project_branches b on i.project_uuid = b.uuid
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java
index fbc50aea6bf..d7a168b0abe 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java
@@ -37,6 +37,7 @@ import org.sonar.db.RowNotFoundException;
import org.sonar.db.component.BranchType;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
+import org.sonar.db.component.KeyType;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.rule.RuleDefinitionDto;
import org.sonar.db.rule.RuleDto;
@@ -234,7 +235,8 @@ public class IssueDaoTest {
assertThat(fp.getChecksum()).isNotEmpty();
assertThat(fp.getRuleKey()).isNotNull();
assertThat(fp.getStatus()).isNotNull();
- assertThat(fp.getBranchName()).isEqualTo("feature/foo");
+ assertThat(fp.getBranchKey()).isEqualTo("feature/foo");
+ assertThat(fp.getKeyType()).isEqualTo(KeyType.BRANCH);
assertThat(fp.getIssueUpdateDate()).isNotNull();
}