From: Teryk Bellahsene Date: Fri, 2 Oct 2015 14:56:39 +0000 (+0200) Subject: SONAR-6310 Delete RoR WS api/profiles/index X-Git-Tag: 5.2-RC1~93 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4dba36f4e20ac32291d473a3169ee372408a9a22;p=sonarqube.git SONAR-6310 Delete RoR WS api/profiles/index --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java index dfae02a9327..0b24b35d01c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java @@ -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") diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java index 2e826d693bb..78cb5ff6802 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java @@ -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 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb index b19e00233e7..694c84dd744 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb @@ -21,28 +21,6 @@ require 'json' class Api::ProfilesController < Api::ApiController - # GET /api/profiles?language=[&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=[&name=my_profile] -v def backup