]> source.dussan.org Git - sonarqube.git/commitdiff
Remove deprecated ProjectAnalysisService
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 4 Dec 2017 14:19:04 +0000 (15:19 +0100)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 6 Dec 2017 13:40:17 +0000 (14:40 +0100)
33 files changed:
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/CreateEventAction.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/DeleteAction.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/DeleteEventAction.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/EventCategory.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/EventValidator.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/ProjectAnalysesWsParameters.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/SearchRequest.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/UpdateEventAction.java
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/CreateEventActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/DeleteEventActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/EventValidatorTest.java
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/UpdateEventActionTest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/CreateEventRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/DeleteEventRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/DeleteRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/EventCategory.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysisService.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/UpdateEventRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/package-info.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/CreateEventRequestTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParametersTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysisServiceTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/UpdateEventRequestTest.java [deleted file]
tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDateQPChangedTest.java

index 2128a1f32ec47fd17e0d81f836f6c8abf650a3c5..f33235b3f1fb5164208606d4a7a6cb5a9bc174f3 100644 (file)
@@ -42,7 +42,6 @@ import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.user.UserSession;
 import org.sonarqube.ws.ProjectAnalyses.CreateEventResponse;
 import org.sonarqube.ws.ProjectAnalyses.Event;
-import org.sonarqube.ws.client.projectanalysis.EventCategory;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
@@ -50,13 +49,13 @@ import static java.lang.String.format;
 import static org.apache.commons.lang.StringUtils.isNotBlank;
 import static org.sonar.core.util.Protobuf.setNullable;
 import static org.sonar.db.event.EventValidator.MAX_NAME_LENGTH;
