aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-10-02 16:54:56 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-10-05 09:37:17 +0200
commit5ae0faa33a29284b4cb3fec0af0db526e4302ea9 (patch)
treea14af8a8706612829a091e4d2dcfb6da5017648c
parent2708557c7039f81ef3a536acb0f73fce42e4c490 (diff)
downloadsonarqube-5ae0faa33a29284b4cb3fec0af0db526e4302ea9.tar.gz
sonarqube-5ae0faa33a29284b4cb3fec0af0db526e4302ea9.zip
SONAR-6311 Delete RoR WS api/profiles/destroy
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java18
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java12
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb14
3 files changed, 1 insertions, 43 deletions
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 6d9df46f23d..dfae02a9327 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
@@ -37,7 +37,6 @@ public class ProfilesWs implements WebService {
defineIndexAction(controller);
defineBackupAction(controller);
defineRestoreAction(controller);
- defineDestroyAction(controller);
controller.done();
}
@@ -88,21 +87,4 @@ public class ProfilesWs implements WebService {
.setDescription("Path to the file containing the backup (HTML format)");
RailsHandler.addJsonOnlyFormatParam(action);
}
-
- private static void defineDestroyAction(NewController controller) {
- WebService.NewAction action = controller.createAction("destroy")
- .setDescription("Delete a quality profile. Requires Administer Quality Profiles permission")
- .setSince("3.3")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
-
- action.createParam("language")
- .setDescription("Profile language")
- .setRequired(true)
- .setExampleValue("java");
- action.createParam("name")
- .setDescription("Profile name")
- .setRequired(true)
- .setExampleValue("Sonar way");
- }
}
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 98ff19fbb65..2e826d693bb 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,7 +46,7 @@ public class ProfilesWsTest {
assertThat(controller).isNotNull();
assertThat(controller.path()).isEqualTo("api/profiles");
assertThat(controller.description()).isNotEmpty();
- assertThat(controller.actions()).hasSize(4);
+ assertThat(controller.actions()).hasSize(3);
}
@Test
@@ -79,14 +79,4 @@ public class ProfilesWsTest {
assertThat(restoreProfiles.handler()).isInstanceOf(RailsHandler.class);
assertThat(restoreProfiles.params()).hasSize(2);
}
-
- @Test
- public void define_destroy_action() {
- WebService.Controller controller = tester.controller("api/profiles");
-
- WebService.Action restoreProfiles = controller.action("destroy");
- assertThat(restoreProfiles).isNotNull();
- assertThat(restoreProfiles.handler()).isInstanceOf(RailsHandler.class);
- assertThat(restoreProfiles.params()).hasSize(2);
- }
}
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 1cb1f19a708..b19e00233e7 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,20 +21,6 @@ require 'json'
class Api::ProfilesController < Api::ApiController
- # POST /api/profiles/destroy?language=<language>&name=<name>
- def destroy
- verify_post_request
- access_denied unless has_role?(:profileadmin)
- require_parameters :language, :name
-
- call_backend do
- profile = Internal.quality_profiles.profile(params[:name], params[:language])
- not_found('Profile not found') unless profile
- Internal.component(Java::OrgSonarServerQualityprofile::QProfileService.java_class).delete(profile.key)
- end
- render_success('Profile destroyed')
- end
-
# GET /api/profiles?language=<language>[&name=<name>]
def index
require_parameters :language