]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7305 Deprecate api/timemachine WS
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 24 Jan 2017 16:16:40 +0000 (17:16 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 24 Jan 2017 17:36:49 +0000 (18:36 +0100)
server/sonar-server/src/main/java/org/sonar/server/measure/ws/TimeMachineWs.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/TimeMachineWsTest.java

index f43e243f01435260f3154abb8c2abe9867696fb7..279268b674b43db89afb8fcaba16eed58597dd68 100644 (file)
 package org.sonar.server.measure.ws;
 
 import com.google.common.io.Resources;
-import org.sonar.api.server.ws.RailsHandler;
 import org.sonar.api.server.ws.WebService;
-
-import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+import org.sonar.server.ws.RemovedWebServiceHandler;
 
 public class TimeMachineWs implements WebService {
 
   @Override
   public void define(Context context) {
     NewController controller = context.createController("api/timemachine")
-      .setDescription("Get project measure data from past analyses.")
+      .setDescription("Removed since 6.3, please use api/measures/search_analyses instead")
       .setSince("2.10");
-
-    defineSystemAction(controller);
-
+    defineIndexAction(controller);
     controller.done();
   }
 
-  private void defineSystemAction(NewController controller) {
-    NewAction action = controller.createAction("index")
-      .setDescription("Get a list of past measures. Requires Browse permission on project")
+  private void defineIndexAction(NewController controller) {
+    controller.createAction("index")
+      .setDescription("The web service is removed and you're invited to use api/measures/search_analyses instead")
       .setSince("2.10")
-      .setHandler(RailsHandler.INSTANCE)
+      .setDeprecatedSince("6.3")
+      .setHandler(RemovedWebServiceHandler.INSTANCE)
       .setResponseExample(Resources.getResource(this.getClass(), "timemachine-example-index.json"));
-
-    action.createParam("resource")
-      .setDescription("id or key of the resource (ie: component)")
-      .setRequired(true)
-      .setExampleValue(KEY_PROJECT_EXAMPLE_001);
-
-    action.createParam("metrics")
-      .setDescription("Comma-separated list of <a href=\"http://redirect.sonarsource.com/doc/metric-definitions.html\">metric keys/ids</a>")
-      .setRequired(true)
-      .setExampleValue("coverage,violations");
-
-    action.createParam("fromDateTime")
-      .setDescription("ISO-8601 datetime (inclusive)")
-      .setExampleValue("2010-12-25T23:59:59+0100");
-
-    action.createParam("toDateTime")
-      .setDescription("ISO-8601 datetime (inclusive)")
-      .setExampleValue("2010-12-25T23:59:59+0100");
-
-    action.createParam("format")
-      .setDescription("Response format")
-      .setPossibleValues("json", "csv");
   }
 
 }
index c8d77af29d8fb4c66fef095e7ed46f420160cf29..7bfa56c6ba09ac322b90b7f9420cb75bf6fe1d14 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.server.measure.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.ws.WsTester;
 
@@ -49,9 +48,7 @@ public class TimeMachineWsTest {
   public void define_index_action() {
     WebService.Action action = controller.action("index");
     assertThat(action).isNotNull();
-    assertThat(action.handler()).isInstanceOf(RailsHandler.class);
     assertThat(action.responseExampleAsString()).isNotEmpty();
-    assertThat(action.params()).hasSize(5);
   }
 
 }