diff options
4 files changed, 13 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/organization/ws/DeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/organization/ws/DeleteAction.java index 53053d9a06b..b79f08900bf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/organization/ws/DeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/organization/ws/DeleteAction.java @@ -36,6 +36,8 @@ import org.sonar.server.user.UserSession; import static com.google.common.base.Preconditions.checkArgument; import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_KEY; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; +import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_ORGANIZATION; +import static org.sonar.server.ws.KeyExamples.KEY_ORG_EXAMPLE_002; import static org.sonar.server.ws.WsUtils.checkFoundWithOptional; public class DeleteAction implements OrganizationsWsAction { @@ -66,10 +68,11 @@ public class DeleteAction implements OrganizationsWsAction { .setSince("6.2") .setHandler(this); - action.createParam(PARAM_KEY) + action.createParam(PARAM_ORGANIZATION) .setRequired(true) .setDescription("Organization key") - .setExampleValue("foo-company"); + .setDeprecatedKey(PARAM_KEY, "6.4") + .setExampleValue(KEY_ORG_EXAMPLE_002); } @Override @@ -79,7 +82,7 @@ public class DeleteAction implements OrganizationsWsAction { try (DbSession dbSession = dbClient.openSession(false)) { organizationFlags.checkEnabled(dbSession); - String key = request.mandatoryParam(PARAM_KEY); + String key = request.mandatoryParam(PARAM_ORGANIZATION); preventDeletionOfDefaultOrganization(key, defaultOrganizationProvider.get()); OrganizationDto organizationDto = checkFoundWithOptional( diff --git a/server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java b/server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java index ee140c23c3d..f9073234e8b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java @@ -28,6 +28,7 @@ public class KeyExamples { public static final String KEY_DEVELOPER_EXAMPLE_001 = "DEV:ada@lovelace.com"; public static final String KEY_ORG_EXAMPLE_001 = "my-org"; + public static final String KEY_ORG_EXAMPLE_002 = "foo-company"; private KeyExamples() { // prevent instantiation diff --git a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/DeleteActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/DeleteActionTest.java index 27c6b6f9dc7..9b828f6bf30 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/DeleteActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/DeleteActionTest.java @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + package org.sonar.server.organization.ws; import java.util.List; @@ -49,8 +50,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_KEY; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; +import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_ORGANIZATION; public class DeleteActionTest { @@ -82,7 +83,7 @@ public class DeleteActionTest { assertThat(action.params()).hasSize(1); assertThat(action.responseExample()).isNull(); - assertThat(action.param("key")) + assertThat(action.param("organization")) .matches(param -> param.isRequired()) .matches(param -> "foo-company".equals(param.exampleValue())) .matches(param -> "Organization key".equals(param.description())); @@ -113,7 +114,7 @@ public class DeleteActionTest { logInAsSystemAdministrator(); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("The 'key' parameter is missing"); + expectedException.expectMessage("The 'organization' parameter is missing"); wsTester.newRequest().execute(); } @@ -286,7 +287,7 @@ public class DeleteActionTest { private void sendRequest(String organizationKey) { wsTester.newRequest() - .setParam(PARAM_KEY, organizationKey) + .setParam(PARAM_ORGANIZATION, organizationKey) .execute(); } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java index 09fa027efb6..408909067cf 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java @@ -68,7 +68,7 @@ public class OrganizationService extends BaseService { public void delete(@Nullable String key) { PostRequest post = new PostRequest(path("delete")) - .setParam("key", key); + .setParam("organization", key); call(post).failIfNotSuccessful(); } |