]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6310 Delete RoR WS api/profiles/index
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 2 Oct 2015 14:56:39 +0000 (16:56 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 5 Oct 2015 07:37:17 +0000 (09:37 +0200)
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 dfae02a932757fdc46814d094b67018802b1d0f5..0b24b35d01c463ecbb9ecabaa2c97135c6717a5c 100644 (file)
@@ -19,7 +19,6 @@
  */
 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;
 
@@ -34,30 +33,12 @@ public class ProfilesWs implements WebService {
     NewController controller = context.createController("api/profiles")
       .setDescription("Former quality profiles web service");
 
-    defineIndexAction(controller);
     defineBackupAction(controller);
     defineRestoreAction(controller);
 
     controller.done();
   }
 
-  private static void defineIndexAction(NewController controller) {
-    WebService.NewAction action = controller.createAction("index")
-      .setDescription("Get a profile")
-      .setSince("3.3")
-      .setHandler(RailsHandler.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")
-      .setExampleValue("Sonar way");
-    RailsHandler.addFormatParam(action);
-  }
-
   private static void defineBackupAction(NewController controller) {
     WebService.NewAction action = controller.createAction("backup")
       .setDescription("Backup a quality profile. Requires Administer Quality Profiles permission")
index 2e826d693bbda4aac3fff8e5ef9669f27f77dc53..78cb5ff6802c468402cb144404c2dceada4155a9 100644 (file)
@@ -46,18 +46,7 @@ public class ProfilesWsTest {
     assertThat(controller).isNotNull();
     assertThat(controller.path()).isEqualTo("api/profiles");
     assertThat(controller.description()).isNotEmpty();
-    assertThat(controller.actions()).hasSize(3);
-  }
-
-  @Test
-  public void define_index_action() {
-    WebService.Controller controller = tester.controller("api/profiles");
-
-    WebService.Action restoreProfiles = controller.action("index");
-    assertThat(restoreProfiles).isNotNull();
-    assertThat(restoreProfiles.handler()).isInstanceOf(RailsHandler.class);
-    assertThat(restoreProfiles.responseExampleAsString()).isNotEmpty();
-    assertThat(restoreProfiles.params()).hasSize(3);
+    assertThat(controller.actions()).hasSize(2);
   }
 
   @Test
index b19e00233e7718d60868fb766df2518a29ece97d..694c84dd7445874652d40444ae428dc248b6359e 100644 (file)
@@ -21,28 +21,6 @@ require 'json'
 
 class Api::ProfilesController < Api::ApiController
 
-  # 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
-
   # Backup a profile. If output format is xml, then backup is directly returned.
   # GET /api/profiles/backup?language=<language>[&name=my_profile] -v
   def backup