From cbc00be035405cade14eef1366a89b65583242b8 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 24 Mar 2016 17:44:13 +0100 Subject: [PATCH] SONAR-7473 Drop 'reporter' field from backend --- .../computation/issue/IssueAssignerTest.java | 7 ++++++- .../sonar/server/issue/IssueStorageTest.java | 5 ----- .../server/issue/ServerIssueStorageTest.java | 2 -- .../issue/workflow/IssueWorkflowTest.java | 12 ++++-------- .../should_insert_new_issues-result.xml | 2 +- .../should_update_issues-result.xml | 2 +- .../IssueStorageTest/should_update_issues.xml | 2 +- .../should_insert_new_issues-result.xml | 2 +- .../org/sonar/core/issue/DefaultIssue.java | 12 +++++------- .../sonar/core/issue/DefaultIssueBuilder.java | 7 ++++--- .../sonar/core/issue/DefaultIssueTest.java | 8 +++----- .../java/org/sonar/db/issue/IssueDto.java | 19 ++----------------- .../org/sonar/db/issue/IssueMapper.xml | 8 ++------ .../java/org/sonar/db/issue/IssueDaoTest.java | 3 --- .../java/org/sonar/db/issue/IssueDtoTest.java | 6 ++---- .../org/sonar/db/issue/IssueMapperTest.java | 4 ---- ...tChangelogOfNonClosedIssuesByComponent.xml | 4 ++-- .../find_severities_by_component.xml | 6 +++--- .../should_select_issue_and_component_ids.xml | 6 +++--- ...uld_select_non_closed_issues_by_module.xml | 2 +- ...ed_issues_by_module_on_removed_project.xml | 2 +- .../db/issue/IssueDaoTest/update-result.xml | 2 +- .../should_select_assignees.xml | 6 +++--- .../java/org/sonar/api/issue/Issuable.java | 5 ++++- .../main/java/org/sonar/api/issue/Issue.java | 3 ++- 25 files changed, 52 insertions(+), 85 deletions(-) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java index 839437da0fb..1d3a3403f98 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueAssignerTest.java @@ -181,7 +181,12 @@ public class IssueAssignerTest { underTest.onIssue(FILE, issue); assertThat(logTester.logs(LoggerLevel.WARN)).containsOnly( - "No SCM info has been found for issue DefaultIssue[key=,type=VULNERABILITY,componentUuid=,componentKey=,moduleUuid=,moduleUuidPath=,projectUuid=,projectKey=,ruleKey=,language=,severity=,manualSeverity=false,message=,line=2,gap=,effort=,status=,resolution=,reporter=,assignee=,checksum=,attributes=,authorLogin=,comments=,tags=,locations=,creationDate=,updateDate=,closeDate=,currentChange=,changes=,isNew=true,beingClosed=false,onDisabledRule=false,isChanged=false,sendNotifications=false,selectedAt=]"); + "No SCM info has been found for issue DefaultIssue[key=,type=VULNERABILITY,componentUuid=,componentKey=," + + "moduleUuid=,moduleUuidPath=,projectUuid=,projectKey=,ruleKey=,language=,severity=," + + "manualSeverity=false,message=,line=2,gap=,effort=,status=,resolution=," + + "assignee=,checksum=,attributes=,authorLogin=,comments=,tags=," + + "locations=,creationDate=,updateDate=,closeDate=,currentChange=,changes=,isNew=true," + + "beingClosed=false,onDisabledRule=false,isChanged=false,sendNotifications=false,selectedAt=]"); } private void setSingleChangeset(String author, Long date, String revision) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueStorageTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueStorageTest.java index 0ae426537a1..946f39bd2be 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueStorageTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueStorageTest.java @@ -67,7 +67,6 @@ public class IssueStorageTest { .setRuleKey(RuleKey.of("squid", "AvoidCycle")) .setLine(5000) .setEffort(Duration.create(10L)) - .setReporter("emmerik") .setResolution("OPEN") .setStatus("OPEN") .setSeverity("BLOCKER") @@ -104,7 +103,6 @@ public class IssueStorageTest { .setRuleKey(RuleKey.of("squid", "AvoidCycle")) .setLine(5000) .setEffort(Duration.create(10L)) - .setReporter("emmerik") .setResolution("OPEN") .setStatus("OPEN") .setSeverity("BLOCKER") @@ -144,7 +142,6 @@ public class IssueStorageTest { .setRuleKey(RuleKey.of("squid", "AvoidCycle")) .setLine(5000) .setEffort(Duration.create(10L)) - .setReporter("emmerik") .setResolution("OPEN") .setStatus("OPEN") .setSeverity("BLOCKER") @@ -189,7 +186,6 @@ public class IssueStorageTest { .setAuthorLogin("simon") .setAssignee("loic") .setFieldChange(context, "severity", "INFO", "BLOCKER") - .setReporter("emmerik") .setResolution("FIXED") .setStatus("RESOLVED") .setSeverity("BLOCKER") @@ -236,7 +232,6 @@ public class IssueStorageTest { .setAuthorLogin("simon") .setAssignee("loic") .setFieldChange(context, "severity", "INFO", "BLOCKER") - .setReporter("emmerik") .setResolution("FIXED") .setStatus("RESOLVED") .setSeverity("BLOCKER") diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java index 064588828e7..1feb8adf25e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java @@ -95,7 +95,6 @@ public class ServerIssueStorageTest { .setProjectKey("struts") .setLine(5000) .setEffort(Duration.create(10L)) - .setReporter("emmerik") .setResolution("OPEN") .setStatus("OPEN") .setSeverity("BLOCKER") @@ -138,7 +137,6 @@ public class ServerIssueStorageTest { .setAuthorLogin("simon") .setAssignee("loic") .setFieldChange(context, "severity", "INFO", "BLOCKER") - .setReporter("emmerik") .setResolution("FIXED") .setStatus("RESOLVED") .setSeverity("BLOCKER") diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java index abc253ed079..6b1e4549c5f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java @@ -125,8 +125,7 @@ public class IssueWorkflowTest { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(STATUS_CLOSED) - .setRuleKey(RuleKey.of("manual", "Performance")) - .setReporter("simon"); + .setRuleKey(RuleKey.of("manual", "Performance")); List transitions = workflow.outTransitions(issue); assertThat(keys(transitions)).containsOnly("reopen"); @@ -333,11 +332,11 @@ public class IssueWorkflowTest { .setKey("ABCDE") .setRuleKey(RuleKey.of(MANUAL_REPOSITORY_KEY, "Performance")) - // resolved by user + // resolved by user .setResolution(RESOLUTION_FIXED) .setStatus(STATUS_RESOLVED) - // but unmatched by tracking engine + // but unmatched by tracking engine .setBeingClosed(true); workflow.start(); @@ -353,8 +352,7 @@ public class IssueWorkflowTest { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(STATUS_OPEN) - .setRuleKey(RuleKey.of("manual", "Performance")) - .setReporter("simon"); + .setRuleKey(RuleKey.of("manual", "Performance")); workflow.start(); @@ -392,7 +390,6 @@ public class IssueWorkflowTest { .setKey("ABCDE") .setStatus(STATUS_OPEN) .setRuleKey(RuleKey.of("manual", "Performance")) - .setReporter("simon") .setBeingClosed(true) .setOnDisabledRule(true); @@ -410,7 +407,6 @@ public class IssueWorkflowTest { .setKey("ABCDE") .setStatus(STATUS_OPEN) .setRuleKey(RuleKey.of("manual", "Performance")) - .setReporter("simon") .setBeingClosed(true) .setOnDisabledRule(false); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_insert_new_issues-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_insert_new_issues-result.xml index 4cc182d5a66..8c8a93cbd13 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_insert_new_issues-result.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_insert_new_issues-result.xml @@ -12,7 +12,7 @@ rule_id="200" created_at="[null]" updated_at="[null]" - reporter="emmerik" + reporter="[null]" issue_attributes="foo=bar" tags="[null]" action_plan_key="[null]" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues-result.xml index 27e6a2aa6c2..1a8a5607b7f 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues-result.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues-result.xml @@ -17,7 +17,7 @@ rule_id="200" created_at="2013-05-18" updated_at="2013-05-18" - reporter="emmerik" + reporter="[null]" issue_attributes="foo=bar" tags="[null]" action_plan_key="[null]" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues.xml index 6983f832393..478c01ec27d 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/IssueStorageTest/should_update_issues.xml @@ -17,7 +17,7 @@ rule_id="200" created_at="1400000000000" updated_at="1400000000000" - reporter="emmerik" + reporter="[null]" issue_attributes="foo=bar" tags="[null]" action_plan_key="[null]" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues-result.xml index 0e12196051f..71d96ca788d 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues-result.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues-result.xml @@ -12,7 +12,7 @@ rule_id="200" created_at="1000000000" updated_at="1000000000" - reporter="emmerik" + reporter="[null]" issue_attributes="foo=bar" tags="[null]" action_plan_key="[null]" diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java index aa56371cb11..e8885be59ba 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java @@ -75,7 +75,6 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure. private Duration effort; private String status; private String resolution; - private String reporter; private String assignee; private String checksum; private Map attributes = null; @@ -340,15 +339,14 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure. return this; } + /** + * @deprecated since 5.5, manual issue feature has been dropped. + */ + @Deprecated @Override @CheckForNull public String reporter() { - return reporter; - } - - public DefaultIssue setReporter(@Nullable String s) { - this.reporter = s; - return this; + return null; } @Override diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java index a97a4c089bd..4f44a40bba1 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java @@ -41,7 +41,6 @@ public class DefaultIssueBuilder implements Issuable.IssueBuilder { private String message; private String severity; private Double effortToFix; - private String reporter; private String assignee; private RuleType type; private Map attributes; @@ -114,9 +113,12 @@ public class DefaultIssueBuilder implements Issuable.IssueBuilder { return this; } + /** + * @deprecated since 5.5, manual issue feature has been dropped. + */ + @Deprecated @Override public DefaultIssueBuilder reporter(@Nullable String s) { - this.reporter = s; return this; } @@ -157,7 +159,6 @@ public class DefaultIssueBuilder implements Issuable.IssueBuilder { issue.setManualSeverity(false); issue.setGap(effortToFix); issue.setLine(line); - issue.setReporter(reporter); issue.setAssignee(assignee); issue.setAttributes(attributes); issue.setResolution(null); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java index a98373af68c..190c413f7b8 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java @@ -53,7 +53,6 @@ public class DefaultIssueTest { .setEffort(Duration.create(28800L)) .setStatus(Issue.STATUS_CLOSED) .setResolution(Issue.RESOLUTION_FIXED) - .setReporter("simon") .setAssignee("julien") .setAuthorLogin("steph") .setChecksum("c7b5db46591806455cf082bb348631e8") @@ -76,11 +75,10 @@ public class DefaultIssueTest { assertThat(issue.manualSeverity()).isTrue(); assertThat(issue.message()).isEqualTo("a message"); assertThat(issue.line()).isEqualTo(7); - assertThat(issue.effortToFix()).isEqualTo(1.2d); - assertThat(issue.debt()).isEqualTo(Duration.create(28800L)); + assertThat(issue.gap()).isEqualTo(1.2d); + assertThat(issue.effort()).isEqualTo(Duration.create(28800L)); assertThat(issue.status()).isEqualTo(Issue.STATUS_CLOSED); assertThat(issue.resolution()).isEqualTo(Issue.RESOLUTION_FIXED); - assertThat(issue.reporter()).isEqualTo("simon"); assertThat(issue.assignee()).isEqualTo("julien"); assertThat(issue.authorLogin()).isEqualTo("steph"); assertThat(issue.checksum()).isEqualTo("c7b5db46591806455cf082bb348631e8"); @@ -173,7 +171,7 @@ public class DefaultIssueTest { @Test public void test_nullable_fields() throws Exception { issue.setGap(null).setSeverity(null).setLine(null); - assertThat(issue.effortToFix()).isNull(); + assertThat(issue.gap()).isNull(); assertThat(issue.severity()).isNull(); assertThat(issue.line()).isNull(); } diff --git a/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java b/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java index 56d267a6b6b..0c996463aa6 100644 --- a/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java +++ b/sonar-db/src/main/java/org/sonar/db/issue/IssueDto.java @@ -69,7 +69,6 @@ public final class IssueDto implements Serializable { private String status; private String resolution; private String checksum; - private String reporter; private String assignee; private String authorLogin; private String issueAttributes; @@ -115,7 +114,6 @@ public final class IssueDto implements Serializable { .setSeverity(issue.severity()) .setManualSeverity(issue.manualSeverity()) .setChecksum(issue.checksum()) - .setReporter(issue.reporter()) .setAssignee(issue.assignee()) .setRuleId(ruleId) .setRuleKey(issue.ruleKey().repository(), issue.ruleKey().rule()) @@ -134,7 +132,7 @@ public final class IssueDto implements Serializable { .setIssueUpdateDate(issue.updateDate()) .setSelectedAt(issue.selectedAt()) - // technical dates + // technical dates .setCreatedAt(now) .setUpdatedAt(now); } @@ -163,7 +161,6 @@ public final class IssueDto implements Serializable { .setSeverity(issue.severity()) .setChecksum(issue.checksum()) .setManualSeverity(issue.manualSeverity()) - .setReporter(issue.reporter()) .setAssignee(issue.assignee()) .setIssueAttributes(KeyValueFormat.format(issue.attributes())) .setAuthorLogin(issue.authorLogin()) @@ -180,7 +177,7 @@ public final class IssueDto implements Serializable { .setIssueUpdateDate(issue.updateDate()) .setSelectedAt(issue.selectedAt()) - // technical date + // technical date .setUpdatedAt(now); } @@ -341,17 +338,6 @@ public final class IssueDto implements Serializable { return this; } - @CheckForNull - public String getReporter() { - return reporter; - } - - public IssueDto setReporter(@Nullable String s) { - checkArgument(s == null || s.length() <= 255, "Value is too long for issue reporter: %s", s); - this.reporter = s; - return this; - } - @CheckForNull public String getAssignee() { return assignee; @@ -722,7 +708,6 @@ public final class IssueDto implements Serializable { issue.setLine(line); issue.setChecksum(checksum); issue.setSeverity(severity); - issue.setReporter(reporter); issue.setAssignee(assignee); issue.setAttributes(KeyValueFormat.parse(Objects.firstNonNull(issueAttributes, ""))); issue.setComponentKey(componentKey); diff --git a/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml index 8c13afdc31c..cc440f77446 100644 --- a/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml @@ -18,7 +18,6 @@ i.status as status, i.resolution as resolution, i.checksum as checksum, - i.reporter as reporter, i.assignee as assignee, i.author_login as authorLogin, i.tags as tagsString, @@ -69,7 +68,7 @@ INSERT INTO issues (kee, rule_id, severity, manual_severity, message, line, locations, gap, effort, status, tags, - resolution, checksum, reporter, assignee, author_login, issue_attributes, issue_creation_date, issue_update_date, + resolution, checksum, assignee, author_login, issue_attributes, issue_creation_date, issue_update_date, issue_close_date, created_at, updated_at, component_uuid, project_uuid, issue_type) VALUES (#{kee,jdbcType=VARCHAR}, #{ruleId,jdbcType=INTEGER}, #{severity,jdbcType=VARCHAR}, @@ -77,7 +76,7 @@ #{locations,jdbcType=BINARY}, #{gap,jdbcType=DOUBLE}, #{effort,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}, #{tagsString,jdbcType=VARCHAR}, #{resolution,jdbcType=VARCHAR}, #{checksum,jdbcType=VARCHAR}, - #{reporter,jdbcType=VARCHAR}, #{assignee,jdbcType=VARCHAR}, #{authorLogin,jdbcType=VARCHAR}, + #{assignee,jdbcType=VARCHAR}, #{authorLogin,jdbcType=VARCHAR}, #{issueAttributes,jdbcType=VARCHAR}, #{issueCreationTime,jdbcType=BIGINT},#{issueUpdateTime,jdbcType=BIGINT}, #{issueCloseTime,jdbcType=BIGINT}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, @@ -99,7 +98,6 @@ status=#{status,jdbcType=VARCHAR}, resolution=#{resolution,jdbcType=VARCHAR}, checksum=#{checksum,jdbcType=VARCHAR}, - reporter=#{reporter,jdbcType=VARCHAR}, assignee=#{assignee,jdbcType=VARCHAR}, author_login=#{authorLogin,jdbcType=VARCHAR}, tags=#{tagsString,jdbcType=VARCHAR}, @@ -128,7 +126,6 @@ status=#{status,jdbcType=VARCHAR}, resolution=#{resolution,jdbcType=VARCHAR}, checksum=#{checksum,jdbcType=VARCHAR}, - reporter=#{reporter,jdbcType=VARCHAR}, assignee=#{assignee,jdbcType=VARCHAR}, author_login=#{authorLogin,jdbcType=VARCHAR}, tags=#{tagsString,jdbcType=VARCHAR}, @@ -181,7 +178,6 @@ i.status as status, i.resolution as resolution, i.checksum as checksum, - i.reporter as reporter, i.assignee as assignee, i.author_login as authorLogin, i.tags as tagsString, diff --git a/sonar-db/src/test/java/org/sonar/db/issue/IssueDaoTest.java b/sonar-db/src/test/java/org/sonar/db/issue/IssueDaoTest.java index 9f2290ad1e9..4b48ebbce04 100644 --- a/sonar-db/src/test/java/org/sonar/db/issue/IssueDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/issue/IssueDaoTest.java @@ -36,7 +36,6 @@ import org.sonar.db.rule.RuleTesting; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; - public class IssueDaoTest { public static final RuleDto RULE = RuleTesting.newXooX1(); @@ -120,7 +119,6 @@ public class IssueDaoTest { assertThat(issue.getResolution()).isEqualTo("FIXED"); assertThat(issue.getChecksum()).isEqualTo("123456789"); assertThat(issue.getAuthorLogin()).isEqualTo("morgan"); - assertThat(issue.getReporter()).isEqualTo("emmerik"); assertThat(issue.getAssignee()).isEqualTo("karadoc"); assertThat(issue.getIssueAttributes()).isEqualTo("JIRA=FOO-1234"); assertThat(issue.getIssueCreationDate()).isNotNull(); @@ -181,7 +179,6 @@ public class IssueDaoTest { dto.setResolution("FIXED"); dto.setStatus("RESOLVED"); dto.setSeverity("BLOCKER"); - dto.setReporter("emmerik"); dto.setAuthorLogin("morgan"); dto.setAssignee("karadoc"); dto.setIssueAttributes("JIRA=FOO-1234"); diff --git a/sonar-db/src/test/java/org/sonar/db/issue/IssueDtoTest.java b/sonar-db/src/test/java/org/sonar/db/issue/IssueDtoTest.java index 865f476f867..f4c4b5a98eb 100644 --- a/sonar-db/src/test/java/org/sonar/db/issue/IssueDtoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/issue/IssueDtoTest.java @@ -77,7 +77,6 @@ public class IssueDtoTest { .setSeverity("BLOCKER") .setMessage("message") .setManualSeverity(true) - .setReporter("arthur") .setAssignee("perceval") .setIssueAttributes("key=value") .setAuthorLogin("pierre") @@ -98,13 +97,12 @@ public class IssueDtoTest { assertThat(issue.projectKey()).isEqualTo("org.sonar.sample"); assertThat(issue.status()).isEqualTo(Issue.STATUS_CLOSED); assertThat(issue.resolution()).isEqualTo(Issue.RESOLUTION_FALSE_POSITIVE); - assertThat(issue.effortToFix()).isEqualTo(15.0); - assertThat(issue.debt()).isEqualTo(Duration.create(10L)); + assertThat(issue.gap()).isEqualTo(15.0); + assertThat(issue.effort()).isEqualTo(Duration.create(10L)); assertThat(issue.line()).isEqualTo(6); assertThat(issue.severity()).isEqualTo("BLOCKER"); assertThat(issue.message()).isEqualTo("message"); assertThat(issue.manualSeverity()).isTrue(); - assertThat(issue.reporter()).isEqualTo("arthur"); assertThat(issue.assignee()).isEqualTo("perceval"); assertThat(issue.attribute("key")).isEqualTo("value"); assertThat(issue.authorLogin()).isEqualTo("pierre"); diff --git a/sonar-db/src/test/java/org/sonar/db/issue/IssueMapperTest.java b/sonar-db/src/test/java/org/sonar/db/issue/IssueMapperTest.java index 0091675d756..8c3da1c63ff 100644 --- a/sonar-db/src/test/java/org/sonar/db/issue/IssueMapperTest.java +++ b/sonar-db/src/test/java/org/sonar/db/issue/IssueMapperTest.java @@ -74,7 +74,6 @@ public class IssueMapperTest { assertThat(result.getResolution()).isEqualTo("FIXED"); assertThat(result.getStatus()).isEqualTo("RESOLVED"); assertThat(result.getSeverity()).isEqualTo("BLOCKER"); - assertThat(result.getReporter()).isEqualTo("emmerik"); assertThat(result.getAuthorLogin()).isEqualTo("morgan"); assertThat(result.getAssignee()).isEqualTo("karadoc"); assertThat(result.getIssueAttributes()).isEqualTo("JIRA=FOO-1234"); @@ -105,7 +104,6 @@ public class IssueMapperTest { update.setResolution("FIXED"); update.setStatus("RESOLVED"); update.setSeverity("BLOCKER"); - update.setReporter("emmerik"); update.setAuthorLogin("morgan"); update.setAssignee("karadoc"); update.setIssueAttributes("JIRA=FOO-1234"); @@ -136,7 +134,6 @@ public class IssueMapperTest { assertThat(result.getResolution()).isEqualTo("FIXED"); assertThat(result.getStatus()).isEqualTo("RESOLVED"); assertThat(result.getSeverity()).isEqualTo("BLOCKER"); - assertThat(result.getReporter()).isEqualTo("emmerik"); assertThat(result.getAuthorLogin()).isEqualTo("morgan"); assertThat(result.getAssignee()).isEqualTo("karadoc"); assertThat(result.getIssueAttributes()).isEqualTo("JIRA=FOO-1234"); @@ -221,7 +218,6 @@ public class IssueMapperTest { .setResolution("FIXED") .setStatus("RESOLVED") .setSeverity("BLOCKER") - .setReporter("emmerik") .setAuthorLogin("morgan") .setAssignee("karadoc") .setIssueAttributes("JIRA=FOO-1234") diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueChangeDaoTest/selectChangelogOfNonClosedIssuesByComponent.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueChangeDaoTest/selectChangelogOfNonClosedIssuesByComponent.xml index 5119dd45c57..efb08c7ae4f 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueChangeDaoTest/selectChangelogOfNonClosedIssuesByComponent.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueChangeDaoTest/selectChangelogOfNonClosedIssuesByComponent.xml @@ -15,7 +15,7 @@ line="200" gap="[null]" checksum="[null]" - reporter="user" + reporter="[null]" assignee="user" author_login="[null]" issue_attributes="[null]" @@ -146,7 +146,7 @@ line="200" gap="[null]" checksum="[null]" - reporter="user" + reporter="[null]" assignee="user" author_login="[null]" issue_attributes="[null]" diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml index 35486efd650..3a272a88b28 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/find_severities_by_component.xml @@ -15,7 +15,7 @@ status="OPEN" resolution="[null]" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" @@ -41,7 +41,7 @@ status="OPEN" resolution="[null]" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" @@ -69,7 +69,7 @@ status="OPEN" resolution="[null]" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml index 1aa94275af2..a86bf7a776a 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml @@ -15,7 +15,7 @@ status="OPEN" resolution="FIXED" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" @@ -41,7 +41,7 @@ status="OPEN" resolution="FIXED" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" @@ -69,7 +69,7 @@ status="OPEN" resolution="FIXED" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml index 82aeab40ca1..946a67dd5be 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml @@ -15,7 +15,7 @@ status="OPEN" resolution="[null]" checksum="[null]" - reporter="user" + reporter="[null]" assignee="user" author_login="[null]" issue_attributes="[null]" diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml index e48cccd9e4a..06cf3a4e64d 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml @@ -35,7 +35,7 @@ status="OPEN" resolution="[null]" checksum="[null]" - reporter="user" + reporter="[null]" assignee="user" author_login="[null]" issue_attributes="[null]" diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml index 3c03568a481..483763302b6 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/update-result.xml @@ -14,7 +14,7 @@ status="RESOLVED" resolution="FIXED" checksum="123456789" - reporter="emmerik" + reporter="[null]" author_login="morgan" assignee="karadoc" issue_attributes="JIRA=FOO-1234" diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml index 53ebfd57a66..58cad579bdc 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml @@ -17,7 +17,7 @@ status="OPEN" resolution="FIXED" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" @@ -43,7 +43,7 @@ status="OPEN" resolution="FIXED" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="[null]" author_login="[null]" issue_attributes="JIRA=FOO-1234" @@ -69,7 +69,7 @@ status="OPEN" resolution="FIXED" checksum="XXX" - reporter="arthur" + reporter="[null]" assignee="perceval" author_login="[null]" issue_attributes="JIRA=FOO-1234" diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java index a723fb4b621..a9dee840467 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java @@ -20,6 +20,7 @@ package org.sonar.api.issue; import java.util.List; +import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.batch.sensor.issue.NewIssue; import org.sonar.api.batch.sensor.issue.NewIssueLocation; @@ -112,8 +113,10 @@ public interface Issuable extends Perspective { IssueBuilder severity(@Nullable String severity); /** - * Login of the user who reported the issue. Optional. + * @deprecated since 5.5, manual issue feature has been dropped. */ + @Deprecated + @CheckForNull IssueBuilder reporter(@Nullable String reporter); IssueBuilder effortToFix(@Nullable Double d); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java index ce99e1d3c25..96ee3c2405b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java @@ -139,8 +139,9 @@ public interface Issue extends Serializable { String resolution(); /** - * Login of the user who reported this issue. Null if the issue is reported by a rule engine. + * @deprecated since 5.5, manual issue feature has been dropped. */ + @Deprecated @CheckForNull String reporter(); -- 2.39.5