aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-08-18 11:00:08 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 11:34:47 +0200
commit41d132ec6b3841989816e36779cc5e946ba1a2b6 (patch)
treed4ab0d8d29b508ddcfab54d531f57103c7280e33 /sonar-ws/src
parentcff416d7f9910c258bc8d7175c08afff96a9eb2a (diff)
downloadsonarqube-41d132ec6b3841989816e36779cc5e946ba1a2b6.tar.gz
sonarqube-41d132ec6b3841989816e36779cc5e946ba1a2b6.zip
SONAR-9616 Fix ce ws on branches
Diffstat (limited to 'sonar-ws/src')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java11
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java4
-rw-r--r--sonar-ws/src/main/protobuf/ws-commons.proto2
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java22
4 files changed, 18 insertions, 21 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java
index 272d6670f47..243af50e8b7 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java
@@ -29,9 +29,9 @@ import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsConnector;
import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_BRANCH;
+import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
+import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_KEY;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS;
@@ -89,7 +89,7 @@ public class CeService extends BaseService {
return call(
new GetRequest(path("activity_status"))
.setParam(PARAM_COMPONENT_ID, request.getComponentId())
- .setParam(PARAM_COMPONENT_KEY, request.getComponentKey()),
+ .setParam(DEPRECATED_PARAM_COMPONENT_KEY, request.getComponentKey()),
WsCe.ActivityStatusWsResponse.parser());
}
@@ -97,11 +97,10 @@ public class CeService extends BaseService {
return call(new GetRequest(path(ACTION_WORKER_COUNT)), WorkerCountResponse.parser());
}
- public ProjectResponse component(String componentKey, String branch) {
+ public ProjectResponse component(String componentKey) {
return call(
new GetRequest(path("component"))
- .setParam(PARAM_COMPONENT_KEY, componentKey)
- .setParam(PARAM_BRANCH, branch),
+ .setParam(PARAM_COMPONENT, componentKey),
ProjectResponse.parser());
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java
index 680051f2dd2..9449526952d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java
@@ -24,14 +24,14 @@ public class CeWsParameters {
public static final String ACTION_WORKER_COUNT = "worker_count";
public static final String PARAM_COMPONENT_ID = "componentId";
- public static final String PARAM_COMPONENT_KEY = "componentKey";
+ public static final String DEPRECATED_PARAM_COMPONENT_KEY = "componentKey";
+ public static final String PARAM_COMPONENT = "component";
public static final String PARAM_COMPONENT_QUERY = "componentQuery";
public static final String PARAM_TYPE = "type";
public static final String PARAM_STATUS = "status";
public static final String PARAM_ONLY_CURRENTS = "onlyCurrents";
public static final String PARAM_MIN_SUBMITTED_AT = "minSubmittedAt";
public static final String PARAM_MAX_EXECUTED_AT = "maxExecutedAt";
- public static final String PARAM_BRANCH = "branch";
private CeWsParameters() {
// prevent instantiation
diff --git a/sonar-ws/src/main/protobuf/ws-commons.proto b/sonar-ws/src/main/protobuf/ws-commons.proto
index 9690b295d21..a9b566583e3 100644
--- a/sonar-ws/src/main/protobuf/ws-commons.proto
+++ b/sonar-ws/src/main/protobuf/ws-commons.proto
@@ -115,7 +115,7 @@ enum RuleType {
}
enum BranchType {
- // Zero is required in order to not get MAINTAINABILITY as default value
+ // Zero is required in order to not get LONG as default value
// See http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/
UNKNOWN_BRANCH_TYPE = 0;
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java
index 39d42729c24..b75aec5e9cc 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java
@@ -31,9 +31,8 @@ import org.sonarqube.ws.client.WsConnector;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.data.MapEntry.entry;
import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_BRANCH;
+import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_KEY;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS;
@@ -108,9 +107,9 @@ public class CeServiceTest {
@Test
public void task_with_stacktrace_and_scanner_context() {
underTest.task(TaskWsRequest.newBuilder("task_id")
- .withErrorStacktrace()
- .withScannerContext()
- .build());
+ .withErrorStacktrace()
+ .withScannerContext()
+ .build());
assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "stacktrace,scannerContext"));
@@ -119,8 +118,8 @@ public class CeServiceTest {
@Test
public void task_with_scanner_context_only() {
underTest.task(TaskWsRequest.newBuilder("task_id")
- .withScannerContext()
- .build());
+ .withScannerContext()
+ .build());
assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "scannerContext"));
@@ -129,8 +128,8 @@ public class CeServiceTest {
@Test
public void task_with_stacktrace_only() {
underTest.task(TaskWsRequest.newBuilder("task_id")
- .withErrorStacktrace()
- .build());
+ .withErrorStacktrace()
+ .build());
assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "stacktrace"));
@@ -146,14 +145,13 @@ public class CeServiceTest {
@Test
public void component() {
- underTest.component("my_component", "my_branch");
+ underTest.component("my_component");
GetRequest result = serviceTester.getGetRequest();
assertThat(serviceTester.getGetParser()).isSameAs(WsCe.ProjectResponse.parser());
serviceTester.assertThat(result)
.hasPath("component")
- .hasParam(PARAM_COMPONENT_KEY, "my_component")
- .hasParam(PARAM_BRANCH, "my_branch")
+ .hasParam(PARAM_COMPONENT, "my_component")
.andNoOtherParam();
}
}