]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9616 Fix ce ws on branches
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 18 Aug 2017 09:00:08 +0000 (11:00 +0200)
committerJanos Gyerik <janos.gyerik@sonarsource.com>
Tue, 12 Sep 2017 09:34:47 +0000 (11:34 +0200)
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.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/ActivityActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java
sonar-ws/src/main/protobuf/ws-commons.proto
sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java

index cf395d10e34037c9387596fc2962a58b1673c6b6..aaf1ea5fa71cc320dfc809e03468b7fe3c1c9b36 100644 (file)
@@ -39,8 +39,8 @@ import org.sonarqube.ws.client.ce.ActivityStatusWsRequest;
 
 import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
+import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_KEY;
 
 public class ActivityStatusAction implements CeWsAction {
   private final UserSession userSession;
@@ -67,7 +67,7 @@ public class ActivityStatusAction implements CeWsAction {
     action.createParam(PARAM_COMPONENT_ID)
       .setDescription("Id of the component (project) to filter on")
       .setExampleValue(Uuids.UUID_EXAMPLE_03);
-    action.createParam(PARAM_COMPONENT_KEY)
+    action.createParam(DEPRECATED_PARAM_COMPONENT_KEY)
       .setDescription("Key of the component (project) to filter on")
       .setExampleValue(KeyExamples.KEY_PROJECT_EXAMPLE_001);
 
@@ -120,7 +120,7 @@ public class ActivityStatusAction implements CeWsAction {
   private static ActivityStatusWsRequest toWsRequest(Request request) {
     return ActivityStatusWsRequest.newBuilder()
       .setComponentId(request.param(PARAM_COMPONENT_ID))
-      .setComponentKey(request.param(PARAM_COMPONENT_KEY))
+      .setComponentKey(request.param(DEPRECATED_PARAM_COMPONENT_KEY))
       .build();
   }
 }
index a842073aabae016b2c1d113dc13e1a4ccf153df5..71301984c9ba960f89c473e535f08b1285958cdb 100644 (file)
@@ -36,15 +36,13 @@ import org.sonar.server.component.ComponentFinder;
 import org.sonar.server.user.UserSession;
 import org.sonar.server.ws.KeyExamples;
 
-import static com.google.common.base.Preconditions.checkArgument;
 import static org.sonar.db.Pagination.forPage;
-import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY;
-import static org.sonar.server.ws.KeyExamples.KEY_BRANCH_EXAMPLE_001;
+import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 import static org.sonarqube.ws.WsCe.ProjectResponse;
-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;
 
 public class ComponentAction implements CeWsAction {
 
@@ -66,7 +64,7 @@ public class ComponentAction implements CeWsAction {
       .setDescription("Get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).<br>" +
         "Requires the following permission: 'Browse' on the specified component.<br>" +
         "Either '%s' or '%s' must be provided, not both.",
-        PARAM_COMPONENT_ID, PARAM_COMPONENT_KEY)
+        PARAM_COMPONENT_ID, DEPRECATED_PARAM_COMPONENT_KEY)
       .setSince("5.2")
       .setResponseExample(getClass().getResource("component-example.json"))
       .setChangelog(
@@ -77,16 +75,13 @@ public class ComponentAction implements CeWsAction {
 
     action.createParam(PARAM_COMPONENT_ID)
       .setRequired(false)
-      .setExampleValue(Uuids.UUID_EXAMPLE_01);
+      .setExampleValue(Uuids.UUID_EXAMPLE_01)
+      .setDeprecatedSince("6.6");
 
-    action.createParam(PARAM_COMPONENT_KEY)
+    action.createParam(PARAM_COMPONENT)
       .setRequired(false)
-      .setExampleValue(KeyExamples.KEY_PROJECT_EXAMPLE_001);
-
-    action.createParam(PARAM_BRANCH)
-      .setDescription("Branch key")
-      .setInternal(true)
-      .setExampleValue(KEY_BRANCH_EXAMPLE_001);
+      .setExampleValue(KeyExamples.KEY_PROJECT_EXAMPLE_001)
+      .setDeprecatedKey("componentKey", "6.6");
   }
 
   @Override
@@ -110,13 +105,8 @@ public class ComponentAction implements CeWsAction {
   }
 
   private ComponentDto loadComponent(DbSession dbSession, Request wsRequest) {
-    String componentKey = wsRequest.param(PARAM_COMPONENT_KEY);
+    String componentKey = wsRequest.param(PARAM_COMPONENT);
     String componentId = wsRequest.param(PARAM_COMPONENT_ID);
-    String branch = wsRequest.param(PARAM_BRANCH);
-    checkArgument(componentId == null || branch == null, "'%s' and '%s' parameters cannot be used at the same time", PARAM_COMPONENT_ID,
-      PARAM_BRANCH);
-    return branch == null
-      ? componentFinder.getByUuidOrKey(dbSession, componentId, componentKey, COMPONENT_ID_AND_KEY)
-      : componentFinder.getByKeyAndBranch(dbSession, componentKey, branch);
+    return componentFinder.getByUuidOrKey(dbSession, componentId, componentKey, COMPONENT_ID_AND_COMPONENT);
   }
 }
index 6e218184800e3927c467b18e91a822b0bbfc7268..606c361218e1ad038348dc44c5d1cbbff9f72077 100644 (file)
  */
 package org.sonar.server.ce.ws;
 
-import com.google.common.collect.ImmutableMultimap;
 import com.google.common.collect.Multimap;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -40,9 +38,7 @@ import org.sonar.db.DbSession;
 import org.sonar.db.ce.CeActivityDto;
 import org.sonar.db.ce.CeQueueDto;
 import org.sonar.db.ce.CeTaskCharacteristicDto;
-import org.sonar.db.component.BranchDto;
 import org.sonar.db.component.ComponentDto;
-import org.sonar.db.component.SnapshotDto;
 import org.sonar.db.organization.OrganizationDto;
 import org.sonarqube.ws.Common;
 import org.sonarqube.ws.WsCe;
@@ -83,7 +79,7 @@ public class TaskFormatter {
     setNullable(organizationKey, builder::setOrganization);
     if (dto.getComponentUuid() != null) {
       builder.setComponentId(dto.getComponentUuid());
-      buildComponent(builder, dto.getComponentUuid(), componentDtoCache);
+      setComponent(builder, dto.getComponentUuid(), componentDtoCache);
     }
     builder.setId(dto.getUuid());
     builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name()));
@@ -93,13 +89,8 @@ public class TaskFormatter {
     builder.setSubmittedAt(formatDateTime(new Date(dto.getCreatedAt())));
     setNullable(dto.getStartedAt(), builder::setStartedAt, DateUtils::formatDateTime);
     setNullable(computeExecutionTimeMs(dto), builder::setExecutionTimeMs);
-    builder.setIncremental(componentDtoCache.hasIncrementalCharacteristic(dto.getUuid()));
-    componentDtoCache.getBranchName(dto.getUuid()).ifPresent(
-      b -> {
-        builder.setBranch(b);
-        builder.setBranchType(componentDtoCache.getBranchType(dto.getUuid())
-          .orElseThrow(() -> new IllegalStateException(format("Could not find branch type of '%s'", dto.getUuid()))));
-      });
+    setIncremental(builder, dto.getUuid(), componentDtoCache);
+    setBranch(builder, dto.getUuid(), componentDtoCache);
     return builder.build();
   }
 
@@ -123,13 +114,13 @@ public class TaskFormatter {
     builder.setStatus(WsCe.TaskStatus.valueOf(dto.getStatus().name()));
     builder.setType(dto.getTaskType());
     builder.setLogs(false);
-    setNullable(dto.getComponentUuid(), uuid -> buildComponent(builder, uuid, componentDtoCache).setComponentId(uuid));
+    setNullable(dto.getComponentUuid(), uuid -> setComponent(builder, uuid, componentDtoCache).setComponentId(uuid));
     String analysisUuid = dto.getAnalysisUuid();
     if (analysisUuid != null) {
       builder.setAnalysisId(analysisUuid);
     }
-    SnapshotDto analysis = analysisUuid == null ? null : componentDtoCache.getAnalysis(analysisUuid);
-    builder.setIncremental(analysis != null && analysis.getIncremental());
+    setIncremental(builder, dto.getUuid(), componentDtoCache);
+    setBranch(builder, dto.getUuid(), componentDtoCache);
     setNullable(analysisUuid, builder::setAnalysisId);
     setNullable(dto.getSubmitterLogin(), builder::setSubmitterLogin);
     builder.setSubmittedAt(formatDateTime(new Date(dto.getSubmittedAt())));
@@ -143,7 +134,7 @@ public class TaskFormatter {
     return builder.build();
   }
 
-  private static WsCe.Task.Builder buildComponent(WsCe.Task.Builder builder, @Nullable String componentUuid, DtoCache componentDtoCache) {
+  private static WsCe.Task.Builder setComponent(WsCe.Task.Builder builder, @Nullable String componentUuid, DtoCache componentDtoCache) {
     ComponentDto componentDto = componentDtoCache.getComponent(componentUuid);
     if (componentDto == null) {
       return builder;
@@ -151,29 +142,34 @@ public class TaskFormatter {
     builder.setComponentKey(componentDto.getKey());
     builder.setComponentName(componentDto.name());
     builder.setComponentQualifier(componentDto.qualifier());
-    String branch = componentDto.getBranch();
-    if (branch == null) {
-      return builder;
-    }
-    builder.setBranch(branch);
-    builder.setBranchType(Common.BranchType.valueOf(componentDtoCache.getBranch(componentUuid).getBranchType().name()));
+    return builder;
+  }
+
+  private static WsCe.Task.Builder setIncremental(WsCe.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) {
+    builder.setIncremental(componentDtoCache.hasIncrementalCharacteristic(taskUuid));
+    return builder;
+  }
+
+  private static WsCe.Task.Builder setBranch(WsCe.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) {
+    componentDtoCache.getBranchName(taskUuid).ifPresent(
+      b -> {
+        builder.setBranch(b);
+        builder.setBranchType(componentDtoCache.getBranchType(taskUuid)
+          .orElseThrow(() -> new IllegalStateException(format("Could not find branch type of task '%s'", taskUuid))));
+      });
     return builder;
   }
 
   private static class DtoCache {
     private final Map<String, ComponentDto> componentsByUuid;
     private final Map<String, OrganizationDto> organizationsByUuid;
-    private final Map<String, SnapshotDto> analysisByUuid;
-    private final Map<String, BranchDto> branchesByUuid;
     private final Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid;
 
-    private DtoCache(Map<String, ComponentDto> componentsByUuid, Map<String, OrganizationDto> organizationsByUuid, Map<String, SnapshotDto> analysisByUuid,
-      Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid, Map<String, BranchDto> branchesByUuid) {
+    private DtoCache(Map<String, ComponentDto> componentsByUuid, Map<String, OrganizationDto> organizationsByUuid,
+      Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid) {
       this.componentsByUuid = componentsByUuid;
       this.organizationsByUuid = organizationsByUuid;
-      this.analysisByUuid = analysisByUuid;
       this.characteristicsByTaskUuid = characteristicsByTaskUuid;
-      this.branchesByUuid = branchesByUuid;
     }
 
     static DtoCache forQueueDtos(DbClient dbClient, DbSession dbSession, Collection<CeQueueDto> ceQueueDtos) {
@@ -183,10 +179,7 @@ public class TaskFormatter {
       Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
         .selectByTaskUuids(dbSession, ceQueueDtos.stream().map(CeQueueDto::getUuid).collect(Collectors.toList()))
         .stream().collect(MoreCollectors.index(CeTaskCharacteristicDto::getTaskUuid));
-      Map<String, BranchDto> branchesByUuid = dbClient.branchDao().selectByUuids(dbSession, componentsByUuid.keySet()).stream()
-        .collect(MoreCollectors.uniqueIndex(BranchDto::getUuid));
-      return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), Collections.emptyMap(), characteristicsByTaskUuid,
-        branchesByUuid);
+      return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), characteristicsByTaskUuid);
     }
 
     private static Set<String> uuidOfCeQueueDtos(Collection<CeQueueDto> ceQueueDtos) {
@@ -203,12 +196,10 @@ public class TaskFormatter {
         uuidOfCeActivityDtos(ceActivityDtos))
         .stream()
         .collect(MoreCollectors.uniqueIndex(ComponentDto::uuid));
-      Set<String> analysisUuids = ceActivityDtos.stream().map(CeActivityDto::getAnalysisUuid).filter(Objects::nonNull).collect(MoreCollectors.toSet());
-      Map<String, SnapshotDto> analysisByUuid = dbClient.snapshotDao().selectByUuids(dbSession, analysisUuids).stream().collect(MoreCollectors.uniqueIndex(SnapshotDto::getUuid));
-      Map<String, BranchDto> branchesByUuid = dbClient.branchDao().selectByUuids(dbSession, componentsByUuid.keySet()).stream()
-        .collect(MoreCollectors.uniqueIndex(BranchDto::getUuid));
-      return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), analysisByUuid,
-        ImmutableMultimap.<String, CeTaskCharacteristicDto>builder().build(), branchesByUuid);
+      Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
+        .selectByTaskUuids(dbSession, ceActivityDtos.stream().map(CeActivityDto::getUuid).collect(Collectors.toList()))
+        .stream().collect(MoreCollectors.index(CeTaskCharacteristicDto::getTaskUuid));
+      return new DtoCache(componentsByUuid, buildOrganizationsByUuid(dbClient, dbSession, componentsByUuid), characteristicsByTaskUuid);
     }
 
     private static Set<String> uuidOfCeActivityDtos(Collection<CeActivityDto> ceActivityDtos) {
@@ -252,16 +243,6 @@ public class TaskFormatter {
       return organizationDto.getKey();
     }
 
-    @CheckForNull
-    SnapshotDto getAnalysis(String analysisUuid) {
-      return analysisByUuid.get(analysisUuid);
-    }
-
-    @CheckForNull
-    BranchDto getBranch(String componentUuid) {
-      return branchesByUuid.get(componentUuid);
-    }
-
     boolean hasIncrementalCharacteristic(String taskUuid) {
       return characteristicsByTaskUuid.get(taskUuid).stream()
         .filter(c -> c.getKey().equals(CeTaskCharacteristicDto.INCREMENTAL_KEY))
index 57e4354b7e4f8da263ddcc5110f29cbbb9560081..85297de65b279f01042be4560f14a01317891e36 100644 (file)
@@ -347,7 +347,8 @@ public class ActivityActionTest {
   public void incremental_analysis_on_single_project() {
     ComponentDto project = db.components().insertPrivateProject();
     SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    CeActivityDto activity = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    insertCharacteristic(activity, INCREMENTAL_KEY, "true");
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
 
     ActivityResponse activityResponse = call(ws.newRequest()
@@ -363,7 +364,8 @@ public class ActivityActionTest {
     ComponentDto project = db.components().insertPrivateProject();
     SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
     SnapshotDto standardAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(false));
-    insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    CeActivityDto incrementalTask = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    insertCharacteristic(incrementalTask, INCREMENTAL_KEY, "true");
     insertActivity("T2", project, SUCCESS, standardAnalysis);
     logInAsSystemAdministrator();
 
@@ -381,7 +383,8 @@ public class ActivityActionTest {
   public void incremental_analysis_on_search_uuid() {
     ComponentDto project = db.components().insertPrivateProject();
     SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    CeActivityDto activity = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    insertCharacteristic(activity, INCREMENTAL_KEY, "true");
     logInAsSystemAdministrator();
 
     ActivityResponse activityResponse = call(ws.newRequest()
@@ -419,7 +422,9 @@ public class ActivityActionTest {
     userSession.addProjectPermission(UserRole.USER, project);
     ComponentDto longLivingBranch = db.components().insertProjectBranch(project, b -> b.setBranchType(LONG));
     SnapshotDto analysis = db.components().insertSnapshot(longLivingBranch);
-    insertActivity("T1", longLivingBranch, SUCCESS, analysis);
+    CeActivityDto activity = insertActivity("T1", project, SUCCESS, analysis);
+    insertCharacteristic(activity, BRANCH_KEY, longLivingBranch.getBranch());
+    insertCharacteristic(activity, BRANCH_TYPE_KEY, LONG.name());
 
     ActivityResponse response = ws.newRequest().executeProtobuf(ActivityResponse.class);
 
@@ -566,9 +571,17 @@ public class ActivityActionTest {
   }
 
   private CeTaskCharacteristicDto insertCharacteristic(CeQueueDto queueDto, String key, String value) {
+    return insertCharacteristic(queueDto.getUuid(), key, value);
+  }
+
+  private CeTaskCharacteristicDto insertCharacteristic(CeActivityDto activityDto, String key, String value) {
+    return insertCharacteristic(activityDto.getUuid(), key, value);
+  }
+
+  private CeTaskCharacteristicDto insertCharacteristic(String taskUuid, String key, String value) {
     CeTaskCharacteristicDto dto = new CeTaskCharacteristicDto()
       .setUuid(Uuids.createFast())
-      .setTaskUuid(queueDto.getUuid())
+      .setTaskUuid(taskUuid)
       .setKey(key)
       .setValue(value);
     db.getDbClient().ceTaskCharacteristicsDao().insert(db.getSession(), Collections.singletonList(dto));
index 01b223801ab864670269e5ac9e0bfe9ff9935d9e..02dc23d6a80ed33d3a5c3a6eb2bcd6bb4f0853c2 100644 (file)
@@ -46,8 +46,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.db.ce.CeQueueTesting.newCeQueueDto;
 import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
 import static org.sonar.test.JsonAssert.assertJson;
+import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_KEY;
 
 public class ActivityStatusActionTest {
 
@@ -192,7 +192,7 @@ public class ActivityStatusActionTest {
       request.setParam(PARAM_COMPONENT_ID, componentUuid);
     }
     if (componentKey != null) {
-      request.setParam(PARAM_COMPONENT_KEY, componentKey);
+      request.setParam(DEPRECATED_PARAM_COMPONENT_KEY, componentKey);
     }
     return request.executeProtobuf(WsCe.ActivityStatusWsResponse.class);
   }
index 9672520e1eb77a107f16da4169d72258e49a4c67..aabe69a6f3b20ff1ddd53e976aefc37d18bb9abf 100644 (file)
@@ -53,10 +53,9 @@ import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY;
 import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY;
 import static org.sonar.db.ce.CeTaskCharacteristicDto.INCREMENTAL_KEY;
 import static org.sonar.db.component.BranchType.LONG;
-import static org.sonar.db.component.ComponentTesting.newFileDto;
+import static org.sonar.db.component.BranchType.SHORT;
+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.measure.MeasuresWsParameters.PARAM_BRANCH;
 
 public class ComponentActionTest {
 
@@ -77,7 +76,7 @@ public class ComponentActionTest {
     userSession.addProjectPermission(UserRole.USER, project);
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentId", project.uuid())
+      .setParam(PARAM_COMPONENT, project.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
 
     assertThat(response.getQueueCount()).isEqualTo(0);
@@ -98,7 +97,7 @@ public class ComponentActionTest {
     insertQueue("T5", project1, PENDING);
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentId", project1.uuid())
+      .setParam(PARAM_COMPONENT, project1.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
     assertThat(response.getQueueCount()).isEqualTo(2);
     assertThat(response.getQueue(0).getId()).isEqualTo("T4");
@@ -122,7 +121,22 @@ public class ComponentActionTest {
     insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis);
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEY, project.getDbKey())
+      .setParam(PARAM_COMPONENT, project.getDbKey())
+      .executeProtobuf(WsCe.ProjectResponse.class);
+    assertThat(response.hasCurrent()).isTrue();
+    assertThat(response.getCurrent().getId()).isEqualTo("T1");
+    assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid());
+  }
+
+  @Test
+  public void search_tasks_by_component_id() {
+    ComponentDto project = db.components().insertPrivateProject();
+    logInWithBrowsePermission(project);
+    SnapshotDto analysis = db.components().insertSnapshot(project);
+    insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis);
+
+    WsCe.ProjectResponse response = ws.newRequest()
+      .setParam(PARAM_COMPONENT_ID, project.uuid())
       .executeProtobuf(WsCe.ProjectResponse.class);
     assertThat(response.hasCurrent()).isTrue();
     assertThat(response.getCurrent().getId()).isEqualTo("T1");
@@ -140,7 +154,7 @@ public class ComponentActionTest {
     insertActivity("T5", project, CeActivityDto.Status.CANCELED);
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentId", project.uuid())
+      .setParam(PARAM_COMPONENT, project.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
     assertThat(response.getQueueCount()).isEqualTo(0);
     // T3 is the latest task executed on PROJECT_1 ignoring Canceled ones
@@ -148,31 +162,16 @@ public class ComponentActionTest {
     assertThat(response.getCurrent().getId()).isEqualTo("T3");
   }
 
-  @Test
-  public void incremental_analysis_by_component_id() {
-    ComponentDto project = db.components().insertPrivateProject();
-    userSession.logIn().addProjectPermission(UserRole.USER, project);
-    SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    insertActivity("T1", project, SUCCESS, incrementalAnalysis);
-
-    WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentId", project.uuid())
-      .executeProtobuf(WsCe.ProjectResponse.class);
-
-    assertThat(response.getCurrent())
-      .extracting(WsCe.Task::getId, WsCe.Task::getIncremental)
-      .containsExactlyInAnyOrder("T1", true);
-  }
-
   @Test
   public void incremental_analysis_by_component_key() {
     ComponentDto project = db.components().insertPrivateProject();
     userSession.logIn().addProjectPermission(UserRole.USER, project);
     SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    CeActivityDto activity = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
+    insertCharacteristic(activity, INCREMENTAL_KEY, "true");
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentKey", project.getKey())
+      .setParam(PARAM_COMPONENT, project.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
 
     assertThat(response.getCurrent())
@@ -191,7 +190,7 @@ public class ComponentActionTest {
     insertCharacteristic(queue2, INCREMENTAL_KEY, "true");
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentId", project.uuid())
+      .setParam(PARAM_COMPONENT, project.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
 
     assertThat(response.getQueueList())
@@ -207,17 +206,18 @@ public class ComponentActionTest {
     userSession.addProjectPermission(UserRole.USER, project);
     ComponentDto longLivingBranch = db.components().insertProjectBranch(project, b -> b.setBranchType(LONG));
     SnapshotDto analysis = db.components().insertSnapshot(longLivingBranch);
-    insertActivity("T1", longLivingBranch, SUCCESS, analysis);
+    CeActivityDto activity = insertActivity("T1", project, SUCCESS, analysis);
+    insertCharacteristic(activity, BRANCH_KEY, longLivingBranch.getBranch());
+    insertCharacteristic(activity, BRANCH_TYPE_KEY, LONG.name());
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentKey", longLivingBranch.getKey())
-      .setParam("branch", longLivingBranch.getBranch())
+      .setParam(PARAM_COMPONENT, project.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
 
     assertThat(response.getCurrent())
       .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey)
       .containsOnly(
-        "T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.SUCCESS, longLivingBranch.getKey());
+        "T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.SUCCESS, project.getKey());
   }
 
   @Test
@@ -225,30 +225,73 @@ public class ComponentActionTest {
     ComponentDto project = db.components().insertMainBranch();
     userSession.addProjectPermission(UserRole.USER, project);
     ComponentDto longLivingBranch = db.components().insertProjectBranch(project, b -> b.setBranchType(LONG));
-    CeQueueDto queue1 = insertQueue("T1", longLivingBranch, IN_PROGRESS);
+    CeQueueDto queue1 = insertQueue("T1", project, IN_PROGRESS);
     insertCharacteristic(queue1, BRANCH_KEY, longLivingBranch.getBranch());
     insertCharacteristic(queue1, BRANCH_TYPE_KEY, LONG.name());
-    CeQueueDto queue2 = insertQueue("T2", longLivingBranch, PENDING);
+    CeQueueDto queue2 = insertQueue("T2", project, PENDING);
     insertCharacteristic(queue2, BRANCH_KEY, longLivingBranch.getBranch());
     insertCharacteristic(queue2, BRANCH_TYPE_KEY, LONG.name());
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam("componentKey", longLivingBranch.getKey())
-      .setParam("branch", longLivingBranch.getBranch())
+      .setParam(PARAM_COMPONENT, longLivingBranch.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
 
     assertThat(response.getQueueList())
       .extracting(WsCe.Task::getId, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getStatus, WsCe.Task::getComponentKey)
       .containsOnly(
-        tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.IN_PROGRESS, longLivingBranch.getKey()),
-        tuple("T2", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.PENDING, longLivingBranch.getKey()));
+        tuple("T1", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.IN_PROGRESS, project.getKey()),
+        tuple("T2", longLivingBranch.getBranch(), Common.BranchType.LONG, WsCe.TaskStatus.PENDING, project.getKey()));
+  }
+
+  @Test
+  public void return_many_tasks_from_same_project() {
+    ComponentDto project = db.components().insertMainBranch();
+    userSession.addProjectPermission(UserRole.USER, project);
+    insertQueue("Main", project, IN_PROGRESS);
+    ComponentDto longLivingBranch = db.components().insertProjectBranch(project, b -> b.setBranchType(LONG).setKey("long-branch"));
+    CeQueueDto longLivingBranchQueue = insertQueue("Long", project, IN_PROGRESS);
+    insertCharacteristic(longLivingBranchQueue, BRANCH_KEY, longLivingBranch.getBranch());
+    insertCharacteristic(longLivingBranchQueue, BRANCH_TYPE_KEY, LONG.name());
+    ComponentDto shortLivingBranch = db.components().insertProjectBranch(project, b -> b.setBranchType(SHORT).setKey("short-branch"));
+    CeQueueDto shortLivingBranchQueue = insertQueue("Short", project, PENDING);
+    insertCharacteristic(shortLivingBranchQueue, BRANCH_KEY, shortLivingBranch.getBranch());
+    insertCharacteristic(shortLivingBranchQueue, BRANCH_TYPE_KEY, SHORT.name());
+    CeQueueDto incrementalQueue = insertQueue("Incremental", project, PENDING);
+    insertCharacteristic(incrementalQueue, INCREMENTAL_KEY, "true");
+
+    WsCe.ProjectResponse response = ws.newRequest()
+      .setParam(PARAM_COMPONENT, longLivingBranch.getKey())
+      .executeProtobuf(WsCe.ProjectResponse.class);
+
+    assertThat(response.getQueueList())
+      .extracting(WsCe.Task::getId, WsCe.Task::getComponentKey, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getIncremental)
+      .containsOnly(
+        tuple("Main", project.getKey(), "", Common.BranchType.UNKNOWN_BRANCH_TYPE, false),
+        tuple("Long", longLivingBranch.getKey(), longLivingBranch.getBranch(), Common.BranchType.LONG, false),
+        tuple("Short", shortLivingBranch.getKey(), shortLivingBranch.getBranch(), Common.BranchType.SHORT, false),
+        tuple("Incremental", project.getKey(), "", Common.BranchType.UNKNOWN_BRANCH_TYPE, true));
+  }
+
+  @Test
+  public void deprecated_component_key() {
+    ComponentDto project = db.components().insertPrivateProject();
+    logInWithBrowsePermission(project);
+    SnapshotDto analysis = db.components().insertSnapshot(project);
+    insertActivity("T1", project, CeActivityDto.Status.SUCCESS, analysis);
+
+    WsCe.ProjectResponse response = ws.newRequest()
+      .setParam("componentKey", project.getKey())
+      .executeProtobuf(WsCe.ProjectResponse.class);
+    assertThat(response.hasCurrent()).isTrue();
+    assertThat(response.getCurrent().getId()).isEqualTo("T1");
+    assertThat(response.getCurrent().getAnalysisId()).isEqualTo(analysis.getUuid());
   }
 
   @Test
   public void fail_with_404_when_component_does_not_exist() throws Exception {
     expectedException.expect(NotFoundException.class);
     ws.newRequest()
-      .setParam("componentId", "UNKNOWN")
+      .setParam(PARAM_COMPONENT, "UNKNOWN")
       .setMediaType(MediaTypes.PROTOBUF)
       .execute();
   }
@@ -262,7 +305,7 @@ public class ComponentActionTest {
     expectedException.expectMessage("Insufficient privileges");
 
     ws.newRequest()
-      .setParam(PARAM_COMPONENT_ID, project.uuid())
+      .setParam(PARAM_COMPONENT, project.getKey())
       .execute();
   }
 
@@ -274,38 +317,6 @@ public class ComponentActionTest {
     ws.newRequest().execute();
   }
 
-  @Test
-  public void fail_if_branch_does_not_exist() {
-    ComponentDto project = db.components().insertPrivateProject();
-    ComponentDto file = db.components().insertComponent(newFileDto(project));
-    userSession.addProjectPermission(UserRole.USER, project);
-    db.components().insertProjectBranch(project, b -> b.setKey("my_branch"));
-
-    expectedException.expect(NotFoundException.class);
-    expectedException.expectMessage(String.format("Component '%s' on branch '%s' not found", file.getKey(), "another_branch"));
-
-    ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEY, file.getKey())
-      .setParam(PARAM_BRANCH, "another_branch")
-      .execute();
-  }
-
-  @Test
-  public void fail_when_componentId_and_branch_params_are_used_together() {
-    ComponentDto project = db.components().insertPrivateProject();
-    ComponentDto file = db.components().insertComponent(newFileDto(project));
-    userSession.addProjectPermission(UserRole.USER, project);
-    db.components().insertProjectBranch(project, b -> b.setKey("my_branch"));
-
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("'componentId' and 'branch' parameters cannot be used at the same time");
-
-    ws.newRequest()
-      .setParam(PARAM_COMPONENT_ID, file.uuid())
-      .setParam(PARAM_BRANCH, "my_branch")
-      .execute();
-  }
-
   private void logInWithBrowsePermission(ComponentDto project) {
     userSession.logIn().addProjectPermission(UserRole.USER, project);
   }
@@ -340,9 +351,17 @@ public class ComponentActionTest {
   }
 
   private CeTaskCharacteristicDto insertCharacteristic(CeQueueDto queueDto, String key, String value) {
+    return insertCharacteristic(queueDto.getUuid(), key, value);
+  }
+
+  private CeTaskCharacteristicDto insertCharacteristic(CeActivityDto activityDto, String key, String value) {
+    return insertCharacteristic(activityDto.getUuid(), key, value);
+  }
+
+  private CeTaskCharacteristicDto insertCharacteristic(String taskUuid, String key, String value) {
     CeTaskCharacteristicDto dto = new CeTaskCharacteristicDto()
       .setUuid(Uuids.createFast())
-      .setTaskUuid(queueDto.getUuid())
+      .setTaskUuid(taskUuid)
       .setKey(key)
       .setValue(value);
     db.getDbClient().ceTaskCharacteristicsDao().insert(db.getSession(), Collections.singletonList(dto));
index efee0ee2c4d2c3f740637625dfaab68dd869dcea..b2f66b0eff1b235b5db034bd7873940e0114aae2 100644 (file)
@@ -36,7 +36,6 @@ import org.sonar.db.ce.CeQueueDto;
 import org.sonar.db.ce.CeTaskCharacteristicDto;
 import org.sonar.db.ce.CeTaskTypes;
 import org.sonar.db.component.ComponentDto;
-import org.sonar.db.component.SnapshotDto;
 import org.sonar.db.organization.OrganizationDto;
 import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
@@ -146,16 +145,9 @@ public class TaskActionTest {
     logInAsRoot();
 
     ComponentDto project = db.components().insertPrivateProject();
-    SnapshotDto analysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    CeQueueDto queueDto = new CeQueueDto()
-      .setTaskType(CeTaskTypes.REPORT)
-      .setUuid(SOME_TASK_UUID)
-      .setComponentUuid(project.uuid());
-    CeActivityDto activityDto = new CeActivityDto(queueDto)
-      .setStatus(CeActivityDto.Status.FAILED)
-      .setExecutionTimeMs(500L)
-      .setAnalysisUuid(analysis.getUuid());
-    persist(activityDto);
+    db.components().insertSnapshot(project, s -> s.setIncremental(true));
+    CeActivityDto activity = createAndPersistArchivedTask(project);
+    insertCharacteristic(activity, "incremental", "true");
 
     WsCe.TaskResponse taskResponse = ws.newRequest()
       .setParam("id", SOME_TASK_UUID)
@@ -170,16 +162,10 @@ public class TaskActionTest {
     ComponentDto project = db.components().insertMainBranch();
     userSession.addProjectPermission(UserRole.USER, project);
     ComponentDto longLivingBranch = db.components().insertProjectBranch(project, b -> b.setBranchType(LONG));
-    SnapshotDto analysis = db.components().insertSnapshot(longLivingBranch);
-    CeQueueDto queueDto = new CeQueueDto()
-      .setTaskType(CeTaskTypes.REPORT)
-      .setUuid(SOME_TASK_UUID)
-      .setComponentUuid(longLivingBranch.uuid());
-    CeActivityDto activityDto = new CeActivityDto(queueDto)
-      .setStatus(CeActivityDto.Status.FAILED)
-      .setExecutionTimeMs(500L)
-      .setAnalysisUuid(analysis.getUuid());
-    persist(activityDto);
+    db.components().insertSnapshot(longLivingBranch);
+    CeActivityDto activity = createAndPersistArchivedTask(project);
+    insertCharacteristic(activity, BRANCH_KEY, longLivingBranch.getBranch());
+    insertCharacteristic(activity, BRANCH_TYPE_KEY, LONG.name());
 
     WsCe.TaskResponse taskResponse = ws.newRequest()
       .setParam("id", SOME_TASK_UUID)
@@ -436,9 +422,17 @@ public class TaskActionTest {
   }
 
   private CeTaskCharacteristicDto insertCharacteristic(CeQueueDto queueDto, String key, String value) {
+    return insertCharacteristic(queueDto.getUuid(), key, value);
+  }
+
+  private CeTaskCharacteristicDto insertCharacteristic(CeActivityDto activityDto, String key, String value) {
+    return insertCharacteristic(activityDto.getUuid(), key, value);
+  }
+
+  private CeTaskCharacteristicDto insertCharacteristic(String taskUuid, String key, String value) {
     CeTaskCharacteristicDto dto = new CeTaskCharacteristicDto()
       .setUuid(Uuids.createFast())
-      .setTaskUuid(queueDto.getUuid())
+      .setTaskUuid(taskUuid)
       .setKey(key)
       .setValue(value);
     db.getDbClient().ceTaskCharacteristicsDao().insert(db.getSession(), Collections.singletonList(dto));
index 272d6670f47b9a76a74b62a380e38d4798759902..243af50e8b71d24eea59f066e8ef3c35279c526c 100644 (file)
@@ -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());
   }
 
index 680051f2dd2395d161cd8c6fcc41a0c61299a832..9449526952dd5fc3277bc46a870704d465a1a850 100644 (file)
@@ -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
index 9690b295d21e99516a7ddc7ec3d22957028f58cf..a9b566583e3efcc9dae3ae61c25ebfacd753a2a8 100644 (file)
@@ -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;
 
index 39d42729c24ccf52e66ac00112a658694a13b73a..b75aec5e9ccbfc671f02d1b79ceebed57adb5a70 100644 (file)
@@ -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();
   }
 }