From 37868d0d6f9c3360695f4ed908854cb2cc0235cb Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Mon, 30 Jan 2017 12:45:33 +0100 Subject: [PATCH] SONAR-7286 Add docs on removed api/favourites WS --- .../sonar/server/favorite/FavoriteModule.java | 2 + .../server/favorite/ws/FavouritesWs.java | 41 +++++++++++++++++++ .../server/favorite/FavoriteModuleTest.java | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 server/sonar-server/src/main/java/org/sonar/server/favorite/ws/FavouritesWs.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/favorite/FavoriteModule.java b/server/sonar-server/src/main/java/org/sonar/server/favorite/FavoriteModule.java index 414aa027e69..642bfd3654f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/favorite/FavoriteModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/favorite/FavoriteModule.java @@ -23,6 +23,7 @@ package org.sonar.server.favorite; import org.sonar.core.platform.Module; import org.sonar.server.favorite.ws.AddAction; import org.sonar.server.favorite.ws.FavoritesWs; +import org.sonar.server.favorite.ws.FavouritesWs; import org.sonar.server.favorite.ws.RemoveAction; import org.sonar.server.favorite.ws.SearchAction; @@ -31,6 +32,7 @@ public class FavoriteModule extends Module { @Override protected void configureModule() { add( + FavouritesWs.class, FavoriteFinder.class, FavoriteUpdater.class, FavoritesWs.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/FavouritesWs.java b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/FavouritesWs.java new file mode 100644 index 00000000000..ccd38a8b3ca --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/FavouritesWs.java @@ -0,0 +1,41 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact 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.favorite.ws; + +import org.sonar.api.server.ws.WebService; +import org.sonar.server.ws.RemovedWebServiceHandler; + +public class FavouritesWs implements WebService { + + @Override + public void define(Context context) { + NewController controller = context.createController("api/favourites") + .setDescription("Removed since 6.3, please use api/favorites instead") + .setSince("2.6"); + controller.createAction("index") + .setDescription("The web service is removed and you're invited to use api/favorites instead") + .setSince("2.6") + .setDeprecatedSince("6.3") + .setHandler(RemovedWebServiceHandler.INSTANCE) + .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample()); + controller.done(); + } + +} diff --git a/server/sonar-server/src/test/java/org/sonar/server/favorite/FavoriteModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/favorite/FavoriteModuleTest.java index 64086da9ce7..63fb4728b77 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/favorite/FavoriteModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/favorite/FavoriteModuleTest.java @@ -30,6 +30,6 @@ public class FavoriteModuleTest { public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new FavoriteModule().configure(container); - assertThat(container.size()).isEqualTo(6 + 2); + assertThat(container.size()).isEqualTo(7 + 2); } } -- 2.39.5