]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9181 Deprecate WS api/projects/ghosts
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 5 Sep 2017 08:44:59 +0000 (10:44 +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/GhostsAction.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java

index f8945203a180a309838ad898504f1c9f905aff02..2c7dd00c722b560be408b01fc56bf1a76bc2bfb4 100644 (file)
@@ -67,10 +67,12 @@ public class GhostsAction implements ProjectsWsAction {
     action.setChangelog(new Change("6.4", "The 'uuid' field is deprecated in the response"));
 
     action
-      .setDescription("List ghost projects.<br /> " +
+      .setDescription("List ghost projects.<br> " +
+        "With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.<br> " +
         "Requires 'Administer System' permission.")
       .setResponseExample(Resources.getResource(getClass(), "projects-example-ghosts.json"))
       .setSince("5.2")
+      .setDeprecatedSince("6.6")
       .addPagingParams(100, MAX_LIMIT)
       .addFieldsParam(POSSIBLE_FIELDS)
       .addSearchQuery("sonar", "names", "keys")
index c04ed17e84a79e3b711da842f519ad3091d16f20..5350d3090cbf315be7cf3c62b6ee5452abe46ee4 100644 (file)
@@ -60,14 +60,19 @@ public class GhostsActionTest {
 
   private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
   private DbClient dbClient = db.getDbClient();
-  private WsActionTester underTest = new WsActionTester(new GhostsAction(dbClient, userSessionRule, defaultOrganizationProvider));
+
+  private WsActionTester ws = new WsActionTester(new GhostsAction(dbClient, userSessionRule, defaultOrganizationProvider));
 
   @Test
-  public void verify_definition() {
-    WebService.Action action = underTest.getDef();
-    assertThat(action.description()).isEqualTo("List ghost projects.<br /> Requires 'Administer System' permission.");
+  public void definition() {
+    WebService.Action action = ws.getDef();
+    assertThat(action.key()).isEqualTo("ghosts");
+    assertThat(action.description()).isEqualTo("List ghost projects.<br> " +
+      "With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.<br> " +
+      "Requires 'Administer System' permission.");
     assertThat(action.since()).isEqualTo("5.2");
     assertThat(action.isInternal()).isFalse();
+    assertThat(action.deprecatedSince()).isEqualTo("6.6");
 
     assertThat(action.params()).hasSize(5);
 
@@ -86,7 +91,7 @@ public class GhostsActionTest {
     ComponentDto activeProject = insertActiveProject(organization);
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam("organization", organization.getKey())
       .execute();
 
@@ -119,7 +124,7 @@ public class GhostsActionTest {
     }
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam("organization", organization.getKey())
       .setParam(Param.PAGE, "3")
       .setParam(Param.PAGE_SIZE, "4")
@@ -140,7 +145,7 @@ public class GhostsActionTest {
     insertGhostProject(organization);
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam("organization", organization.getKey())
       .setParam(Param.FIELDS, "name")
       .execute();
@@ -160,7 +165,7 @@ public class GhostsActionTest {
 
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam("organization", organization.getKey())
       .setParam(Param.TEXT_QUERY, "name-1")
       .execute();
@@ -177,7 +182,7 @@ public class GhostsActionTest {
 
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam("organization", organization.getKey())
       .setParam(Param.TEXT_QUERY, "GHOST-key")
       .execute();
@@ -207,7 +212,7 @@ public class GhostsActionTest {
     db.getSession().commit();
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
-    TestResponse result = underTest.newRequest()
+    TestResponse result = ws.newRequest()
       .setParam("organization", organization.getKey())
       .execute();
 
@@ -222,7 +227,7 @@ public class GhostsActionTest {
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("Insufficient privileges");
 
-    underTest.newRequest().execute();
+    ws.newRequest().execute();
   }
 
   @Test
@@ -232,7 +237,7 @@ public class GhostsActionTest {
     expectedException.expect(NotFoundException.class);
     expectedException.expectMessage("No organization for key 'foo'");
 
-    underTest.newRequest().setParam("organization", "foo").execute();
+    ws.newRequest().setParam("organization", "foo").execute();
   }
 
   private ComponentDto insertGhostProject(OrganizationDto organization) {