From 7e87812f0c2a3000368e76b2965360c476f8ec10 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 18 Jul 2017 11:25:17 +0200 Subject: [PATCH] SONAR-9516 remove deprecated params from client of WS api/projects/delete --- .../sonarqube/ws/client/project/DeleteRequest.java | 12 ------------ .../ws/client/project/ProjectsService.java | 3 +-- .../ws/client/project/ProjectsServiceTest.java | 14 +++----------- 3 files changed, 4 insertions(+), 25 deletions(-) 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 -- 2.39.5