]> source.dussan.org Git - sonarqube.git/commitdiff
Remove deprecated MeasuresService
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 4 Dec 2017 14:52:09 +0000 (15:52 +0100)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 6 Dec 2017 13:40:17 +0000 (14:40 +0100)
38 files changed:
server/sonar-server/src/main/java/org/sonar/server/component/ws/AppAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/MeasuresWsParameters.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java
server/sonar-server/src/main/java/org/sonar/server/duplication/ws/ShowAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasuresWs.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasuresWsParametersBuilder.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/BaseService.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/measure/ComponentRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchHistoryRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/measure/package-info.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/measures/ComponentTreeRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/measures/SearchRequest.java
sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchHistoryRequestTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchRequestTest.java [deleted file]
tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java
tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java
tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java
tests/src/test/java/org/sonarqube/tests/performance/scanner/DuplicationTest.java
tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java
tests/src/test/java/util/ItUtils.java

index 901da41760b9ba896e588f7fd9303b8c837512fb..b19d1110941bebc4052d4073d7e13d3c2511e699 100644 (file)
@@ -59,7 +59,7 @@ import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
 import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT;
 import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001;
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
 
 public class AppAction implements ComponentsWsAction {
 
diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/MeasuresWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/MeasuresWsParameters.java
new file mode 100644 (file)
index 0000000..86f91d6
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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.component.ws;
+
+import com.google.common.collect.ImmutableSortedSet;
+import java.util.Set;
+
+public class MeasuresWsParameters {
+  public static final String CONTROLLER_MEASURES = "api/measures";
+
+  // actions
+  public static final String ACTION_COMPONENT_TREE = "component_tree";
+  public static final String ACTION_COMPONENT = "component";
+  public static final String ACTION_SEARCH_HISTORY = "search_history";
+
+  // parameters
+  public static final String DEPRECATED_PARAM_BASE_COMPONENT_ID = "baseComponentId";
+  public static final String DEPRECATED_PARAM_BASE_COMPONENT_KEY = "baseComponentKey";
+  public static final String PARAM_COMPONENT = "component";
+  public static final String PARAM_BRANCH = "branch";
+  public static final String PARAM_STRATEGY = "strategy";
+  public static final String PARAM_QUALIFIERS = "qualifiers";
+  public static final String PARAM_METRICS = "metrics";
+  public static final String PARAM_METRIC_KEYS = "metricKeys";
+  public static final String PARAM_METRIC_SORT = "metricSort";
+  public static final String PARAM_METRIC_PERIOD_SORT = "metricPeriodSort";
+  public static final String PARAM_METRIC_SORT_FILTER = "metricSortFilter";
+  public static final String PARAM_ADDITIONAL_FIELDS = "additionalFields";
+  public static final String DEPRECATED_PARAM_COMPONENT_ID = "componentId";
+  public static final String DEPRECATED_PARAM_COMPONENT_KEY = "componentKey";
+  public static final String PARAM_PROJECT_KEYS = "projectKeys";
+  public static final String PARAM_DEVELOPER_ID = "developerId";
+  public static final String PARAM_DEVELOPER_KEY = "developerKey";
+  public static final String PARAM_FROM = "from";
+  public static final String PARAM_TO = "to";
+
+  public static final String ADDITIONAL_METRICS = "metrics";
+  public static final String ADDITIONAL_PERIODS = "periods";
+
+  public static final Set<String> ADDITIONAL_FIELDS = ImmutableSortedSet.of(ADDITIONAL_METRICS, ADDITIONAL_PERIODS);
+
+  private MeasuresWsParameters() {
+    // static constants only
+  }
+}
index f7bd7a58a85c08d84514799bb2e23a1bf4487a9e..842595effb1abce40a118656daecef05c8b05cda 100644 (file)
@@ -49,7 +49,7 @@ import static org.sonar.server.ws.WsUtils.writeProtobuf;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SHOW;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COMPONENT;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
 
 public class ShowAction implements ComponentsWsAction {
   private final UserSession userSession;
index 6a6ac04d04961ee24f433c02af30f8cc85c03c24..3ba26b161ff65ad587f570b54dc047b9524a523b 100644 (file)
@@ -74,7 +74,7 @@ import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COM
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COMPONENT_ID;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_QUALIFIERS;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_STRATEGY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
 
 public class TreeAction implements ComponentsWsAction {
 
index 6136a64d95f2dc3f1f4bdbefb1e7004040fcc383..240a5a69bfce1a1a48c167f0a821d61d01787348 100644 (file)
@@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkArgument;
 import static org.sonar.server.component.ComponentFinder.ParamNames.UUID_AND_KEY;
 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.measure.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
 
 public class ShowAction implements DuplicationsWsAction {
 
index 37fbe9a40f2098777c35b3992638afff97b8bc09..cf035382a7a9ecfffe69e077248396077cbc84f3 100644 (file)
@@ -69,17 +69,17 @@ import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001;
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ACTION_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ADDITIONAL_METRICS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ADDITIONAL_PERIODS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ACTION_COMPONENT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ADDITIONAL_METRICS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ADDITIONAL_PERIODS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_DEVELOPER_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
 
 public class ComponentAction implements MeasuresWsAction {
   private static final Set<String> QUALIFIERS_ELIGIBLE_FOR_BEST_VALUE = ImmutableSortedSet.of(Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE);
index 4a1b94aa3e79a03337bbcd853eb86359d542c757..e66ef82f23d48ce542b4c0b29696c14dfdd87ad3 100644 (file)
@@ -98,22 +98,22 @@ import static org.sonar.server.ws.WsParameterBuilder.createQualifiersParameter;
 import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ACTION_COMPONENT_TREE;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ADDITIONAL_METRICS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ADDITIONAL_PERIODS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_PERIOD_SORT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT_FILTER;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_QUALIFIERS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_STRATEGY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ACTION_COMPONENT_TREE;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ADDITIONAL_METRICS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ADDITIONAL_PERIODS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_KEY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_DEVELOPER_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_PERIOD_SORT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_SORT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_SORT_FILTER;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_QUALIFIERS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_STRATEGY;
 
 /**
  * <p>Navigate through components based on different strategy with specified measures.
@@ -237,7 +237,7 @@ public class ComponentTreeAction implements MeasuresWsAction {
       .setPossibleValues(METRIC_SORT_FILTERS);
 
     createMetricKeysParameter(action)
-      .setDescription("Metric keys. Types %s are not allowed", COMMA_JOINER.join(FORBIDDEN_METRIC_TYPES))
+      .setDescription("Comma-separated list of metric keys. Types %s are not allowed.", COMMA_JOINER.join(FORBIDDEN_METRIC_TYPES))
       .setMaxValuesAllowed(MAX_METRIC_KEYS);
     createAdditionalFieldsParameter(action);
     createDeveloperParameters(action);
index 41d3972c49d57e76d39b5a43854b1ddb9ff2ab53..7bf66a383d6cfb81f65e74336a41815d46cef2ea 100644 (file)
@@ -20,7 +20,7 @@
 package org.sonar.server.measure.ws;
 
 import org.sonar.api.server.ws.WebService;
-import org.sonarqube.ws.client.measure.MeasuresWsParameters;
+import org.sonar.server.component.ws.MeasuresWsParameters;
 
 public class MeasuresWs implements WebService {
   private final MeasuresWsAction[] actions;
index 61877ece378df20931d1084949a5b1cb2d946c0d..48a4804bf5c1a89dee9dcd99e5bf35a555c4c953 100644 (file)
@@ -22,11 +22,11 @@ package org.sonar.server.measure.ws;
 import org.sonar.api.server.ws.WebService.NewAction;
 import org.sonar.api.server.ws.WebService.NewParam;
 
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ADDITIONAL_FIELDS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_DEVELOPER_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
 
 class MeasuresWsParametersBuilder {
 
@@ -43,7 +43,7 @@ class MeasuresWsParametersBuilder {
 
   static NewParam createMetricKeysParameter(NewAction action) {
     return action.createParam(PARAM_METRIC_KEYS)
-      .setDescription("Metric keys")
+      .setDescription("Comma-separated list of metric keys")
       .setRequired(true)
       .setExampleValue("ncloc,complexity,violations");
   }
index bdd6d5b2738adcd0098341e3ff339993dcc39078..2592ebce5af2c43665edde1bd89fddf632e1ff73 100644 (file)
@@ -55,8 +55,8 @@ import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_002;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_PROJECT_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_PROJECT_KEYS;
 
 public class SearchAction implements MeasuresWsAction {
 
index c76decf679247487fdf4e2656c47853cfd65dedd..ceb039191c03d4cc4799b626fed62563a3f16f76 100644 (file)
@@ -56,12 +56,12 @@ import static org.sonar.core.util.Protobuf.setNullable;
 import static org.sonar.db.component.SnapshotDto.STATUS_PROCESSED;
 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.measure.MeasuresWsParameters.ACTION_SEARCH_HISTORY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_FROM;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRICS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_TO;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ACTION_SEARCH_HISTORY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_FROM;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRICS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_TO;
 
 public class SearchHistoryAction implements MeasuresWsAction {
 
index 026a92eb616419390989114773db76cbf284801b..a08abc408b1c54cc7d938f89a3776c5c68622ad7 100644 (file)
@@ -54,12 +54,12 @@ import static org.sonar.db.component.ComponentTesting.newFileDto;
 import static org.sonar.db.component.ComponentTesting.newProjectCopy;
 import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.INT;
 import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_DEVELOPER_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
 
 public class ComponentActionTest {
 
index 8909b85dd04d232cd01a94d6a45b556c80364d7c..6f23473e37e027198f5a9d0c8b472c0b50ec5607 100644 (file)
@@ -79,18 +79,18 @@ import static org.sonar.server.measure.ws.ComponentTreeAction.METRIC_SORT;
 import static org.sonar.server.measure.ws.ComponentTreeAction.NAME_SORT;
 import static org.sonar.server.measure.ws.ComponentTreeAction.WITH_MEASURES_ONLY_METRIC_SORT_FILTER;
 import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ADDITIONAL_PERIODS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_PERIOD_SORT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT_FILTER;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_QUALIFIERS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_STRATEGY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.ADDITIONAL_PERIODS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_ID;
+import static org.sonar.server.component.ws.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_KEY;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_PERIOD_SORT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_SORT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_SORT_FILTER;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_QUALIFIERS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_STRATEGY;
 
 public class ComponentTreeActionTest {
   @Rule
index 0ed7e63c25cf946d4d19e732e2e15c53e52b7688..ecc5d3e8ae1abe9ae4f77d564b56e2a5f43ce031 100644 (file)
@@ -56,8 +56,8 @@ import static org.sonar.db.component.ComponentTesting.newFileDto;
 import static org.sonar.db.component.ComponentTesting.newModuleDto;
 import static org.sonar.db.component.ComponentTesting.newSubView;
 import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_PROJECT_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRIC_KEYS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_PROJECT_KEYS;
 
 public class SearchActionTest {
 
index 1544e8a77b3651a954e92b6be5ad890bc4147d64..56a26b15b4bf3dca5e869a16f2d83e5c914050fd 100644 (file)
@@ -69,11 +69,11 @@ import static org.sonar.db.component.SnapshotTesting.newAnalysis;
 import static org.sonar.db.measure.MeasureTesting.newMeasureDto;
 import static org.sonar.db.metric.MetricTesting.newMetricDto;
 import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_FROM;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRICS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_TO;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_BRANCH;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_FROM;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_METRICS;
+import static org.sonar.server.component.ws.MeasuresWsParameters.PARAM_TO;
 
 public class SearchHistoryActionTest {
 
index 4c6a0e9449e2a6cd4f069ce783a80d394c3dad4b..46e07dbb8045a6a54dc83c32cdf371bfea18622f 100644 (file)
@@ -52,7 +52,7 @@ public abstract class BaseService {
     return wsConnector.call(request).failIfNotSuccessful();
   }
 
-  public <T extends Message> T convert(WsResponse response, Parser<T> parser) {
+  public static <T extends Message> T convert(WsResponse response, Parser<T> parser) {
     try (InputStream byteStream = response.contentStream()) {
       byte[] bytes = IOUtils.toByteArray(byteStream);
       // HTTP header "Content-Type" is not verified. It may be different than protobuf.
index 27d06ffac667974515d409f37425e9b61633d4c7..71d261c2718e8bc6ceadf34ee77509ff6a152841 100644 (file)
@@ -63,7 +63,6 @@ class DefaultWsClient implements WsClient {
   private final UserGroupsService userGroupsService;
   private final UserTokensService userTokensService;
   private final QualitygatesService qualityGatesService;
-  private final org.sonarqube.ws.client.measure.MeasuresService measuresOld;
   private final MeasuresService measures;
   private final SystemService systemService;
   private final CeService ceService;
@@ -90,7 +89,6 @@ class DefaultWsClient implements WsClient {
     this.userGroupsService = new UserGroupsService(wsConnector);
     this.userTokensService = new UserTokensService(wsConnector);
     this.qualityGatesService = new QualitygatesService(wsConnector);
-    this.measuresOld = new org.sonarqube.ws.client.measure.MeasuresService(wsConnector);
     this.measures = new MeasuresService(wsConnector);
     this.systemService = new SystemService(wsConnector);
     this.ceService = new CeService(wsConnector);
@@ -165,11 +163,6 @@ class DefaultWsClient implements WsClient {
     return qualityGatesService;
   }
 
-  @Override
-  public org.sonarqube.ws.client.measure.MeasuresService measuresOld() {
-    return measuresOld;
-  }
-
   @Override
   public MeasuresService measures() {
     return measures;
index 1de94f492e40c0f340a269014433df4b5adb8e79..75ac3a18e1c68a4767d5fbb796478120d305beed 100644 (file)
@@ -91,12 +91,6 @@ public interface WsClient {
 
   QualitygatesService qualityGates();
 
-  /**
-   * @deprecated since 7.0 use {@link #measures()} instead
-   */
-  @Deprecated
-  org.sonarqube.ws.client.measure.MeasuresService measuresOld();
-
   MeasuresService measures();
 
   SystemService system();
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentRequest.java
deleted file mode 100644 (file)
index 4eb5bbc..0000000
+++ /dev/null
@@ -1,130 +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.measure;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class ComponentRequest {
-  private String componentId;
-  private String componentKey;
-  private String component;
-  private String branch;
-  private List<String> metricKeys;
-  private List<String> additionalFields;
-  private String developerId;
-  private String developerKey;
-
-  /**
-   * @deprecated since 6.6, please use {@link #getComponent()} instead
-   */
-  @Deprecated
-  @CheckForNull
-  public String getComponentId() {
-    return componentId;
-  }
-
-  /**
-   * @deprecated since 6.6, please use {@link #setComponent(String)} instead
-   */
-  @Deprecated
-  public ComponentRequest setComponentId(@Nullable String componentId) {
-    this.componentId = componentId;
-    return this;
-  }
-
-  /**
-   * @deprecated since 6.6, please use {@link #getComponent()} instead
-   */
-  @Deprecated
-  @CheckForNull
-  public String getComponentKey() {
-    return componentKey;
-  }
-
-  /**
-   * @deprecated since 6.6, please use {@link #setComponent(String)} instead
-   */
-  @Deprecated
-  public ComponentRequest setComponentKey(@Nullable String componentKey) {
-    this.componentKey = componentKey;
-    return this;
-  }
-
-  @CheckForNull
-  public String getComponent() {
-    return component;
-  }
-
-  public ComponentRequest setComponent(@Nullable String component) {
-    this.component = component;
-    return this;
-  }
-
-  @CheckForNull
-  public String getBranch() {
-    return branch;
-  }
-
-  public ComponentRequest setBranch(@Nullable String branch) {
-    this.branch = branch;
-    return this;
-  }
-
-  public List<String> getMetricKeys() {
-    return metricKeys;
-  }
-
-  public ComponentRequest setMetricKeys(@Nullable List<String> metricKeys) {
-    this.metricKeys = metricKeys;
-    return this;
-  }
-
-  @CheckForNull
-  public List<String> getAdditionalFields() {
-    return additionalFields;
-  }
-
-  public ComponentRequest setAdditionalFields(@Nullable List<String> additionalFields) {
-    this.additionalFields = additionalFields;
-    return this;
-  }
-
-  @CheckForNull
-  public String getDeveloperId() {
-    return developerId;
-  }
-
-  public ComponentRequest setDeveloperId(@Nullable String developerId) {
-    this.developerId = developerId;
-    return this;
-  }
-
-  @CheckForNull
-  public String getDeveloperKey() {
-    return developerKey;
-  }
-
-  public ComponentRequest setDeveloperKey(@Nullable String developerKey) {
-    this.developerKey = developerKey;
-    return this;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeRequest.java
deleted file mode 100644 (file)
index fa6bb47..0000000
+++ /dev/null
@@ -1,242 +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.measure;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class ComponentTreeRequest {
-
-  private String baseComponentId;
-  private String baseComponentKey;
-  private String component;
-  private String branch;
-  private String strategy;
-  private List<String> qualifiers;
-  private List<String> additionalFields;
-  private String query;
-  private List<String> sort;
-  private Boolean asc;
-  private String metricSort;
-  private Integer metricPeriodSort;
-  private String metricSortFilter;
-  private List<String> metricKeys;
-  private Integer page;
-  private Integer pageSize;
-  private String developerId;
-  private String developerKey;
-
-  /**
-   * @deprecated since 6.6, please use {@link #getComponent()} instead
-   */
-  @Deprecated
-  @CheckForNull
-  public String getBaseComponentId() {
-    return baseComponentId;
-  }
-
-  /**
-   * @deprecated since 6.6, please use {@link #setComponent(String)} instead
-   */
-  @Deprecated
-  public ComponentTreeRequest setBaseComponentId(@Nullable String baseComponentId) {
-    this.baseComponentId = baseComponentId;
-    return this;
-  }
-
-  /**
-   * @deprecated since 6.6, please use {@link #getComponent()} instead
-   */
-  @Deprecated
-  @CheckForNull
-  public String getBaseComponentKey() {
-    return baseComponentKey;
-  }
-
-  /**
-   * @deprecated since 6.6, please use {@link #setComponent(String)} instead
-   */
-  @Deprecated
-  public ComponentTreeRequest setBaseComponentKey(@Nullable String baseComponentKey) {
-    this.baseComponentKey = baseComponentKey;
-    return this;
-  }
-
-  @CheckForNull
-  public String getComponent() {
-    return component;
-  }
-
-  public ComponentTreeRequest setComponent(@Nullable String component) {
-    this.component = component;
-    return this;
-  }
-
-  @CheckForNull
-  public String getBranch() {
-    return branch;
-  }
-
-  public ComponentTreeRequest setBranch(@Nullable String branch) {
-    this.branch = branch;
-    return this;
-  }
-
-  @CheckForNull
-  public String getStrategy() {
-    return strategy;
-  }
-
-  public ComponentTreeRequest setStrategy(String strategy) {
-    this.strategy = strategy;
-    return this;
-  }
-
-  @CheckForNull
-  public List<String> getQualifiers() {
-    return qualifiers;
-  }
-
-  public ComponentTreeRequest setQualifiers(@Nullable List<String> qualifiers) {
-    this.qualifiers = qualifiers;
-    return this;
-  }
-
-  @CheckForNull
-  public List<String> getAdditionalFields() {
-    return additionalFields;
-  }
-
-  public ComponentTreeRequest setAdditionalFields(@Nullable List<String> additionalFields) {
-    this.additionalFields = additionalFields;
-    return this;
-  }
-
-  @CheckForNull
-  public String getQuery() {
-    return query;
-  }
-
-  public ComponentTreeRequest setQuery(@Nullable String query) {
-    this.query = query;
-    return this;
-  }
-
-  @CheckForNull
-  public List<String> getSort() {
-    return sort;
-  }
-
-  public ComponentTreeRequest setSort(@Nullable List<String> sort) {
-    this.sort = sort;
-    return this;
-  }
-
-  @CheckForNull
-  public String getMetricSort() {
-    return metricSort;
-  }
-
-  public ComponentTreeRequest setMetricSort(@Nullable String metricSort) {
-    this.metricSort = metricSort;
-    return this;
-  }
-
-  @CheckForNull
-  public String getMetricSortFilter() {
-    return metricSortFilter;
-  }
-
-  public ComponentTreeRequest setMetricSortFilter(@Nullable String metricSortFilter) {
-    this.metricSortFilter = metricSortFilter;
-    return this;
-  }
-
-  @CheckForNull
-  public List<String> getMetricKeys() {
-    return metricKeys;
-  }
-
-  public ComponentTreeRequest setMetricKeys(List<String> metricKeys) {
-    this.metricKeys = metricKeys;
-    return this;
-  }
-
-  @CheckForNull
-  public Boolean getAsc() {
-    return asc;
-  }
-
-  public ComponentTreeRequest setAsc(@Nullable Boolean asc) {
-    this.asc = asc;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPage() {
-    return page;
-  }
-
-  public ComponentTreeRequest setPage(int page) {
-    this.page = page;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPageSize() {
-    return pageSize;
-  }
-
-  public ComponentTreeRequest setPageSize(int pageSize) {
-    this.pageSize = pageSize;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getMetricPeriodSort() {
-    return metricPeriodSort;
-  }
-
-  public ComponentTreeRequest setMetricPeriodSort(@Nullable Integer metricPeriodSort) {
-    this.metricPeriodSort = metricPeriodSort;
-    return this;
-  }
-
-  @CheckForNull
-  public String getDeveloperId() {
-    return developerId;
-  }
-
-  public ComponentTreeRequest setDeveloperId(@Nullable String developerId) {
-    this.developerId = developerId;
-    return this;
-  }
-
-  @CheckForNull
-  public String getDeveloperKey() {
-    return developerKey;
-  }
-
-  public ComponentTreeRequest setDeveloperKey(@Nullable String developerKey) {
-    this.developerKey = developerKey;
-    return this;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java
deleted file mode 100644 (file)
index e68608e..0000000
+++ /dev/null
@@ -1,119 +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.measure;
-
-import org.sonar.api.server.ws.WebService.Param;
-import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
-import org.sonarqube.ws.Measures.ComponentWsResponse;
-import org.sonarqube.ws.Measures.SearchHistoryResponse;
-import org.sonarqube.ws.Measures.SearchWsResponse;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ACTION_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ACTION_COMPONENT_TREE;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ACTION_SEARCH_HISTORY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.CONTROLLER_MEASURES;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_FROM;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRICS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT_FILTER;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_PROJECT_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_QUALIFIERS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_STRATEGY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_TO;
-
-/**
- * @deprecated since 7.0, use {@link org.sonarqube.ws.client.measures.MeasuresService} instead
- */
-@Deprecated
-public class MeasuresService extends BaseService {
-  public MeasuresService(WsConnector wsConnector) {
-    super(wsConnector, CONTROLLER_MEASURES);
-  }
-
-  public ComponentTreeWsResponse componentTree(ComponentTreeRequest request) {
-    GetRequest getRequest = new GetRequest(path(ACTION_COMPONENT_TREE))
-      .setParam(DEPRECATED_PARAM_BASE_COMPONENT_ID, request.getBaseComponentId())
-      .setParam(DEPRECATED_PARAM_BASE_COMPONENT_KEY, request.getBaseComponentKey())
-      .setParam(PARAM_COMPONENT, request.getComponent())
-      .setParam(PARAM_BRANCH, request.getBranch())
-      .setParam(PARAM_STRATEGY, request.getStrategy())
-      .setParam(PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers()))
-      .setParam(PARAM_METRIC_KEYS, inlineMultipleParamValue(request.getMetricKeys()))
-      .setParam(PARAM_ADDITIONAL_FIELDS, inlineMultipleParamValue(request.getAdditionalFields()))
-      .setParam(PARAM_DEVELOPER_ID, request.getDeveloperId())
-      .setParam(PARAM_DEVELOPER_KEY, request.getDeveloperKey())
-      .setParam("q", request.getQuery())
-      .setParam("p", request.getPage())
-      .setParam("ps", request.getPageSize())
-      .setParam("s", inlineMultipleParamValue(request.getSort()))
-      .setParam("asc", request.getAsc())
-      .setParam(PARAM_METRIC_SORT, request.getMetricSort())
-      .setParam(PARAM_METRIC_SORT_FILTER, request.getMetricSortFilter());
-
-    return call(getRequest, ComponentTreeWsResponse.parser());
-  }
-
-  public ComponentWsResponse component(ComponentRequest request) {
-    GetRequest getRequest = new GetRequest(path(ACTION_COMPONENT))
-      .setParam(DEPRECATED_PARAM_COMPONENT_ID, request.getComponentId())
-      .setParam(DEPRECATED_PARAM_COMPONENT_KEY, request.getComponentKey())
-      .setParam(PARAM_COMPONENT, request.getComponent())
-      .setParam(PARAM_BRANCH, request.getBranch())
-      .setParam(PARAM_ADDITIONAL_FIELDS, inlineMultipleParamValue(request.getAdditionalFields()))
-      .setParam(PARAM_METRIC_KEYS, inlineMultipleParamValue(request.getMetricKeys()))
-      .setParam(PARAM_DEVELOPER_ID, request.getDeveloperId())
-      .setParam(PARAM_DEVELOPER_KEY, request.getDeveloperKey());
-
-    return call(getRequest, ComponentWsResponse.parser());
-  }
-
-  public SearchHistoryResponse searchHistory(SearchHistoryRequest request) {
-    GetRequest getRequest = new GetRequest(path(ACTION_SEARCH_HISTORY))
-      .setParam(PARAM_COMPONENT, request.getComponent())
-      .setParam(PARAM_BRANCH, request.getBranch())
-      .setParam(PARAM_METRICS, inlineMultipleParamValue(request.getMetrics()))
-      .setParam(PARAM_FROM, request.getFrom())
-      .setParam(PARAM_TO, request.getTo())
-      .setParam(Param.PAGE, request.getPage())
-      .setParam(Param.PAGE_SIZE, request.getPageSize());
-
-    return call(getRequest, SearchHistoryResponse.parser());
-  }
-
-  public SearchWsResponse search(SearchRequest request) {
-    GetRequest getRequest = new GetRequest(path(ACTION_SEARCH_HISTORY))
-      .setParam(PARAM_PROJECT_KEYS, inlineMultipleParamValue(request.getProjectKeys()))
-      .setParam(PARAM_METRIC_KEYS, inlineMultipleParamValue(request.getMetricKeys()));
-    return call(getRequest, SearchWsResponse.parser());
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java
deleted file mode 100644 (file)
index 519ec10..0000000
+++ /dev/null
@@ -1,62 +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.measure;
-
-import com.google.common.collect.ImmutableSortedSet;
-import java.util.Set;
-
-public class MeasuresWsParameters {
-  public static final String CONTROLLER_MEASURES = "api/measures";
-
-  // actions
-  public static final String ACTION_COMPONENT_TREE = "component_tree";
-  public static final String ACTION_COMPONENT = "component";
-  public static final String ACTION_SEARCH_HISTORY = "search_history";
-
-  // parameters
-  public static final String DEPRECATED_PARAM_BASE_COMPONENT_ID = "baseComponentId";
-  public static final String DEPRECATED_PARAM_BASE_COMPONENT_KEY = "baseComponentKey";
-  public static final String PARAM_COMPONENT = "component";
-  public static final String PARAM_BRANCH = "branch";
-  public static final String PARAM_STRATEGY = "strategy";
-  public static final String PARAM_QUALIFIERS = "qualifiers";
-  public static final String PARAM_METRICS = "metrics";
-  public static final String PARAM_METRIC_KEYS = "metricKeys";
-  public static final String PARAM_METRIC_SORT = "metricSort";
-  public static final String PARAM_METRIC_PERIOD_SORT = "metricPeriodSort";
-  public static final String PARAM_METRIC_SORT_FILTER = "metricSortFilter";
-  public static final String PARAM_ADDITIONAL_FIELDS = "additionalFields";
-  public static final String DEPRECATED_PARAM_COMPONENT_ID = "componentId";
-  public static final String DEPRECATED_PARAM_COMPONENT_KEY = "componentKey";
-  public static final String PARAM_PROJECT_KEYS = "projectKeys";
-  public static final String PARAM_DEVELOPER_ID = "developerId";
-  public static final String PARAM_DEVELOPER_KEY = "developerKey";
-  public static final String PARAM_FROM = "from";
-  public static final String PARAM_TO = "to";
-
-  public static final String ADDITIONAL_METRICS = "metrics";
-  public static final String ADDITIONAL_PERIODS = "periods";
-
-  public static final Set<String> ADDITIONAL_FIELDS = ImmutableSortedSet.of(ADDITIONAL_METRICS, ADDITIONAL_PERIODS);
-
-  private MeasuresWsParameters() {
-    // static constants only
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchHistoryRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchHistoryRequest.java
deleted file mode 100644 (file)
index b99b9b7..0000000
+++ /dev/null
@@ -1,147 +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.measure;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static java.lang.String.format;
-
-public class SearchHistoryRequest {
-  public static final int MAX_PAGE_SIZE = 1_000;
-  public static final int DEFAULT_PAGE_SIZE = 100;
-
-  private final String component;
-  private final String branch;
-  private final List<String> metrics;
-  private final String from;
-  private final String to;
-  private final int page;
-  private final int pageSize;
-
-  public SearchHistoryRequest(Builder builder) {
-    this.component = builder.component;
-    this.branch = builder.branch;
-    this.metrics = builder.metrics;
-    this.from = builder.from;
-    this.to = builder.to;
-    this.page = builder.page;
-    this.pageSize = builder.pageSize;
-  }
-
-  public String getComponent() {
-    return component;
-  }
-
-  @CheckForNull
-  public String getBranch() {
-    return branch;
-  }
-
-  public List<String> getMetrics() {
-    return metrics;
-  }
-
-  @CheckForNull
-  public String getFrom() {
-    return from;
-  }
-
-  @CheckForNull
-  public String getTo() {
-    return to;
-  }
-
-  public int getPage() {
-    return page;
-  }
-
-  public int getPageSize() {
-    return pageSize;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String component;
-    private String branch;
-    private List<String> metrics;
-    private String from;
-    private String to;
-    private int page = 1;
-    private int pageSize = DEFAULT_PAGE_SIZE;
-
-    private Builder() {
-      // enforce build factory method
-    }
-
-    public Builder setComponent(String component) {
-      this.component = component;
-      return this;
-    }
-
-    public Builder setBranch(@Nullable String branch) {
-      this.branch = branch;
-      return this;
-    }
-
-    public Builder setMetrics(List<String> metrics) {
-      this.metrics = metrics;
-      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 Builder setPage(int page) {
-      this.page = page;
-      return this;
-    }
-
-    public Builder setPageSize(int pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public SearchHistoryRequest build() {
-      checkArgument(component != null && !component.isEmpty(), "Component key is required");
-      checkArgument(metrics != null && !metrics.isEmpty(), "Metric keys are required");
-      checkArgument(pageSize <= MAX_PAGE_SIZE, "Page size (%d) must be lower than or equal to %d", pageSize, MAX_PAGE_SIZE);
-
-      return new SearchHistoryRequest(this);
-    }
-
-    private static void checkArgument(boolean condition, String message, Object... args) {
-      if (!condition) {
-        throw new IllegalArgumentException(format(message, args));
-      }
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchRequest.java
deleted file mode 100644 (file)
index 5c8cc2b..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.measure;
-
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-public class SearchRequest {
-  private static final int MAX_NB_PROJECTS = 100;
-
-  private final List<String> metricKeys;
-  private final List<String> projectKeys;
-
-  public SearchRequest(Builder builder) {
-    metricKeys = builder.metricKeys;
-    projectKeys = builder.projectKeys;
-  }
-
-  public List<String> getMetricKeys() {
-    return metricKeys;
-  }
-
-  public List<String> getProjectKeys() {
-    return projectKeys;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private List<String> metricKeys;
-    private List<String> projectKeys;
-
-    private Builder() {
-      // enforce method constructor
-    }
-
-    public Builder setMetricKeys(List<String> metricKeys) {
-      this.metricKeys = metricKeys;
-      return this;
-    }
-
-    public Builder setProjectKeys(List<String> projectKeys) {
-      this.projectKeys = projectKeys;
-      return this;
-    }
-
-    public SearchRequest build() {
-      checkArgument(metricKeys != null && !metricKeys.isEmpty(), "Metric keys must be provided");
-      checkArgument(projectKeys != null && !projectKeys.isEmpty(), "Project keys must be provided");
-      int nbComponents = projectKeys.size();
-      checkArgument(nbComponents <= MAX_NB_PROJECTS,
-        "%s projects provided, more than maximum authorized (%s)", nbComponents, MAX_NB_PROJECTS);
-      return new SearchRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/package-info.java
deleted file mode 100644 (file)
index f4cc706..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.measure;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
index eea21c7966ce08ff4b62aa6f86b3abfcf6638b1f..8611025b45218d9c0ca7414fbccbb140dd6ece16 100644 (file)
@@ -37,7 +37,7 @@ public class ComponentRequest {
   private String componentId;
   private String developerId;
   private String developerKey;
-  private String metricKeys;
+  private List<String> metricKeys;
 
   /**
    * Example value: "periods,metrics"
@@ -125,12 +125,12 @@ public class ComponentRequest {
    * This is a mandatory parameter.
    * Example value: "ncloc,complexity,violations"
    */
-  public ComponentRequest setMetricKeys(String metricKeys) {
+  public ComponentRequest setMetricKeys(List<String> metricKeys) {
     this.metricKeys = metricKeys;
     return this;
   }
 
-  public String getMetricKeys() {
+  public List<String> getMetricKeys() {
     return metricKeys;
   }
 }
index c63da756229e363c4009e6b860d8e4f8ea0219f5..a7373c34f450755e1bd4c67bfcc8c4ad5ad834c4 100644 (file)
@@ -38,7 +38,7 @@ public class ComponentTreeRequest {
   private String component;
   private String developerId;
   private String developerKey;
-  private String metricKeys;
+  private List<String> metricKeys;
   private String metricPeriodSort;
   private String metricSort;
   private String metricSortFilter;
@@ -153,12 +153,12 @@ public class ComponentTreeRequest {
    * This is a mandatory parameter.
    * Example value: "ncloc,complexity,violations"
    */
-  public ComponentTreeRequest setMetricKeys(String metricKeys) {
+  public ComponentTreeRequest setMetricKeys(List<String> metricKeys) {
     this.metricKeys = metricKeys;
     return this;
   }
 
-  public String getMetricKeys() {
+  public List<String> getMetricKeys() {
     return metricKeys;
   }
 
index 7422d8aae2d152e2c4df8087defb1617c9e17ebd..bbea8ca23d90c8f49b1127249effd7d9d3babbd2 100644 (file)
@@ -57,7 +57,7 @@ public class MeasuresService extends BaseService {
         .setParam("componentId", request.getComponentId())
         .setParam("developerId", request.getDeveloperId())
         .setParam("developerKey", request.getDeveloperKey())
-        .setParam("metricKeys", request.getMetricKeys()),
+        .setParam("metricKeys", request.getMetricKeys() == null ? null : request.getMetricKeys().stream().collect(Collectors.joining(","))),
       ComponentWsResponse.parser());
   }
 
@@ -78,7 +78,7 @@ public class MeasuresService extends BaseService {
         .setParam("component", request.getComponent())
         .setParam("developerId", request.getDeveloperId())
         .setParam("developerKey", request.getDeveloperKey())
-        .setParam("metricKeys", request.getMetricKeys())
+        .setParam("metricKeys", request.getMetricKeys() == null ? null : request.getMetricKeys().stream().collect(Collectors.joining(",")))
         .setParam("metricPeriodSort", request.getMetricPeriodSort())
         .setParam("metricSort", request.getMetricSort())
         .setParam("metricSortFilter", request.getMetricSortFilter())
@@ -101,7 +101,7 @@ public class MeasuresService extends BaseService {
   public SearchWsResponse search(SearchRequest request) {
     return call(
       new GetRequest(path("search"))
-        .setParam("metricKeys", request.getMetricKeys())
+        .setParam("metricKeys", request.getMetricKeys() == null ? null : request.getMetricKeys().stream().collect(Collectors.joining(",")))
         .setParam("projectKeys", request.getProjectKeys() == null ? null : request.getProjectKeys().stream().collect(Collectors.joining(","))),
       SearchWsResponse.parser());
   }
index bd7614fb216da63dc77f040cae3ebc2a035cf8de..422c6ffa977a5916d5c902acc7bf94c4e5b3c93c 100644 (file)
@@ -31,19 +31,19 @@ import javax.annotation.Generated;
 @Generated("sonar-ws-generator")
 public class SearchRequest {
 
-  private String metricKeys;
+  private List<String> metricKeys;
   private List<String> projectKeys;
 
   /**
    * This is a mandatory parameter.
    * Example value: "ncloc,complexity,violations"
    */
-  public SearchRequest setMetricKeys(String metricKeys) {
+  public SearchRequest setMetricKeys(List<String> metricKeys) {
     this.metricKeys = metricKeys;
     return this;
   }
 
-  public String getMetricKeys() {
+  public List<String> getMetricKeys() {
     return metricKeys;
   }
 
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java
deleted file mode 100644 (file)
index cfdc00f..0000000
+++ /dev/null
@@ -1,200 +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.measure;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.Measures;
-import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
-import org.sonarqube.ws.Measures.ComponentWsResponse;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static java.util.Arrays.asList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_BASE_COMPONENT_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_FROM;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRICS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT_FILTER;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_PROJECT_KEYS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_QUALIFIERS;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_STRATEGY;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_TO;
-
-public class MeasuresServiceTest {
-  private static final String VALUE_BASE_COMPONENT_ID = "base-component-id";
-  private static final String VALUE_BASE_COMPONENT_KEY = "base-component-key";
-  private static final String VALUE_COMPONENT = "component-key";
-  private static final List<String> VALUE_METRIC_KEYS = newArrayList("ncloc", "complexity");
-  private static final List<String> VALUE_METRICS = newArrayList("ncloc", "complexity");
-  private static final String VALUE_STRATEGY = "all";
-  private static final List<String> VALUE_QUALIFIERS = newArrayList("FIL", "PRJ");
-  private static final ArrayList<String> VALUE_ADDITIONAL_FIELDS = newArrayList("metrics");
-  private static final List<String> VALUE_SORT = newArrayList("qualifier", "metric");
-  private static final boolean VALUE_ASC = false;
-  private static final String VALUE_METRIC_SORT = "ncloc";
-  private static final String VALUE_METRIC_SORT_FILTER = "all";
-  private static final int VALUE_PAGE = 42;
-  private static final int VALUE_PAGE_SIZE = 1000;
-  private static final String VALUE_QUERY = "query-sq";
-  private static final String VALUE_DEVELOPER_ID = "developer-id";
-  private static final String VALUE_DEVELOPER_KEY = "developer-key";
-  private static final String VALUE_FROM = "2017-10-01";
-  private static final String VALUE_TO = "2017-11-01";
-
-  @Rule
-  public ServiceTester<MeasuresService> serviceTester = new ServiceTester<>(new MeasuresService(mock(WsConnector.class)));
-
-  private MeasuresService underTest = serviceTester.getInstanceUnderTest();
-
-  @Test
-  public void component() {
-    ComponentRequest request = new ComponentRequest()
-      .setComponentId(VALUE_BASE_COMPONENT_ID)
-      .setComponentKey(VALUE_BASE_COMPONENT_KEY)
-      .setComponent(VALUE_BASE_COMPONENT_KEY)
-      .setBranch("my_branch")
-      .setMetricKeys(VALUE_METRIC_KEYS)
-      .setAdditionalFields(VALUE_ADDITIONAL_FIELDS)
-      .setMetricKeys(VALUE_METRICS)
-      .setDeveloperId(VALUE_DEVELOPER_ID)
-      .setDeveloperKey(VALUE_DEVELOPER_KEY);
-
-    underTest.component(request);
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(ComponentWsResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam(DEPRECATED_PARAM_COMPONENT_ID, VALUE_BASE_COMPONENT_ID)
-      .hasParam(DEPRECATED_PARAM_COMPONENT_KEY, VALUE_BASE_COMPONENT_KEY)
-      .hasParam(PARAM_COMPONENT, VALUE_BASE_COMPONENT_KEY)
-      .hasParam(PARAM_BRANCH, "my_branch")
-      .hasParam(PARAM_METRIC_KEYS, "ncloc,complexity")
-      .hasParam(PARAM_ADDITIONAL_FIELDS, "metrics")
-      .hasParam(PARAM_DEVELOPER_ID, VALUE_DEVELOPER_ID)
-      .hasParam(PARAM_DEVELOPER_KEY, VALUE_DEVELOPER_KEY)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void component_tree() {
-    ComponentTreeRequest componentTreeRequest = new ComponentTreeRequest()
-      .setBaseComponentId(VALUE_BASE_COMPONENT_ID)
-      .setBaseComponentKey(VALUE_BASE_COMPONENT_KEY)
-      .setComponent(VALUE_BASE_COMPONENT_KEY)
-      .setBranch("my_branch")
-      .setMetricKeys(VALUE_METRIC_KEYS)
-      .setStrategy(VALUE_STRATEGY)
-      .setQualifiers(VALUE_QUALIFIERS)
-      .setAdditionalFields(VALUE_ADDITIONAL_FIELDS)
-      .setSort(VALUE_SORT)
-      .setAsc(VALUE_ASC)
-      .setMetricSort(VALUE_METRIC_SORT)
-      .setPage(VALUE_PAGE)
-      .setPageSize(VALUE_PAGE_SIZE)
-      .setQuery(VALUE_QUERY)
-      .setDeveloperId(VALUE_DEVELOPER_ID)
-      .setDeveloperKey(VALUE_DEVELOPER_KEY)
-      .setMetricSortFilter(VALUE_METRIC_SORT_FILTER);
-
-    underTest.componentTree(componentTreeRequest);
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(ComponentTreeWsResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam(DEPRECATED_PARAM_BASE_COMPONENT_ID, VALUE_BASE_COMPONENT_ID)
-      .hasParam(DEPRECATED_PARAM_BASE_COMPONENT_KEY, VALUE_BASE_COMPONENT_KEY)
-      .hasParam(PARAM_COMPONENT, VALUE_BASE_COMPONENT_KEY)
-      .hasParam(PARAM_BRANCH, "my_branch")
-      .hasParam(PARAM_METRIC_KEYS, "ncloc,complexity")
-      .hasParam(PARAM_STRATEGY, VALUE_STRATEGY)
-      .hasParam(PARAM_QUALIFIERS, "FIL,PRJ")
-      .hasParam(PARAM_ADDITIONAL_FIELDS, "metrics")
-      .hasParam("s", "qualifier,metric")
-      .hasParam("asc", VALUE_ASC)
-      .hasParam(PARAM_METRIC_SORT, VALUE_METRIC_SORT)
-      .hasParam("p", VALUE_PAGE)
-      .hasParam("ps", VALUE_PAGE_SIZE)
-      .hasParam("q", VALUE_QUERY)
-      .hasParam(PARAM_DEVELOPER_ID, VALUE_DEVELOPER_ID)
-      .hasParam(PARAM_DEVELOPER_KEY, VALUE_DEVELOPER_KEY)
-      .hasParam(PARAM_METRIC_SORT_FILTER, VALUE_METRIC_SORT_FILTER)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void search_history() {
-    SearchHistoryRequest request = SearchHistoryRequest.builder()
-      .setComponent(VALUE_COMPONENT)
-      .setBranch("my_branch")
-      .setMetrics(VALUE_METRICS)
-      .setFrom(VALUE_FROM)
-      .setTo(VALUE_TO)
-      .setPage(VALUE_PAGE)
-      .setPageSize(VALUE_PAGE_SIZE)
-      .build();
-
-    underTest.searchHistory(request);
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Measures.SearchHistoryResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam(PARAM_COMPONENT, VALUE_COMPONENT)
-      .hasParam(PARAM_BRANCH, "my_branch")
-      .hasParam(PARAM_METRICS, "ncloc,complexity")
-      .hasParam(PARAM_FROM, VALUE_FROM)
-      .hasParam(PARAM_TO, VALUE_TO)
-      .hasParam("p", VALUE_PAGE)
-      .hasParam("ps", VALUE_PAGE_SIZE)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void search() {
-    SearchRequest request = SearchRequest.builder()
-      .setProjectKeys(asList("P1", "P2"))
-      .setMetricKeys(asList("ncloc", "complexity"))
-      .build();
-
-    underTest.search(request);
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Measures.SearchWsResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam(PARAM_PROJECT_KEYS, "P1,P2")
-      .hasParam(PARAM_METRIC_KEYS, "ncloc,complexity")
-      .andNoOtherParam();
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchHistoryRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchHistoryRequestTest.java
deleted file mode 100644 (file)
index 85a9dab..0000000
+++ /dev/null
@@ -1,103 +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.measure;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static java.util.Collections.emptyList;
-import static java.util.Collections.singletonList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonarqube.ws.client.measure.SearchHistoryRequest.DEFAULT_PAGE_SIZE;
-import static org.sonarqube.ws.client.measure.SearchHistoryRequest.MAX_PAGE_SIZE;
-
-public class SearchHistoryRequestTest {
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  private SearchHistoryRequest.Builder underTest = SearchHistoryRequest.builder();
-
-  @Test
-  public void full_example() {
-    SearchHistoryRequest result = underTest
-      .setComponent("C1")
-      .setBranch("my_branch")
-      .setMetrics(singletonList("new_lines"))
-      .setFrom("2017-01-15")
-      .setTo("2017-01-20")
-      .setPage(23)
-      .setPageSize(42)
-      .build();
-
-    assertThat(result)
-      .extracting(SearchHistoryRequest::getComponent, SearchHistoryRequest::getBranch, SearchHistoryRequest::getMetrics, SearchHistoryRequest::getFrom, SearchHistoryRequest::getTo,
-        SearchHistoryRequest::getPage, SearchHistoryRequest::getPageSize)
-      .containsExactly("C1", "my_branch", singletonList("new_lines"), "2017-01-15", "2017-01-20", 23, 42);
-  }
-
-  @Test
-  public void default_values() {
-    SearchHistoryRequest result = underTest.setComponent("C1").setMetrics(singletonList("new_lines")).build();
-
-    assertThat(result.getPage()).isEqualTo(1);
-    assertThat(result.getPageSize()).isEqualTo(DEFAULT_PAGE_SIZE);
-  }
-
-  @Test
-  public void fail_if_no_component() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Component key is required");
-
-    underTest.setMetrics(singletonList("new_lines")).build();
-  }
-
-  @Test
-  public void fail_if_empty_component() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Component key is required");
-
-    underTest.setComponent("").setMetrics(singletonList("new_lines")).build();
-  }
-
-  @Test
-  public void fail_if_no_metric() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Metric keys are required");
-
-    underTest.setComponent("C1").build();
-  }
-
-  @Test
-  public void fail_if_empty_metrics() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Metric keys are required");
-
-    underTest.setComponent("C1").setMetrics(emptyList()).build();
-  }
-
-  @Test
-  public void fail_if_page_size_greater_than_max_authorized_size() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Page size (1001) must be lower than or equal to 1000");
-
-    underTest.setComponent("C1").setMetrics(singletonList("violations")).setPageSize(MAX_PAGE_SIZE + 1).build();
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchRequestTest.java
deleted file mode 100644 (file)
index 90c36dc..0000000
+++ /dev/null
@@ -1,111 +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.measure;
-
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static java.util.Collections.emptyList;
-import static java.util.Collections.singletonList;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SearchRequestTest {
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  SearchRequest.Builder underTest = SearchRequest.builder();
-
-  @Test
-  public void create_request() {
-    SearchRequest result = underTest
-      .setMetricKeys(singletonList("metric"))
-      .setProjectKeys(singletonList("key"))
-      .build();
-
-    assertThat(result.getMetricKeys()).containsExactly("metric");
-    assertThat(result.getProjectKeys()).containsExactly("key");
-  }
-
-  @Test
-  public void create_request_with_100_keys() {
-    SearchRequest result = underTest
-      .setMetricKeys(singletonList("metric"))
-      .setProjectKeys(IntStream.rangeClosed(1, 100).mapToObj(Integer::toString).collect(Collectors.toList()))
-      .build();
-
-    assertThat(result.getProjectKeys()).hasSize(100);
-  }
-
-  @Test
-  public void fail_when_non_null_metric_keys() {
-    expectExceptionOnMetricKeys();
-
-    underTest.setMetricKeys(null).build();
-  }
-
-  @Test
-  public void fail_when_non_empty_metric_keys() {
-    expectExceptionOnMetricKeys();
-
-    underTest.setMetricKeys(emptyList()).build();
-  }
-
-  @Test
-  public void fail_when_unset_metric_keys() {
-    expectExceptionOnMetricKeys();
-
-    underTest.build();
-  }
-
-  @Test
-  public void fail_when_component_keys_is_empty() {
-    expectExceptionOnComponents();
-
-    underTest
-      .setMetricKeys(singletonList("metric"))
-      .setProjectKeys(emptyList())
-      .build();
-  }
-
-  @Test
-  public void fail_when_component_keys_contains_more_than_100_keys() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("101 projects provided, more than maximum authorized (100)");
-
-    underTest
-      .setMetricKeys(singletonList("metric"))
-      .setProjectKeys(IntStream.rangeClosed(1, 101).mapToObj(Integer::toString).collect(Collectors.toList()))
-      .build();
-  }
-
-  private void expectExceptionOnMetricKeys() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Metric keys must be provided");
-  }
-
-  private void expectExceptionOnComponents() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Project keys must be provided");
-  }
-}
index f8230246a8e5318189636d9c7045a1fa2bfa9584..8bf091cf72a3aab7cd1d5434ee2a300ed07611bf 100644 (file)
@@ -31,9 +31,9 @@ import org.sonarqube.ws.Measures;
 import org.sonarqube.ws.client.components.TreeRequest;
 import org.sonarqube.ws.client.issues.IssuesService;
 import org.sonarqube.ws.client.issues.SearchRequest;
-import org.sonarqube.ws.client.measure.ComponentTreeRequest;
-import org.sonarqube.ws.client.measure.ComponentRequest;
-import org.sonarqube.ws.client.measure.MeasuresService;
+import org.sonarqube.ws.client.measures.ComponentTreeRequest;
+import org.sonarqube.ws.client.measures.ComponentRequest;
+import org.sonarqube.ws.client.measures.MeasuresService;
 
 import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
@@ -88,15 +88,15 @@ public class LiteTest {
   @Test
   public void call_measures_ws() {
     // project measures
-    MeasuresService measuresService = tester.wsClient().measuresOld();
+    MeasuresService measuresService = tester.wsClient().measures();
     Measures.ComponentWsResponse component = measuresService.component(new ComponentRequest()
-      .setComponentKey(PROJECT_KEY)
+      .setComponent(PROJECT_KEY)
       .setMetricKeys(asList("lines", "ncloc", "files")));
     assertThat(component.getComponent().getMeasuresCount()).isEqualTo(3);
 
     // file measures
     Measures.ComponentTreeWsResponse tree = measuresService.componentTree(new ComponentTreeRequest()
-      .setBaseComponentKey(PROJECT_KEY)
+      .setComponent(PROJECT_KEY)
       .setQualifiers(singletonList("FIL"))
       .setMetricKeys(asList("lines", "ncloc")));
     assertThat(tree.getComponentsCount()).isEqualTo(4);
index 44a55d60c64851dfeb23a4cb693b42b2b45e02c7..2515b25fec083ef0e63c94f0ad51378f55d2f9d4 100644 (file)
@@ -30,8 +30,8 @@ import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Measures;
 import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
 import org.sonarqube.ws.Measures.ComponentWsResponse;
-import org.sonarqube.ws.client.measure.ComponentTreeRequest;
-import org.sonarqube.ws.client.measure.ComponentRequest;
+import org.sonarqube.ws.client.measures.ComponentTreeRequest;
+import org.sonarqube.ws.client.measures.ComponentRequest;
 
 import static com.google.common.collect.Lists.newArrayList;
 import static java.util.Arrays.asList;
@@ -59,7 +59,7 @@ public class MeasuresWsTest {
   public void component_tree() {
     scanXooSample();
 
-    ComponentTreeWsResponse response = tester.wsClient().measuresOld().componentTree(new ComponentTreeRequest()
+    ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeRequest()
       .setComponent("sample")
       .setMetricKeys(singletonList("ncloc"))
       .setAdditionalFields(asList("metrics", "periods")));
@@ -123,7 +123,7 @@ public class MeasuresWsTest {
   }
 
   private void verifyComponentTreeWithChildren(String baseComponentKey, String... childKeys) {
-    ComponentTreeWsResponse response = tester.wsClient().measuresOld().componentTree(new ComponentTreeRequest()
+    ComponentTreeWsResponse response = tester.wsClient().measures().componentTree(new ComponentTreeRequest()
       .setComponent(baseComponentKey)
       .setMetricKeys(singletonList("ncloc"))
       .setStrategy("children"));
@@ -137,7 +137,7 @@ public class MeasuresWsTest {
   public void component() {
     scanXooSample();
 
-    ComponentWsResponse response = tester.wsClient().measuresOld().component(new ComponentRequest()
+    ComponentWsResponse response = tester.wsClient().measures().component(new ComponentRequest()
       .setComponent("sample")
       .setMetricKeys(singletonList("ncloc"))
       .setAdditionalFields(newArrayList("metrics", "periods")));
index 9970b0a8470c76bb2b90d1d2ddaaedbb04770a87..2dc2d73b7ffa55b272fee3aa1f0c019e23b2097f 100644 (file)
@@ -21,7 +21,6 @@ package org.sonarqube.tests.measure;
 
 import com.sonar.orchestrator.Orchestrator;
 import com.sonar.orchestrator.build.SonarScanner;
-import java.util.Arrays;
 import java.util.Date;
 import java.util.Map;
 import org.junit.BeforeClass;
@@ -32,10 +31,11 @@ import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Measures.Measure;
 import org.sonarqube.ws.Measures.SearchHistoryResponse;
 import org.sonarqube.ws.Measures.SearchHistoryResponse.HistoryValue;
-import org.sonarqube.ws.client.measure.SearchHistoryRequest;
+import org.sonarqube.ws.client.measures.SearchHistoryRequest;
 import util.ItUtils;
 import util.ItUtils.ComponentNavigation;
 
+import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
 import static org.apache.commons.lang.time.DateUtils.addDays;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -102,12 +102,11 @@ public class TimeMachineTest {
   public void noDataForInterval() {
     Date now = new Date();
 
-    SearchHistoryResponse response = tester.wsClient().measuresOld().searchHistory(SearchHistoryRequest.builder()
+    SearchHistoryResponse response = tester.wsClient().measures().searchHistory(new SearchHistoryRequest()
       .setComponent(PROJECT_KEY)
       .setMetrics(singletonList("lines"))
       .setFrom(formatDate(now))
-      .setTo(formatDate(now))
-      .build());
+      .setTo(formatDate(now)));
 
     assertThat(response.getPaging().getTotal()).isEqualTo(0);
     assertThat(response.getMeasures(0).getHistoryList()).isEmpty();
@@ -134,10 +133,9 @@ public class TimeMachineTest {
   }
 
   private static SearchHistoryResponse searchHistory(String... metrics) {
-    return tester.wsClient().measuresOld().searchHistory(SearchHistoryRequest.builder()
+    return tester.wsClient().measures().searchHistory(new SearchHistoryRequest()
       .setComponent(PROJECT_KEY)
-      .setMetrics(Arrays.asList(metrics))
-      .build());
+      .setMetrics(asList(metrics)));
   }
 
   private static void assertHistory(SearchHistoryResponse response, String metric, String... expectedMeasures) {
index f0e6590a6e04af9a899d5e37f6bbbcf4a3dfcfd6..80e1f718f6a92b4e4460131a12fef0656dbcd687 100644 (file)
@@ -37,7 +37,7 @@ import org.sonarqube.ws.Measures;
 import org.sonarqube.ws.client.HttpConnector;
 import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsClientFactories;
-import org.sonarqube.ws.client.measure.ComponentRequest;
+import org.sonarqube.ws.client.measures.ComponentRequest;
 
 import static java.lang.Double.parseDouble;
 import static java.util.Arrays.asList;
@@ -80,8 +80,8 @@ public class DuplicationTest extends AbstractPerfTest {
   }
 
   private Map<String, Double> getMeasures(String key) {
-    return newWsClient().measuresOld().component(new ComponentRequest()
-      .setComponentKey(key)
+    return newWsClient().measures().component(new ComponentRequest()
+      .setComponent(key)
       .setMetricKeys(asList("duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density")))
       .getComponent().getMeasuresList()
       .stream()
index f929798ec846058d56a5c7e953845724376b4581..a858de6af526ac5693b14b5ea2748c28453eb367 100644 (file)
@@ -31,22 +31,26 @@ import java.io.File;
 import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.Collections;
 import org.apache.commons.io.IOUtils;
 import org.junit.After;
 import org.junit.Test;
 import org.sonarqube.qa.util.SelenideConfig;
+import org.sonarqube.ws.Measures;
 import org.sonarqube.ws.Measures.Measure;
+import org.sonarqube.ws.MediaTypes;
+import org.sonarqube.ws.client.BaseService;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.HttpConnector;
+import org.sonarqube.ws.client.PostRequest;
 import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsClientFactories;
 import org.sonarqube.ws.client.WsResponse;
-import org.sonarqube.ws.client.measure.ComponentRequest;
+import org.sonarqube.ws.client.measures.ComponentRequest;
 
 import static com.codeborne.selenide.Condition.hasText;
 import static com.codeborne.selenide.Selenide.$;
 import static java.lang.Integer.parseInt;
+import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
 
 public class UpgradeTest {
@@ -73,7 +77,7 @@ public class UpgradeTest {
   private void testDatabaseUpgrade(Version fromVersion) {
     startOldVersionServer(fromVersion, false);
     scanProject();
-    int files = countFiles(PROJECT_KEY);
+    int files = countFilesOld(PROJECT_KEY);
     assertThat(files).isGreaterThan(0);
     stopServer();
 
@@ -83,9 +87,9 @@ public class UpgradeTest {
   }
 
   private void verifyAnalysis(int expectedNumberOfFiles) {
-    assertThat(countFiles(PROJECT_KEY)).isEqualTo(expectedNumberOfFiles);
+    assertThat(countFilesNew(PROJECT_KEY)).isEqualTo(expectedNumberOfFiles);
     scanProject();
-    assertThat(countFiles(PROJECT_KEY)).isEqualTo(expectedNumberOfFiles);
+    assertThat(countFilesNew(PROJECT_KEY)).isEqualTo(expectedNumberOfFiles);
     browseWebapp();
   }
 
@@ -197,8 +201,20 @@ public class UpgradeTest {
     orchestrator.executeBuild(build);
   }
 
-  private int countFiles(String key) {
-    Measure measure = newWsClient(orchestrator).measuresOld().component(new ComponentRequest().setComponentKey(key).setMetricKeys(Collections.singletonList("files")))
+  private int countFilesOld(String key) {
+    PostRequest httpRequest = new PostRequest("api/measures/component")
+      .setParam("componentKey", key)
+      .setParam("metricKeys", singletonList("files"))
+      .setMediaType(MediaTypes.PROTOBUF);
+    WsResponse response = HttpConnector.newBuilder()
+      .url(orchestrator.getServer().getUrl())
+      .build().call(httpRequest);
+    Measure measure = BaseService.convert(response, Measures.ComponentWsResponse.parser()).getComponent().getMeasures(0);
+    return parseInt(measure.getValue());
+  }
+
+  private int countFilesNew(String key) {
+    Measure measure = newWsClient(orchestrator).measures().component(new ComponentRequest().setComponent(key).setMetricKeys(singletonList("files")))
       .getComponent().getMeasures(0);
     return parseInt(measure.getValue());
   }
index c1dfd54f86ec55940a8fccf21713bbf4366b54a1..7700bf120f5eeb7676c85a2becceb85c0570e213 100644 (file)
@@ -71,7 +71,7 @@ import org.sonarqube.ws.client.HttpConnector;
 import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsClientFactories;
 import org.sonarqube.ws.client.components.ShowRequest;
-import org.sonarqube.ws.client.measure.ComponentRequest;
+import org.sonarqube.ws.client.measures.ComponentRequest;
 import org.sonarqube.ws.client.qualityprofile.RestoreRequest;
 import org.sonarqube.ws.client.settings.ResetRequest;
 import org.sonarqube.ws.client.settings.SetRequest;
@@ -334,7 +334,7 @@ public class ItUtils {
   }
 
   private static Stream<Measure> getStreamMeasures(Orchestrator orchestrator, String componentKey, String... metricKeys) {
-    return newWsClient(orchestrator).measuresOld().component(new ComponentRequest()
+    return newWsClient(orchestrator).measures().component(new ComponentRequest()
       .setComponent(componentKey)
       .setMetricKeys(asList(metricKeys)))
       .getComponent().getMeasuresList()
@@ -343,7 +343,7 @@ public class ItUtils {
 
   @CheckForNull
   public static Measure getMeasureWithVariation(Orchestrator orchestrator, String componentKey, String metricKey) {
-    Measures.ComponentWsResponse response = newWsClient(orchestrator).measuresOld().component(new ComponentRequest()
+    Measures.ComponentWsResponse response = newWsClient(orchestrator).measures().component(new ComponentRequest()
       .setComponent(componentKey)
       .setMetricKeys(singletonList(metricKey))
       .setAdditionalFields(singletonList("periods")));
@@ -353,8 +353,8 @@ public class ItUtils {
 
   @CheckForNull
   public static Map<String, Measure> getMeasuresWithVariationsByMetricKey(Orchestrator orchestrator, String componentKey, String... metricKeys) {
-    return newWsClient(orchestrator).measuresOld().component(new ComponentRequest()
-      .setComponentKey(componentKey)
+    return newWsClient(orchestrator).measures().component(new ComponentRequest()
+      .setComponent(componentKey)
       .setMetricKeys(asList(metricKeys))
       .setAdditionalFields(singletonList("periods"))).getComponent().getMeasuresList()
       .stream()