]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6310 Delete WS api/profiles/index
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 19 Jan 2017 08:15:30 +0000 (09:15 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 24 Jan 2017 17:36:48 +0000 (18:36 +0100)
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb

index a17b91ec7cf96e12e3fb370f2592644ec6040a90..cff23525c980b73828366a521f1c2574ab93bb67 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.server.qualityprofile.ws;
 import com.google.common.io.Resources;
 import org.sonar.api.server.ws.RailsHandler;
 import org.sonar.api.server.ws.WebService;
+import org.sonar.server.ws.RemovedWebServiceHandler;
 
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
 
@@ -44,32 +45,20 @@ public class ProfilesWs implements WebService {
     NewController controller = context.createController(API_ENDPOINT)
       .setDescription("Manage quality profiles. Deprecated since 5.2.")
       .setSince("4.4");
-
-
     restoreAction.define(controller);
     defineListAction(controller);
     defineIndexAction(controller);
-
     controller.done();
   }
 
   private static void defineIndexAction(NewController controller) {
-    WebService.NewAction action = controller.createAction("index")
-      .setDescription("Get a profile.")
+    controller.createAction("index")
+      .setDescription("Get a profile.<br/>" +
+        "The web service is removed and you're invited to use api/qualityprofiles/search instead")
       .setSince("3.3")
       .setDeprecatedSince("5.2")
-      .setHandler(RailsHandler.INSTANCE)
+      .setHandler(RemovedWebServiceHandler.INSTANCE)
       .setResponseExample(Resources.getResource(ProfilesWs.class, "example-index.json"));
-
-    action.createParam("language")
-      .setDescription("Profile language")
-      .setRequired(true)
-      .setExampleValue("java");
-    action.createParam("name")
-      .setDescription("Profile name. If no profile name is given, default profile for the given language will be returned")
-      .setRequired(true)
-      .setExampleValue("Sonar way");
-    RailsHandler.addFormatParam(action);
   }
 
   private static void defineListAction(NewController controller) {
index 546983964270d2c4f2bb1261996c4a52cf3bfacc..024c26887af76a90af2551a7d89f191503da4f2e 100644 (file)
@@ -26,6 +26,7 @@ import org.sonar.api.server.ws.RailsHandler;
 import org.sonar.api.server.ws.WebService;
 import org.sonar.server.qualityprofile.QProfileBackuper;
 import org.sonar.server.user.UserSession;
+import org.sonar.server.ws.RemovedWebServiceHandler;
 import org.sonar.server.ws.WsTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -57,9 +58,9 @@ public class ProfilesWsTest {
 
     WebService.Action restoreProfiles = controller.action("index");
     assertThat(restoreProfiles).isNotNull();
-    assertThat(restoreProfiles.handler()).isInstanceOf(RailsHandler.class);
+    assertThat(restoreProfiles.handler()).isInstanceOf(RemovedWebServiceHandler.class);
     assertThat(restoreProfiles.responseExampleAsString()).isNotEmpty();
-    assertThat(restoreProfiles.params()).hasSize(3);
+    assertThat(restoreProfiles.params()).isEmpty();
   }
 
   @Test
index 20cd93a5b96b46ae642743dce166a27038c1f026..d2d399038c045ce586c37518d45b390335840059 100644 (file)
@@ -81,28 +81,7 @@ class Api::ProfilesController < Api::ApiController
       format.text { render :text => text_not_supported }
     end
   end
-  
-  # GET /api/profiles?language=<language>[&name=<name>]
-  def index
-    require_parameters :language
-
-    language=params[:language]
-    name=params[:name]
-    if name.blank?
-      @profile=Profile.by_default(language)
-    else
-      @profile=Profile.find_by_name_and_language(name, language)
-    end
-    not_found('Profile not found') unless @profile
 
-    @active_rules=filter_rules()
-
-    respond_to do |format|
-      format.json { render :json => jsonp(to_json) }
-      format.xml { render :xml => to_xml }
-      format.text { render :text => text_not_supported }
-    end
-  end
 
   private