aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-19 09:29:40 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-24 18:36:48 +0100
commit919955b34e8c92cd2572a42d276db4445e982c6c (patch)
treea60a0652fa2be3be53180d65ecc5a3bf4dd29759 /server
parentdf07474a15ceb5767167ec75fe1c3e538756417e (diff)
downloadsonarqube-919955b34e8c92cd2572a42d276db4445e982c6c.tar.gz
sonarqube-919955b34e8c92cd2572a42d276db4445e982c6c.zip
SONAR-6506 Delete internal WS api/updatecenter/installed_plugins
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/updatecenter/ws/UpdateCenterWs.java21
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java17
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb70
3 files changed, 4 insertions, 104 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/updatecenter/ws/UpdateCenterWs.java b/server/sonar-server/src/main/java/org/sonar/server/updatecenter/ws/UpdateCenterWs.java
index b311da9ac4e..63abf653419 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/updatecenter/ws/UpdateCenterWs.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/updatecenter/ws/UpdateCenterWs.java
@@ -19,8 +19,7 @@
*/
package org.sonar.server.updatecenter.ws;
-import com.google.common.io.Resources;
-import org.sonar.api.server.ws.RailsHandler;
+import java.util.Arrays;
import org.sonar.api.server.ws.WebService;
public class UpdateCenterWs implements WebService {
@@ -36,23 +35,7 @@ public class UpdateCenterWs implements WebService {
NewController controller = context.createController("api/updatecenter")
.setDescription("Get list of installed plugins")
.setSince("2.10");
-
- defineInstalledPluginsAction(controller);
- for (UpdateCenterWsAction action : actions) {
- action.define(controller);
- }
-
+ Arrays.stream(actions).forEach(action -> action.define(controller));
controller.done();
}
-
- private void defineInstalledPluginsAction(NewController controller) {
- NewAction action = controller.createAction("installed_plugins")
- .setDescription("Get the list of all the plugins installed on the SonarQube instance")
- .setSince("2.10")
- .setHandler(RailsHandler.INSTANCE)
- .setInternal(true)
- .setResponseExample(Resources.getResource(this.getClass(), "example-installed_plugins.json"));
- RailsHandler.addFormatParam(action);
- }
-
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java
index 0d25e12ba8d..6bd21995134 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java
@@ -21,7 +21,6 @@ package org.sonar.server.updatecenter.ws;
import org.junit.Before;
import org.junit.Test;
-import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
import org.sonar.server.platform.ServerFileSystem;
import org.sonar.server.ws.WsTester;
@@ -35,8 +34,7 @@ public class UpdateCenterWsTest {
@Before
public void setUp() {
- tester = new WsTester(new UpdateCenterWs(
- new UploadAction(null, mock(ServerFileSystem.class))));
+ tester = new WsTester(new UpdateCenterWs(new UploadAction(null, mock(ServerFileSystem.class))));
}
@Test
@@ -45,18 +43,7 @@ public class UpdateCenterWsTest {
assertThat(controller).isNotNull();
assertThat(controller.since()).isEqualTo("2.10");
assertThat(controller.description()).isNotEmpty();
- assertThat(controller.actions()).hasSize(2);
- }
-
- @Test
- public void define_installed_plugins_action() {
- WebService.Controller controller = tester.controller("api/updatecenter");
-
- WebService.Action action = controller.action("installed_plugins");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.class);
- assertThat(action.responseExampleAsString()).isNotEmpty();
- assertThat(action.params()).hasSize(1);
+ assertThat(controller.actions()).hasSize(1);
}
@Test
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb
deleted file mode 100644
index 4819403d2e8..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2016 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube 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.
-#
-# SonarQube 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.
-#
-
-require 'json'
-
-class Api::UpdatecenterController < Api::ApiController
-
- #
- # GET /api/updatecenter/installed_plugins
- # curl http://localhost:9000/api/updatecenter/installed_plugins -v
- #
- def installed_plugins
- respond_to do |format|
- format.json { render :json => jsonp(plugins_to_json(user_plugins())) }
- format.xml { render :xml => plugins_to_xml(user_plugins()) }
- format.text { render :text => text_not_supported }
- end
- end
-
- private
-
- def plugins_to_json(plugins=[])
- json=[]
- plugins.each do |p|
- json<<plugin_to_json(p)
- end
- json
- end
-
- def plugin_to_json(plugin)
- hash={}
- hash['key']=plugin.getKey()
- hash['name']=plugin.getName()
- hash['version']=plugin.getVersion().getName()
- hash
- end
-
- def plugins_to_xml(plugins, xml=Builder::XmlMarkup.new(:indent => 0))
- xml.plugins do
- plugins.each do |plugin|
- xml.plugin do
- xml.key(plugin.getKey())
- xml.name(plugin.getName())
- xml.version(plugin.getVersion().getName())
- end
- end
- end
- end
-
- def user_plugins
- java_facade.getPluginInfos().to_a.sort
- end
-end