]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6834 New WS GET api/ce/queue
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 17 Sep 2015 21:58:03 +0000 (23:58 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 18 Sep 2015 21:48:48 +0000 (23:48 +0200)
server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeQueueWsAction.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeTaskWsAction.java
server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWsTaskFormatter.java
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/main/resources/org/sonar/server/computation/ws/CeQueueWsAction/example.json [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/computation/CeQueueInitializerTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeQueueWsActionTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeTaskWsActionTest.java
sonar-ws/src/main/gen-java/org/sonarqube/ws/WsCe.java
sonar-ws/src/main/protobuf/ws-ce.proto

diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeQueueWsAction.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeQueueWsAction.java
new file mode 100644 (file)
index 0000000..dccf6f5
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.computation.ws;
+
+import java.util.List;
+import org.sonar.api.server.ws.Request;
+import org.sonar.api.server.ws.Response;
+import org.sonar.api.server.ws.WebService;
+import org.sonar.api.web.UserRole;
+import org.sonar.db.DbClient;
+import org.sonar.db.DbSession;
+import org.sonar.db.ce.CeQueueDto;
+import org.sonar.server.user.UserSession;
+import org.sonar.server.ws.WsUtils;
+import org.sonarqube.ws.WsCe;
+
+/**
+ * GET api/ce/queue
+ * <p>Get the status of the queue</p>
+ */
+public class CeQueueWsAction implements CeWsAction {
+
+  public static final String PARAM_COMPONENT_ID = "componentId";
+
+  private final UserSession userSession;
+  private final DbClient dbClient;
+  private final CeWsTaskFormatter formatter;
+
+  public CeQueueWsAction(UserSession userSession, DbClient dbClient, CeWsTaskFormatter formatter) {
+    this.userSession = userSession;
+    this.dbClient = dbClient;
+    this.formatter = formatter;
+  }
+
+  @Override
+  public void define(WebService.NewController controller) {
+    WebService.NewAction action = controller.createAction("queue")
+      .setDescription("Gets the tasks of the Compute Engine queue")
+      .setInternal(true)
+      .setResponseExample(getClass().getResource("CeQueueWsAction/example.json"))
+      .setHandler(this);
+
+    action.createParam(PARAM_COMPONENT_ID);
+  }
+
+  @Override
+  public void handle(Request wsRequest, Response wsResponse) throws Exception {
+    String componentUuid = wsRequest.param(PARAM_COMPONENT_ID);
+
+    DbSession dbSession = dbClient.openSession(false);
+    try {
+      List<CeQueueDto> dtos;
+      if (componentUuid == null) {
+        // no filters
+        userSession.checkGlobalPermission(UserRole.ADMIN);
+        dtos = dbClient.ceQueueDao().selectAllInAscOrder(dbSession);
+      } else {
+        // filter by component
+        userSession.checkProjectUuidPermission(UserRole.USER, componentUuid);
+        dtos = dbClient.ceQueueDao().selectByComponentUuid(dbSession, componentUuid);
+      }
+
+      WsCe.QueueResponse.Builder wsResponseBuilder = WsCe.QueueResponse.newBuilder();
+      wsResponseBuilder.addAllTasks(formatter.format(dbSession, dtos));
+      WsUtils.writeProtobuf(wsResponseBuilder.build(), wsRequest, wsResponse);
+
+    } finally {
+      dbClient.closeSession(dbSession);
+    }
+  }
+}
index 1cd393180efba2d042522048ead1eeeba88264a2..6eba0f439bd57e73a1605086153da4d928d9b32b 100644 (file)
@@ -74,11 +74,11 @@ public class CeTaskWsAction implements CeWsAction {
       WsCe.TaskResponse.Builder wsTaskResponse = WsCe.TaskResponse.newBuilder();
       Optional<CeQueueDto> queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, taskId);
       if (queueDto.isPresent()) {
-        wsTaskResponse.setTask(wsTaskFormatter.format(queueDto.get()));
+        wsTaskResponse.setTask(wsTaskFormatter.format(dbSession, queueDto.get()));
       } else {
         Optional<CeActivityDto> activityDto = dbClient.ceActivityDao().selectByUuid(dbSession, taskId);
         if (activityDto.isPresent()) {
-          wsTaskResponse.setTask(wsTaskFormatter.format(activityDto.get()));
+          wsTaskResponse.setTask(wsTaskFormatter.format(dbSession, activityDto.get()));
         } else {
           throw new NotFoundException();
         }
index 186175a800d000ad96fdc8049d11f2cc8981f67d..6205fb7c319305612eefdef95ccb2e78d4819462 100644 (file)
  */
 package org.sonar.server.computation.ws;
 
+import com.google.common.base.Optional;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
 import org.sonar.api.utils.DateUtils;
+import org.sonar.db.DbClient;
+import org.sonar.db.DbSession;
 import org.sonar.db.ce.CeActivityDto;
 import org.sonar.db.ce.CeQueueDto;
 import org.sonar.db.component.ComponentDto;
-import org.sonar.server.component.ComponentService;
 import org.sonarqube.ws.WsCe;
 
 public class CeWsTaskFormatter {
 
-  private final ComponentService componentService;
+  private final DbClient dbClient;
 
-  public CeWsTaskFormatter(ComponentService componentService) {
-    this.componentService = componentService;
+  public CeWsTaskFormatter(DbClient dbClient) {
+    this.dbClient = dbClient;
   }
 
-  public WsCe.Task format(CeQueueDto dto) {
+  public List<WsCe.Task> format(DbSession dbSession, List<CeQueueDto> dtos) {
+    ComponentCache cache = new ComponentCache(dbSession);
+    List<WsCe.Task> result = new ArrayList<>();
+    for (CeQueueDto dto : dtos) {
+      result.add(format(dto, cache));
+    }
+    return result;
+  }
+
+  public WsCe.Task format(DbSession dbSession, CeQueueDto dto) {
+    return format(dto, new ComponentCache(dbSession));
+  }
+
+  private WsCe.Task format(CeQueueDto dto, ComponentCache componentCache) {
     WsCe.Task.Builder builder = WsCe.Task.newBuilder();
     builder.setId(dto.getUuid());
     builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name()));
-    builder.setTaskType(dto.getTaskType());
+    builder.setType(dto.getTaskType());
     if (dto.getComponentUuid() != null) {
       builder.setComponentId(dto.getComponentUuid());
-      buildComponent(builder, dto.getComponentUuid());
+      buildComponent(builder, componentCache.get(dto.getComponentUuid()));
     }
     if (dto.getSubmitterLogin() != null) {
       builder.setSubmitterLogin(dto.getSubmitterLogin());
@@ -54,14 +75,18 @@ public class CeWsTaskFormatter {
     return builder.build();
   }
 
-  public WsCe.Task format(CeActivityDto dto) {
+  public WsCe.Task format(DbSession dbSession, CeActivityDto dto) {
+    return format(dto, new ComponentCache(dbSession));
+  }
+
+  private WsCe.Task format(CeActivityDto dto, ComponentCache componentCache) {
     WsCe.Task.Builder builder = WsCe.Task.newBuilder();
     builder.setId(dto.getUuid());
     builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name()));
-    builder.setTaskType(dto.getTaskType());
+    builder.setType(dto.getTaskType());
     if (dto.getComponentUuid() != null) {
       builder.setComponentId(dto.getComponentUuid());
-      buildComponent(builder, dto.getComponentUuid());
+      buildComponent(builder, componentCache.get(dto.getComponentUuid()));
     }
     if (dto.getSubmitterLogin() != null) {
       builder.setSubmitterLogin(dto.getSubmitterLogin());
@@ -79,11 +104,32 @@ public class CeWsTaskFormatter {
     return builder.build();
   }
 
-  private void buildComponent(WsCe.Task.Builder builder, String componentUuid) {
-    ComponentDto project = componentService.getNonNullByUuid(componentUuid);
-    if (project != null) {
-      builder.setComponentKey(project.getKey());
-      builder.setComponentName(project.name());
+  private void buildComponent(WsCe.Task.Builder builder, @Nullable ComponentDto componentDto) {
+    if (componentDto != null) {
+      builder.setComponentKey(componentDto.getKey());
+      builder.setComponentName(componentDto.name());
+    }
+  }
+
+  private class ComponentCache {
+    private final DbSession dbSession;
+    private final Map<String, ComponentDto> componentsByUuid = new HashMap<>();
+
+    ComponentCache(DbSession dbSession) {
+      this.dbSession = dbSession;
+    }
+
+    @CheckForNull
+    ComponentDto get(String uuid) {
+      ComponentDto dto = componentsByUuid.get(uuid);
+      if (dto == null) {
+        Optional<ComponentDto> opt = dbClient.componentDao().selectByUuid(dbSession, uuid);
+        if (opt.isPresent()) {
+          dto = opt.get();
+          componentsByUuid.put(uuid, dto);
+        }
+      }
+      return dto;
     }
   }
 }
index 9f21e781cd25651c3c99794d32c1928a4c5191dc..612948b2938032e46b570c07311110f67358fcce 100644 (file)
@@ -72,6 +72,7 @@ import org.sonar.server.computation.ReportFiles;
 import org.sonar.server.computation.ReportSubmitter;
 import org.sonar.server.computation.monitoring.CEQueueStatusImpl;
 import org.sonar.server.computation.monitoring.ComputeEngineQueueMonitor;
+import org.sonar.server.computation.ws.CeQueueWsAction;
 import org.sonar.server.computation.ws.CeSubmitWsAction;
 import org.sonar.server.computation.ws.CeTaskWsAction;
 import org.sonar.server.computation.ws.CeWs;
@@ -724,6 +725,7 @@ public class PlatformLevel4 extends PlatformLevel {
       CeWsTaskFormatter.class,
       CeTaskWsAction.class,
       CeSubmitWsAction.class,
+      CeQueueWsAction.class,
       IsQueueEmptyWs.class,
       DefaultPeriodCleaner.class,
       ProjectCleaner.class,
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/CeQueueWsAction/example.json b/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/CeQueueWsAction/example.json
new file mode 100644 (file)
index 0000000..f16ec71
--- /dev/null
@@ -0,0 +1,24 @@
+{
+  "tasks": [
+    {
+      "id": "BU_dO1vsORa8_beWCwsP",
+      "type": "REPORT",
+      "componentId": "AU-Tpxb--iU5OvuD2FLy",
+      "componentKey": "project_1",
+      "componentName": "Project One",
+      "status": "IN_PROGRESS",
+      "submittedAt": "2015-08-13T23:34:59+0200",
+      "submitterLogin": "john"
+    },
+    {
+      "id": "AU_dO1vsORa8_beWCwmP",
+      "taskType": "REPORT",
+      "componentId": "AU_dO1vlORa8_beWCwmO",
+      "componentKey": "project_2",
+      "componentName": "Project Two",
+      "status": "IN_PROGRESS",
+      "submittedAt": "2015-09-17T23:34:59+0200",
+      "startedAt": "2015-09-17T23:35:00+0200"
+    }
+  ]
+}
index 11b41917b1b2dc461b7886be1a12a1558d2de408..046da85ea64c888dded7de2712acf34d75f36426 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.server.computation;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Arrays;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeQueueWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeQueueWsActionTest.java
new file mode 100644 (file)
index 0000000..5cc9b70
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.computation.ws;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.api.utils.System2;
+import org.sonar.api.web.UserRole;
+import org.sonar.core.util.Protobuf;
+import org.sonar.db.DbTester;
+import org.sonar.db.ce.CeQueueDto;
+import org.sonar.db.ce.CeTaskTypes;
+import org.sonar.server.plugins.MimeTypes;
+import org.sonar.server.tester.UserSessionRule;
+import org.sonar.server.ws.TestResponse;
+import org.sonar.server.ws.WsActionTester;
+import org.sonarqube.ws.WsCe;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class CeQueueWsActionTest {
+
+  @Rule
+  public UserSessionRule userSession = UserSessionRule.standalone();
+
+  @Rule
+  public DbTester dbTester = DbTester.create(System2.INSTANCE);
+
+  CeWsTaskFormatter formatter = new CeWsTaskFormatter(dbTester.getDbClient());
+  CeQueueWsAction underTest = new CeQueueWsAction(userSession, dbTester.getDbClient(), formatter);
+  WsActionTester tester = new WsActionTester(underTest);
+
+  @Test
+  public void get_all_queue() {
+    userSession.setGlobalPermissions(UserRole.ADMIN);
+    insert("T1", "PROJECT_1", CeQueueDto.Status.PENDING);
+    insert("T2", "PROJECT_2", CeQueueDto.Status.IN_PROGRESS);
+
+    TestResponse wsResponse = tester.newRequest()
+      .setMediaType(MimeTypes.PROTOBUF)
+      .execute();
+
+    // verify the protobuf response
+    WsCe.QueueResponse queueResponse = Protobuf.read(wsResponse.getInputStream(), WsCe.QueueResponse.PARSER);
+    assertThat(queueResponse.getTasksCount()).isEqualTo(2);
+    assertThat(queueResponse.getTasks(0).getId()).isEqualTo("T1");
+    assertThat(queueResponse.getTasks(0).getStatus()).isEqualTo(WsCe.TaskStatus.PENDING);
+    assertThat(queueResponse.getTasks(0).getComponentId()).isEqualTo("PROJECT_1");
+    assertThat(queueResponse.getTasks(1).getId()).isEqualTo("T2");
+    assertThat(queueResponse.getTasks(1).getStatus()).isEqualTo(WsCe.TaskStatus.IN_PROGRESS);
+    assertThat(queueResponse.getTasks(1).getComponentId()).isEqualTo("PROJECT_2");
+  }
+
+  @Test
+  public void get_queue_of_project() {
+    userSession.addProjectUuidPermissions(UserRole.USER, "PROJECT_1");
+    insert("T1", "PROJECT_1", CeQueueDto.Status.PENDING);
+    insert("T2", "PROJECT_2", CeQueueDto.Status.PENDING);
+    insert("T3", "PROJECT_2", CeQueueDto.Status.IN_PROGRESS);
+
+    TestResponse wsResponse = tester.newRequest()
+      .setParam("componentId", "PROJECT_1")
+      .setMediaType(MimeTypes.PROTOBUF)
+      .execute();
+
+    // verify the protobuf response
+    WsCe.QueueResponse queueResponse = Protobuf.read(wsResponse.getInputStream(), WsCe.QueueResponse.PARSER);
+    assertThat(queueResponse.getTasksCount()).isEqualTo(1);
+    assertThat(queueResponse.getTasks(0).getId()).isEqualTo("T1");
+  }
+
+  private CeQueueDto insert(String taskUuid, String componentUuid, CeQueueDto.Status status) {
+    CeQueueDto queueDto = new CeQueueDto();
+    queueDto.setTaskType(CeTaskTypes.REPORT);
+    queueDto.setComponentUuid(componentUuid);
+    queueDto.setUuid(taskUuid);
+    queueDto.setStatus(status);
+    dbTester.getDbClient().ceQueueDao().insert(dbTester.getSession(), queueDto);
+    dbTester.getSession().commit();
+    return queueDto;
+  }
+}
index a07fb41b8e88ceef02af2b313ecf351638f6c208..d01092ac1487a519fd0a2db78bc6860a1098c54a 100644 (file)
@@ -29,7 +29,6 @@ import org.sonar.db.ce.CeActivityDto;
 import org.sonar.db.ce.CeQueueDto;
 import org.sonar.db.ce.CeTaskTypes;
 import org.sonar.db.component.ComponentDto;
-import org.sonar.server.component.ComponentService;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.plugins.MimeTypes;
 import org.sonar.server.tester.UserSessionRule;
@@ -38,8 +37,6 @@ import org.sonar.server.ws.WsActionTester;
 import org.sonarqube.ws.WsCe;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 public class CeTaskWsActionTest {
 
@@ -49,8 +46,7 @@ public class CeTaskWsActionTest {
   @Rule
   public DbTester dbTester = DbTester.create(System2.INSTANCE);
 
-  ComponentService componentService = mock(ComponentService.class);
-  CeWsTaskFormatter formatter = new CeWsTaskFormatter(componentService);
+  CeWsTaskFormatter formatter = new CeWsTaskFormatter(dbTester.getDbClient());
   CeTaskWsAction underTest = new CeTaskWsAction(dbTester.getDbClient(), formatter, userSession);
   WsActionTester tester = new WsActionTester(underTest);
 
@@ -59,7 +55,7 @@ public class CeTaskWsActionTest {
     userSession.setGlobalPermissions(UserRole.ADMIN);
 
     ComponentDto project = new ComponentDto().setUuid("PROJECT_1").setName("Project One").setKey("P1");
-    when(componentService.getNonNullByUuid("PROJECT_1")).thenReturn(project);
+    dbTester.getDbClient().componentDao().insert(dbTester.getSession(), project);
 
     CeQueueDto queueDto = new CeQueueDto();
     queueDto.setTaskType(CeTaskTypes.REPORT);
@@ -91,7 +87,7 @@ public class CeTaskWsActionTest {
     userSession.setGlobalPermissions(UserRole.ADMIN);
 
     ComponentDto project = new ComponentDto().setUuid("PROJECT_1").setName("Project One").setKey("P1");
-    when(componentService.getNonNullByUuid("PROJECT_1")).thenReturn(project);
+    dbTester.getDbClient().componentDao().insert(dbTester.getSession(), project);
 
     CeQueueDto queueDto = new CeQueueDto();
     queueDto.setTaskType(CeTaskTypes.REPORT);
index 0ddc5912d5d51ef1605e72f234bf17f528700625..54ba9950baf99112210bbcb54ce547fadbc4c856 100644 (file)
@@ -2841,18 +2841,18 @@ public final class WsCe {
         getIdBytes();
 
     /**
-     * <code>optional string taskType = 2;</code>
+     * <code>optional string type = 2;</code>
      */
-    boolean hasTaskType();
+    boolean hasType();
     /**
-     * <code>optional string taskType = 2;</code>
+     * <code>optional string type = 2;</code>
      */
-    java.lang.String getTaskType();
+    java.lang.String getType();
     /**
-     * <code>optional string taskType = 2;</code>
+     * <code>optional string type = 2;</code>
      */
     com.google.protobuf.ByteString
-        getTaskTypeBytes();
+        getTypeBytes();
 
     /**
      * <code>optional string componentId = 3;</code>
@@ -2992,7 +2992,7 @@ public final class WsCe {
     }
     private Task() {
       id_ = "";
-      taskType_ = "";
+      type_ = "";
       componentId_ = "";
       componentKey_ = "";
       componentName_ = "";
@@ -3041,7 +3041,7 @@ public final class WsCe {
             case 18: {
               com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000002;
-              taskType_ = bs;
+              type_ = bs;
               break;
             }
             case 26: {
@@ -3175,19 +3175,19 @@ public final class WsCe {
       }
     }
 
-    public static final int TASKTYPE_FIELD_NUMBER = 2;
-    private volatile java.lang.Object taskType_;
+    public static final int TYPE_FIELD_NUMBER = 2;
+    private volatile java.lang.Object type_;
     /**
-     * <code>optional string taskType = 2;</code>
+     * <code>optional string type = 2;</code>
      */
-    public boolean hasTaskType() {
+    public boolean hasType() {
       return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
-     * <code>optional string taskType = 2;</code>
+     * <code>optional string type = 2;</code>
      */
-    public java.lang.String getTaskType() {
-      java.lang.Object ref = taskType_;
+    public java.lang.String getType() {
+      java.lang.Object ref = type_;
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
@@ -3195,22 +3195,22 @@ public final class WsCe {
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
-          taskType_ = s;
+          type_ = s;
         }
         return s;
       }
     }
     /**
-     * <code>optional string taskType = 2;</code>
+     * <code>optional string type = 2;</code>
      */
     public com.google.protobuf.ByteString
-        getTaskTypeBytes() {
-      java.lang.Object ref = taskType_;
+        getTypeBytes() {
+      java.lang.Object ref = type_;
       if (ref instanceof java.lang.String) {
         com.google.protobuf.ByteString b = 
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
-        taskType_ = b;
+        type_ = b;
         return b;
       } else {
         return (com.google.protobuf.ByteString) ref;
@@ -3573,7 +3573,7 @@ public final class WsCe {
         output.writeBytes(1, getIdBytes());
       }
       if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeBytes(2, getTaskTypeBytes());
+        output.writeBytes(2, getTypeBytes());
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         output.writeBytes(3, getComponentIdBytes());
@@ -3620,7 +3620,7 @@ public final class WsCe {
       }
       if (((bitField0_ & 0x00000002) == 0x00000002)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(2, getTaskTypeBytes());
+          .computeBytesSize(2, getTypeBytes());
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         size += com.google.protobuf.CodedOutputStream
@@ -3776,7 +3776,7 @@ public final class WsCe {
         super.clear();
         id_ = "";
         bitField0_ = (bitField0_ & ~0x00000001);
-        taskType_ = "";
+        type_ = "";
         bitField0_ = (bitField0_ & ~0x00000002);
         componentId_ = "";
         bitField0_ = (bitField0_ & ~0x00000004);
@@ -3829,7 +3829,7 @@ public final class WsCe {
         if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
           to_bitField0_ |= 0x00000002;
         }
-        result.taskType_ = taskType_;
+        result.type_ = type_;
         if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
           to_bitField0_ |= 0x00000004;
         }
@@ -3891,9 +3891,9 @@ public final class WsCe {
           id_ = other.id_;
           onChanged();
         }
-        if (other.hasTaskType()) {
+        if (other.hasType()) {
           bitField0_ |= 0x00000002;
-          taskType_ = other.taskType_;
+          type_ = other.type_;
           onChanged();
         }
         if (other.hasComponentId()) {
@@ -4044,24 +4044,24 @@ public final class WsCe {
         return this;
       }
 
-      private java.lang.Object taskType_ = "";
+      private java.lang.Object type_ = "";
       /**
-       * <code>optional string taskType = 2;</code>
+       * <code>optional string type = 2;</code>
        */
-      public boolean hasTaskType() {
+      public boolean hasType() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
-       * <code>optional string taskType = 2;</code>
+       * <code>optional string type = 2;</code>
        */
-      public java.lang.String getTaskType() {
-        java.lang.Object ref = taskType_;
+      public java.lang.String getType() {
+        java.lang.Object ref = type_;
         if (!(ref instanceof java.lang.String)) {
           com.google.protobuf.ByteString bs =
               (com.google.protobuf.ByteString) ref;
           java.lang.String s = bs.toStringUtf8();
           if (bs.isValidUtf8()) {
-            taskType_ = s;
+            type_ = s;
           }
           return s;
         } else {
@@ -4069,53 +4069,53 @@ public final class WsCe {
         }
       }
       /**
-       * <code>optional string taskType = 2;</code>
+       * <code>optional string type = 2;</code>
        */
       public com.google.protobuf.ByteString
-          getTaskTypeBytes() {
-        java.lang.Object ref = taskType_;
+          getTypeBytes() {
+        java.lang.Object ref = type_;
         if (ref instanceof String) {
           com.google.protobuf.ByteString b = 
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
-          taskType_ = b;
+          type_ = b;
           return b;
         } else {
           return (com.google.protobuf.ByteString) ref;
         }
       }
       /**
-       * <code>optional string taskType = 2;</code>
+       * <code>optional string type = 2;</code>
        */
-      public Builder setTaskType(
+      public Builder setType(
           java.lang.String value) {
         if (value == null) {
     throw new NullPointerException();
   }
   bitField0_ |= 0x00000002;
-        taskType_ = value;
+        type_ = value;
         onChanged();
         return this;
       }
       /**
-       * <code>optional string taskType = 2;</code>
+       * <code>optional string type = 2;</code>
        */
-      public Builder clearTaskType() {
+      public Builder clearType() {
         bitField0_ = (bitField0_ & ~0x00000002);
-        taskType_ = getDefaultInstance().getTaskType();
+        type_ = getDefaultInstance().getType();
         onChanged();
         return this;
       }
       /**
-       * <code>optional string taskType = 2;</code>
+       * <code>optional string type = 2;</code>
        */
-      public Builder setTaskTypeBytes(
+      public Builder setTypeBytes(
           com.google.protobuf.ByteString value) {
         if (value == null) {
     throw new NullPointerException();
   }
   bitField0_ |= 0x00000002;
-        taskType_ = value;
+        type_ = value;
         onChanged();
         return this;
       }
@@ -4836,17 +4836,17 @@ public final class WsCe {
       "eueResponse\022$\n\005tasks\030\001 \003(\0132\025.sonarqube.w" +
       "s.ce.Task\"f\n\020ActivityResponse\022,\n\006paging\030" +
       "\001 \001(\0132\034.sonarqube.ws.commons.Paging\022$\n\005t" +
-      "asks\030\002 \003(\0132\025.sonarqube.ws.ce.Task\"\230\002\n\004Ta" +
-      "sk\022\n\n\002id\030\001 \001(\t\022\020\n\010taskType\030\002 \001(\t\022\023\n\013comp" +
-      "onentId\030\003 \001(\t\022\024\n\014componentKey\030\004 \001(\t\022\025\n\rc",
-      "omponentName\030\005 \001(\t\022+\n\006status\030\006 \001(\0162\033.son" +
-      "arqube.ws.ce.TaskStatus\022\023\n\013submittedAt\030\007" +
-      " \001(\t\022\026\n\016submitterLogin\030\010 \001(\t\022\021\n\tstartedA" +
-      "t\030\t \001(\t\022\022\n\nfinishedAt\030\n \001(\t\022\026\n\016isLastFin" +
-      "ished\030\013 \001(\010\022\027\n\017executionTimeMs\030\014 \001(\003*Q\n\n" +
-      "TaskStatus\022\013\n\007PENDING\020\000\022\017\n\013IN_PROGRESS\020\001" +
-      "\022\013\n\007SUCCESS\020\002\022\n\n\006FAILED\020\003\022\014\n\010CANCELED\020\004B" +
-      "\032\n\020org.sonarqube.wsB\004WsCeH\001"
+      "asks\030\002 \003(\0132\025.sonarqube.ws.ce.Task\"\224\002\n\004Ta" +
+      "sk\022\n\n\002id\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022\023\n\013componen" +
+      "tId\030\003 \001(\t\022\024\n\014componentKey\030\004 \001(\t\022\025\n\rcompo",
+      "nentName\030\005 \001(\t\022+\n\006status\030\006 \001(\0162\033.sonarqu" +
+      "be.ws.ce.TaskStatus\022\023\n\013submittedAt\030\007 \001(\t" +
+      "\022\026\n\016submitterLogin\030\010 \001(\t\022\021\n\tstartedAt\030\t " +
+      "\001(\t\022\022\n\nfinishedAt\030\n \001(\t\022\026\n\016isLastFinishe" +
+      "d\030\013 \001(\010\022\027\n\017executionTimeMs\030\014 \001(\003*Q\n\nTask" +
+      "Status\022\013\n\007PENDING\020\000\022\017\n\013IN_PROGRESS\020\001\022\013\n\007" +
+      "SUCCESS\020\002\022\n\n\006FAILED\020\003\022\014\n\010CANCELED\020\004B\032\n\020o" +
+      "rg.sonarqube.wsB\004WsCeH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
         new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
@@ -4890,7 +4890,7 @@ public final class WsCe {
     internal_static_sonarqube_ws_ce_Task_fieldAccessorTable = new
       com.google.protobuf.GeneratedMessage.FieldAccessorTable(
         internal_static_sonarqube_ws_ce_Task_descriptor,
-        new java.lang.String[] { "Id", "TaskType", "ComponentId", "ComponentKey", "ComponentName", "Status", "SubmittedAt", "SubmitterLogin", "StartedAt", "FinishedAt", "IsLastFinished", "ExecutionTimeMs", });
+        new java.lang.String[] { "Id", "Type", "ComponentId", "ComponentKey", "ComponentName", "Status", "SubmittedAt", "SubmitterLogin", "StartedAt", "FinishedAt", "IsLastFinished", "ExecutionTimeMs", });
     org.sonarqube.ws.Common.getDescriptor();
   }
 
index fa558dd598cd2b0393a18f13e1cbcebfd10c3254..5ab5e4ab58a45754b8211064a793c7395ec42547 100644 (file)
@@ -50,7 +50,7 @@ message ActivityResponse {
 
 message Task {
   optional string id = 1;
-  optional string taskType = 2;
+  optional string type = 2;
   optional string componentId = 3;
   optional string componentKey = 4;
   optional string componentName = 5;