diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-05 15:16:21 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-05 15:16:21 +0000 |
commit | feec99a308549901f0ad927e0d7a88956444cd9f (patch) | |
tree | 62bba08897d60f2a51503d7f543c0685334ee6e7 | |
parent | 35c9e60c985300140cf1a3899f85a537e519a9cc (diff) | |
download | sonarqube-feec99a308549901f0ad927e0d7a88956444cd9f.tar.gz sonarqube-feec99a308549901f0ad927e0d7a88956444cd9f.zip |
SONAR-1897 URL /api/plugins conflicts with existing web service extension point. Rename to /api/updatecenter/installed_plugins
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb (renamed from sonar-server/src/main/webapp/WEB-INF/app/controllers/api/plugins_controller.rb) | 8 | ||||
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/services/PluginQuery.java | 19 | ||||
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateCenterQuery.java | 29 | ||||
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java | 16 | ||||
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/services/UpdateCenterQueryTest.java | 16 |
5 files changed, 49 insertions, 39 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/plugins_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb index 147f8ca7071..dbbaa13598f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/plugins_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb @@ -20,15 +20,15 @@ require 'json' -class Api::PluginsController < Api::ApiController +class Api::UpdatecenterController < Api::ApiController before_filter :admin_required # - # GET /api/plugins - # curl http://localhost:9000/api/plugins -v -u admin:admin + # GET /api/updatecenter/installed_plugins + # curl http://localhost:9000/api/updatecenter/installed_plugins -v -u admin:admin # - def index + def installed_plugins respond_to do |format| format.json { render :json => jsonp(plugins_to_json(Plugin.user_plugins)) } format.xml { render :xml => plugins_to_xml(Plugin.user_plugins) } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PluginQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PluginQuery.java deleted file mode 100644 index 6ba030cf03c..00000000000 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PluginQuery.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.sonar.wsclient.services; - -/** - * @since 2.4 - */ -public class PluginQuery extends Query<Plugin> { - - public static final String BASE_URL = "/api/plugins"; - - @Override - public Class<Plugin> getModelClass() { - return Plugin.class; - } - - @Override - public String getUrl() { - return BASE_URL; - } -} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateCenterQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateCenterQuery.java new file mode 100644 index 00000000000..f25bd86ebc7 --- /dev/null +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateCenterQuery.java @@ -0,0 +1,29 @@ +package org.sonar.wsclient.services; + +/** + * @since 2.4 + */ +public class UpdateCenterQuery extends Query<Plugin> { + + public static final String BASE_URL = "/api/updatecenter/"; + private String action; + + private UpdateCenterQuery(String action) { + this.action = action; + } + + @Override + public Class<Plugin> getModelClass() { + return Plugin.class; + } + + @Override + public String getUrl() { + return BASE_URL + action; + } + + public static UpdateCenterQuery createForInstalledPlugins() { + return new UpdateCenterQuery("installed_plugins"); + } + +} diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java deleted file mode 100644 index 49d226852ee..00000000000 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.sonar.wsclient.services; - -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -public class PluginQueryTest { - - @Test - public void index() { - PluginQuery query = new PluginQuery(); - assertThat(query.getUrl(), is("/api/plugins")); - } - -} diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/UpdateCenterQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/UpdateCenterQueryTest.java new file mode 100644 index 00000000000..a7be24f929d --- /dev/null +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/UpdateCenterQueryTest.java @@ -0,0 +1,16 @@ +package org.sonar.wsclient.services; + +import org.junit.Test; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class UpdateCenterQueryTest { + + @Test + public void index() { + UpdateCenterQuery query = UpdateCenterQuery.createForInstalledPlugins(); + assertThat(query.getUrl(), is("/api/updatecenter/installed_plugins")); + } + +} |