From cc72a7cef34b9cc1739ef20d0be8a320a7af18ba Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 14 May 2013 09:49:40 +0200 Subject: [PATCH] SONAR-4282 Remove useless show ws action --- .../api/action_plans_controller.rb | 20 ------------ .../org/sonar/wsclient/issue/ActionPlan.java | 3 +- .../wsclient/issue/ActionPlanClient.java | 2 -- .../issue/DefaultActionPlanClient.java | 9 ------ .../issue/DefaultActionPlanClientTest.java | 31 ------------------- 5 files changed, 2 insertions(+), 63 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb index 7e424dab77d..2121ce968b6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb @@ -22,26 +22,6 @@ class Api::ActionPlansController < Api::ApiController before_filter :admin_required, :only => [ :create, :delete, :update, :close, :open ] - # - # GET /api/action_plan/show?key= - # - # -- Example - # curl -v -u 'http://localhost:9000/api/action_plans/show?key=9b6f89c0-3347-46f6-a6d1-dd6c761240e0' - # - def show - require_parameters :key - - action_plan = Internal.issues.findActionPlan(params[:key]) - hash = {} - hash[:actionPlan] = action_plan_to_hash(action_plan) if action_plan - - respond_to do |format| - format.json { render :json => jsonp(hash) } - format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'actionPlan') } - end - end - - # # GET /api/action_plans/search?project= # diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlan.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlan.java index 1c0853408ef..84c03ac0589 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlan.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlan.java @@ -81,13 +81,14 @@ public class ActionPlan { return JsonUtils.getDateTime(json, "updatedAt"); } + @CheckForNull public Integer totalIssues() { return JsonUtils.getInteger(json, "totalIssues"); } + @CheckForNull public Integer openIssues() { return JsonUtils.getInteger(json, "openIssues"); } - } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlanClient.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlanClient.java index e4e0e1c1e7b..d535e75bad1 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlanClient.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlanClient.java @@ -28,8 +28,6 @@ public interface ActionPlanClient { List find(String projectKey); - ActionPlan get(String actionPlanKey); - ActionPlan create(NewActionPlan newActionPlan); ActionPlan update(UpdateActionPlan updateActionPlan); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/DefaultActionPlanClient.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/DefaultActionPlanClient.java index eccdf5038f5..651800edeff 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/DefaultActionPlanClient.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/DefaultActionPlanClient.java @@ -60,15 +60,6 @@ public class DefaultActionPlanClient implements ActionPlanClient { return result; } - @Override - public ActionPlan get(String actionPlanKey) { - HttpRequest request = requestFactory.get("/api/action_plans/show", EncodingUtils.toMap("key", actionPlanKey)); - if (!request.ok()) { - throw new IllegalStateException("Fail to search action plan. Bad HTTP response status: " + request.code()); - } - return createActionPlanResult(request); - } - @Override public ActionPlan create(NewActionPlan newActionPlan) { HttpRequest request = requestFactory.post(NewActionPlan.BASE_URL, newActionPlan.urlParams()); diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java index 6b56706c8de..34fc84b3695 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java @@ -67,37 +67,6 @@ public class DefaultActionPlanClientTest { assertThat(actionPlan.updatedAt()).isNotNull(); } - @Test - public void should_find_action_plan() { - HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url(), null, null); - httpServer.doReturnBody("{\"actionPlan\": {\"key\": \"382f6f2e-ad9d-424a-b973-9b065e04348a\",\n" + - "\"name\": \"Long term\",\n" + - "\"status\": \"CLOSED\",\n" + - "\"project\": \"com.sonarsource.it.samples:simple-sample\",\n" + - "\"userLogin\": \"admin\",\n" + - "\"deadLine\": \"2013-05-30T00:00:00+0200\",\n" + - "\"totalIssues\": 0,\n" + - "\"openIssues\": 0,\n" + - "\"createdAt\": \"2013-05-13T12:50:29+0200\",\n" + - "\"updatedAt\": \"2013-05-13T12:50:44+0200\"}}"); - - ActionPlanClient client = new DefaultActionPlanClient(requestFactory); - ActionPlan actionPlan = client.get("382f6f2e-ad9d-424a-b973-9b065e04348a"); - - assertThat(httpServer.requestedPath()).isEqualTo("/api/action_plans/show?key=382f6f2e-ad9d-424a-b973-9b065e04348a"); - assertThat(actionPlan).isNotNull(); - assertThat(actionPlan.key()).isEqualTo("382f6f2e-ad9d-424a-b973-9b065e04348a"); - assertThat(actionPlan.name()).isEqualTo("Long term"); - assertThat(actionPlan.project()).isEqualTo("com.sonarsource.it.samples:simple-sample"); - assertThat(actionPlan.status()).isEqualTo("CLOSED"); - assertThat(actionPlan.userLogin()).isEqualTo("admin"); - assertThat(actionPlan.deadLine()).isNotNull(); - assertThat(actionPlan.totalIssues()).isEqualTo(0); - assertThat(actionPlan.openIssues()).isEqualTo(0); - assertThat(actionPlan.createdAt()).isNotNull(); - assertThat(actionPlan.updatedAt()).isNotNull(); - } - @Test public void should_create_action_plan() { HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url(), null, null); -- 2.39.5