diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2023-11-06 14:18:31 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-11-08 20:02:53 +0000 |
commit | 9f451cb3fb66e618e48278de7104e204b8695ef1 (patch) | |
tree | df9b39d8845af59e02e7ed1ff67f456b148ce78e /server/sonar-server-common | |
parent | 34dffa98cc400f52b59826670c765a77e07316e9 (diff) | |
download | sonarqube-9f451cb3fb66e618e48278de7104e204b8695ef1.tar.gz sonarqube-9f451cb3fb66e618e48278de7104e204b8695ef1.zip |
SONAR-20877 Update naming to issueStatus
Diffstat (limited to 'server/sonar-server-common')
9 files changed, 41 insertions, 41 deletions
diff --git a/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIndexerIT.java b/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIndexerIT.java index 4bc12e92e33..540b67e6eb6 100644 --- a/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIndexerIT.java +++ b/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIndexerIT.java @@ -153,7 +153,7 @@ public class IssueIndexerIT { .containsExactlyInAnyOrder(Map.of( SUB_FIELD_SOFTWARE_QUALITY, SoftwareQuality.MAINTAINABILITY.name(), SUB_FIELD_SEVERITY, Severity.HIGH.name())); - assertThat(doc.simpleStatus()).isEqualTo(issue.getSimpleStatus().name()); + assertThat(doc.issueStatus()).isEqualTo(issue.getIssueStatus().name()); } @Test diff --git a/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIteratorFactoryIT.java b/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIteratorFactoryIT.java index 10acc9a28a6..e3f5ed6ba05 100644 --- a/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIteratorFactoryIT.java +++ b/server/sonar-server-common/src/it/java/org/sonar/server/issue/index/IssueIteratorFactoryIT.java @@ -28,7 +28,7 @@ import java.util.stream.Stream; import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; -import org.sonar.core.issue.status.SimpleStatus; +import org.sonar.core.issue.status.IssueStatus; import org.sonar.db.DbTester; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ProjectData; @@ -82,7 +82,7 @@ public class IssueIteratorFactoryIT { assertThat(issue.key()).isEqualTo(expected.getKey()); assertThat(issue.resolution()).isEqualTo("FIXED"); assertThat(issue.status()).isEqualTo("RESOLVED"); - assertThat(issue.simpleStatus()).isEqualTo(SimpleStatus.FIXED.name()); + assertThat(issue.issueStatus()).isEqualTo(IssueStatus.FIXED.name()); assertThat(issue.severity()).isEqualTo("BLOCKER"); assertThat(issue.assigneeUuid()).isEqualTo("uuid-of-guy1"); assertThat(issue.authorLogin()).isEqualTo("guy2"); diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java index 39a8d88d15b..4966abcac4f 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java @@ -41,7 +41,7 @@ import org.sonar.api.utils.Duration; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.DefaultIssueComment; import org.sonar.core.issue.IssueChangeContext; -import org.sonar.core.issue.status.SimpleStatus; +import org.sonar.core.issue.status.IssueStatus; import org.sonar.db.protobuf.DbIssues; import org.sonar.db.user.UserDto; import org.sonar.db.user.UserIdDto; @@ -64,16 +64,16 @@ public class IssueFieldsSetter { public static final String ASSIGNEE = "assignee"; /** - * @deprecated use {@link IssueFieldsSetter#SIMPLE_STATUS} instead + * @deprecated use {@link IssueFieldsSetter#ISSUE_STATUS} instead */ @Deprecated(since = "10.4") public static final String RESOLUTION = "resolution"; /** - * @deprecated use {@link IssueFieldsSetter#SIMPLE_STATUS} instead + * @deprecated use {@link IssueFieldsSetter#ISSUE_STATUS} instead */ @Deprecated(since = "10.4") public static final String STATUS = "status"; - public static final String SIMPLE_STATUS = "simpleStatus"; + public static final String ISSUE_STATUS = "issueStatus"; public static final String AUTHOR = "author"; public static final String FILE = "file"; public static final String FROM_BRANCH = "from_branch"; @@ -260,10 +260,10 @@ public class IssueFieldsSetter { return false; } - public boolean setSimpleStatus(DefaultIssue issue, @Nullable SimpleStatus previousSimpleStatus, @Nullable SimpleStatus newSimpleStatus, IssueChangeContext context) { - if (!Objects.equals(newSimpleStatus, previousSimpleStatus)) { - //Currently, simple status is not persisted in database, but is considered as an issue change - issue.setFieldChange(context, SIMPLE_STATUS, previousSimpleStatus, issue.getSimpleStatus()); + public boolean setIssueStatus(DefaultIssue issue, @Nullable IssueStatus previousIssueStatus, @Nullable IssueStatus newIssueStatus, IssueChangeContext context) { + if (!Objects.equals(newIssueStatus, previousIssueStatus)) { + //Currently, issue status is not persisted in database, but is considered as an issue change + issue.setFieldChange(context, ISSUE_STATUS, previousIssueStatus, issue.getIssueStatus()); return true; } return false; diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/SearchRequest.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/SearchRequest.java index a47d23d637b..cd57bcccc18 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/SearchRequest.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/SearchRequest.java @@ -61,7 +61,7 @@ public class SearchRequest { private List<String> impactSoftwareQualities; private List<String> cleanCodeAttributesCategories; private List<String> statuses; - private List<String> simpleStatuses; + private List<String> issueStatuses; private List<String> tags; private Set<String> types; private List<String> pciDss32; @@ -338,14 +338,14 @@ public class SearchRequest { return this; } - public SearchRequest setSimpleStatuses(@Nullable List<String> simpleStatuses) { - this.simpleStatuses = simpleStatuses; + public SearchRequest setIssueStatuses(@Nullable List<String> issueStatuses) { + this.issueStatuses = issueStatuses; return this; } @CheckForNull - public List<String> getSimpleStatuses() { - return simpleStatuses; + public List<String> getIssueStatuses() { + return issueStatuses; } @CheckForNull diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueDoc.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueDoc.java index c9945d0b805..8f1e22209eb 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueDoc.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueDoc.java @@ -113,8 +113,8 @@ public class IssueDoc extends BaseDoc { } @CheckForNull - public String simpleStatus() { - return getNullableField(IssueIndexDefinition.FIELD_ISSUE_SIMPLE_STATUS); + public String issueStatus() { + return getNullableField(IssueIndexDefinition.FIELD_ISSUE_NEW_STATUS); } @CheckForNull @@ -241,8 +241,8 @@ public class IssueDoc extends BaseDoc { return this; } - public IssueDoc setSimpleStatus(String s) { - setField(IssueIndexDefinition.FIELD_ISSUE_SIMPLE_STATUS, s); + public IssueDoc setIssueStatus(String s) { + setField(IssueIndexDefinition.FIELD_ISSUE_NEW_STATUS, s); return this; } diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java index e6d0478661b..4a529fe632e 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexDefinition.java @@ -86,7 +86,7 @@ public class IssueIndexDefinition implements IndexDefinition { public static final String FIELD_ISSUE_SEVERITY = "severity"; public static final String FIELD_ISSUE_SEVERITY_VALUE = "severityValue"; public static final String FIELD_ISSUE_STATUS = "status"; - public static final String FIELD_ISSUE_SIMPLE_STATUS = "simpleStatus"; + public static final String FIELD_ISSUE_NEW_STATUS = "issueStatus"; public static final String FIELD_ISSUE_TAGS = "tags"; public static final String FIELD_ISSUE_TYPE = "type"; public static final String FIELD_ISSUE_PCI_DSS_32 = "pciDss-3.2"; @@ -161,7 +161,7 @@ public class IssueIndexDefinition implements IndexDefinition { mapping.createBooleanField(FIELD_ISSUE_IS_MAIN_BRANCH); mapping.keywordFieldBuilder(FIELD_ISSUE_DIRECTORY_PATH).disableNorms().build(); mapping.keywordFieldBuilder(FIELD_ISSUE_RESOLUTION).disableNorms().build(); - mapping.keywordFieldBuilder(FIELD_ISSUE_SIMPLE_STATUS).disableNorms().build(); + mapping.keywordFieldBuilder(FIELD_ISSUE_NEW_STATUS).disableNorms().build(); mapping.keywordFieldBuilder(FIELD_ISSUE_RULE_UUID).disableNorms().build(); mapping.keywordFieldBuilder(FIELD_ISSUE_SEVERITY).disableNorms().build(); mapping.createByteField(FIELD_ISSUE_SEVERITY_VALUE); diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java index 0fdd1884526..93f962b398b 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java @@ -96,7 +96,7 @@ class IssueIteratorForSingleChunk implements IssueIterator { .orElse(null); doc.setCleanCodeAttributeCategory(cleanCodeAttributeCategory); doc.setStatus(indexedIssueDto.getStatus()); - doc.setSimpleStatus(indexedIssueDto.getSimpleStatus()); + doc.setIssueStatus(indexedIssueDto.getIssueStatus()); doc.setEffort(indexedIssueDto.getEffort()); doc.setAuthorLogin(indexedIssueDto.getAuthorLogin()); diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/IssueWorkflow.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/IssueWorkflow.java index 3f241732581..4b0d9f186f7 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/IssueWorkflow.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/IssueWorkflow.java @@ -29,7 +29,7 @@ import org.sonar.api.server.ServerSide; import org.sonar.api.web.UserRole; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.IssueChangeContext; -import org.sonar.core.issue.status.SimpleStatus; +import org.sonar.core.issue.status.IssueStatus; import org.sonar.server.issue.IssueFieldsSetter; import static com.google.common.base.Preconditions.checkArgument; @@ -331,10 +331,10 @@ public class IssueWorkflow implements Startable { public boolean doManualTransition(DefaultIssue issue, String transitionKey, IssueChangeContext issueChangeContext) { Transition transition = stateOf(issue).transition(transitionKey); if (transition.supports(issue) && !transition.automatic()) { - SimpleStatus previousSimpleStatus = issue.getSimpleStatus(); + IssueStatus previousIssueStatus = issue.getIssueStatus(); functionExecutor.execute(transition.functions(), issue, issueChangeContext); updater.setStatus(issue, transition.to(), issueChangeContext); - updater.setSimpleStatus(issue, previousSimpleStatus, issue.getSimpleStatus(), issueChangeContext); + updater.setIssueStatus(issue, previousIssueStatus, issue.getIssueStatus(), issueChangeContext); return true; } return false; @@ -350,10 +350,10 @@ public class IssueWorkflow implements Startable { public void doAutomaticTransition(DefaultIssue issue, IssueChangeContext issueChangeContext) { Transition transition = stateOf(issue).outAutomaticTransition(issue); if (transition != null) { - SimpleStatus previousSimpleStatus = issue.getSimpleStatus(); + IssueStatus previousIssueStatus = issue.getIssueStatus(); functionExecutor.execute(transition.functions(), issue, issueChangeContext); updater.setStatus(issue, transition.to(), issueChangeContext); - updater.setSimpleStatus(issue, previousSimpleStatus, issue.getSimpleStatus(), issueChangeContext); + updater.setIssueStatus(issue, previousIssueStatus, issue.getIssueStatus(), issueChangeContext); } } diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java index f1174ceed4d..0194976e849 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java @@ -38,7 +38,7 @@ import org.sonar.api.utils.Duration; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.FieldDiffs; import org.sonar.core.issue.IssueChangeContext; -import org.sonar.core.issue.status.SimpleStatus; +import org.sonar.core.issue.status.IssueStatus; import org.sonar.db.protobuf.DbCommons; import org.sonar.db.protobuf.DbIssues; import org.sonar.db.protobuf.DbIssues.MessageFormattingType; @@ -435,42 +435,42 @@ public class IssueFieldsSetterTest { } @Test - public void setSimpleStatus_shouldTriggerFieldChange() { + public void setIssueStatus_shouldTriggerFieldChange() { issue.setResolution(null); issue.setStatus(Issue.STATUS_OPEN); - SimpleStatus simpleStatus = issue.getSimpleStatus(); + IssueStatus issueStatus = issue.getIssueStatus(); underTest.setResolution(issue, Issue.RESOLUTION_WONT_FIX, context); underTest.setStatus(issue, Issue.STATUS_RESOLVED, context); - underTest.setSimpleStatus(issue, simpleStatus, issue.getSimpleStatus(), context); + underTest.setIssueStatus(issue, issueStatus, issue.getIssueStatus(), context); - FieldDiffs.Diff diff = issue.currentChange().diffs().get(IssueFieldsSetter.SIMPLE_STATUS); - assertThat(diff.oldValue()).isEqualTo(SimpleStatus.OPEN); - assertThat(diff.newValue()).isEqualTo(SimpleStatus.ACCEPTED); + FieldDiffs.Diff diff = issue.currentChange().diffs().get(IssueFieldsSetter.ISSUE_STATUS); + assertThat(diff.oldValue()).isEqualTo(IssueStatus.OPEN); + assertThat(diff.newValue()).isEqualTo(IssueStatus.ACCEPTED); } @Test - public void setSimpleStatus_shouldNotTriggerFieldChange_whenNoChanges() { + public void setIssueStatus_shouldNotTriggerFieldChange_whenNoChanges() { issue.setResolution(null); issue.setStatus(Issue.STATUS_OPEN); - SimpleStatus simpleStatus = issue.getSimpleStatus(); - underTest.setSimpleStatus(issue, simpleStatus, issue.getSimpleStatus(), context); + IssueStatus issueStatus = issue.getIssueStatus(); + underTest.setIssueStatus(issue, issueStatus, issue.getIssueStatus(), context); assertThat(issue.currentChange()).isNull(); } @Test - public void setSimpleStatus_shouldNotTriggerFieldChange_whenSecurityHotspot() { + public void setIssueStatus_shouldNotTriggerFieldChange_whenSecurityHotspot() { issue.setResolution(null); issue.setStatus(Issue.STATUS_TO_REVIEW); - SimpleStatus simpleStatus = issue.getSimpleStatus(); + IssueStatus issueStatus = issue.getIssueStatus(); issue.setResolution(Issue.RESOLUTION_SAFE); issue.setStatus(Issue.STATUS_REVIEWED); - underTest.setSimpleStatus(issue, simpleStatus, issue.getSimpleStatus(), context); + underTest.setIssueStatus(issue, issueStatus, issue.getIssueStatus(), context); assertThat(issue.currentChange()).isNull(); } |