]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9516 remove deprecated params from client of WS api/projects/delete
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 18 Jul 2017 09:25:17 +0000 (11:25 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 21 Jul 2017 22:31:16 +0000 (00:31 +0200)
sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java
sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java

index c21edd90113f5038deda392a7e93efffdfe28208..0d798bd54f226e1eb14082d14e7ddc647ac21fb7 100644 (file)
@@ -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;
index 71b31ef1d1d8ac2d666adaa2e06f9490f3c2e483..f43c40d50be254e973846ddcc431c7e2ae1a1678 100644 (file)
@@ -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) {
index 8420491f422fabf30b8b2fcad6e12eb3a387383b..8d21940ab027a878600db9a1452c74cac8a01e37 100644 (file)
@@ -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