diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2017-09-05 10:44:59 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-09-11 11:28:29 +0200 |
commit | e8eff068e1d16bb343c87d0c16580dcb43cc5add (patch) | |
tree | f1128fb5e6d965562200467b44f444de5fdbe651 | |
parent | 8cd67853ecc669b921e73b345636dab7af2eaaa7 (diff) | |
download | sonarqube-e8eff068e1d16bb343c87d0c16580dcb43cc5add.tar.gz sonarqube-e8eff068e1d16bb343c87d0c16580dcb43cc5add.zip |
SONAR-9181 Deprecate WS api/projects/ghosts
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java | 4 | ||||
-rw-r--r-- | server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java | 29 |
2 files changed, 20 insertions, 13 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java index f8945203a18..2c7dd00c722 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java @@ -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") diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java index c04ed17e84a..5350d3090cb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java @@ -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) { |