From: Jacek Date: Tue, 31 May 2022 12:15:59 +0000 (+0200) Subject: SONAR-16316 Include issues with 'diff' issue changes into csv result X-Git-Tag: 9.5.0.56709~64 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=916249ba35404af7a78bb0fd396f69e137c4bec1;p=sonarqube.git SONAR-16316 Include issues with 'diff' issue changes into csv result --- diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/report/RegulatoryReportMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/report/RegulatoryReportMapper.xml index ea6b2bb051f..dc8be684288 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/report/RegulatoryReportMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/report/RegulatoryReportMapper.xml @@ -5,8 +5,27 @@ - - + + + + + + + + + + + + + + + + + + + + + @@ -18,7 +37,6 @@ i.line as line, i.status as status, i.resolution as resolution, - p.kee as componentKey, p.path as fileName, i.issue_type as type, r.plugin_name as ruleRepository, @@ -29,18 +47,19 @@ - select , + ic.kee as issue_change_kee, ic.change_data, - ic.issue_change_creation_date + ic.change_type from issues i inner join rules r on r.uuid=i.rule_uuid inner join components p on p.uuid=i.component_uuid left join issue_changes ic on ic.issue_key = i.kee left join new_code_reference_issues n on i.kee = n.issue_key where i.project_uuid=#{branchUuid,jdbcType=VARCHAR} - and (ic.change_type = 'comment' or ic.change_type is null) and i.status !='CLOSED' order by i.kee, ic.issue_change_creation_date diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/report/RegulatoryReportDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/report/RegulatoryReportDaoTest.java index e500e8bfa13..ca2d6391b50 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/report/RegulatoryReportDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/report/RegulatoryReportDaoTest.java @@ -64,8 +64,11 @@ public class RegulatoryReportDaoTest { IssueDto issue3 = db.issues().insertIssue(rule, project, file, i -> i.setStatus("RESOLVED").setResolution(RESOLUTION_WONT_FIX)); // comments - db.issues().insertChange(issue1, ic -> ic.setChangeData("c2").setIssueChangeCreationDate(2000L).setChangeType("comment")); db.issues().insertChange(issue1, ic -> ic.setChangeData("c1").setIssueChangeCreationDate(1000L).setChangeType("comment")); + db.issues().insertChange(issue1, ic -> ic.setChangeData("c2").setIssueChangeCreationDate(2000L).setChangeType("comment")); + db.issues().insertChange(issue1, ic -> ic.setChangeData("c3").setIssueChangeCreationDate(3000L).setChangeType("diff").setKey(null)); + + db.issues().insertChange(issue2, ic -> ic.setChangeData("c4").setIssueChangeCreationDate(4000L).setChangeType("diff").setKey(null)); // not returned IssueDto issue4 = db.issues().insertIssue(rule, project, file, i -> i.setStatus("CLOSED").setResolution(null)); @@ -89,6 +92,10 @@ public class RegulatoryReportDaoTest { assertThat(issue.getType().getDbConstant()).isEqualTo(issue1.getType()); assertThat(issue.getSecurityStandards()).isEqualTo(rule.getSecurityStandards()); assertThat(issue.isManualSeverity()).isEqualTo(issue1.isManualSeverity()); + assertThat(issue.getCreationDate()).isEqualTo(issue1.getIssueCreationTime()); + assertThat(issue.isNewCodeReferenceIssue()).isEqualTo(issue1.isNewCodeReferenceIssue()); + assertThat(issue.getResolution()).isEqualTo(issue1.getResolution()); + assertThat(issue.getStatus()).isEqualTo(issue1.getStatus()); assertThat(issue.getComments()).containsExactly("c1", "c2"); } }