From 0ed5e825f6694b5f33d4234e9228ed7c6b9a236e Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Tue, 15 Oct 2019 13:02:20 -0500 Subject: [PATCH] SONAR-12593 Remove deprecated RestoreBuiltInAction WS --- .../qualityprofile/ws/QProfilesWsModule.java | 1 - .../ws/RestoreBuiltInAction.java | 44 ------------- .../ws/RestoreBuiltInActionTest.java | 61 ------------------- 3 files changed, 106 deletions(-) delete mode 100644 server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInAction.java delete mode 100644 server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInActionTest.java diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfilesWsModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfilesWsModule.java index 1a1b82453bd..45c9e14bb82 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfilesWsModule.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfilesWsModule.java @@ -49,7 +49,6 @@ public class QProfilesWsModule extends Module { RemoveGroupAction.class, RemoveUserAction.class, RestoreAction.class, - RestoreBuiltInAction.class, ActivateRuleAction.class, DeactivateRuleAction.class, SearchAction.class, diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInAction.java deleted file mode 100644 index 67358c9ce1d..00000000000 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.qualityprofile.ws; - -import org.sonar.api.server.ws.Request; -import org.sonar.api.server.ws.Response; -import org.sonar.api.server.ws.WebService; -import org.sonar.server.ws.RemovedWebServiceHandler; - -public class RestoreBuiltInAction implements QProfileWsAction { - - @Override - public void define(WebService.NewController controller) { - controller.createAction("restore_built_in") - .setDescription("This web service has no effect since 6.4. It's no more possible to restore built-in quality profiles because they are automatically " + - "updated and read only. Returns HTTP code 410.") - .setSince("4.4") - .setDeprecatedSince("6.4") - .setPost(true) - .setHandler(this); - } - - @Override - public void handle(Request request, Response response) throws Exception { - RemovedWebServiceHandler.INSTANCE.handle(request, response); - } -} diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInActionTest.java deleted file mode 100644 index 093338ec1ee..00000000000 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RestoreBuiltInActionTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.qualityprofile.ws; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.server.ws.WebService; -import org.sonar.server.exceptions.ServerException; -import org.sonar.server.ws.WsActionTester; - -import static java.net.HttpURLConnection.HTTP_GONE; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; - -public class RestoreBuiltInActionTest { - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private RestoreBuiltInAction underTest = new RestoreBuiltInAction(); - private WsActionTester ws = new WsActionTester(underTest); - - @Test - public void test_definition() { - WebService.Action action = ws.getDef(); - - assertThat(action.key()).isEqualTo("restore_built_in"); - assertThat(action.isPost()).isTrue(); - assertThat(action.responseExampleAsString()).isNull(); - assertThat(action.deprecatedSince()).isEqualTo("6.4"); - - assertThat(action.params()).isEmpty(); - } - - @Test - public void fail_when_ws_is_called() { - try { - ws.newRequest().execute(); - fail(); - } catch (ServerException e) { - assertThat(e.httpCode()).isEqualTo(HTTP_GONE); - } - } -} -- 2.39.5