From 8eb8931a7b241260ae730c2582446abddd397f4c Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 3 Jun 2013 16:25:25 +0200 Subject: [PATCH] SONAR-4304 allow to flag manual issues as false-positive --- .../org/sonar/core/issue/workflow/IssueWorkflow.java | 5 +---- .../org/sonar/core/issue/workflow/IssueWorkflowTest.java | 9 ++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java b/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java index 12a8318fadf..acc539876da 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java @@ -85,17 +85,14 @@ public class IssueWorkflow implements BatchComponent, ServerComponent, Startable // resolve as false-positive .transition(Transition.builder(DefaultTransitions.FALSE_POSITIVE) .from(Issue.STATUS_OPEN).to(Issue.STATUS_RESOLVED) - .conditions(new IsManual(false)) .functions(new SetResolution(Issue.RESOLUTION_FALSE_POSITIVE), SetAssignee.UNASSIGN) .build()) .transition(Transition.builder(DefaultTransitions.FALSE_POSITIVE) .from(Issue.STATUS_REOPENED).to(Issue.STATUS_RESOLVED) - .conditions(new IsManual(false)) .functions(new SetResolution(Issue.RESOLUTION_FALSE_POSITIVE), SetAssignee.UNASSIGN) .build()) .transition(Transition.builder(DefaultTransitions.FALSE_POSITIVE) .from(Issue.STATUS_CONFIRMED).to(Issue.STATUS_RESOLVED) - .conditions(new IsManual(false)) .functions(new SetResolution(Issue.RESOLUTION_FALSE_POSITIVE), SetAssignee.UNASSIGN) .build()) @@ -128,7 +125,7 @@ public class IssueWorkflow implements BatchComponent, ServerComponent, Startable .build()) .transition(Transition.builder("automaticclosemanual") .from(Issue.STATUS_RESOLVED).to(Issue.STATUS_CLOSED) - .conditions(new IsEndOfLife(false), new HasResolution(Issue.RESOLUTION_FIXED), new IsManual(true)) + .conditions(new IsEndOfLife(false), new IsManual(true)) .functions(new SetCloseDate(true)) .automatic() .build()) diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java index eda0b11523a..5d21f7767ef 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java @@ -240,7 +240,8 @@ public class IssueWorkflowTest { assertThat(workflow.outTransitions(issue)).containsOnly( Transition.create("confirm", "OPEN", "CONFIRMED"), - Transition.create("resolve", "OPEN", "RESOLVED") + Transition.create("resolve", "OPEN", "RESOLVED"), + Transition.create("falsepositive", "OPEN", "RESOLVED") ); workflow.doTransition(issue, "resolve", mock(IssueChangeContext.class)); @@ -269,7 +270,8 @@ public class IssueWorkflowTest { assertThat(workflow.outTransitions(issue)).containsOnly( Transition.create("confirm", "OPEN", "CONFIRMED"), - Transition.create("resolve", "OPEN", "RESOLVED") + Transition.create("resolve", "OPEN", "RESOLVED"), + Transition.create("falsepositive", "OPEN", "RESOLVED") ); workflow.doTransition(issue, "confirm", mock(IssueChangeContext.class)); @@ -278,7 +280,8 @@ public class IssueWorkflowTest { assertThat(workflow.outTransitions(issue)).containsOnly( Transition.create("unconfirm", "CONFIRMED", "REOPENED"), - Transition.create("resolve", "CONFIRMED", "RESOLVED") + Transition.create("resolve", "CONFIRMED", "RESOLVED"), + Transition.create("falsepositive", "CONFIRMED", "RESOLVED") ); // keep confirmed and unresolved -- 2.39.5