diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-03-21 18:00:26 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-03-23 17:38:34 +0100 |
commit | df6b7d4d745cd76e8b38280a1156703c8c5b835a (patch) | |
tree | bc667dfa94b65898ffc32f4b0d31587c5c2c61e0 /server | |
parent | bd45c3888aef453bc5ff69d8e4db5d6ecab433f5 (diff) | |
download | sonarqube-df6b7d4d745cd76e8b38280a1156703c8c5b835a.tar.gz sonarqube-df6b7d4d745cd76e8b38280a1156703c8c5b835a.zip |
Remove unused "statuses" field in response of api/rules/app
This field is not used by web app
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java | 18 | ||||
-rw-r--r-- | server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java | 11 |
2 files changed, 2 insertions, 27 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java index fd5455c4e9c..5c008df76d9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java @@ -19,11 +19,8 @@ */ package org.sonar.server.rule.ws; -import java.util.Locale; -import org.sonar.api.i18n.I18n; import org.sonar.api.resources.Language; import org.sonar.api.resources.Languages; -import org.sonar.api.rule.RuleStatus; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -41,14 +38,12 @@ public class AppAction implements RulesWsAction { private final Languages languages; private final DbClient dbClient; - private final I18n i18n; private final UserSession userSession; private final RuleWsSupport wsSupport; - public AppAction(Languages languages, DbClient dbClient, I18n i18n, UserSession userSession, RuleWsSupport wsSupport) { + public AppAction(Languages languages, DbClient dbClient, UserSession userSession, RuleWsSupport wsSupport) { this.languages = languages; this.dbClient = dbClient; - this.i18n = i18n; this.userSession = userSession; this.wsSupport = wsSupport; } @@ -81,7 +76,6 @@ public class AppAction implements RulesWsAction { addProfiles(dbSession, organization, json); addLanguages(json); addRuleRepositories(json, dbSession); - addStatuses(json); json.endObject().close(); } } @@ -130,14 +124,4 @@ public class AppAction implements RulesWsAction { .endObject()); json.endArray(); } - - private void addStatuses(JsonWriter json) { - json.name("statuses").beginObject(); - for (RuleStatus status : RuleStatus.values()) { - if (status != RuleStatus.REMOVED) { - json.prop(status.toString(), i18n.message(Locale.getDefault(), "rules.status." + status.toString().toLowerCase(Locale.ENGLISH), status.toString())); - } - } - json.endObject(); - } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java index 61fe819c81e..a764dc6ab40 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/AppActionTest.java @@ -19,11 +19,9 @@ */ package org.sonar.server.rule.ws; -import java.util.Locale; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.sonar.api.i18n.I18n; import org.sonar.api.resources.Language; import org.sonar.api.resources.Languages; import org.sonar.api.server.ws.WebService; @@ -43,10 +41,6 @@ import org.sonar.server.ws.WsActionTester; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import static org.sonar.test.JsonAssert.assertJson; public class AppActionTest { @@ -63,9 +57,8 @@ public class AppActionTest { private Languages languages = new Languages(LANG1, LANG2); private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db); - private I18n i18n = mock(I18n.class); private RuleWsSupport wsSupport = new RuleWsSupport(db.getDbClient(), userSession, defaultOrganizationProvider); - private AppAction underTest = new AppAction(languages, db.getDbClient(), i18n, userSession, wsSupport); + private AppAction underTest = new AppAction(languages, db.getDbClient(), userSession, wsSupport); private WsActionTester tester = new WsActionTester(underTest); @Test @@ -221,8 +214,6 @@ public class AppActionTest { RuleRepositoryDto repo2 = new RuleRepositoryDto("squid", "ws", "SonarQube"); db.getDbClient().ruleRepositoryDao().insert(db.getSession(), asList(repo1, repo2)); db.getSession().commit(); - when(i18n.message(isA(Locale.class), anyString(), anyString())).thenAnswer( - invocation -> invocation.getArguments()[1]); } private void insertQualityProfiles(OrganizationDto organization) { |