diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2019-03-26 16:36:26 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-04-23 20:21:07 +0200 |
commit | afe312e4cbf9ac88676d526ff6da0b641aef4ae8 (patch) | |
tree | 7204b4f4de9ef832aba5e5d05a48d236e2b3ff4e /server/sonar-db-dao | |
parent | aecf4fd6c7a0521f5fcc2101497f7c0e1f63ac99 (diff) | |
download | sonarqube-afe312e4cbf9ac88676d526ff6da0b641aef4ae8.tar.gz sonarqube-afe312e4cbf9ac88676d526ff6da0b641aef4ae8.zip |
SONAR-11858 Apply light issue tracking with siblings for all branches
Diffstat (limited to 'server/sonar-db-dao')
6 files changed, 14 insertions, 12 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java index eca30f4dcd1..d065136abab 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java @@ -364,8 +364,8 @@ public class ComponentDao implements Dao { return mapper(dbSession).selectProjectsByNameQuery(nameQueryForSql, includeModules); } - public List<KeyWithUuidDto> selectComponentKeysHavingIssuesToMerge(DbSession dbSession, String mergeBranchUuid) { - return mapper(dbSession).selectComponentKeysHavingIssuesToMerge(mergeBranchUuid); + public List<KeyWithUuidDto> selectAllSiblingComponentKeysHavingOpenIssues(DbSession dbSession, String referenceBranchUuid, String currentBranchUuid) { + return mapper(dbSession).selectAllSiblingComponentKeysHavingOpenIssues(referenceBranchUuid, currentBranchUuid); } /** diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java index fac6f2c06da..b8045d385c4 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java @@ -166,7 +166,8 @@ public interface ComponentMapper { void updateTags(ComponentDto component); - List<KeyWithUuidDto> selectComponentKeysHavingIssuesToMerge(@Param("mergeBranchUuid") String mergeBranchUuid); + List<KeyWithUuidDto> selectAllSiblingComponentKeysHavingOpenIssues(@Param("referenceBranchUuid") String referenceBranchUuid, + @Param("currentBranchUuid") String currentBranchUuid); List<ProjectNclocDistributionDto> selectPrivateProjectsWithNcloc(@Param("organizationUuid") String organizationUuid); 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 623c790b10f..7876c944ab3 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 @@ -33,7 +33,7 @@ public final class ShortBranchIssueDto implements Serializable { private Integer line; private String checksum; private String status; - private Long issueCreationDate; + private Long issueUpdateDate; // joins private String ruleKey; @@ -109,12 +109,12 @@ public final class ShortBranchIssueDto implements Serializable { return RuleKey.of(ruleRepo, ruleKey); } - public Long getIssueCreationDate() { - return issueCreationDate; + public Long getIssueUpdateDate() { + return issueUpdateDate; } - public ShortBranchIssueDto setIssueCreationDate(Long issueCreationDate) { - this.issueCreationDate = issueCreationDate; + public ShortBranchIssueDto setIssueUpdateDate(Long issueUpdateDate) { + this.issueUpdateDate = issueUpdateDate; return this; } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml index 90ec7a99a7e..f0c7c129f09 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml @@ -816,14 +816,15 @@ DELETE FROM projects WHERE id=#{id,jdbcType=BIGINT} </delete> - <select id="selectComponentKeysHavingIssuesToMerge" resultType="KeyWithUuid"> + <select id="selectAllSiblingComponentKeysHavingOpenIssues" resultType="KeyWithUuid"> SELECT DISTINCT p.kee as kee, p.uuid as uuid FROM projects p JOIN issues i ON p.uuid = i.component_uuid JOIN project_branches b ON i.project_uuid = b.uuid AND (b.branch_type = 'SHORT' OR b.branch_type = 'PULL_REQUEST') - AND b.merge_branch_uuid = #{mergeBranchUuid,jdbcType=VARCHAR} + AND b.merge_branch_uuid = #{referenceBranchUuid,jdbcType=VARCHAR} + AND b.uuid != #{currentBranchUuid,jdbcType=VARCHAR} AND i.status != 'CLOSED' </select> 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 cf9958a1e50..b636849ce36 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 @@ -290,7 +290,7 @@ i.line as line, i.status as status, i.checksum as checksum, - i.issue_creation_date as issueCreationDate, + i.issue_update_date as issueUpdateDate, r.plugin_rule_key as ruleKey, r.plugin_name as ruleRepo, b.kee as branchName 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 28263acb141..fbc50aea6bf 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 @@ -235,7 +235,7 @@ public class IssueDaoTest { assertThat(fp.getRuleKey()).isNotNull(); assertThat(fp.getStatus()).isNotNull(); assertThat(fp.getBranchName()).isEqualTo("feature/foo"); - assertThat(fp.getIssueCreationDate()).isNotNull(); + assertThat(fp.getIssueUpdateDate()).isNotNull(); } @Test |