diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2019-11-28 16:08:19 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2020-01-13 20:46:24 +0100 |
commit | b9e5b79c297f4978be1f4dd60922e2496ec6b01a (patch) | |
tree | 22242f6893f28171cd4b6d9d03497fff6ea1863c /server/sonar-server-common | |
parent | e292839ab8e07dda4fd8c41c35ad447f6fe80889 (diff) | |
download | sonarqube-b9e5b79c297f4978be1f4dd60922e2496ec6b01a.tar.gz sonarqube-b9e5b79c297f4978be1f4dd60922e2496ec6b01a.zip |
SONAR-12722 drop `in_review` status
Diffstat (limited to 'server/sonar-server-common')
4 files changed, 5 insertions, 136 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/SecurityStandardCategoryStatistics.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/SecurityStandardCategoryStatistics.java index 7e3082c8ce7..ea54b187792 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/SecurityStandardCategoryStatistics.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/SecurityStandardCategoryStatistics.java @@ -28,19 +28,17 @@ public class SecurityStandardCategoryStatistics { private final String category; private final long vulnerabilities; private final OptionalInt vulnerabiliyRating; - private final long inReviewSecurityHotspots; private final long toReviewSecurityHotspots; private final long reviewedSecurityHotspots; private final List<SecurityStandardCategoryStatistics> children; private long activeRules; private long totalRules; - public SecurityStandardCategoryStatistics(String category, long vulnerabilities, OptionalInt vulnerabiliyRating, long inReviewSecurityHotspots, long toReviewSecurityHotspots, + public SecurityStandardCategoryStatistics(String category, long vulnerabilities, OptionalInt vulnerabiliyRating, long toReviewSecurityHotspots, long reviewedSecurityHotspots, @Nullable List<SecurityStandardCategoryStatistics> children) { this.category = category; this.vulnerabilities = vulnerabilities; this.vulnerabiliyRating = vulnerabiliyRating; - this.inReviewSecurityHotspots = inReviewSecurityHotspots; this.toReviewSecurityHotspots = toReviewSecurityHotspots; this.reviewedSecurityHotspots = reviewedSecurityHotspots; this.children = children; @@ -58,10 +56,6 @@ public class SecurityStandardCategoryStatistics { return vulnerabiliyRating; } - public long getInReviewSecurityHotspots() { - return inReviewSecurityHotspots; - } - public long getToReviewSecurityHotspots() { return toReviewSecurityHotspots; } 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 56b19117499..fd7046b917a 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 @@ -39,7 +39,6 @@ import static org.sonar.api.issue.Issue.RESOLUTION_REMOVED; import static org.sonar.api.issue.Issue.RESOLUTION_WONT_FIX; import static org.sonar.api.issue.Issue.STATUS_CLOSED; import static org.sonar.api.issue.Issue.STATUS_CONFIRMED; -import static org.sonar.api.issue.Issue.STATUS_IN_REVIEW; import static org.sonar.api.issue.Issue.STATUS_OPEN; import static org.sonar.api.issue.Issue.STATUS_REOPENED; import static org.sonar.api.issue.Issue.STATUS_RESOLVED; @@ -64,7 +63,7 @@ public class IssueWorkflow implements Startable { public void start() { StateMachine.Builder builder = StateMachine.builder() .states(STATUS_OPEN, STATUS_CONFIRMED, STATUS_REOPENED, STATUS_RESOLVED, STATUS_CLOSED, - STATUS_TO_REVIEW, STATUS_IN_REVIEW, STATUS_REVIEWED); + STATUS_TO_REVIEW, STATUS_REVIEWED); buildManualTransitions(builder); buildAutomaticTransitions(builder); buildSecurityHotspotTransitions(builder); @@ -160,11 +159,6 @@ public class IssueWorkflow implements Startable { private static void buildSecurityHotspotTransitions(StateMachine.Builder builder) { builder - .transition(Transition.builder(DefaultTransitions.SET_AS_IN_REVIEW) - .from(STATUS_TO_REVIEW).to(STATUS_IN_REVIEW) - .conditions(new HasType(RuleType.SECURITY_HOTSPOT)) - .requiredProjectPermission(UserRole.SECURITYHOTSPOT_ADMIN) - .build()) .transition(Transition.builder(DefaultTransitions.RESOLVE_AS_REVIEWED) .from(STATUS_TO_REVIEW).to(STATUS_REVIEWED) .conditions(new HasType(RuleType.SECURITY_HOTSPOT)) @@ -172,12 +166,6 @@ public class IssueWorkflow implements Startable { .requiredProjectPermission(UserRole.SECURITYHOTSPOT_ADMIN) .build()) .transition(Transition.builder(DefaultTransitions.RESOLVE_AS_REVIEWED) - .from(STATUS_IN_REVIEW).to(STATUS_REVIEWED) - .conditions(new HasType(RuleType.SECURITY_HOTSPOT)) - .functions(new SetResolution(RESOLUTION_FIXED)) - .requiredProjectPermission(UserRole.SECURITYHOTSPOT_ADMIN) - .build()) - .transition(Transition.builder(DefaultTransitions.RESOLVE_AS_REVIEWED) .from(STATUS_OPEN).to(STATUS_REVIEWED) .conditions(new HasType(RuleType.VULNERABILITY), IsManualVulnerability.INSTANCE) .functions(new SetType(RuleType.SECURITY_HOTSPOT), new SetResolution(RESOLUTION_FIXED)) @@ -191,12 +179,6 @@ public class IssueWorkflow implements Startable { .requiredProjectPermission(UserRole.SECURITYHOTSPOT_ADMIN) .build()) .transition(Transition.builder(DefaultTransitions.OPEN_AS_VULNERABILITY) - .from(STATUS_IN_REVIEW).to(STATUS_OPEN) - .conditions(new HasType(RuleType.SECURITY_HOTSPOT)) - .functions(new SetType(RuleType.VULNERABILITY)) - .requiredProjectPermission(UserRole.SECURITYHOTSPOT_ADMIN) - .build()) - .transition(Transition.builder(DefaultTransitions.OPEN_AS_VULNERABILITY) .from(STATUS_TO_REVIEW).to(STATUS_OPEN) .conditions(new HasType(RuleType.SECURITY_HOTSPOT)) .functions(new SetType(RuleType.VULNERABILITY)) @@ -204,12 +186,6 @@ public class IssueWorkflow implements Startable { .build()) .transition(Transition.builder(DefaultTransitions.RESET_AS_TO_REVIEW) - .from(STATUS_IN_REVIEW).to(STATUS_TO_REVIEW) - .conditions(new HasType(RuleType.SECURITY_HOTSPOT)) - .functions(new SetResolution(null)) - .requiredProjectPermission(UserRole.SECURITYHOTSPOT_ADMIN) - .build()) - .transition(Transition.builder(DefaultTransitions.RESET_AS_TO_REVIEW) .from(STATUS_REVIEWED).to(STATUS_TO_REVIEW) .conditions(new HasType(RuleType.SECURITY_HOTSPOT)) .functions(new SetResolution(null)) @@ -258,12 +234,6 @@ public class IssueWorkflow implements Startable { .automatic() .build()) .transition(Transition.builder(AUTOMATIC_CLOSE_TRANSITION) - .from(STATUS_IN_REVIEW).to(STATUS_CLOSED) - .conditions(IsBeingClosed.INSTANCE, new HasType(RuleType.SECURITY_HOTSPOT)) - .functions(SetClosed.INSTANCE, SetCloseDate.INSTANCE) - .automatic() - .build()) - .transition(Transition.builder(AUTOMATIC_CLOSE_TRANSITION) .from(STATUS_REVIEWED).to(STATUS_CLOSED) .conditions(IsBeingClosed.INSTANCE, new HasType(RuleType.SECURITY_HOTSPOT)) .functions(SetClosed.INSTANCE, SetCloseDate.INSTANCE) diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java index 3886de33764..d63b4f6cf3a 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java @@ -44,7 +44,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.api.issue.Issue.RESOLUTION_FIXED; import static org.sonar.api.issue.Issue.RESOLUTION_REMOVED; import static org.sonar.api.issue.Issue.STATUS_CLOSED; -import static org.sonar.api.issue.Issue.STATUS_IN_REVIEW; import static org.sonar.api.issue.Issue.STATUS_OPEN; import static org.sonar.api.issue.Issue.STATUS_RESOLVED; import static org.sonar.api.issue.Issue.STATUS_REVIEWED; @@ -54,7 +53,7 @@ import static org.sonar.db.rule.RuleTesting.XOO_X1; @RunWith(DataProviderRunner.class) public class IssueWorkflowForSecurityHotspotsTest { - private static final String[] ALL_STATUSES_LEADING_TO_CLOSED = new String[] {STATUS_TO_REVIEW, STATUS_IN_REVIEW, STATUS_RESOLVED}; + private static final String[] ALL_STATUSES_LEADING_TO_CLOSED = new String[] {STATUS_TO_REVIEW, STATUS_RESOLVED}; private static final String[] SUPPORTED_RESOLUTIONS_FOR_UNCLOSING = new String[] {RESOLUTION_FIXED, RESOLUTION_REMOVED}; @@ -94,17 +93,7 @@ public class IssueWorkflowForSecurityHotspotsTest { List<Transition> transitions = underTest.outTransitions(issue); - assertThat(keys(transitions)).containsExactlyInAnyOrder("setinreview", "resolveasreviewed", "openasvulnerability"); - } - - @Test - public void list_out_transitions_in_status_in_review() { - underTest.start(); - DefaultIssue issue = new DefaultIssue().setType(RuleType.SECURITY_HOTSPOT).setStatus(STATUS_IN_REVIEW); - - List<Transition> transitions = underTest.outTransitions(issue); - - assertThat(keys(transitions)).containsExactlyInAnyOrder("resolveasreviewed", "openasvulnerability", "resetastoreview"); + assertThat(keys(transitions)).containsExactlyInAnyOrder("resolveasreviewed", "openasvulnerability"); } @Test @@ -128,21 +117,6 @@ public class IssueWorkflowForSecurityHotspotsTest { } @Test - public void set_as_in_review() { - underTest.start(); - DefaultIssue issue = new DefaultIssue() - .setType(RuleType.SECURITY_HOTSPOT) - .setIsFromHotspot(true) - .setStatus(STATUS_TO_REVIEW); - - boolean result = underTest.doManualTransition(issue, DefaultTransitions.SET_AS_IN_REVIEW, IssueChangeContext.createUser(new Date(), "USER1")); - - assertThat(result).isTrue(); - assertThat(issue.getStatus()).isEqualTo(STATUS_IN_REVIEW); - assertThat(issue.resolution()).isNull(); - } - - @Test public void resolve_as_reviewed_from_to_review() { underTest.start(); DefaultIssue issue = new DefaultIssue() @@ -158,39 +132,6 @@ public class IssueWorkflowForSecurityHotspotsTest { } @Test - public void resolve_as_reviewed_from_in_review() { - underTest.start(); - DefaultIssue issue = new DefaultIssue() - .setType(RuleType.SECURITY_HOTSPOT) - .setIsFromHotspot(true) - .setStatus(STATUS_IN_REVIEW) - .setResolution(null); - - boolean result = underTest.doManualTransition(issue, DefaultTransitions.RESOLVE_AS_REVIEWED, IssueChangeContext.createUser(new Date(), "USER1")); - - assertThat(result).isTrue(); - assertThat(issue.getStatus()).isEqualTo(STATUS_REVIEWED); - assertThat(issue.resolution()).isEqualTo(RESOLUTION_FIXED); - } - - @Test - public void open_as_vulnerability_from_in_review() { - underTest.start(); - DefaultIssue issue = new DefaultIssue() - .setType(RuleType.SECURITY_HOTSPOT) - .setIsFromHotspot(true) - .setStatus(STATUS_IN_REVIEW) - .setResolution(null); - - boolean result = underTest.doManualTransition(issue, DefaultTransitions.OPEN_AS_VULNERABILITY, IssueChangeContext.createUser(new Date(), "USER1")); - - assertThat(result).isTrue(); - assertThat(issue.type()).isEqualTo(RuleType.VULNERABILITY); - assertThat(issue.getStatus()).isEqualTo(Issue.STATUS_OPEN); - assertThat(issue.resolution()).isNull(); - } - - @Test public void open_as_vulnerability_from_to_review() { underTest.start(); DefaultIssue issue = new DefaultIssue() @@ -241,22 +182,6 @@ public class IssueWorkflowForSecurityHotspotsTest { } @Test - public void reset_as_to_review_from_in_review() { - underTest.start(); - DefaultIssue issue = new DefaultIssue() - .setType(RuleType.SECURITY_HOTSPOT) - .setIsFromHotspot(true) - .setStatus(STATUS_IN_REVIEW) - .setResolution(null); - - boolean result = underTest.doManualTransition(issue, DefaultTransitions.RESET_AS_TO_REVIEW, IssueChangeContext.createUser(new Date(), "USER1")); - assertThat(result).isTrue(); - assertThat(issue.type()).isEqualTo(RuleType.SECURITY_HOTSPOT); - assertThat(issue.getStatus()).isEqualTo(STATUS_TO_REVIEW); - assertThat(issue.resolution()).isNull(); - } - - @Test public void reset_as_to_review_from_opened_as_vulnerability() { underTest.start(); DefaultIssue issue = new DefaultIssue() @@ -292,25 +217,6 @@ public class IssueWorkflowForSecurityHotspotsTest { } @Test - public void automatically_close_resolved_security_hotspots_in_status_in_review() { - underTest.start(); - DefaultIssue issue = new DefaultIssue() - .setType(RuleType.SECURITY_HOTSPOT) - .setResolution(null) - .setStatus(STATUS_IN_REVIEW) - .setNew(false) - .setBeingClosed(true); - Date now = new Date(); - - underTest.doAutomaticTransition(issue, IssueChangeContext.createScan(now)); - - assertThat(issue.resolution()).isEqualTo(RESOLUTION_FIXED); - assertThat(issue.status()).isEqualTo(STATUS_CLOSED); - assertThat(issue.closeDate()).isNotNull(); - assertThat(issue.updateDate()).isEqualTo(DateUtils.truncate(now, Calendar.SECOND)); - } - - @Test public void automatically_close_resolved_security_hotspots_in_status_reviewed() { underTest.start(); DefaultIssue issue = new DefaultIssue() diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java index 205627ad939..5e93500ee05 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java @@ -51,7 +51,6 @@ import static org.sonar.api.issue.Issue.RESOLUTION_REMOVED; import static org.sonar.api.issue.Issue.RESOLUTION_WONT_FIX; import static org.sonar.api.issue.Issue.STATUS_CLOSED; import static org.sonar.api.issue.Issue.STATUS_CONFIRMED; -import static org.sonar.api.issue.Issue.STATUS_IN_REVIEW; import static org.sonar.api.issue.Issue.STATUS_OPEN; import static org.sonar.api.issue.Issue.STATUS_REOPENED; import static org.sonar.api.issue.Issue.STATUS_RESOLVED; @@ -73,7 +72,7 @@ public class IssueWorkflowTest { // issues statuses expectedStatus.addAll(Arrays.asList(STATUS_OPEN, STATUS_CONFIRMED, STATUS_REOPENED, STATUS_RESOLVED, STATUS_CLOSED)); // hostpots statuses - expectedStatus.addAll(Arrays.asList(STATUS_TO_REVIEW, STATUS_IN_REVIEW, STATUS_REVIEWED)); + expectedStatus.addAll(Arrays.asList(STATUS_TO_REVIEW, STATUS_REVIEWED)); assertThat(underTest.statusKeys()).containsExactlyInAnyOrder(expectedStatus.toArray(new String[]{})); } |