]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4282 Remove useless show ws action
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 14 May 2013 07:49:40 +0000 (09:49 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 14 May 2013 07:49:40 +0000 (09:49 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/action_plans_controller.rb
sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlan.java
sonar-ws-client/src/main/java/org/sonar/wsclient/issue/ActionPlanClient.java
sonar-ws-client/src/main/java/org/sonar/wsclient/issue/DefaultActionPlanClient.java
sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java

index 7e424dab77db88def58240dcf32c613dc2efb0a9..2121ce968b6466cf3a8142bfca7d8408007d3b90 100644 (file)
@@ -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=<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=<project>
   #
index 1c0853408ef3b384b41d881638715c67347a98da..84c03ac0589f8763a247489ef64ab84ec41df0e5 100644 (file)
@@ -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");
   }
 
-
 }
index e4e0e1c1e7bfcb83474643124763102a07723258..d535e75bad1f29c48138ccaf0ef46107f5456fb7 100644 (file)
@@ -28,8 +28,6 @@ public interface ActionPlanClient {
 
   List<ActionPlan> find(String projectKey);
 
-  ActionPlan get(String actionPlanKey);
-
   ActionPlan create(NewActionPlan newActionPlan);
 
   ActionPlan update(UpdateActionPlan updateActionPlan);
index eccdf5038f59059c156ad6054afc1fa9d7d41858..651800edeff50bcd0b616f98d5ccb8266389d779 100644 (file)
@@ -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());
index 6b56706c8de620499ec76a7f9384d1d25a9e1515..34fc84b3695948518ca7089662b35938b9c4b86b 100644 (file)
@@ -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);