]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10383 Fix changelog about pull request in api/ce/activity
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 29 Mar 2018 13:02:12 +0000 (15:02 +0200)
committerSonarTech <sonartech@sonarsource.com>
Fri, 6 Apr 2018 18:21:51 +0000 (20:21 +0200)
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java

index dcbe6290f974809eaf9cd614bf6feaa422124fb0..67724db7f62ec4c26954d3092bd698707e0be1ce 100644 (file)
@@ -58,9 +58,6 @@ import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime;
 import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
 import static org.sonar.core.util.stream.MoreCollectors.toList;
 import static org.sonar.db.Pagination.forPage;
-import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
-import static org.sonar.server.ws.WsUtils.checkRequest;
-import static org.sonar.server.ws.WsUtils.writeProtobuf;
 import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
 import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY;
 import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT;
@@ -68,6 +65,9 @@ import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
 import static org.sonar.server.ce.ws.CeWsParameters.PARAM_ONLY_CURRENTS;
 import static org.sonar.server.ce.ws.CeWsParameters.PARAM_STATUS;
 import static org.sonar.server.ce.ws.CeWsParameters.PARAM_TYPE;
+import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
+import static org.sonar.server.ws.WsUtils.checkRequest;
+import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
 public class ActivityAction implements CeWsAction {
   private static final int MAX_PAGE_SIZE = 1000;
@@ -101,7 +101,7 @@ public class ActivityAction implements CeWsAction {
         new Change("5.5", "it's no more possible to specify the page parameter."),
         new Change("6.1", "field \"logs\" is deprecated and its value is always false"),
         new Change("6.6", "fields \"branch\" and \"branchType\" added"),
-        new Change("7.1", "fields \"pullRequest\" and \"pullRequestTitle\" added"))
+        new Change("7.1", "field \"pullRequest\" added"))
       .setSince("5.2");
 
     action.createParam(PARAM_COMPONENT_ID)
@@ -238,7 +238,9 @@ public class ActivityAction implements CeWsAction {
     if (component != null) {
       query.setComponentUuid(component.uuid());
     } else if (componentQuery != null) {
-      query.setComponentUuids(loadComponents(dbSession, componentQuery).stream().map(ComponentDto::uuid).collect(toList()));
+      query.setComponentUuids(loadComponents(dbSession, componentQuery).stream()
+        .map(ComponentDto::uuid)
+        .collect(toList()));
     }
     return query;
   }
index 23f1ba3e091d98e58f90cd7a69e7663f870b4762..2fe083766ddc0bda8ea48dfef0467b479063e818 100644 (file)
@@ -75,7 +75,6 @@ public class TaskFormatter {
   private Ce.Task formatQueue(CeQueueDto dto, DtoCache componentDtoCache) {
     Ce.Task.Builder builder = Ce.Task.newBuilder();
     String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid());
-    // FIXME organization field should be set from the CeQueueDto rather than from the ComponentDto
     setNullable(organizationKey, builder::setOrganization);
     if (dto.getComponentUuid() != null) {
       builder.setComponentId(dto.getComponentUuid());
@@ -107,7 +106,6 @@ public class TaskFormatter {
   private static Ce.Task formatActivity(CeActivityDto dto, DtoCache componentDtoCache, @Nullable String scannerContext) {
     Ce.Task.Builder builder = Ce.Task.newBuilder();
     String organizationKey = componentDtoCache.getOrganizationKey(dto.getComponentUuid());
-    // FIXME organization field should be set from the CeActivityDto rather than from the ComponentDto
     setNullable(organizationKey, builder::setOrganization);
     builder.setId(dto.getUuid());
     builder.setStatus(Ce.TaskStatus.valueOf(dto.getStatus().name()));
@@ -174,7 +172,7 @@ public class TaskFormatter {
     }
 
     static DtoCache forQueueDtos(DbClient dbClient, DbSession dbSession, Collection<CeQueueDto> ceQueueDtos) {
-      Map<String, ComponentDto> componentsByUuid = dbClient.componentDao().selectByUuids(dbSession, uuidOfCeQueueDtos(ceQueueDtos))
+      Map<String, ComponentDto> componentsByUuid = dbClient.componentDao().selectByUuids(dbSession, componentUuidsOfCeQueues(ceQueueDtos))
         .stream()
         .collect(MoreCollectors.uniqueIndex(ComponentDto::uuid));
       Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
@@ -183,7 +181,7 @@ public class TaskFormatter {
       return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), characteristicsByTaskUuid);
     }
 
-    private static Set<String> uuidOfCeQueueDtos(Collection<CeQueueDto> ceQueueDtos) {
+    private static Set<String> componentUuidsOfCeQueues(Collection<CeQueueDto> ceQueueDtos) {
       return ceQueueDtos.stream()
         .filter(Objects::nonNull)
         .map(CeQueueDto::getComponentUuid)
@@ -194,7 +192,7 @@ public class TaskFormatter {
     static DtoCache forActivityDtos(DbClient dbClient, DbSession dbSession, Collection<CeActivityDto> ceActivityDtos) {
       Map<String, ComponentDto> componentsByUuid = dbClient.componentDao().selectByUuids(
         dbSession,
-        uuidOfCeActivityDtos(ceActivityDtos))
+        getComponentUuidsOfCeActivities(ceActivityDtos))
         .stream()
         .collect(MoreCollectors.uniqueIndex(ComponentDto::uuid));
       Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
@@ -203,7 +201,7 @@ public class TaskFormatter {
       return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), characteristicsByTaskUuid);
     }
 
-    private static Set<String> uuidOfCeActivityDtos(Collection<CeActivityDto> ceActivityDtos) {
+    private static Set<String> getComponentUuidsOfCeActivities(Collection<CeActivityDto> ceActivityDtos) {
       return ceActivityDtos.stream()
         .filter(Objects::nonNull)
         .map(CeActivityDto::getComponentUuid)
index b88a3dfe70293fd3f4d53d3f1f7b40f28c79f465..e3b9201dfc9711a92603f14071d444784f53625f 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.server.ce.ws;
 
-import java.io.IOException;
 import java.util.Collections;
 import java.util.Date;
 import org.junit.Rule;
@@ -32,7 +31,6 @@ import org.sonar.db.ce.CeQueueDto;
 import org.sonar.db.ce.CeTaskTypes;
 import org.sonar.db.organization.OrganizationDto;
 import org.sonarqube.ws.Ce;
-import org.sonarqube.ws.Ce;
 
 import static java.util.Arrays.asList;
 import static org.assertj.core.api.Assertions.assertThat;