+import static org.sonar.server.projectanalysis.ws.EventCategory.OTHER;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.EventCategory.fromLabel;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_CATEGORY;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_NAME;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.fromLabel;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_CATEGORY;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_NAME;
 
 public class CreateEventAction implements ProjectAnalysesWsAction {
   private static final Set<String> ALLOWED_QUALIFIERS = ImmutableSet.of(Qualifiers.PROJECT, Qualifiers.APP);
index e7a66a3dc5b4920ff51ca6bb690879fe1214cd64..8cb1aeb9a8d96aac97e6a1cc610c9b1cca884f2c 100644 (file)
@@ -33,7 +33,7 @@ import org.sonar.server.user.UserSession;
 import static com.google.common.base.Preconditions.checkArgument;
 import static java.lang.String.format;
 import static org.sonar.db.component.SnapshotDto.STATUS_UNPROCESSED;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
 
 public class DeleteAction implements ProjectAnalysesWsAction {
   private final DbClient dbClient;
index 087ff98fc1ec38eab7fdf06d25faf82f1311343b..dbe48a54ff1704dc06d8b7a4d8e65d99a283ba57 100644 (file)
@@ -36,9 +36,9 @@ import org.sonar.server.user.UserSession;
 import static com.google.common.base.Preconditions.checkArgument;
 import static java.lang.String.format;
 import static org.sonar.server.projectanalysis.ws.EventValidator.checkModifiable;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_EVENT;
+import static org.sonar.server.projectanalysis.ws.EventCategory.OTHER;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_EVENT;
 
 public class DeleteEventAction implements ProjectAnalysesWsAction {
   private final DbClient dbClient;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/EventCategory.java b/server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/EventCategory.java
new file mode 100644 (file)
index 0000000..4baa77a
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.projectanalysis.ws;
+
+public enum EventCategory {
+  VERSION("Version"), OTHER("Other"), QUALITY_PROFILE("Profile"), QUALITY_GATE("Alert");
+
+  private final String label;
+
+  EventCategory(String label) {
+    this.label = label;
+  }
+
+  public String getLabel() {
+    return label;
+  }
+
+  public static EventCategory fromLabel(String label) {
+    for (EventCategory category : values()) {
+      if (category.getLabel().equals(label)) {
+        return category;
+      }
+    }
+
+    throw new IllegalArgumentException("Unknown event category label '" + label + "'");
+  }
+}
index b6247bcb7d9efacc658412e4f0e09ffccf50411c..818cccb309aa00521828d2118476e4c3fcb37998 100644 (file)
@@ -24,12 +24,11 @@ import com.google.common.collect.ImmutableSet;
 import java.util.Set;
 import java.util.function.Consumer;
 import org.sonar.db.event.EventDto;
-import org.sonarqube.ws.client.projectanalysis.EventCategory;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.fromLabel;
+import static org.sonar.server.projectanalysis.ws.EventCategory.OTHER;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.EventCategory.fromLabel;
 
 class EventValidator {
   private static final Set<String> AUTHORIZED_CATEGORIES = ImmutableSet.of(VERSION.name(), OTHER.name());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/ProjectAnalysesWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/ProjectAnalysesWsParameters.java
new file mode 100644 (file)
index 0000000..f4259e9
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.projectanalysis.ws;
+
+public class ProjectAnalysesWsParameters {
+  public static final String PARAM_ANALYSIS = "analysis";
+  public static final String PARAM_CATEGORY = "category";
+  public static final String PARAM_NAME = "name";
+  public static final String PARAM_EVENT = "event";
+  public static final String PARAM_PROJECT = "project";
+  public static final String PARAM_FROM = "from";
+  public static final String PARAM_TO = "to";
+  public static final String PARAM_BRANCH = "branch";
+
+  private ProjectAnalysesWsParameters() {
+    // static access only
+  }
+}
index 204384812027e00bf2e12289fd1cf95b5dc02024..16fa7f535e17a90c4178cae2eeab31441172aecc 100644 (file)
@@ -40,7 +40,6 @@ import org.sonar.server.component.ComponentFinder;
 import org.sonar.server.user.UserSession;
 import org.sonar.server.ws.KeyExamples;
 import org.sonarqube.ws.ProjectAnalyses;
-import org.sonarqube.ws.client.projectanalysis.EventCategory;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime;
@@ -50,12 +49,12 @@ import static org.sonar.db.component.SnapshotQuery.SORT_FIELD.BY_DATE;
 import static org.sonar.db.component.SnapshotQuery.SORT_ORDER.DESC;
 import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_CATEGORY;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_FROM;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_PROJECT;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_TO;
+import static org.sonar.server.projectanalysis.ws.EventCategory.OTHER;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_BRANCH;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_CATEGORY;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_FROM;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_PROJECT;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_TO;
 import static org.sonar.server.projectanalysis.ws.SearchRequest.DEFAULT_PAGE_SIZE;
 
 public class SearchAction implements ProjectAnalysesWsAction {
index d55ce270bdc3837988d0c205659b9276d242703d..38ed38f33b3be252eb6a068d97d7983a984cd6f7 100644 (file)
@@ -19,8 +19,6 @@
  */
 package org.sonar.server.projectanalysis.ws;
 
-import org.sonarqube.ws.client.projectanalysis.EventCategory;
-
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 
index 41c0a746b3e5323041c47ff32e97e9297f3c1e01..1ffdfbf4edb78c0833763d74feac8dbe0c7ded08 100644 (file)
@@ -27,7 +27,7 @@ import org.sonarqube.ws.ProjectAnalyses.SearchResponse;
 
 import static org.sonar.api.utils.DateUtils.formatDateTime;
 import static org.sonar.core.util.Protobuf.setNullable;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.fromLabel;
+import static org.sonar.server.projectanalysis.ws.EventCategory.fromLabel;
 
 class SearchResponseBuilder {
   private final Analysis.Builder wsAnalysis;
index 45164cb841e8ce702dccb1aa3eccde41c2d2710a..f9fd401c5093b55ba43a773102e4ae4cf1cfd647 100644 (file)
@@ -37,7 +37,6 @@ import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.user.UserSession;
 import org.sonarqube.ws.ProjectAnalyses.Event;
 import org.sonarqube.ws.ProjectAnalyses.UpdateEventResponse;
-import org.sonarqube.ws.client.projectanalysis.EventCategory;
 
 import javax.annotation.CheckForNull;
 
@@ -48,10 +47,10 @@ import static org.apache.commons.lang.StringUtils.isNotBlank;
 import static org.sonar.core.util.Protobuf.setNullable;
 import static org.sonar.server.projectanalysis.ws.EventValidator.checkModifiable;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.fromLabel;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_EVENT;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_NAME;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.EventCategory.fromLabel;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_EVENT;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_NAME;
 
 public class UpdateEventAction implements ProjectAnalysesWsAction {
   private static final int MAX_NAME_LENGTH = 100;
index 5b536ebcf36e1a08d568ea7b5f95d29670188bde..8d9bd7155789d45694f93e3dd301f7223dea45f8 100644 (file)
@@ -56,11 +56,11 @@ import static org.sonar.db.component.SnapshotTesting.newAnalysis;
 import static org.sonar.db.component.SnapshotTesting.newSnapshot;
 import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.WsRequest.Method.POST;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_CATEGORY;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_NAME;
+import static org.sonar.server.projectanalysis.ws.EventCategory.OTHER;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_CATEGORY;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_NAME;
 
 public class CreateEventActionTest {
 
index 246c794fe27c045da8ca627887b96a0fa39e67c0..23fd7eaa5af7f4d691892e9b74923707f0b05c8c 100644 (file)
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.tuple;
 import static org.sonar.db.component.SnapshotDto.STATUS_PROCESSED;
 import static org.sonar.db.component.SnapshotDto.STATUS_UNPROCESSED;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_ANALYSIS;
 
 public class DeleteActionTest {
   @Rule
index 4bb5a15b3bccfe855ab90759960d0f06307847ed..dcc6d2e7070e785ddc7b9aa5a32dc76b1ac26859 100644 (file)
@@ -44,8 +44,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
 import static org.sonar.db.event.EventTesting.newEvent;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_EVENT;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_EVENT;
 
 public class DeleteEventActionTest {
   @Rule
index 43bbcfd2f6c8493725ef6d257f35f9c45cdf35d0..1172c9b3c2ac8c8b1c450d2b4aea229201580eaf 100644 (file)
@@ -28,7 +28,7 @@ import org.sonar.db.event.EventTesting;
 import org.sonar.db.organization.OrganizationTesting;
 
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.QUALITY_GATE;
+import static org.sonar.server.projectanalysis.ws.EventCategory.QUALITY_GATE;
 
 public class EventValidatorTest {
   @Rule
index 703d093398ccea7b496db524b153154ad6640f93..338c710d79525469d07c06360d37133dc5a6d6d1 100644 (file)
@@ -47,7 +47,6 @@ import org.sonarqube.ws.Common.Paging;
 import org.sonarqube.ws.ProjectAnalyses.Analysis;
 import org.sonarqube.ws.ProjectAnalyses.Event;
 import org.sonarqube.ws.ProjectAnalyses.SearchResponse;
-import org.sonarqube.ws.client.projectanalysis.EventCategory;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
@@ -61,14 +60,14 @@ import static org.sonar.db.event.EventTesting.newEvent;
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
 import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.WsRequest.Method.POST;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.QUALITY_GATE;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_CATEGORY;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_FROM;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_PROJECT;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_TO;
+import static org.sonar.server.projectanalysis.ws.EventCategory.OTHER;
+import static org.sonar.server.projectanalysis.ws.EventCategory.QUALITY_GATE;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_BRANCH;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_CATEGORY;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_FROM;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_PROJECT;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_TO;
 
 public class SearchActionTest {
 
index 48d788a1406fed90ba6345e58bf9d98cf10a4aab..0bd7d881596cc542ba75ef4a7e02b0a969ca632b 100644 (file)
@@ -48,10 +48,10 @@ import static org.sonar.db.component.SnapshotTesting.newAnalysis;
 import static org.sonar.db.event.EventTesting.newEvent;
 import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.WsRequest.Method.POST;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_EVENT;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_NAME;
+import static org.sonar.server.projectanalysis.ws.EventCategory.OTHER;
+import static org.sonar.server.projectanalysis.ws.EventCategory.VERSION;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_EVENT;
+import static org.sonar.server.projectanalysis.ws.ProjectAnalysesWsParameters.PARAM_NAME;
 
 public class UpdateEventActionTest {
   @Rule
index e0cd34ed34331c4ef436f191b0208a57392e5d9e..27d06ffac667974515d409f37425e9b61633d4c7 100644 (file)
@@ -29,7 +29,6 @@ import org.sonarqube.ws.client.organizations.OrganizationsService;
 import org.sonarqube.ws.client.permissions.PermissionsService;
 import org.sonarqube.ws.client.project.ProjectsService;
 import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
-import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
 import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
 import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
 import org.sonarqube.ws.client.qualitygates.QualitygatesService;
@@ -74,7 +73,6 @@ class DefaultWsClient implements WsClient {
   private final SettingsService settingsService;
   private final RootsService rootsService;
   private final WebhooksService webhooksService;
-  private final ProjectAnalysisService projectAnalysisOld;
   private final ProjectAnalysesService projectAnalyses;
   private final NotificationsService notificationsService;
   private final ProjectBranchesService projectBranchesService;
@@ -102,7 +100,6 @@ class DefaultWsClient implements WsClient {
     this.settingsService = new SettingsService(wsConnector);
     this.rootsService = new RootsService(wsConnector);
     this.webhooksService = new WebhooksService(wsConnector);
-    this.projectAnalysisOld = new ProjectAnalysisService(wsConnector);
     this.projectAnalyses = new ProjectAnalysesService(wsConnector);
     this.projectBranchesService = new ProjectBranchesService(wsConnector);
     this.notificationsService = new NotificationsService(wsConnector);
@@ -218,11 +215,6 @@ class DefaultWsClient implements WsClient {
     return webhooksService;
   }
 
-  @Override
-  public ProjectAnalysisService projectAnalysisOld() {
-    return projectAnalysisOld;
-  }
-
   @Override
   public ProjectAnalysesService projectAnalyses() {
     return projectAnalyses;
index 82becf77c3d08b7f48b044f213c4c62a19af22a8..1de94f492e40c0f340a269014433df4b5adb8e79 100644 (file)
@@ -29,7 +29,6 @@ import org.sonarqube.ws.client.organizations.OrganizationsService;
 import org.sonarqube.ws.client.permissions.PermissionsService;
 import org.sonarqube.ws.client.project.ProjectsService;
 import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
-import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
 import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
 import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
 import org.sonarqube.ws.client.qualitygates.QualitygatesService;
@@ -133,13 +132,6 @@ public interface WsClient {
    */
   WebhooksService webhooks();
 
-  /**
-   * @since 6.3
-   * @deprecated since 7.0 use {@link #projectAnalyses()} instead
-   */
-  @Deprecated
-  ProjectAnalysisService projectAnalysisOld();
-
   ProjectAnalysesService projectAnalyses();
 
   /**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/CreateEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/CreateEventRequest.java
deleted file mode 100644 (file)
index 909d2d7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-public class CreateEventRequest {
-  private final String analysis;
-  private final EventCategory category;
-  private final String name;
-
-  private CreateEventRequest(Builder builder) {
-    analysis = builder.analysis;
-    category = builder.category;
-    name = builder.name;
-  }
-
-  public String getAnalysis() {
-    return analysis;
-  }
-
-  public EventCategory getCategory() {
-    return category;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String analysis;
-    private EventCategory category = EventCategory.OTHER;
-    private String name;
-
-    private Builder() {
-      // enforce static factory method
-    }
-
-    public Builder setAnalysis(String analysis) {
-      this.analysis = analysis;
-      return this;
-    }
-
-    public Builder setCategory(EventCategory category) {
-      this.category = category;
-      return this;
-    }
-
-    public Builder setName(String name) {
-      this.name = name;
-      return this;
-    }
-
-    public CreateEventRequest build() {
-      checkArgument(analysis != null, "Analysis key is required");
-      checkArgument(category != null, "Category is required");
-      checkArgument(name != null, "Name is required");
-
-      return new CreateEventRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/DeleteEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/DeleteEventRequest.java
deleted file mode 100644 (file)
index 3b4c3ed..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import static java.util.Objects.requireNonNull;
-
-public class DeleteEventRequest {
-  private final String event;
-
-  public DeleteEventRequest(String event) {
-    this.event = requireNonNull(event);
-  }
-
-  public String getEvent() {
-    return event;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/DeleteRequest.java
deleted file mode 100644 (file)
index 95590fe..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import static java.util.Objects.requireNonNull;
-
-public class DeleteRequest {
-  private final String analysis;
-
-  public DeleteRequest(String analysis) {
-    this.analysis = requireNonNull(analysis);
-  }
-
-  public String getAnalysis() {
-    return analysis;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/EventCategory.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/EventCategory.java
deleted file mode 100644 (file)
index 39305b4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-public enum EventCategory {
-  VERSION("Version"), OTHER("Other"), QUALITY_PROFILE("Profile"), QUALITY_GATE("Alert");
-
-  private final String label;
-
-  EventCategory(String label) {
-    this.label = label;
-  }
-
-  public String getLabel() {
-    return label;
-  }
-
-  public static EventCategory fromLabel(String label) {
-    for (EventCategory category : values()) {
-      if (category.getLabel().equals(label)) {
-        return category;
-      }
-    }
-
-    throw new IllegalArgumentException("Unknown event category label '" + label + "'");
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java
deleted file mode 100644 (file)
index 3960760..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-public class ProjectAnalysesWsParameters {
-  public static final String PARAM_ANALYSIS = "analysis";
-  public static final String PARAM_CATEGORY = "category";
-  public static final String PARAM_NAME = "name";
-  public static final String PARAM_EVENT = "event";
-  public static final String PARAM_PROJECT = "project";
-  public static final String PARAM_FROM = "from";
-  public static final String PARAM_TO = "to";
-  public static final String PARAM_BRANCH = "branch";
-
-  private ProjectAnalysesWsParameters() {
-    // static access only
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysisService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysisService.java
deleted file mode 100644 (file)
index cf4ca3c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import org.sonarqube.ws.ProjectAnalyses.SearchResponse;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.sonar.api.server.ws.WebService.Param.PAGE;
-import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_CATEGORY;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_PROJECT;
-
-/**
- * @deprecated since 7.0, use {@link org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService} instead
- */
-@Deprecated
-public class ProjectAnalysisService extends BaseService {
-
-  public ProjectAnalysisService(WsConnector wsConnector) {
-    super(wsConnector, "api/project_analyses");
-  }
-
-  public SearchResponse search(SearchRequest searchRequest) {
-    EventCategory eventCategory = searchRequest.getCategory();
-    GetRequest request = new GetRequest(path("search"))
-      .setParam(PARAM_PROJECT, searchRequest.getProject())
-      .setParam(PARAM_BRANCH, searchRequest.getBranch())
-      .setParam(PARAM_CATEGORY, eventCategory == null ? null : eventCategory.name())
-      .setParam(PAGE, searchRequest.getPage())
-      .setParam(PAGE_SIZE, searchRequest.getPageSize());
-    return call(request, SearchResponse.parser());
-  }
-
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java
deleted file mode 100644 (file)
index c415d62..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-
-public class SearchRequest {
-  public static final int DEFAULT_PAGE_SIZE = 100;
-  public static final int MAX_SIZE = 500;
-
-  private final String project;
-  private final String branch;
-  private final EventCategory category;
-  private final int page;
-  private final int pageSize;
-  private final String from;
-  private final String to;
-
-  private SearchRequest(Builder builder) {
-    this.project = builder.project;
-    this.branch= builder.branch;
-    this.category = builder.category;
-    this.page = builder.page;
-    this.pageSize = builder.pageSize;
-    this.from = builder.from;
-    this.to = builder.to;
-  }
-
-  public String getProject() {
-    return project;
-  }
-
-  @CheckForNull
-  public String getBranch() {
-    return branch;
-  }
-
-  @CheckForNull
-  public EventCategory getCategory() {
-    return category;
-  }
-
-  public int getPage() {
-    return page;
-  }
-
-  public int getPageSize() {
-    return pageSize;
-  }
-
-  @CheckForNull
-  public String getFrom() {
-    return from;
-  }
-
-  @CheckForNull
-  public String getTo() {
-    return to;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String project;
-    private String branch;
-    private EventCategory category;
-    private int page = 1;
-    private int pageSize = DEFAULT_PAGE_SIZE;
-    private String from;
-    private String to;
-
-    private Builder() {
-      // enforce static factory method
-    }
-
-    public Builder setProject(String project) {
-      this.project = project;
-      return this;
-    }
-
-    public Builder setBranch(@Nullable String branch) {
-      this.branch = branch;
-      return this;
-    }
-
-    public Builder setCategory(@Nullable EventCategory category) {
-      this.category = category;
-      return this;
-    }
-
-    public Builder setPage(int page) {
-      this.page = page;
-      return this;
-    }
-
-    public Builder setPageSize(int pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public Builder setFrom(@Nullable String from) {
-      this.from = from;
-      return this;
-    }
-
-    public Builder setTo(@Nullable String to) {
-      this.to = to;
-      return this;
-    }
-
-    public SearchRequest build() {
-      requireNonNull(project, "Project is required");
-      checkArgument(pageSize <= MAX_SIZE, "Page size must be lower than or equal to " + MAX_SIZE);
-      return new SearchRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/UpdateEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/UpdateEventRequest.java
deleted file mode 100644 (file)
index 27dbbf7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import javax.annotation.CheckForNull;
-
-import static java.util.Objects.requireNonNull;
-
-public class UpdateEventRequest {
-  private final String event;
-  private final String name;
-
-  public UpdateEventRequest(String event, String name) {
-    this.event = requireNonNull(event, "Event key is required");
-    this.name = requireNonNull(name, "Name is required");
-  }
-
-  public String getEvent() {
-    return event;
-  }
-
-  @CheckForNull
-  public String getName() {
-    return name;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/package-info.java
deleted file mode 100644 (file)
index 7ffc784..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.projectanalysis;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/CreateEventRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/CreateEventRequestTest.java
deleted file mode 100644 (file)
index 41bac7c..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.OTHER;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.VERSION;
-
-public class CreateEventRequestTest {
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  private CreateEventRequest.Builder underTest = CreateEventRequest.builder();
-
-  @Test
-  public void build_request() {
-    CreateEventRequest result = underTest.setAnalysis("P1").setCategory(OTHER).setName("name").build();
-
-    assertThat(result.getAnalysis()).isEqualTo("P1");
-    assertThat(result.getCategory()).isEqualTo(OTHER);
-    assertThat(result.getName()).isEqualTo("name");
-  }
-
-  @Test
-  public void other_category_by_default() {
-    CreateEventRequest result = underTest.setAnalysis("P1").setName("name").build();
-
-    assertThat(OTHER).isEqualTo(result.getCategory());
-  }
-
-  @Test
-  public void fail_when_no_category() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Category is required");
-
-    underTest.setAnalysis("P1").setName("name").setCategory(null).build();
-  }
-
-  @Test
-  public void fail_when_no_analysis() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Analysis key is required");
-
-    underTest.setCategory(VERSION).setName("name").build();
-  }
-
-  @Test
-  public void fail_when_no_name() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Name is required");
-
-    underTest.setAnalysis("P1").setCategory(VERSION).build();
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParametersTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParametersTest.java
deleted file mode 100644 (file)
index d72c477..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.test.TestUtils.hasOnlyPrivateConstructors;
-
-public class ProjectAnalysesWsParametersTest {
-
-  @Test
-  public void private_access_only() {
-    assertThat(hasOnlyPrivateConstructors(ProjectAnalysesWsParameters.class)).isTrue();
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysisServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysisServiceTest.java
deleted file mode 100644 (file)
index 8139bd0..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.ProjectAnalyses;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.sonar.api.server.ws.WebService.Param.PAGE;
-import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.QUALITY_GATE;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_CATEGORY;
-import static org.sonarqube.ws.client.projectanalysis.ProjectAnalysesWsParameters.PARAM_PROJECT;
-
-public class ProjectAnalysisServiceTest {
-
-  @Rule
-  public ServiceTester<ProjectAnalysisService> serviceTester = new ServiceTester<>(new ProjectAnalysisService(mock(WsConnector.class)));
-
-  private ProjectAnalysisService underTest = serviceTester.getInstanceUnderTest();
-
-  @Test
-  public void search() {
-    underTest.search(SearchRequest.builder()
-      .setProject("project")
-      .setBranch("my_branch")
-      .setCategory(QUALITY_GATE)
-      .setPage(10)
-      .setPageSize(50)
-    .build());
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(ProjectAnalyses.SearchResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam(PARAM_PROJECT, "project")
-      .hasParam(PARAM_BRANCH, "my_branch")
-      .hasParam(PARAM_CATEGORY, QUALITY_GATE.name())
-      .hasParam(PAGE, 10)
-      .hasParam(PAGE_SIZE, 50)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void search_with_minimal_fields() {
-    underTest.search(SearchRequest.builder()
-      .setProject("project")
-      .build());
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(ProjectAnalyses.SearchResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam(PARAM_PROJECT, "project")
-      .hasParam(PAGE, 1)
-      .hasParam(PAGE_SIZE, 100)
-      .andNoOtherParam();
-  }
-
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java
deleted file mode 100644 (file)
index 4abe04f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.client.projectanalysis.EventCategory.QUALITY_GATE;
-
-public class SearchRequestTest {
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  private SearchRequest.Builder underTest = SearchRequest.builder();
-
-  @Test
-  public void search_request() {
-    SearchRequest result = underTest
-      .setProject("P1")
-      .setBranch("my_branch")
-      .setCategory(QUALITY_GATE)
-      .setPage(2)
-      .setPageSize(500)
-      .setFrom("2016-01-01")
-      .setTo("2017-07-01")
-      .build();
-
-    assertThat(result.getProject()).isEqualTo("P1");
-    assertThat(result.getBranch()).isEqualTo("my_branch");
-    assertThat(result.getPage()).isEqualTo(2);
-    assertThat(result.getPageSize()).isEqualTo(500);
-    assertThat(result.getCategory()).isEqualTo(QUALITY_GATE);
-    assertThat(result.getFrom()).isEqualTo("2016-01-01");
-    assertThat(result.getTo()).isEqualTo("2017-07-01");
-  }
-
-  @Test
-  public void page_default_values() {
-    SearchRequest result = underTest.setProject("P1").build();
-
-    assertThat(result.getPage()).isEqualTo(1);
-    assertThat(result.getPageSize()).isEqualTo(100);
-  }
-
-  @Test
-  public void fail_if_project_is_null() {
-    expectedException.expect(NullPointerException.class);
-
-    underTest.build();
-  }
-
-  @Test
-  public void fail_if_page_size_greater_than_500() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Page size must be lower than or equal to 500");
-
-    underTest.setProject("P1")
-      .setPageSize(501)
-      .build();
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/UpdateEventRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/UpdateEventRequestTest.java
deleted file mode 100644 (file)
index a5321c6..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.sonarqube.ws.client.projectanalysis;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class UpdateEventRequestTest {
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  private UpdateEventRequest underTest;
-
-  @Test
-  public void request_with_name_only() {
-    underTest = new UpdateEventRequest("E1", "name");
-
-    assertThat(underTest.getEvent()).isEqualTo("E1");
-    assertThat(underTest.getName()).isEqualTo("name");
-  }
-
-  @Test
-  public void request_with_all_parameters() {
-    underTest = new UpdateEventRequest("E1", "name");
-
-    assertThat(underTest.getEvent()).isEqualTo("E1");
-    assertThat(underTest.getName()).isEqualTo("name");
-  }
-
-  @Test
-  public void fail_if_null_event() {
-    expectedException.expect(NullPointerException.class);
-    expectedException.expectMessage("Event key is required");
-
-    new UpdateEventRequest(null, "name");
-  }
-
-  @Test
-  public void fail_if_name_not_provided() {
-    expectedException.expect(NullPointerException.class);
-    expectedException.expectMessage("Name is required");
-
-    new UpdateEventRequest("E1", null);
-  }
-}
index c50bd459e953ab9b5446f11c12323fb05a1de85c..43dbee9f167aad72937cb800b22dd13b01e2036b 100644 (file)
@@ -37,7 +37,7 @@ import org.junit.Test;
 import org.sonar.wsclient.issue.Issue;
 import org.sonar.wsclient.issue.IssueQuery;
 import org.sonarqube.ws.ProjectAnalyses;
-import org.sonarqube.ws.client.projectanalysis.SearchRequest;
+import org.sonarqube.ws.client.projectanalyses.SearchRequest;
 import util.ItUtils;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -358,8 +358,8 @@ public class IssueCreationDateQPChangedTest extends AbstractIssueTest {
     private static Date getAnalysisDate(Function<List<ProjectAnalyses.Analysis>, Optional<ProjectAnalyses.Analysis>> chooseItem) {
       return Optional.of(
         ItUtils.newWsClient(ORCHESTRATOR)
-          .projectAnalysisOld()
-          .search(SearchRequest.builder().setProject(SAMPLE_PROJECT_KEY).build())
+          .projectAnalyses()
+          .search(new SearchRequest().setProject(SAMPLE_PROJECT_KEY))
           .getAnalysesList())
         .flatMap(chooseItem)
         .map(ProjectAnalyses.Analysis::getDate)