]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9140 drop support for Developer in ComponentTesting
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 19 Apr 2017 09:19:35 +0000 (11:19 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 27 Apr 2017 12:25:54 +0000 (14:25 +0200)
12 files changed:
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java
server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/measure/ProjectMeasuresIndexerIteratorTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java

index b82b94c10dacecdf794e9f681029f9f755cd371f..793ea5442bc37492d6d2e59a3c10b0df99cbc3f2 100644 (file)
@@ -50,7 +50,6 @@ import static java.util.Collections.emptySet;
 import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.guava.api.Assertions.assertThat;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newDirectory;
 import static org.sonar.db.component.ComponentTesting.newFileDto;
 import static org.sonar.db.component.ComponentTesting.newModuleDto;
@@ -876,7 +875,6 @@ public class ComponentDaoTest {
     OrganizationDto organizationDto = db.organizations().insert();
     db.components().insertProjectAndSnapshot(newProjectDto(organizationDto).setName("aaaa-name"));
     db.components().insertProjectAndSnapshot(newView(organizationDto));
-    db.components().insertProjectAndSnapshot(newDeveloper(organizationDto, "project-name"));
     for (int i = 9; i >= 1; i--) {
       db.components().insertProjectAndSnapshot(newProjectDto(organizationDto).setName("project-" + i));
     }
index e3091f02626c81942fad4f8e6800580a39f68d67..c0f8870fb822cd19f547ca71391d45c391130507 100644 (file)
@@ -27,7 +27,6 @@ import org.sonar.db.DbTester;
 import org.sonar.db.organization.OrganizationDto;
 
 import static java.util.Arrays.asList;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.ComponentTesting.newView;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
@@ -51,10 +50,6 @@ public class ComponentDbTester {
     return insertComponentAndSnapshot(component);
   }
 
-  public SnapshotDto insertDeveloperAndSnapshot(ComponentDto component) {
-    return insertComponentAndSnapshot(component);
-  }
-
   private SnapshotDto insertComponentAndSnapshot(ComponentDto component) {
     dbClient.componentDao().insert(dbSession, component);
     SnapshotDto snapshot = dbClient.snapshotDao().insert(dbSession, newAnalysis(component));
@@ -113,18 +108,6 @@ public class ComponentDbTester {
     return insertComponentImpl(newView(organizationDto, uuid), noExtraConfiguration());
   }
 
-  public ComponentDto insertDeveloper(String name, Consumer<ComponentDto> dtoPopulator) {
-    return insertComponentImpl(newDeveloper(db.getDefaultOrganization(), name), dtoPopulator);
-  }
-
-  public ComponentDto insertDeveloper(String name) {
-    return insertComponentImpl(newDeveloper(db.getDefaultOrganization(), name), noExtraConfiguration());
-  }
-
-  public ComponentDto insertDeveloper(String name, String uuid) {
-    return insertComponentImpl(newDeveloper(db.getDefaultOrganization(), name, uuid), noExtraConfiguration());
-  }
-
   private static <T> Consumer<T> noExtraConfiguration() {
     return (t) -> {
     };
index cd9d9d20275ac4900fd48ecc5d044b4b3b1c75b1..f053971523954ddc1c1fb3a8dea93e923f3b4541 100644 (file)
@@ -123,33 +123,6 @@ public class ComponentTesting {
       .setEnabled(true);
   }
 
-  public static ComponentDto newDeveloper(OrganizationDto organizationDto, String name) {
-    return newDeveloper(organizationDto.getUuid(), name, Uuids.createFast());
-  }
-
-  public static ComponentDto newDeveloper(OrganizationDto organizationDto, String name, String uuid) {
-    return newDeveloper(organizationDto.getUuid(), name, uuid);
-  }
-
-  private static ComponentDto newDeveloper(String organizationUuid, String name, String uuid) {
-    return new ComponentDto()
-      .setOrganizationUuid(organizationUuid)
-      .setUuid(uuid)
-      .setUuidPath(ComponentDto.UUID_PATH_OF_ROOT)
-      .setProjectUuid(uuid)
-      .setModuleUuidPath(UUID_PATH_SEPARATOR + uuid + UUID_PATH_SEPARATOR)
-      .setRootUuid(uuid)
-      .setKey(uuid)
-      .setName(name)
-      .setLongName(name)
-      .setScope(Scopes.PROJECT)
-      // XXX No constant !
-      .setQualifier("DEV")
-      .setPath(null)
-      .setLanguage(null)
-      .setEnabled(true);
-  }
-
   public static ComponentDto newView(OrganizationDto organizationDto) {
     return newView(organizationDto.getUuid(), Uuids.createFast());
   }
@@ -182,20 +155,6 @@ public class ComponentTesting {
       .setLanguage(null);
   }
 
-  public static ComponentDto newDevProjectCopy(String uuid, ComponentDto project, ComponentDto developer) {
-    checkNotNull(project.getId(), "The project need to be persisted before creating this technical project.");
-    return newChildComponent(uuid, developer, developer)
-      .setUuid(uuid)
-      .setKey(developer.key() + ":" + project.key())
-      .setName(project.name())
-      .setLongName(project.longName())
-      .setCopyComponentUuid(project.uuid())
-      .setScope(Scopes.PROJECT)
-      .setQualifier("DEV_PRJ")
-      .setPath(null)
-      .setLanguage(null);
-  }
-
   public static ComponentDto newChildComponent(String uuid, ComponentDto moduleOrProject, ComponentDto parent) {
     return new ComponentDto()
       .setOrganizationUuid(parent.getOrganizationUuid())
index ee6d84d2792f6994568336d8a57f0d320d19b8a6..3e9d52aae2c3e98ff3ab18a4a387a046013f2a54 100644 (file)
@@ -20,7 +20,6 @@
 package org.sonar.db.measure;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
@@ -28,7 +27,6 @@ import javax.annotation.Nullable;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
-import org.sonar.api.resources.Scopes;
 import org.sonar.api.utils.System2;
 import org.sonar.core.util.UuidFactoryImpl;
 import org.sonar.db.DbClient;
@@ -37,18 +35,14 @@ import org.sonar.db.DbTester;
 import org.sonar.db.component.ComponentDto;
 import org.sonar.db.component.SnapshotDto;
 import org.sonar.db.component.SnapshotTesting;
-import org.sonar.db.organization.OrganizationDto;
 
 import static java.util.Arrays.asList;
 import static java.util.Collections.emptyList;
 import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.resources.Qualifiers.FILE;
-import static org.sonar.api.resources.Qualifiers.PROJECT;
 import static org.sonar.api.resources.Qualifiers.UNIT_TEST_FILE;
-import static org.sonar.api.resources.Qualifiers.VIEW;
 import static org.sonar.api.utils.DateUtils.parseDate;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newFileDto;
 import static org.sonar.db.component.ComponentTesting.newModuleDto;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
@@ -225,46 +219,6 @@ public class MeasureDaoTest {
     selectSingle(MeasureQuery.builder().setComponentUuid("C1"));
   }
 
-  @Test
-  public void selectProjectMeasuresOfDeveloper() {
-    OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto dev = db.components().insertComponent(newDeveloper(organizationDto, "DEV"));
-    insertAnalysis(LAST_ANALYSIS_UUID, dev.uuid(), true);
-    insertAnalysis(PREVIOUS_ANALYSIS_UUID, dev.uuid(), false);
-    List<Integer> allMetricIds = Arrays.asList(NCLOC_METRIC_ID, COMPLEXITY_METRIC_ID, COVERAGE_METRIC_ID);
-    long developerId = dev.getId();
-    assertThat(underTest.selectProjectMeasuresOfDeveloper(db.getSession(), developerId, allMetricIds)).isEmpty();
-
-    String projectUuid = insertComponent(Scopes.PROJECT, PROJECT, true);
-    String viewUuid = insertComponent(Scopes.PROJECT, VIEW, true);
-    String disabledProjectUuid = insertComponent(Scopes.PROJECT, PROJECT, false);
-    insertMeasure("M1", LAST_ANALYSIS_UUID, projectUuid, NCLOC_METRIC_ID);
-    insertMeasure("M2", LAST_ANALYSIS_UUID, projectUuid, COMPLEXITY_METRIC_ID);
-    insertMeasure("M3", LAST_ANALYSIS_UUID, projectUuid, COVERAGE_METRIC_ID);
-    insertMeasure("M4", PREVIOUS_ANALYSIS_UUID, projectUuid, NCLOC_METRIC_ID);
-    insertMeasure("M5", PREVIOUS_ANALYSIS_UUID, projectUuid, COMPLEXITY_METRIC_ID);
-    insertMeasure("M6", PREVIOUS_ANALYSIS_UUID, projectUuid, COVERAGE_METRIC_ID);
-    insertMeasure("M11", LAST_ANALYSIS_UUID, projectUuid, developerId, NCLOC_METRIC_ID);
-    insertMeasure("M12", LAST_ANALYSIS_UUID, projectUuid, developerId, COMPLEXITY_METRIC_ID);
-    insertMeasure("M13", LAST_ANALYSIS_UUID, projectUuid, developerId, COVERAGE_METRIC_ID);
-    insertMeasure("M14", PREVIOUS_ANALYSIS_UUID, projectUuid, NCLOC_METRIC_ID);
-    insertMeasure("M15", PREVIOUS_ANALYSIS_UUID, projectUuid, COMPLEXITY_METRIC_ID);
-    insertMeasure("M16", PREVIOUS_ANALYSIS_UUID, projectUuid, COVERAGE_METRIC_ID);
-    insertMeasure("M51", LAST_ANALYSIS_UUID, viewUuid, NCLOC_METRIC_ID);
-    insertMeasure("M52", LAST_ANALYSIS_UUID, viewUuid, COMPLEXITY_METRIC_ID);
-    insertMeasure("M53", LAST_ANALYSIS_UUID, viewUuid, COVERAGE_METRIC_ID);
-    insertMeasure("M54", LAST_ANALYSIS_UUID, disabledProjectUuid, developerId, NCLOC_METRIC_ID);
-    insertMeasure("M55", LAST_ANALYSIS_UUID, disabledProjectUuid, developerId, COMPLEXITY_METRIC_ID);
-    insertMeasure("M56", LAST_ANALYSIS_UUID, disabledProjectUuid, developerId, COVERAGE_METRIC_ID);
-
-    assertThat(underTest.selectProjectMeasuresOfDeveloper(db.getSession(), developerId, allMetricIds))
-      .extracting(MeasureDto::getData)
-      .containsOnly("M11", "M12", "M13", "M54", "M55", "M56");
-    assertThat(underTest.selectProjectMeasuresOfDeveloper(db.getSession(), developerId, singletonList(NCLOC_METRIC_ID)))
-      .extracting(MeasureDto::getData)
-      .containsOnly("M11", "M54");
-  }
-
   @Test
   public void select_tree_by_query() {
     ComponentDto project = db.components().insertProject();
index 1adb5696bca8ccb395c6d48c38e5491d048490fe..5175730b11e250dfa55876fefa8e447cc87be36e 100644 (file)
@@ -47,7 +47,6 @@ import static org.sonar.api.measures.Metric.ValueType.DISTRIB;
 import static org.sonar.api.measures.Metric.ValueType.INT;
 import static org.sonar.api.measures.Metric.ValueType.LEVEL;
 import static org.sonar.api.measures.Metric.ValueType.STRING;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.ComponentTesting.newView;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
@@ -204,9 +203,6 @@ public class ProjectMeasuresIndexerIteratorTest {
     // A view
     dbTester.components().insertProjectAndSnapshot(newView(dbTester.getDefaultOrganization()));
 
-    // A developer
-    dbTester.components().insertProjectAndSnapshot(newDeveloper(dbTester.getDefaultOrganization(), "dev"));
-
     dbSession.commit();
 
     assertResultSetIsEmpty();
index 73e57f68478acb0ee4ca7c798d765f901f162c7f..272b1233010ba2e3a0ce713e7a50ec434f1cff2b 100644 (file)
@@ -52,7 +52,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.sonar.api.utils.DateUtils.formatDate;
 import static org.sonar.api.utils.DateUtils.formatDateTime;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.ComponentTesting.newView;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
@@ -256,19 +255,16 @@ public class ActivityActionTest {
   }
 
   @Test
-  public void search_activity_returns_views_and_developers() {
+  public void search_activity_returns_views() {
     OrganizationDto organizationDto = dbTester.organizations().insert();
     ComponentDto apacheView = newView(organizationDto).setName("Apache View").setUuid("V1").setProjectUuid("V1");
-    ComponentDto developer = newDeveloper(organizationDto, "Apache Developer").setUuid("D1").setProjectUuid("D1");
-    dbTester.components().insertDeveloperAndSnapshot(developer);
     dbTester.components().insertViewAndSnapshot(apacheView);
     logInAsSystemAdministrator();
-    insertActivity("T1", "D1", CeActivityDto.Status.SUCCESS);
     insertActivity("T2", "V1", CeActivityDto.Status.SUCCESS);
 
     ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac"));
 
-    assertThat(activityResponse.getTasksList()).extracting("id").containsOnly("T1", "T2");
+    assertThat(activityResponse.getTasksList()).extracting("id").containsOnly("T2");
   }
 
   @Test
index 447a6bc61a63dcd42809ea79c5910ee2df46aeb5..9d806cc5db451021fdf546d834a34888a3f22d3d 100644 (file)
@@ -55,7 +55,6 @@ import org.sonar.server.ws.KeyExamples;
 import org.sonar.server.ws.TestRequest;
 import org.sonar.server.ws.WsActionTester;
 import org.sonarqube.ws.Common;
-import org.sonarqube.ws.MediaTypes;
 import org.sonarqube.ws.WsComponents.Component;
 import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse;
 import org.sonarqube.ws.client.component.SearchProjectsRequest;
@@ -78,7 +77,6 @@ import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
 import static org.sonar.api.server.ws.WebService.Param.SORT;
 import static org.sonar.api.utils.DateUtils.formatDateTime;
 import static org.sonar.core.util.stream.MoreCollectors.toList;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newDirectory;
 import static org.sonar.db.component.ComponentTesting.newFileDto;
 import static org.sonar.db.component.ComponentTesting.newModuleDto;
@@ -228,7 +226,7 @@ public class SearchProjectsActionTest {
     ComponentDto project = newProjectDto(organizationDto).setName("SonarQube");
     ComponentDto directory = newDirectory(project, "path");
     insertProjectInDbAndEs(project);
-    componentDb.insertComponents(newModuleDto(project), newView(organizationDto), newDeveloper(organizationDto, "Sonar Developer"), directory, newFileDto(project, directory));
+    componentDb.insertComponents(newModuleDto(project), newView(organizationDto), directory, newFileDto(project, directory));
 
     SearchProjectsWsResponse result = call(request);
 
index f47c7508ca4ce56fef98707588a8a53ce324c1f5..6e83228d6187bcc1908d0daf050f0b1f65727f34 100644 (file)
@@ -57,8 +57,6 @@ import org.sonarqube.ws.WsComponents.TreeWsResponse;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.db.component.ComponentTesting.newDevProjectCopy;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newDirectory;
 import static org.sonar.db.component.ComponentTesting.newModuleDto;
 import static org.sonar.db.component.ComponentTesting.newProjectCopy;
@@ -263,24 +261,6 @@ public class TreeActionTest {
     assertThat(response.getPaging().getPageIndex()).isEqualTo(1);
   }
 
-  @Test
-  public void return_developers() {
-    ComponentDto project = newProjectDto(db.getDefaultOrganization(), "project-uuid");
-    componentDb.insertProjectAndSnapshot(project);
-    ComponentDto developer = newDeveloper(db.organizations().insert(), "developer-name");
-    componentDb.insertDeveloperAndSnapshot(developer);
-    componentDb.insertComponent(newDevProjectCopy("project-copy-uuid", project, developer));
-    db.commit();
-    logInWithBrowsePermission(developer);
-
-    TreeWsResponse response = ws.newRequest().setParam(PARAM_COMPONENT_ID, developer.uuid()).executeProtobuf(TreeWsResponse.class);
-
-    assertThat(response.getBaseComponent().getId()).isEqualTo(developer.uuid());
-    assertThat(response.getComponentsCount()).isEqualTo(1);
-    assertThat(response.getComponents(0).getId()).isEqualTo("project-copy-uuid");
-    assertThat(response.getComponents(0).getRefId()).isEqualTo("project-uuid");
-  }
-
   @Test
   public void return_projects_composing_a_view() {
     ComponentDto project = newProjectDto(db.organizations().insert(), "project-uuid");
@@ -395,7 +375,7 @@ public class TreeActionTest {
     ComponentDto project = newProjectDto(organizationDto, "MY_PROJECT_ID")
       .setKey("MY_PROJECT_KEY")
       .setName("Project Name");
-    SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project);
+    componentDb.insertProjectAndSnapshot(project);
     Date now = new Date();
     JsonParser jsonParser = new JsonParser();
     JsonElement jsonTree = jsonParser.parse(IOUtils.toString(getClass().getResource("tree-example.json"), UTF_8));
index 8ae3aabc8053fe1ab6e2520edc34c281c8fa64fb..f1147f2bf0dbd034a70b0a6a240988cf90683672 100644 (file)
@@ -34,7 +34,6 @@ import org.sonar.db.component.ComponentDto;
 import org.sonar.db.component.SnapshotDto;
 import org.sonar.db.component.SnapshotTesting;
 import org.sonar.db.metric.MetricDto;
-import org.sonar.db.organization.OrganizationDto;
 import org.sonar.server.component.ComponentFinder;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
@@ -45,7 +44,6 @@ import org.sonarqube.ws.WsMeasures.ComponentWsResponse;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.utils.DateUtils.parseDateTime;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newFileDto;
 import static org.sonar.db.component.ComponentTesting.newProjectCopy;
 import static org.sonar.db.component.ComponentTesting.newProjectDto;
@@ -56,7 +54,6 @@ import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT_ID;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
 
 public class ComponentActionTest {
@@ -138,54 +135,6 @@ public class ComponentActionTest {
     assertThat(response.getComponent().getRefKey()).isEqualTo("project-key");
   }
 
-  @Test
-  public void developer_measure_by_developer_uuid() {
-    OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto developer = newDeveloper(organizationDto, "developer-name");
-    componentDb.insertDeveloperAndSnapshot(developer);
-    ComponentDto project = newProjectDto(organizationDto, "project-uuid");
-    SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project);
-    ComponentDto file = newFileDto(project, null, "file-uuid");
-    componentDb.insertComponent(file);
-    MetricDto ncloc = insertNclocMetric();
-    dbClient.measureDao().insert(dbSession,
-      newMeasureDto(ncloc, file, projectSnapshot).setValue(42.0d).setDeveloperId(null),
-      newMeasureDto(ncloc, file, projectSnapshot).setValue(1984.0d).setDeveloperId(developer.getId()));
-    db.commit();
-
-    ComponentWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_ID, "file-uuid")
-      .setParam(PARAM_DEVELOPER_ID, developer.uuid())
-      .setParam(PARAM_METRIC_KEYS, "ncloc").executeProtobuf(ComponentWsResponse.class);
-
-    assertThat(result.getComponent().getMeasuresCount()).isEqualTo(1);
-    assertThat(result.getComponent().getMeasures(0).getValue()).isEqualTo("1984");
-  }
-
-  @Test
-  public void developer_measure_by_developer_key() {
-    OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto developer = newDeveloper(organizationDto, "developer-name");
-    componentDb.insertDeveloperAndSnapshot(developer);
-    ComponentDto project = newProjectDto(organizationDto, PROJECT_UUID);
-    SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project);
-    ComponentDto file = newFileDto(project, null, "file-uuid");
-    componentDb.insertComponent(file);
-    MetricDto ncloc = insertNclocMetric();
-    dbClient.measureDao().insert(dbSession,
-      newMeasureDto(ncloc, file, projectSnapshot).setValue(42.0d).setDeveloperId(null),
-      newMeasureDto(ncloc, file, projectSnapshot).setValue(1984.0d).setDeveloperId(developer.getId()));
-    db.commit();
-
-    ComponentWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_ID, "file-uuid")
-      .setParam(PARAM_DEVELOPER_KEY, developer.key())
-      .setParam(PARAM_METRIC_KEYS, "ncloc").executeProtobuf(ComponentWsResponse.class);
-
-    assertThat(result.getComponent().getMeasuresCount()).isEqualTo(1);
-    assertThat(result.getComponent().getMeasures(0).getValue()).isEqualTo("1984");
-  }
-
   @Test
   public void fail_when_developer_is_not_found() {
     expectedException.expect(NotFoundException.class);
index 95a9f77d4bb143721101a7cfdb4fbd5f6514f7c4..b40064b13049f2c1508be7e6916ab22e79404bcd 100644 (file)
@@ -58,14 +58,11 @@ import static org.sonar.api.measures.Metric.ValueType.FLOAT;
 import static org.sonar.api.measures.Metric.ValueType.INT;
 import static org.sonar.api.measures.Metric.ValueType.RATING;
 import static org.sonar.api.utils.DateUtils.parseDateTime;
-import static org.sonar.db.component.ComponentTesting.newDevProjectCopy;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newDirectory;
 import static org.sonar.db.component.ComponentTesting.newFileDto;
 import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
 import static org.sonar.db.measure.MeasureTesting.newMeasureDto;
-import static org.sonar.server.measure.ws.ComponentTreeAction.CHILDREN_STRATEGY;
 import static org.sonar.server.measure.ws.ComponentTreeAction.LEAVES_STRATEGY;
 import static org.sonar.server.measure.ws.ComponentTreeAction.METRIC_PERIOD_SORT;
 import static org.sonar.server.measure.ws.ComponentTreeAction.METRIC_SORT;
@@ -75,8 +72,6 @@ import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.ADDITIONAL_PERIODS;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BASE_COMPONENT_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
-import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_PERIOD_SORT;
 import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT;
@@ -416,90 +411,6 @@ public class ComponentTreeActionTest {
       .doesNotContain("file-uuid-4");
   }
 
-  @Test
-  public void load_developer_descendants() {
-    ComponentDto project = newProjectDto(db.getDefaultOrganization(), "project-uuid").setKey("project-key");
-    componentDb.insertProjectAndSnapshot(project);
-    ComponentDto developer = newDeveloper(db.getDefaultOrganization(), "developer", "developer-uuid");
-    componentDb.insertDeveloperAndSnapshot(developer);
-    componentDb.insertComponent(newDevProjectCopy("project-uuid-copy", project, developer));
-    insertNclocMetric();
-    db.commit();
-
-    ComponentTreeWsResponse response = ws.newRequest()
-      .setParam(PARAM_BASE_COMPONENT_ID, developer.uuid())
-      .setParam(PARAM_METRIC_KEYS, "ncloc")
-      .executeProtobuf(ComponentTreeWsResponse.class);
-
-    assertThat(response.getComponentsCount()).isEqualTo(1);
-    WsMeasures.Component projectCopy = response.getComponents(0);
-    assertThat(projectCopy.getId()).isEqualTo("project-uuid-copy");
-    assertThat(projectCopy.getRefId()).isEqualTo("project-uuid");
-    assertThat(projectCopy.getRefKey()).isEqualTo("project-key");
-  }
-
-  @Test
-  public void load_developer_measures_by_developer_uuid() {
-    ComponentDto developer = newDeveloper(db.getDefaultOrganization(), "developer", "developer-uuid");
-    ComponentDto project = newProjectDto(db.getDefaultOrganization(), "project-uuid").setKey("project-key");
-    componentDb.insertDeveloperAndSnapshot(developer);
-    SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project);
-    ComponentDto file1 = componentDb.insertComponent(newFileDto(project, null, "file1-uuid"));
-    ComponentDto file2 = componentDb.insertComponent(newFileDto(project, null, "file2-uuid"));
-    componentDb.insertComponent(newDevProjectCopy("project-uuid-copy", project, developer));
-    MetricDto ncloc = insertNclocMetric();
-    dbClient.measureDao().insert(dbSession,
-      newMeasureDto(ncloc, project, projectSnapshot).setDeveloperId(developer.getId()),
-      newMeasureDto(ncloc, file1, projectSnapshot)
-        .setValue(3d)
-        .setDeveloperId(developer.getId()),
-      // measures are not specific to the developer
-      newMeasureDto(ncloc, file1, projectSnapshot).setDeveloperId(null),
-      newMeasureDto(ncloc, file2, projectSnapshot).setDeveloperId(null));
-    db.commit();
-
-    ComponentTreeWsResponse response = ws.newRequest()
-      .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid")
-      .setParam(PARAM_DEVELOPER_ID, "developer-uuid")
-      .setParam(PARAM_STRATEGY, CHILDREN_STRATEGY)
-      .setParam(PARAM_METRIC_KEYS, "ncloc")
-      .executeProtobuf(ComponentTreeWsResponse.class);
-
-    assertThat(response.getComponentsCount()).isEqualTo(2);
-    WsMeasures.Component file = response.getComponents(0);
-    assertThat(file.getId()).isEqualTo("file1-uuid");
-    assertThat(file.getMeasuresCount()).isEqualTo(1);
-    assertThat(file.getMeasures(0).getValue()).isEqualTo("3");
-  }
-
-  @Test
-  public void load_developer_measures_by_developer_key() {
-    ComponentDto developer = newDeveloper(db.getDefaultOrganization(), "developer", "developer-uuid");
-    ComponentDto project = newProjectDto(db.getDefaultOrganization(), "project-uuid").setKey("project-key");
-    componentDb.insertDeveloperAndSnapshot(developer);
-    SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project);
-    ComponentDto file1 = componentDb.insertComponent(newFileDto(project, null, "file1-uuid"));
-    componentDb.insertComponent(newDevProjectCopy("project-uuid-copy", project, developer));
-    MetricDto ncloc = insertNclocMetric();
-    dbClient.measureDao().insert(dbSession,
-      newMeasureDto(ncloc, file1, projectSnapshot)
-        .setValue(3d)
-        .setDeveloperId(developer.getId()));
-    db.commit();
-
-    ComponentTreeWsResponse response = ws.newRequest()
-      .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid")
-      .setParam(PARAM_DEVELOPER_KEY, developer.key())
-      .setParam(PARAM_METRIC_KEYS, "ncloc")
-      .executeProtobuf(ComponentTreeWsResponse.class);
-
-    assertThat(response.getComponentsCount()).isEqualTo(1);
-    WsMeasures.Component file = response.getComponents(0);
-    assertThat(file.getId()).isEqualTo("file1-uuid");
-    assertThat(file.getMeasuresCount()).isEqualTo(1);
-    assertThat(file.getMeasures(0).getValue()).isEqualTo("3");
-  }
-
   @Test
   public void load_measures_when_no_leave_qualifier() {
     resourceTypes.setLeavesQualifiers();
@@ -519,30 +430,6 @@ public class ComponentTreeActionTest {
     assertThat(result.getComponentsCount()).isEqualTo(0);
   }
 
-  @Test
-  public void fail_when_developer_is_unknown() {
-    expectedException.expect(NotFoundException.class);
-
-    ComponentDto developer = newDeveloper(db.getDefaultOrganization(), "developer", "developer-uuid");
-    ComponentDto project = newProjectDto(db.getDefaultOrganization(), "project-uuid").setKey("project-key");
-    componentDb.insertDeveloperAndSnapshot(developer);
-    SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project);
-    ComponentDto file1 = componentDb.insertComponent(newFileDto(project, null, "file1-uuid"));
-    componentDb.insertComponent(newDevProjectCopy("project-uuid-copy", project, developer));
-    MetricDto ncloc = insertNclocMetric();
-    dbClient.measureDao().insert(dbSession,
-      newMeasureDto(ncloc, file1, projectSnapshot)
-        .setValue(3d)
-        .setDeveloperId(developer.getId()));
-    db.commit();
-
-    ws.newRequest()
-      .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid")
-      .setParam(PARAM_DEVELOPER_KEY, "unknown-developer-key")
-      .setParam(PARAM_METRIC_KEYS, "ncloc")
-      .executeProtobuf(ComponentTreeWsResponse.class);
-  }
-
   @Test
   public void fail_when_metric_keys_parameter_is_empty() {
     componentDb.insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization(), "project-uuid"));
index 5759b7c9e7a5cf60ae5d8cbf5e0262604095e6fe..4d14fc200ccaaaf46d3d288835a2e1238dd4aa2d 100644 (file)
@@ -38,7 +38,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.server.ws.WebService.Param.PAGE;
 import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
 import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newProjectCopy;
 import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.ComponentTesting.newView;
@@ -75,7 +74,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
 
     ComponentDto jdk7 = insertJdk7();
     ComponentDto project2 = insertClang();
-    ComponentDto dev = insertDeveloper();
     ComponentDto view = insertView();
     insertProjectInView(jdk7, view);
 
@@ -84,7 +82,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
     db.users().insertProjectPermissionOnUser(user2, UserRole.ADMIN, jdk7);
     db.users().insertProjectPermissionOnUser(user3, UserRole.ADMIN, jdk7);
     db.users().insertProjectPermissionOnUser(user1, UserRole.ISSUE_ADMIN, project2);
-    db.users().insertProjectPermissionOnUser(user1, UserRole.ISSUE_ADMIN, dev);
     db.users().insertProjectPermissionOnUser(user1, UserRole.ISSUE_ADMIN, view);
     // global permission
     db.users().insertPermissionOnUser(user1, ADMINISTER);
@@ -97,7 +94,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
     db.users().insertProjectPermissionOnGroup(group1, UserRole.ADMIN, jdk7);
     db.users().insertProjectPermissionOnGroup(group2, UserRole.ADMIN, jdk7);
     db.users().insertProjectPermissionOnGroup(group3, UserRole.ADMIN, jdk7);
-    db.users().insertProjectPermissionOnGroup(group2, UserRole.ADMIN, dev);
     db.users().insertProjectPermissionOnGroup(group2, UserRole.ADMIN, view);
 
     db.commit();
@@ -195,7 +191,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
   public void filter_by_qualifier() throws Exception {
     OrganizationDto organizationDto = db.organizations().insert();
     db.components().insertComponent(newView(organizationDto, "view-uuid"));
-    db.components().insertComponent(newDeveloper(organizationDto, "developer-name"));
     db.components().insertComponent(newProjectDto(organizationDto, "project-uuid"));
 
     WsPermissions.SearchProjectPermissionsWsResponse result = newRequest()
@@ -205,8 +200,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
     assertThat(result.getProjectsList())
       .extracting("id")
       .contains("project-uuid")
-      .doesNotContain("view-uuid")
-      .doesNotContain("developer-name");
+      .doesNotContain("view-uuid");
   }
 
   @Test
@@ -247,12 +241,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
     return db.components().insertComponent(newProjectCopy("project-in-view-uuid", project, view));
   }
 
-  private ComponentDto insertDeveloper() {
-    return db.components().insertComponent(newDeveloper(db.getDefaultOrganization(), "Simon Brandhof")
-      .setUuid("4e607bf9-7ed0-484a-946d-d58ba7dab2fb")
-      .setKey("simon-brandhof"));
-  }
-
   private ComponentDto insertClang() {
     return db.components().insertComponent(newProjectDto(db.getDefaultOrganization(), "project-uuid-2")
       .setName("Clang")
index 3bd58fcfd7e6573f2fb506c2f352c304abd1e4ae..b40dfdd5048dc31cf36afa372c8cb553e08770e6 100644 (file)
@@ -48,7 +48,6 @@ import org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse.Project;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.measures.CoreMetrics.ALERT_STATUS_KEY;
-import static org.sonar.db.component.ComponentTesting.newDeveloper;
 import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.ComponentTesting.newView;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
@@ -173,14 +172,12 @@ public class SearchMyProjectsActionTest {
   }
 
   @Test
-  public void do_not_return_views_or_developers() {
+  public void do_not_return_views() {
     OrganizationDto organizationDto = db.organizations().insert();
     ComponentDto jdk7 = insertJdk7(organizationDto);
-    ComponentDto dev = insertDeveloper(organizationDto);
     ComponentDto view = insertView(organizationDto);
 
     db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, jdk7);
-    db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, dev);
     db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, view);
 
     SearchMyProjectsWsResponse result = call_ws();
@@ -262,11 +259,6 @@ public class SearchMyProjectsActionTest {
       .setKey("Java"));
   }
 
-  private ComponentDto insertDeveloper(OrganizationDto organizationDto) {
-    return db.components().insertComponent(newDeveloper(organizationDto, "Joda", "4e607bf9-7ed0-484a-946d-d58ba7dab2fb")
-      .setKey("joda"));
-  }
-
   private SearchMyProjectsWsResponse call_ws() {
     return ws.newRequest()
       .executeProtobuf(SearchMyProjectsWsResponse.class);