diff options
author | Jenkins CI <ci@sonarsource.com> | 2016-04-21 08:01:09 +0200 |
---|---|---|
committer | Jenkins CI <ci@sonarsource.com> | 2016-04-21 08:01:09 +0200 |
commit | 91584ca578a35442467d075ec42151b409778503 (patch) | |
tree | 3e1ea4ea59a2d4e4d05de51affca73172fe65f78 /sonar-ws | |
parent | 6c65ff90687ebe7d184864b0d665f8a51aecfc7a (diff) | |
parent | 9d70ff56e7d45ca6d26ee5725cdea6288585358b (diff) | |
download | sonarqube-91584ca578a35442467d075ec42151b409778503.tar.gz sonarqube-91584ca578a35442467d075ec42151b409778503.zip |
Automatic merge from branch-5.5
* origin/branch-5.5:
SONAR-7553 use api/ce/activity_status to get number of pending and failing tasks
SONAR-7553 WS api/ce/activity_status display background tasks related metrics for UI
SONAR-7553 DAO of CE_QUEUE count number of rows by status
SONAR-7553 DAO of CE_ACTIVITY count number of tasks still failing
SONAR-7187 WS api/ce/activity stop using count(1) on DB table CE_QUEUE
SONAR-7553 Create composite DB index CE_ACTIVITY(is_last, status)
SONAR-7187 do not usage pagination
SONAR-7187 Remove paging from api/ce/activity
Diffstat (limited to 'sonar-ws')
4 files changed, 90 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusWsRequest.java new file mode 100644 index 00000000000..66407145b75 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusWsRequest.java @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact 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.ce; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class ActivityStatusWsRequest { + private final String componentId; + private final String componentKey; + + private ActivityStatusWsRequest(Builder builder) { + this.componentId = builder.componentId; + this.componentKey = builder.componentKey; + } + + @CheckForNull + public String getComponentId() { + return componentId; + } + + @CheckForNull + public String getComponentKey() { + return componentKey; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public static class Builder { + private String componentId; + private String componentKey; + + private Builder() { + // enforce newBuilder() use for instantiation + } + + public Builder setComponentId(@Nullable String componentId) { + this.componentId = componentId; + return this; + } + + public Builder setComponentKey(@Nullable String componentKey) { + this.componentKey = componentKey; + return this; + } + + public ActivityStatusWsRequest build() { + return new ActivityStatusWsRequest(this); + } + } +} 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 1871cd800d9..460ddb53faa 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 @@ -28,6 +28,7 @@ import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsConnector; 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; @@ -71,4 +72,13 @@ public class CeService extends BaseService { public WsCe.TaskResponse task(String id) { return call(new GetRequest(path("task")).setParam("id", id), WsCe.TaskResponse.parser()); } + + public WsCe.ActivityStatusWsResponse activityStatus(ActivityStatusWsRequest request) { + return call( + new GetRequest(path("activity_status")) + .setParam(PARAM_COMPONENT_ID, request.getComponentId()) + .setParam(PARAM_COMPONENT_KEY, request.getComponentKey()), + WsCe.ActivityStatusWsResponse.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 3b4fc97e4f1..e2254619a2a 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 @@ -22,6 +22,7 @@ package org.sonarqube.ws.client.ce; public class CeWsParameters { public static final String PARAM_COMPONENT_ID = "componentId"; + public static final String PARAM_COMPONENT_KEY = "componentKey"; public static final String PARAM_COMPONENT_QUERY = "componentQuery"; public static final String PARAM_TYPE = "type"; public static final String PARAM_STATUS = "status"; diff --git a/sonar-ws/src/main/protobuf/ws-ce.proto b/sonar-ws/src/main/protobuf/ws-ce.proto index 1db7111abcf..4440851e45a 100644 --- a/sonar-ws/src/main/protobuf/ws-ce.proto +++ b/sonar-ws/src/main/protobuf/ws-ce.proto @@ -39,10 +39,17 @@ message TaskResponse { // GET api/ce/activity message ActivityResponse { - optional sonarqube.ws.commons.Paging paging = 1; + // paging has been deprecated in 5.5 + optional sonarqube.ws.commons.Paging unusedPaging = 1; repeated Task tasks = 2; } +// GET api/ce/activity_status +message ActivityStatusWsResponse { + optional int32 pending = 1; + optional int32 failing = 2; +} + // GET api/ce/project message ProjectResponse { repeated Task queue = 1; |