From: Simon Brandhof Date: Tue, 18 Jul 2017 09:25:17 +0000 (+0200) Subject: SONAR-9516 remove deprecated params from client of WS api/projects/delete X-Git-Tag: 6.6-RC1~849 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7e87812f0c2a3000368e76b2965360c476f8ec10;p=sonarqube.git SONAR-9516 remove deprecated params from client of WS api/projects/delete --- diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java index c21edd90113..0d798bd54f2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java @@ -26,11 +26,9 @@ import javax.annotation.concurrent.Immutable; @Immutable public class DeleteRequest { - private final String id; private final String key; private DeleteRequest(Builder builder) { - this.id = builder.id; this.key = builder.key; } @@ -39,11 +37,6 @@ public class DeleteRequest { return key; } - @CheckForNull - public String getId() { - return id; - } - public static Builder builder() { return new Builder(); } @@ -54,11 +47,6 @@ public class DeleteRequest { private Builder() { } - public Builder setId(@Nullable String id) { - this.id = id; - return this; - } - public Builder setKey(@Nullable String key) { this.key = key; return this; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java index 71b31ef1d1d..f43c40d50be 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java @@ -78,8 +78,7 @@ public class ProjectsService extends BaseService { */ public void delete(DeleteRequest request) { call(new PostRequest(path("delete")) - .setParam("id", request.getId()) - .setParam("key", request.getKey())); + .setParam("project", request.getKey())); } public void bulkDelete(BulkDeleteRequest request) { diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java index 8420491f422..8d21940ab02 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java @@ -116,19 +116,11 @@ public class ProjectsServiceTest { } @Test - public void deletes_project_by_id() { - underTest.delete(DeleteRequest.builder().setId("abc").build()); + public void delete() { + underTest.delete(DeleteRequest.builder().setKey("P1").build()); assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/delete"); - assertThat(serviceTester.getPostRequest().getParams()).containsOnly(entry("id", "abc")); - } - - @Test - public void deletes_project_by_key() { - underTest.delete(DeleteRequest.builder().setKey("project_key").build()); - - assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/delete"); - assertThat(serviceTester.getPostRequest().getParams()).containsOnly(entry("key", "project_key")); + assertThat(serviceTester.getPostRequest().getParams()).containsOnly(entry("project", "P1")); } @Test