]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9181 Deprecate WS api/projects/provisioned
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 6 Sep 2017 14:29:34 +0000 (16:29 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Mon, 11 Sep 2017 09:28:29 +0000 (11:28 +0200)
server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java

index 8f37223982bacc8ba102fd729bbf4183d87357e9..f4fafb04bc1b9a5c323c9803e62c31439a76e727 100644 (file)
@@ -77,9 +77,11 @@ public class ProvisionedAction implements ProjectsWsAction {
     WebService.NewAction action = controller.createAction("provisioned");
     action
       .setDescription(
-        "Get the list of provisioned projects.<br /> " +
+        "Get the list of provisioned projects.<br> " +
+          "Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.<br> " +
           "Require 'Create Projects' permission.")
       .setSince("5.2")
+      .setDeprecatedSince("6.6")
       .setResponseExample(Resources.getResource(getClass(), "projects-example-provisioned.json"))
       .setHandler(this)
       .addPagingParams(100, MAX_LIMIT)
index c9141745a56e937824175e6dcc90d083542a00a4..218e0912cd8fda236528b4f1c9f4259ac8a7d1c1 100644 (file)
@@ -64,19 +64,22 @@ public class ProvisionedActionTest {
 
   private TestDefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
   private DbClient dbClient = db.getDbClient();
-  private WsActionTester underTest = new WsActionTester(new ProvisionedAction(new ProjectsWsSupport(dbClient, mock(BillingValidationsProxy.class)),
-    dbClient, userSessionRule, defaultOrganizationProvider));
+
+  private WsActionTester ws = new WsActionTester(
+    new ProvisionedAction(new ProjectsWsSupport(dbClient, mock(BillingValidationsProxy.class)), dbClient, userSessionRule, defaultOrganizationProvider));
 
   @Test
-  public void verify_definition() {
-    WebService.Action action = underTest.getDef();
+  public void definition() {
+    WebService.Action action = ws.getDef();
 
-    assertThat(action.description()).isEqualTo("Get the list of provisioned projects.<br /> " +
+    assertThat(action.description()).isEqualTo("Get the list of provisioned projects.<br> " +
+      "Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.<br> " +
       "Require 'Create Projects' permission.");
     assertThat(action.since()).isEqualTo("5.2");
     assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder(
       tuple("6.4", "The 'uuid' field is deprecated in the response"),
       tuple("6.4", "Paging response fields is now in a Paging object"));
+    assertThat(action.deprecatedSince()).isEqualTo("6.6");
 
     assertThat(action.params()).hasSize(5);
 
@@ -95,7 +98,7 @@ public class ProvisionedActionTest {
     db.components().insertSnapshot(SnapshotTesting.newAnalysis(analyzedProject));
     userSessionRule.logIn().addPermission(PROVISION_PROJECTS, org);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam(PARAM_ORGANIZATION, org.getKey())
       .execute();
 
@@ -128,7 +131,7 @@ public class ProvisionedActionTest {
     }
     userSessionRule.logIn().addPermission(PROVISION_PROJECTS, org);
 
-    TestRequest request = underTest.newRequest()
+    TestRequest request = ws.newRequest()
       .setParam(PARAM_ORGANIZATION, org.getKey())
       .setParam(Param.PAGE, "3")
       .setParam(Param.PAGE_SIZE, "4");
@@ -144,7 +147,7 @@ public class ProvisionedActionTest {
     db.components().insertComponent(newProvisionedProject(organization, "1"));
     userSessionRule.logIn().addPermission(PROVISION_PROJECTS, organization);
 
-    String jsonOutput = underTest.newRequest()
+    String jsonOutput = ws.newRequest()
       .setParam(PARAM_ORGANIZATION, organization.getKey())
       .setParam(Param.FIELDS, "key")
       .execute().getInput();
@@ -160,7 +163,7 @@ public class ProvisionedActionTest {
     db.components().insertComponents(newProvisionedProject(org, "1"), newProvisionedProject(org, "2"));
     userSessionRule.logIn().addPermission(PROVISION_PROJECTS, org);
 
-    String jsonOutput = underTest.newRequest()
+    String jsonOutput = ws.newRequest()
       .setParam(PARAM_ORGANIZATION, org.getKey())
       .setParam(Param.TEXT_QUERY, "PROVISIONED-name-2")
       .execute().getInput();
@@ -185,7 +188,7 @@ public class ProvisionedActionTest {
     db.components().insertComponents(hBaseProject, roslynProject);
     userSessionRule.logIn().addPermission(PROVISION_PROJECTS, org);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam(PARAM_ORGANIZATION, org.getKey())
       .execute();
 
@@ -201,12 +204,12 @@ public class ProvisionedActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    underTest.newRequest().execute();
+    ws.newRequest().execute();
   }
 
   @Test
   public void fail_with_NotFoundException_when_organization_with_specified_key_does_not_exist() {
-    TestRequest request = underTest.newRequest()
+    TestRequest request = ws.newRequest()
       .setParam(PARAM_ORGANIZATION, "foo");
     userSessionRule.logIn();