diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-08-05 13:23:13 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-08-05 19:32:14 +0200 |
commit | 9c468c36ec6c64a6706f28ab3fc6993883451fee (patch) | |
tree | 60f772ed62239f0d91c7871e71576214f95ce38d | |
parent | dc90d64eae1daddace35cdc5782985749768e906 (diff) | |
download | sonarqube-9c468c36ec6c64a6706f28ab3fc6993883451fee.tar.gz sonarqube-9c468c36ec6c64a6706f28ab3fc6993883451fee.zip |
Remove ability to set effortToFix on manual issues
4 files changed, 17 insertions, 21 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java index 88409c3bcce..d7b07826d64 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java @@ -238,8 +238,7 @@ public class IssueService { } } - public DefaultIssue createManualIssue(String componentKey, RuleKey ruleKey, @Nullable Integer line, @Nullable String message, @Nullable String severity, - @Nullable Double effortToFix) { + public DefaultIssue createManualIssue(String componentKey, RuleKey ruleKey, @Nullable Integer line, @Nullable String message, @Nullable String severity) { verifyLoggedIn(); DbSession session = dbClient.openSession(false); @@ -266,7 +265,6 @@ public class IssueService { .line(line) .message(!Strings.isNullOrEmpty(message) ? message : rule.getName()) .severity(Objects.firstNonNull(severity, Severity.MAJOR)) - .effortToFix(effortToFix) .ruleKey(ruleKey) .reporter(userSession.getLogin()) .assignee(findSourceLineUser(component.uuid(), line)) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java index 442c6231e6a..0df0a86b806 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java @@ -77,8 +77,7 @@ public class CreateAction implements IssuesWsAction { DefaultIssue issue = issueService.createManualIssue(componentKey, ruleKey, request.paramAsInt("line"), request.param("message"), - request.param("severity"), - null); + request.param("severity")); responseWriter.write(issue.key(), request, response); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java index d5a18f20e97..e089f14fe15 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java @@ -310,7 +310,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - Issue result = service.createManualIssue(file.key(), manualRule.getKey(), null, "Fix it", Severity.MINOR, 2d); + Issue result = service.createManualIssue(file.key(), manualRule.getKey(), null, "Fix it", Severity.MINOR); IssueDoc manualIssue = IssueIndex.getByKey(result.key()); assertThat(manualIssue.componentUuid()).isEqualTo(file.uuid()); @@ -319,7 +319,6 @@ public class IssueServiceMediumTest { assertThat(manualIssue.message()).isEqualTo("Fix it"); assertThat(manualIssue.line()).isNull(); assertThat(manualIssue.severity()).isEqualTo(Severity.MINOR); - assertThat(manualIssue.effortToFix()).isEqualTo(2d); assertThat(manualIssue.reporter()).isEqualTo("john"); } @@ -336,7 +335,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - Issue result = service.createManualIssue(file.key(), manualRule.getKey(), 1, "Fix it", Severity.MINOR, 2d); + Issue result = service.createManualIssue(file.key(), manualRule.getKey(), 1, "Fix it", Severity.MINOR); IssueDoc manualIssue = IssueIndex.getByKey(result.key()); assertThat(manualIssue.componentUuid()).isEqualTo(file.uuid()); @@ -345,7 +344,7 @@ public class IssueServiceMediumTest { assertThat(manualIssue.message()).isEqualTo("Fix it"); assertThat(manualIssue.line()).isEqualTo(1); assertThat(manualIssue.severity()).isEqualTo(Severity.MINOR); - assertThat(manualIssue.effortToFix()).isEqualTo(2d); + assertThat(manualIssue.effortToFix()).isNull(); assertThat(manualIssue.reporter()).isEqualTo("john"); assertThat(manualIssue.assignee()).isEqualTo("arthur"); } @@ -360,7 +359,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - Issue result = service.createManualIssue(file.key(), manualRule.getKey(), null, "Fix it", null, 2d); + Issue result = service.createManualIssue(file.key(), manualRule.getKey(), null, "Fix it", null); Issue manualIssue = IssueIndex.getByKey(result.key()); assertThat(manualIssue.severity()).isEqualTo(Severity.MAJOR); @@ -376,7 +375,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - Issue result = service.createManualIssue(file.key(), manualRule.getKey(), null, null, null, 2d); + Issue result = service.createManualIssue(file.key(), manualRule.getKey(), null, null, null); Issue manualIssue = IssueIndex.getByKey(result.key()); assertThat(manualIssue.message()).isEqualTo("Manual rule name"); @@ -396,7 +395,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - Issue result = service.createManualIssue(file.key(), manualRule.getKey(), 1, "Fix it", Severity.MINOR, 2d); + Issue result = service.createManualIssue(file.key(), manualRule.getKey(), 1, "Fix it", Severity.MINOR); IssueDoc manualIssue = IssueIndex.getByKey(result.key()); assertThat(manualIssue.assignee()).isNull(); @@ -414,7 +413,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - Issue result = service.createManualIssue(file.key(), manualRule.getKey(), 1, "Fix it", Severity.MINOR, 2d); + Issue result = service.createManualIssue(file.key(), manualRule.getKey(), 1, "Fix it", Severity.MINOR); IssueDoc manualIssue = IssueIndex.getByKey(result.key()); assertThat(manualIssue.assignee()).isNull(); @@ -428,7 +427,7 @@ public class IssueServiceMediumTest { userSessionRule.login("john").addProjectPermissions(UserRole.USER, project.key()); try { - service.createManualIssue(file.key(), rule.getKey(), null, "Fix it", null, 2d); + service.createManualIssue(file.key(), rule.getKey(), null, "Fix it", null); fail(); } catch (Exception e) { assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Issues can be created only on rules marked as 'manual': xoo:x1"); @@ -441,7 +440,7 @@ public class IssueServiceMediumTest { ComponentDto file = newFile(project); userSessionRule.login("john").addProjectPermissions(UserRole.USER, project.key()); - service.createManualIssue(file.key(), RuleKey.of("rule", "unknown"), 10, "Fix it", null, 2d); + service.createManualIssue(file.key(), RuleKey.of("rule", "unknown"), 10, "Fix it", null); } @Test(expected = ForbiddenException.class) @@ -457,7 +456,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - service.createManualIssue(file.key(), rule.getKey(), 10, "Fix it", null, 2d); + service.createManualIssue(file.key(), rule.getKey(), 10, "Fix it", null); } @Test(expected = NotFoundException.class) @@ -469,7 +468,7 @@ public class IssueServiceMediumTest { tester.get(RuleDao.class).insert(session, manualRule); session.commit(); - service.createManualIssue("UNKNOWN", manualRule.getKey(), null, "Fix it", Severity.MINOR, 2d); + service.createManualIssue("UNKNOWN", manualRule.getKey(), null, "Fix it", Severity.MINOR); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/CreateActionTest.java index c0ed4dc8da7..8bf0e408e43 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/CreateActionTest.java @@ -44,7 +44,7 @@ public class CreateActionTest { @Test public void create_manual_issue_with_default_values() throws Exception { RuleKey ruleKey = RuleKey.of(RuleKey.MANUAL_REPOSITORY_KEY, "S1"); - when(issueService.createManualIssue("FILE_KEY", ruleKey, null, null, null, null)) + when(issueService.createManualIssue("FILE_KEY", ruleKey, null, null, null)) .thenReturn(new DefaultIssue().setKey("ISSUE_KEY")); tester.newRequest() @@ -52,14 +52,14 @@ public class CreateActionTest { .setParam("rule", ruleKey.toString()) .execute(); - verify(issueService).createManualIssue("FILE_KEY", ruleKey, null, null, null, null); + verify(issueService).createManualIssue("FILE_KEY", ruleKey, null, null, null); verify(responseWriter).write(eq("ISSUE_KEY"), any(Request.class), any(Response.class)); } @Test public void create_manual_issue() throws Exception { RuleKey ruleKey = RuleKey.of(RuleKey.MANUAL_REPOSITORY_KEY, "S1"); - when(issueService.createManualIssue("FILE_KEY", ruleKey, 13, "the msg", "BLOCKER", null)) + when(issueService.createManualIssue("FILE_KEY", ruleKey, 13, "the msg", "BLOCKER")) .thenReturn(new DefaultIssue().setKey("ISSUE_KEY")); tester.newRequest() @@ -70,7 +70,7 @@ public class CreateActionTest { .setParam("message", "the msg") .execute(); - verify(issueService).createManualIssue("FILE_KEY", ruleKey, 13, "the msg", "BLOCKER", null); + verify(issueService).createManualIssue("FILE_KEY", ruleKey, 13, "the msg", "BLOCKER"); verify(responseWriter).write(eq("ISSUE_KEY"), any(Request.class), any(Response.class)); } } |